Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef __MM_CMA_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define __MM_CMA_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <linux/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/kobject.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/android_vendor.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) struct cma_kobject {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 	struct kobject kobj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	struct cma *cma;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct cma {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	unsigned long   base_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	unsigned long   count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	unsigned long   *bitmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	unsigned int order_per_bit; /* Order of pages represented by one bit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	struct mutex    lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #ifdef CONFIG_CMA_DEBUGFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	struct hlist_head mem_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	spinlock_t mem_head_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	struct debugfs_u32_array dfs_bitmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	char name[CMA_MAX_NAME];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #ifdef CONFIG_CMA_SYSFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	/* the number of CMA page successful allocations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	atomic64_t nr_pages_succeeded;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	/* the number of CMA page allocation failures */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	atomic64_t nr_pages_failed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	/* kobject requires dynamic object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	struct cma_kobject *cma_kobj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	ANDROID_OEM_DATA_ARRAY(1, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) extern struct cma cma_areas[MAX_CMA_AREAS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) extern unsigned cma_area_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) static inline unsigned long cma_bitmap_maxno(struct cma *cma)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	return cma->count >> cma->order_per_bit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #ifdef CONFIG_CMA_SYSFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void cma_sysfs_account_success_pages(struct cma *cma, unsigned long nr_pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void cma_sysfs_account_fail_pages(struct cma *cma, unsigned long nr_pages);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) static inline void cma_sysfs_account_success_pages(struct cma *cma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 						   unsigned long nr_pages) {};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static inline void cma_sysfs_account_fail_pages(struct cma *cma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 						unsigned long nr_pages) {};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #endif