1、相关宏在arch/arm64/configs/rockchip_defconfig文件中
CONFIG_ARM64_PAGE_SHIFT=12
......
CONFIG_ARM64_4K_PAGES=y
# CONFIG_ARM64_16K_PAGES is not set
# CONFIG_ARM64_64K_PAGES is not set
2、修改PAGE大小(以16K为例)
CONFIG_ARM64_PAGE_SHIFT=14
......
CONFIG_ARM64_16K_PAGES=y
# CONFIG_ARM64_16K_PAGES is not set
# CONFIG_ARM64_64K_PAGES is not set
需要将CONFIG_ARM64_16K_PAGES打开,并修改CONFIG_ARM64_PAGE_SHIFT
PAGE_SIZE = (1UL << PAGE_SHIFT)
3、编译报错的解决方法
修改页大小后编译内核kernel/drivers/gpu/arm/midgard/mali_kbase_mem_linux.c文件会报错
需要修改kernel/drivers/gpu/arm/midgard/mali_base_kernel.h文件
修改前
#define BASEP_MEM_INVALID_HANDLE (0ull << 12)
#define BASE_MEM_MMU_DUMP_HANDLE (1ull << 12)
#define BASE_MEM_TRACE_BUFFER_HANDLE (2ull << 12)
#define BASE_MEM_MAP_TRACKING_HANDLE (3ull << 12)
#define BASEP_MEM_WRITE_ALLOC_PAGES_HANDLE (4ull << 12)
/* reserved handles ..-64<<PAGE_SHIFT> for future special handles */
#define BASE_MEM_COOKIE_BASE (64ul << 12)
#define BASE_MEM_FIRST_FREE_ADDRESS ((BITS_PER_LONG << 12) + \
BASE_MEM_COOKIE_BASE)
/* Mask to detect 4GB boundary alignment */
#define BASE_MEM_MASK_4GB 0xfffff000UL
根据修改后的PAGE_SHIFT修改相应宏
#define BASEP_MEM_INVALID_HANDLE (0ull << 14)
#define BASE_MEM_MMU_DUMP_HANDLE (1ull << 14)
#define BASE_MEM_TRACE_BUFFER_HANDLE (2ull << 14)
#define BASE_MEM_MAP_TRACKING_HANDLE (3ull << 14)
#define BASEP_MEM_WRITE_ALLOC_PAGES_HANDLE (4ull << 14)
/* reserved handles ..-64<<PAGE_SHIFT> for future special handles */
#define BASE_MEM_COOKIE_BASE (64ul << 14)
#define BASE_MEM_FIRST_FREE_ADDRESS ((BITS_PER_LONG << 14) + \
BASE_MEM_COOKIE_BASE)
/* Mask to detect 4GB boundary alignment */
#define BASE_MEM_MASK_4GB 0xffffc000UL