[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230724103055.2379274-1-chris.zjh@huawei.com>
Date: Mon, 24 Jul 2023 10:30:55 +0000
From: Zhang Jianhua <chris.zjh@...wei.com>
To: <catalin.marinas@....com>, <will@...nel.org>, <joey.gouly@....com>,
<anshuman.khandual@....com>, <mark.rutland@....com>,
<ardb@...nel.org>
CC: <chris.zjh@...wei.com>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH -next] arm64: fix -Wundef warning for PUD_SHIFT
When building with W=1, the following warning occurs.
arch/arm64/include/asm/kernel-pgtable.h:129:41: error: "PUD_SHIFT" is not defined, evaluates to 0 [-Werror=undef]
129 | #define ARM64_MEMSTART_SHIFT PUD_SHIFT
| ^~~~~~~~~
arch/arm64/include/asm/kernel-pgtable.h:142:5: note: in expansion of macro ‘ARM64_MEMSTART_SHIFT’
142 | #if ARM64_MEMSTART_SHIFT < SECTION_SIZE_BITS
| ^~~~~~~~~~~~~~~~~~~~
The reason is that PUD_SHIFT isn't defined if CONFIG_PGTABLE_LEVELS ==
3, and at this time PUD_SHIFT is equal to PGDIR_SHIFT, so define it.
Fixes: 06e9bf2fd9b3 ("arm64: choose memstart_addr based on minimum sparsemem section alignment")
Signed-off-by: Zhang Jianhua <chris.zjh@...wei.com>
---
v2:
Define PUD_SHIFT before use it instead of judgement
---
---
arch/arm64/include/asm/kernel-pgtable.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h
index 577773870b66..996a144e2929 100644
--- a/arch/arm64/include/asm/kernel-pgtable.h
+++ b/arch/arm64/include/asm/kernel-pgtable.h
@@ -59,6 +59,10 @@
#define EARLY_KASLR (0)
#endif
+#ifndef PUD_SHIFT
+#define PUD_SHIFT PGDIR_SHIFT
+#endif
+
#define SPAN_NR_ENTRIES(vstart, vend, shift) \
((((vend) - 1) >> (shift)) - ((vstart) >> (shift)) + 1)
--
2.34.1
Powered by blists - more mailing lists