[PATCH v3 17/19] arm64: text replication: fix compilation warning

Hao Jia jiahao.os at bytedance.com
Wed Jan 17 00:53:55 PST 2024


This commit fixes the following compilation warning When
configured CONFIG_ARM64_64K_PAGES.

./arch/arm64/include/asm/memory.h:56:6: warning: "CONFIG_ARM64_4K_PAGES" is not defined, evaluates to 0 [-Wundef]
 #if (CONFIG_ARM64_4K_PAGES && CONFIG_PGTABLE_LEVELS < 4) || \
      ^~~~~~~~~~~~~~~~~~~~~
./arch/arm64/include/asm/memory.h:57:6: warning: "CONFIG_ARM64_16K_PAGES" is not defined, evaluates to 0 [-Wundef]
     (CONFIG_ARM64_16K_PAGES && CONFIG_PGTABLE_LEVELS < 3) || \

Signed-off-by: Hao Jia <jiahao.os at bytedance.com>
---
 arch/arm64/include/asm/memory.h | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index c73820fb36a3..2652ce170550 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -53,11 +53,19 @@
  * CONFIG_ARM64_16K_PAGES, PGDIR_SIZE is 32M, 64G or 128T
  * CONFIG_ARM64_64K_PAGES, PGDIR_SIZE is 512M or 4T
  */
-#if (CONFIG_ARM64_4K_PAGES && CONFIG_PGTABLE_LEVELS < 4) || \
-    (CONFIG_ARM64_16K_PAGES && CONFIG_PGTABLE_LEVELS < 3) || \
-    (CONFIG_ARM64_64K_PAGES && CONFIG_PGTABLE_LEVELS < 2)
+#if defined(CONFIG_ARM64_4K_PAGES) && CONFIG_PGTABLE_LEVELS < 4
 #define KIMAGE_OFFSET		MODULES_VSIZE
-#else
+#elif defined(CONFIG_ARM64_4K_PAGES)
+#define KIMAGE_OFFSET		PGDIR_SIZE
+#endif
+#if defined(CONFIG_ARM64_16K_PAGES) && CONFIG_PGTABLE_LEVELS < 3
+#define KIMAGE_OFFSET		MODULES_VSIZE
+#elif defined(CONFIG_ARM64_16K_PAGES)
+#define KIMAGE_OFFSET		PGDIR_SIZE
+#endif
+#if defined(CONFIG_ARM64_64K_PAGES) && CONFIG_PGTABLE_LEVELS < 2
+#define KIMAGE_OFFSET		MODULES_VSIZE
+#elif defined(CONFIG_ARM64_64K_PAGES)
 #define KIMAGE_OFFSET		PGDIR_SIZE
 #endif
 #define KIMAGE_VADDR		(_PAGE_END(VA_BITS_MIN) + KIMAGE_OFFSET)
-- 
2.20.1




More information about the linux-arm-kernel mailing list