[PATCH] mips: mm: fix compiler error when CONFIG_XPA=n

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: luyun <luyun@xxxxxxxxxx>

The below error is reported when CONFIG_XPA=n:

arch/mips/mm/init.c: In function â??mem_initâ??:
././include/linux/compiler_types.h:352:38: error: call to â??__compiletime_assert_289â?? declared with attribute error: BUILD_BUG_ON failed: IS_ENABLED(CONFIG_32BIT) && (_PFN_SHIFT > PAGE_SHIFT)
  352 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |                                      ^
././include/linux/compiler_types.h:333:4: note: in definition of macro â??__compiletime_assertâ??
  333 |    prefix ## suffix();    \
      |    ^~~~~~
././include/linux/compiler_types.h:352:2: note: in expansion of macro â??_compiletime_assertâ??
  352 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |  ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro â??compiletime_assertâ??
   39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
      |                                     ^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:50:2: note: in expansion of macro â??BUILD_BUG_ON_MSGâ??
   50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
      |  ^~~~~~~~~~~~~~~~
arch/mips/mm/init.c:454:2: note: in expansion of macro â??BUILD_BUG_ONâ??
  454 |  BUILD_BUG_ON(IS_ENABLED(CONFIG_32BIT) && (_PFN_SHIFT > PAGE_SHIFT));
      |  ^~~~~~~~~~~~

The macro _PFN_SHIFT is defined as (PAGE_SHIFT - 12 + _CACHE_SHIFT + 3)
when CONFIG_CPU_R3K_TLB=n, and _CACHE_SHIFT is conditionally defined with
CONFIG_XPA=y. Also _PFN_SHIFT is just equal to PAGE_SHIFT when
CONFIG_CPU_R3K_TLB=y, there is no need to judge on this condition.

So fix it by adding IS_ENABLED(CONFIG_XPA).

Fixes: 05d013a0366d ("MIPS: Detect bad _PFN_SHIFT values")
Reported-by: k2ci <kernel-bot@xxxxxxxxxx>
Signed-off-by: Yun Lu <luyun@xxxxxxxxxx>
---
 arch/mips/mm/init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 5a8002839550..f13cd2844fed 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -451,7 +451,8 @@ void __init mem_init(void)
 	 * When _PFN_SHIFT is greater than PAGE_SHIFT we won't have enough PTE
 	 * bits to hold a full 32b physical address on MIPS32 systems.
 	 */
-	BUILD_BUG_ON(IS_ENABLED(CONFIG_32BIT) && (_PFN_SHIFT > PAGE_SHIFT));
+	BUILD_BUG_ON(IS_ENABLED(CONFIG_32BIT) && IS_ENABLED(CONFIG_XPA) &&
+		     (_PFN_SHIFT > PAGE_SHIFT));
 
 #ifdef CONFIG_HIGHMEM
 	max_mapnr = highend_pfn ? highend_pfn : max_low_pfn;
-- 
2.25.1

Content-type: Text/plain

No virus found
		Checked by Hillstone Network AntiVirus

[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux