Skip to contentSkip to conversation

mips: BCM63XX: select CPU_SUPPORTS_32BIT_KERNEL

RFC PATCH In review Randy Dunlap 2 participants 4 messages Nov 6, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 mips: BCM63XX: select CPU_SUPPORTS_32BIT_KERNEL

Several header files need info on CONFIG_32BIT or CONFIG_64BIT, but kconfig symbol BCM63XX does not provide that info. This leads to many build errors, e.g.:

   arch/mips/include/asm/page.h:196:13: error: use of undeclared identifier 'CAC_BASE'
           return x - PAGE_OFFSET + PHYS_OFFSET;
   arch/mips/include/asm/mach-generic/spaces.h:91:23: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             (CAC_BASE + PHYS_OFFSET)
   arch/mips/include/asm/io.h:134:28: error: use of undeclared identifier 'CAC_BASE'
           return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);
   arch/mips/include/asm/mach-generic/spaces.h:91:23: note: expanded from macro 'PAGE_OFFSET'
   #define PAGE_OFFSET             (CAC_BASE + PHYS_OFFSET)

arch/mips/include/asm/uaccess.h:82:10: error: use of undeclared identifier '__UA_LIMIT'

           return (__UA_LIMIT & (addr | (addr + size) | __ua_size(size))) == 0;
Fixes e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
Cc Thomas Bogendoerfer <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Paul Burton <[email protected]>
Cc Maxime Bizon <[email protected]>
Cc Ralf Baechle <[email protected]>

---
Note: I did see a bunch of build errors like this one:
../arch/mips/kernel/r4k_fpu.S:217: Error: opcode not supported on this processor: mips1 (mips1) `ldc1 $f24,192($4)' but I'm hoping/guessing that this is due to not having a proper compiler
for the BCM63xx target.

 arch/mips/Kconfig |    1 +
 1 file changed, 1 insertion(+)
arch/mips/Kconfig +1 -0
@@ -329,6 +329,7 @@ config BCM63XX
 	select SYNC_R4K
 	select DMA_NONCOHERENT
 	select IRQ_MIPS_CPU
+	select CPU_SUPPORTS_32BIT_KERNEL
 	select SYS_SUPPORTS_32BIT_KERNEL
 	select SYS_SUPPORTS_BIG_ENDIAN
 	select SYS_HAS_EARLY_PRINTK
#1 lore raw
Quoted 40 lines · Randy Dunlap

Several header files need info on CONFIG_32BIT or CONFIG_64BIT, but kconfig symbol BCM63XX does not provide that info. This leads to many build errors, e.g.:

arch/mips/include/asm/page.h:196:13: error: use of undeclared identifier 'CAC_BASE'
return x - PAGE_OFFSET + PHYS_OFFSET;
arch/mips/include/asm/mach-generic/spaces.h:91:23: note: expanded from macro 'PAGE_OFFSET'
#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
arch/mips/include/asm/io.h:134:28: error: use of undeclared identifier 'CAC_BASE'
return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);
arch/mips/include/asm/mach-generic/spaces.h:91:23: note: expanded from macro 'PAGE_OFFSET'
#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)

arch/mips/include/asm/uaccess.h:82:10: error: use of undeclared identifier '__UA_LIMIT'

            return (__UA_LIMIT & (addr | (addr + size) | __ua_size(size))) == 0;
Fixes e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
Cc Thomas Bogendoerfer <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Paul Burton <[email protected]>
Cc Maxime Bizon <[email protected]>
Cc Ralf Baechle <[email protected]>

---
Note: I did see a bunch of build errors like this one:
../arch/mips/kernel/r4k_fpu.S:217: Error: opcode not supported on this processor: mips1 (mips1) `ldc1 $f24,192($4)' but I'm hoping/guessing that this is due to not having a proper compiler
for the BCM63xx target.

  arch/mips/Kconfig |    1 +
  1 file changed, 1 insertion(+)

arch/mips/Kconfig config BCM63XX · line 332

Quoted 4 lines
arch/mips/Kconfig +1 -0
@@ -329,6 +329,7 @@ config BCM63XX
  	select SYNC_R4K
  	select DMA_NONCOHERENT
  	select IRQ_MIPS_CPU
+	select CPU_SUPPORTS_32BIT_KERNEL

That's one option, the other could be to add:

        select SYS_HAS_CPU_BMIPS32_3300
        select SYS_HAS_CPU_BMIPS4350
        select SYS_HAS_CPU_BMIPS4380

Which would ensure that CPU_SUPPORTS_32BIT_KERNEL is selected AFAICT. Can you try that? What config file did you use to produce that build error BTW?

Signature · 1 line
Florian
#2 lore raw
Quoted 50 lines · Florian Fainelli
Quoted 40 lines · Randy Dunlap

Several header files need info on CONFIG_32BIT or CONFIG_64BIT, but kconfig symbol BCM63XX does not provide that info. This leads to many build errors, e.g.:

    arch/mips/include/asm/page.h:196:13: error: use of undeclared identifier 'CAC_BASE' return x - PAGE_OFFSET + PHYS_OFFSET; arch/mips/include/asm/mach-generic/spaces.h:91:23: note: expanded from macro 'PAGE_OFFSET' #define PAGE_OFFSET             (CAC_BASE + PHYS_OFFSET) arch/mips/include/asm/io.h:134:28: error: use of undeclared identifier 'CAC_BASE' return (void *)(address + PAGE_OFFSET - PHYS_OFFSET); arch/mips/include/asm/mach-generic/spaces.h:91:23: note: expanded from macro 'PAGE_OFFSET' #define PAGE_OFFSET             (CAC_BASE + PHYS_OFFSET)

arch/mips/include/asm/uaccess.h:82:10: error: use of undeclared identifier '__UA_LIMIT' return (__UA_LIMIT & (addr | (addr + size) | __ua_size(size))) == 0;

Fixes e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
Cc Thomas Bogendoerfer <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Paul Burton <[email protected]>
Cc Maxime Bizon <[email protected]>
Cc Ralf Baechle <[email protected]>

---
Note: I did see a bunch of build errors like this one:
../arch/mips/kernel/r4k_fpu.S:217: Error: opcode not supported on this processor: mips1 (mips1) `ldc1 $f24,192($4)' but I'm hoping/guessing that this is due to not having a proper compiler
for the BCM63xx target.

  arch/mips/Kconfig |    1 +

  1 file changed, 1 insertion(+)
arch/mips/Kconfig +0 -0
@@ -329,6 +329,7 @@ config BCM63XX
Quoted 4 lines

      select SYNC_R4K
      select DMA_NONCOHERENT
      select IRQ_MIPS_CPU
+    select CPU_SUPPORTS_32BIT_KERNEL

That's one option, the other could be to add:

Quoted 5 lines

        select SYS_HAS_CPU_BMIPS32_3300
        select SYS_HAS_CPU_BMIPS4350
        select SYS_HAS_CPU_BMIPS4380

Which would ensure that CPU_SUPPORTS_32BIT_KERNEL is selected AFAICT. Can you try that? What config file did you use to produce that build error BTW?

The .config file that is attached to this report from the kernel test robot:
https://lore.kernel.org/all/[email protected]/

Yes, I'll give your suggestion a try on Saturday.

thanks.--
~Randy

#3 lore raw
Quoted 55 lines · Randy Dunlap
Quoted 54 lines · Florian Fainelli
Quoted 40 lines · Randy Dunlap

Several header files need info on CONFIG_32BIT or CONFIG_64BIT, but kconfig symbol BCM63XX does not provide that info. This leads to many build errors, e.g.:

    arch/mips/include/asm/page.h:196:13: error: use of undeclared identifier 'CAC_BASE' return x - PAGE_OFFSET + PHYS_OFFSET; arch/mips/include/asm/mach-generic/spaces.h:91:23: note: expanded from macro 'PAGE_OFFSET' #define PAGE_OFFSET             (CAC_BASE + PHYS_OFFSET) arch/mips/include/asm/io.h:134:28: error: use of undeclared identifier 'CAC_BASE' return (void *)(address + PAGE_OFFSET - PHYS_OFFSET); arch/mips/include/asm/mach-generic/spaces.h:91:23: note: expanded from macro 'PAGE_OFFSET' #define PAGE_OFFSET             (CAC_BASE + PHYS_OFFSET)

arch/mips/include/asm/uaccess.h:82:10: error: use of undeclared identifier '__UA_LIMIT' return (__UA_LIMIT & (addr | (addr + size) | __ua_size(size))) == 0;

Fixes e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
Cc Thomas Bogendoerfer <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Paul Burton <[email protected]>
Cc Maxime Bizon <[email protected]>
Cc Ralf Baechle <[email protected]>

---
Note: I did see a bunch of build errors like this one:
../arch/mips/kernel/r4k_fpu.S:217: Error: opcode not supported on this processor: mips1 (mips1) `ldc1 $f24,192($4)' but I'm hoping/guessing that this is due to not having a proper compiler
for the BCM63xx target.

  arch/mips/Kconfig |    1 +

  1 file changed, 1 insertion(+)
arch/mips/Kconfig +0 -0
@@ -329,6 +329,7 @@ config BCM63XX
Quoted 4 lines

      select SYNC_R4K
      select DMA_NONCOHERENT
      select IRQ_MIPS_CPU
+    select CPU_SUPPORTS_32BIT_KERNEL

That's one option, the other could be to add:

         select SYS_HAS_CPU_BMIPS32_3300
         select SYS_HAS_CPU_BMIPS4350
         select SYS_HAS_CPU_BMIPS4380

Quoted 6 lines
Quoted 1 line

Which would ensure that CPU_SUPPORTS_32BIT_KERNEL is selected AFAICT. Can you try that? What config file did you use to produce that build error BTW?

The .config file that is attached to this report from the kernel test robot:
https://lore.kernel.org/all/[email protected]/

Yes, I'll give your suggestion a try on Saturday.

OK, that works also. I'll send a v2 with that.

However, with that kernel .config file, it does expose another unrelated longstanding build error:

/opt/crosstool/gcc-11.1.0-nolibc/mips-linux/bin/mips-linux-ld: drivers/iio/adc/ingenic-adc.o: in function `jz4725b_adc_init_clk_div':
ingenic-adc.c:(.text.jz4725b_adc_init_clk_div+0x10): undefined reference to clk_get_parent' /opt/crosstool/gcc-11.1.0-nolibc/mips-linux/bin/mips-linux-ld: drivers/iio/adc/ingenic-adc.o: in function jz4770_adc_init_clk_div':
ingenic-adc.c:(.text.jz4770_adc_init_clk_div+0x10): undefined reference to `clk_get_parent'

I prepared a patch for that on April 26, 2021, but it looks like I never sent it. Oh, it's incomplete, not really working yet.
Any comments on how to really fix this problem?

---
From: Randy Dunlap <[email protected]>

MIPS does not always provide clk*() interfaces and there are no always-present stubs for them, so depending on "MIPS || COMPILE_TEST" is not string enough to prevent build errors.

Likewise MACH_INGENIC_SOC || COMPILE_TEST is not strong enough since if only COMPILE_TEST=y, there are still the same build errors.

Can we fix the dissonance between HAVE_CLK and COMMON_CLK?

---
 drivers/iio/adc/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/Kconfig +1 -1
@@ -501,7 +501,7 @@ config INA2XX_ADC
 
 config INGENIC_ADC
 	tristate "Ingenic JZ47xx SoCs ADC driver"
-	depends on MIPS || COMPILE_TEST
+	depends on MACH_INGENIC_SOC || COMPILE_TEST
 	select IIO_BUFFER
 	help
 	  Say yes here to build support for the Ingenic JZ47xx SoCs ADC unit.

thanks.

Signature · 1 line
~Randy