MIPS: sibyte build fixes
Subsystems (5)
PATCH 6/7 drivers: ssb: Kconfig: Amend SSB_EMBEDDED dependencies
In reply to Markos ChandrasSSB_EMBEDDED needs functions from driver_pcicore which are only available if SSD_DRIVER_HOSTMODE is selected so make it depend on that symbol.
Fixes the following linking problem:
drivers/ssb/embedded.c:202:
undefined reference to ssb_pcicore_plat_dev_init' drivers/built-in.o: In function ssb_pcibios_map_irq':drivers/ssb/embedded.c:247:
undefined reference to `ssb_pcicore_pcibios_map_irq'
--- drivers/ssb/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ssb/Kconfig +1 -1
@@ -144,7 +144,7 @@ config SSB_SFLASH # Assumption: We are on embedded, if we compile the MIPS core. config SSB_EMBEDDED bool - depends on SSB_DRIVER_MIPS + depends on SSB_DRIVER_MIPS && SSB_PCICORE_HOSTMODE default y config SSB_DRIVER_EXTIF
Signature · 1 line
1.8.2.1
cover MIPS: sibyte build fixes
Hi,
The following patches aim to fix multiple build problems on sibyte. These patches should be applied to the upstream-sfr/mips-for-linux-next tree.
Markos Chandras (7):
MIPS: sibyte: Fix build for SIBYTE_BW_TRACE
MIPS: sibyte: Declare the cfe_write() buffer as constant
MIPS: sibyte: Add missing sched.h header
MIPS: sibyte: Amend dependencies for SIBYTE_BUS_WATCHER
drivers: watchdog: sb_wdog: Fix 32bit linking problems
drivers: ssb: Kconfig: Amend SSB_EMBEDDED dependencies
MIPS: sibyte: Remove unused variable.
arch/mips/fw/cfe/cfe_api.c | 4 ++-- arch/mips/include/asm/fw/cfe/cfe_api.h | 4 ++-- arch/mips/mm/cerr-sb1.c | 2 +- arch/mips/sibyte/Kconfig | 3 ++- arch/mips/sibyte/common/sb_tbprof.c | 1 + arch/mips/sibyte/sb1250/bus_watcher.c | 3 --- drivers/ssb/Kconfig | 2 +- drivers/watchdog/sb_wdog.c | 5 ++++- 8 files changed, 13 insertions(+), 11 deletions(-)
Signature · 1 line
1.8.2.1
PATCH 1/7 MIPS: sibyte: Fix build for SIBYTE_BW_TRACE
The M_BCM1480_SCD_TRACE_CFG_FREEZE macro removed in 8deab1144b553548fb2f1b51affdd36dcd652aaa "[MIPS] Updated Sibyte headers"
This broke the build for the sibyte platfrom when SIBYTE_BW_TRACE is enabled:arch/mips/mm/cerr-sb1.c:186:2: error: 'M_BCM1480_SCD_TRACE_CFG_FREEZE' undeclared (first use in this function)
We fix this by replacing it with the M_BCM1480_SYS_RESERVED4 macro
--- arch/mips/mm/cerr-sb1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/mm/cerr-sb1.c +1 -1
@@ -183,7 +183,7 @@ asmlinkage void sb1_cache_error(void)#ifdef CONFIG_SIBYTE_BW_TRACE /* Freeze the trace buffer now */ #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) -csr_out32 (M_BCM1480_SCD_TRACE_CFG_FREEZE ,IOADDR (A_SCD_TRACE_CFG )); +csr_out32 (M_BCM1480_SYS_RESERVED4 ,IOADDR (A_SCD_TRACE_CFG ));#else csr_out32 (M_SCD_TRACE_CFG_FREEZE ,IOADDR (A_SCD_TRACE_CFG ));#endif
Signature · 1 line
1.8.2.1
PATCH 3/7 MIPS: sibyte: Add missing sched.h header
In reply to Markos ChandrasIt's needed for the TASK_INTERRUPTIBLE definition.
Fixes the following build problem:arch/mips/sibyte/common/sb_tbprof.c:235:4: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
--- arch/mips/sibyte/common/sb_tbprof.c | 1 + 1 file changed, 1 insertion(+)
arch/mips/sibyte/common/sb_tbprof.c +1 -0
@@ -27,6 +27,7 @@#include <linux/types.h> #include <linux/init.h> #include <linux/interrupt.h> +#include <linux/sched.h> #include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/errno.h>
Signature · 1 line
1.8.2.1
PATCH 4/7 MIPS: sibyte: Amend dependencies for SIBYTE_BUS_WATCHER
In reply to Markos ChandrasSIBYTE_BUS_WATCHER is only visible if CONFIG_SIBYTE_BCM112X or CONFIG_SIBYTE_SB1250 is selected according to the arch/mips/sibyte/Makefile.
This fixes the following build problem:
arch/mips/mm/cerr-sb1.c:254: undefined reference to `check_bus_watcher'
--- arch/mips/sibyte/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/mips/sibyte/Kconfig +2 -1
@@ -147,7 +147,8 @@ config SIBYTE_CFE_CONSOLE config SIBYTE_BUS_WATCHER bool "Support for Bus Watcher statistics" - depends on SIBYTE_SB1xxx_SOC + depends on SIBYTE_SB1xxx_SOC && \ + (SIBYTE_BCM112X || SIBYTE_SB1250) help Handle and keep statistics on the bus error interrupts (COR_ECC, BAD_ECC, IO_BUS).
Signature · 1 line
1.8.2.1
PATCH 5/7 drivers: watchdog: sb_wdog: Fix 32bit linking problems
In reply to Markos ChandrasFixes the following linking problem:drivers/watchdog/sb_wdog.c:211: undefined reference to `__udivdi3'
--- drivers/watchdog/sb_wdog.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/watchdog/sb_wdog.c +4 -1
@@ -170,6 +170,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd, unsigned long arg) {int ret = -ENOTTY ; +u64 tmp_user_dog;unsigned long time;void __user *argp = (void __user *)arg;int __user *p = argp;
@@ -208,7 +209,9 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,* get the remaining count from the ... count register * which is 1*8 before the config register */ - ret =put_user (__raw_readq (user_dog -8 ) /1000000 , p); + tmp_user_dog =__raw_readq (user_dog -8 ); + tmp_user_dog =do_div (tmp_user_dog,1000000 ); + ret =put_user (tmp_user_dog, p);break ; }return ret;
Signature · 1 line
1.8.2.1
PATCH 7/7 MIPS: sibyte: Remove unused variable.
In reply to Markos ChandrasFixes the following build problem:
arch/mips/sibyte/sb1250/bus_watcher.c: In function 'sibyte_bw_int':arch/mips/sibyte/sb1250/bus_watcher.c:179:7: error: unused variable 'bw_buf' [-Werror=unused-variable]
--- arch/mips/sibyte/sb1250/bus_watcher.c | 3 --- 1 file changed, 3 deletions(-)
arch/mips/sibyte/sb1250/bus_watcher.c +0 -3
@@ -175,9 +175,6 @@ static irqreturn_t sibyte_bw_int(int irq, void *data)#ifdef CONFIG_SIBYTE_BW_TRACE int i;#endif -#ifndef CONFIG_PROC_FS -char bw_buf[1024 ]; -#endif #ifdef CONFIG_SIBYTE_BW_TRACE csr_out32 (M_SCD_TRACE_CFG_FREEZE ,IOADDR (A_SCD_TRACE_CFG ));
Signature · 1 line
1.8.2.1
PATCH 2/7 MIPS: sibyte: Declare the cfe_write() buffer as constant
In reply to Markos ChandrasThe write() prototype expects a const char * as argument so declare it as such.
Fixes the following build problem:
arch/mips/sibyte/common/cfe_console.c:23:5: error: passing argument 2 of 'cfe_write' discards 'const' qualifier from pointer target type [-Werror] arch/mips/sibyte/common/cfe_console.c:34:4: error: passing argument 2 of 'cfe_write' makes pointer from integer without a cast [-Werror]
--- arch/mips/fw/cfe/cfe_api.c | 4 ++-- arch/mips/include/asm/fw/cfe/cfe_api.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/mips/fw/cfe/cfe_api.c +2 -2
@@ -406,12 +406,12 @@ int cfe_setenv(char *name, char *val)return xiocb.xiocb_status; } -int cfe_write (int handle,unsigned char *buffer,int length) +int cfe_write (int handle,const char *buffer,int length) {return cfe_writeblk (handle,0 , buffer, length); } -int cfe_writeblk (int handle,s64 offset,unsigned char *buffer,int length) +int cfe_writeblk (int handle,s64 offset,const char *buffer,int length) {struct cfe_xiocb xiocb;
arch/mips/include/asm/fw/cfe/cfe_api.h +2 -2
@@ -115,8 +115,8 @@ int cfe_read(int handle, unsigned char *buffer, int length);int cfe_readblk (int handle,int64_t offset,unsigned char *buffer,int length);int cfe_setenv (char *name,char *val); -int cfe_write (int handle,unsigned char *buffer,int length); -int cfe_writeblk (int handle,int64_t offset,unsigned char *buffer, +int cfe_write (int handle,const char *buffer,int length); +int cfe_writeblk (int handle,int64_t offset,const char *buffer,int length);#endif /* CFE_API_H */
Signature · 1 line
1.8.2.1
Re: [PATCH 3/7] MIPS: sibyte: Add missing sched.h header
In reply to Markos ChandrasQuoted 5 lines · Markos Chandras
It's needed for the
TASK_INTERRUPTIBLEdefinition.Fixes the following build problem:
arch/mips/sibyte/common/sb_tbprof.c:235:4: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
Ideally sched.h should be included into the actual user of TASK_INTERRUPTIBLE, the wake_up_interruptible macro in <linux/wait.h> but that seems way too risky that close to a release.
Ralf
Re: [PATCH 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems
In reply to Markos ChandrasQuoted 21 lines · Markos Chandras
Signed-off-by Markos Chandras <[email protected]>Acked-by Steven J. Hill <[email protected]>Cc Wim Van Sebroeck <[email protected]>--- drivers/watchdog/sb_wdog.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/watchdog/sb_wdog.c +1
-0@@ -170,6 +170,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd, unsigned long arg) {int ret = -ENOTTY ; +u64 tmp_user_dog;unsigned long time;void __user *argp = (void __user *)arg;int __user *p = argp;
drivers/watchdog/sb_wdog.c static long sbwdog_ioctl(struct file *file, unsigned int cmd, · line 214
Quoted 7 lines
drivers/watchdog/sb_wdog.c +3
-1@@ -208,7 +209,9 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,* get the remaining count from the ... count register * which is 1*8 before the config register */ - ret =put_user (__raw_readq (user_dog -8 ) /1000000 , p); + tmp_user_dog =__raw_readq (user_dog -8 ); + tmp_user_dog =do_div (tmp_user_dog,1000000 ); + ret =put_user (tmp_user_dog, p);
In effect the code with your change now does:
ret = put_user(__raw_readq(user_dog - 8) % 1000000, p);
No good.
tmp_user_dog = __raw_readq(user_dog - 8); do_div(tmp_user_dog, 1000000); ret = put_user(tmp_user_dog, p);
Should to the right thing.
I'm not surprised you're finding bugs in 32 bit Sibyte kernel. At heart, the Sibyte SOCs are 64 bit and their architecture limits them to support 256MB memory with a 32 bit kernel without highmem. Highmem though supported is stupid and leaves as the only sane option 64 bit kernels and virtually every user has done that, not last to get full fp performance which is only available with the N32 / N64 ABIs. Oh, and of course many registers need to be accessed 64 bit wide, which on a 32 bit kernel requires a local_irq_disable ... local_irq_enable around the actual access.
In short, nobody but a few diehard backward folks have ever been using 32 bit kernels on Sibyte hardware, so finding such an issue is not really a surprise.
Ralf
Re: [PATCH 3/7] MIPS: sibyte: Add missing sched.h header
In reply to Ralf BaechleQuoted 11 lines · Ralf Baechle
Quoted 5 lines · Markos Chandras
It's needed for the
TASK_INTERRUPTIBLEdefinition.Fixes the following build problem:
arch/mips/sibyte/common/sb_tbprof.c:235:4: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)Ideally
sched.hshould be included into the actual user ofTASK_INTERRUPTIBLE, thewake_up_interruptiblemacro in <linux/wait.h> but that seems way too risky that close to a release.
Oh man, there's include recursion hell waiting for you ;-)
Re: [PATCH 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems
In reply to Ralf BaechleQuoted 13 lines · Ralf Baechle
drivers/watchdog/sb_wdog.c static long sbwdog_ioctl(struct file *file, unsigned int cmd, · line 214
Quoted 8 lines
drivers/watchdog/sb_wdog.c +3
-1@@ -208,7 +209,9 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,* get the remaining count from the ... count register * which is 1*8 before the config register */ - ret =put_user (__raw_readq (user_dog -8 ) /1000000 , p); + tmp_user_dog =__raw_readq (user_dog -8 ); + tmp_user_dog =do_div (tmp_user_dog,1000000 ); + ret =put_user (tmp_user_dog, p);In effect the code with your change now does:
ret = put_user(__raw_readq(user_dog - 8) % 1000000, p);
Quoted 8 lines
No good.
tmp_user_dog = __raw_readq(user_dog - 8); do_div(tmp_user_dog, 1000000); ret = put_user(tmp_user_dog, p);Should to the right thing.
Hi Ralf,
Yes you are right. I will submit a new patch.
--
Regards,
Markos Chandras
Re: [PATCH 1/7] MIPS: sibyte: Fix build for SIBYTE_BW_TRACE
In reply to Markos ChandrasQuoted 23 lines · Markos Chandras
The
M_BCM1480_SCD_TRACE_CFG_FREEZEmacro removed in8deab1144b553548fb2f1b51affdd36dcd652aaa"[MIPS] Updated Sibyte headers"This broke the build for the sibyte platfrom when
SIBYTE_BW_TRACEis enabled:arch/mips/mm/cerr-sb1.c:186:2: error: 'M_BCM1480_SCD_TRACE_CFG_FREEZE' undeclared (first use in this function)We fix this by replacing it with the
M_BCM1480_SYS_RESERVED4macroSigned-off-by Markos Chandras <[email protected]>Acked-by Steven J. Hill <[email protected]>--- arch/mips/mm/cerr-sb1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/mips/mm/cerr-sb1.c +0
-0
arch/mips/mm/cerr-sb1.c asmlinkage void sb1_cache_error(void) · line 189
Quoted 8 lines
arch/mips/mm/cerr-sb1.c +1
-1@@ -183,7 +183,7 @@ asmlinkage void sb1_cache_error(void)#ifdef CONFIG_SIBYTE_BW_TRACE /* Freeze the trace buffer now */ #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) -csr_out32 (M_BCM1480_SCD_TRACE_CFG_FREEZE ,IOADDR (A_SCD_TRACE_CFG )); +csr_out32 (M_BCM1480_SYS_RESERVED4 ,IOADDR (A_SCD_TRACE_CFG ));#else csr_out32 (M_SCD_TRACE_CFG_FREEZE ,IOADDR (A_SCD_TRACE_CFG ));#endif
I think this is the correct solution.
Unfortunately nobody at Broadcom seems to care about the Sibyte SOCs these days though they're still very important for a bunch of Linux distributions.
Ralf
CC arch/mips/mm/cerr-sb1.oarch/mips/mm/cerr-sb1.c: In function ‘sb1_cache_error’:arch/mips/mm/cerr-sb1.c:186:98: error: ‘M_BCM1480_SCD_TRACE_CFG_FREEZE’ undeclared (first use in this function) arch/mips/mm/cerr-sb1.c:186:98: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [arch/mips/mm/cerr-sb1.o] Error 1
This happens because 8deab1144b553548fb2f1b51affdd36dcd652aaa [[MIPS] Updated Sibyte headers] changed the headers but not all the users.
--- arch/mips/mm/cerr-sb1.c | 4 ---- 1 file changed, 4 deletions(-)
arch/mips/mm/cerr-sb1.c +0 -4
@@ -182,11 +182,7 @@ asmlinkage void sb1_cache_error(void)#ifdef CONFIG_SIBYTE_BW_TRACE /* Freeze the trace buffer now */ -#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) -csr_out32 (M_BCM1480_SCD_TRACE_CFG_FREEZE ,IOADDR (A_SCD_TRACE_CFG )); -#else csr_out32 (M_SCD_TRACE_CFG_FREEZE ,IOADDR (A_SCD_TRACE_CFG )); -#endif printk ("Trace buffer frozen\n" );#endif
Re: [PATCH 4/7] MIPS: sibyte: Amend dependencies for SIBYTE_BUS_WATCHER
In reply to Markos ChandrasQuoted 6 lines · Markos Chandras
SIBYTE_BUS_WATCHERis only visible ifCONFIG_SIBYTE_BCM112XorCONFIG_SIBYTE_SB1250is selected according to thearch/mips/sibyte/Makefile.
This fixes the following build problem:
arch/mips/mm/cerr-sb1.c:254: undefined reference to `check_bus_watcher'
I originally had applied this patch but now I'm removing it again. The real culprit is that the Sibyte bus watcher code is hidden in the sb1250/ subdirectory where builds for the later BCM 1x55 and 1x80 SOC generations won't pick it up, thus this errors.
Below patch moves the code to the generic directory and does minor modifications to actually get the code to work.
Thanks anyway!
Ralf
CC arch/mips/sibyte/bcm1480/bus_watcher.o
CHK kernel/config_data.harch/mips/sibyte/bcm1480/bus_watcher.c: In function ‘check_bus_watcher’:arch/mips/sibyte/bcm1480/bus_watcher.c:86:82: error: ‘A_SCD_BUS_ERR_STATUS_DEBUG’ undeclared (first use in this function) arch/mips/sibyte/bcm1480/bus_watcher.c:86:82: note: each undeclared identifier is reported only once for each function it appears in make[3]: *** [arch/mips/sibyte/bcm1480/bus_watcher.o] Error 1
make[2]: *** [arch/mips/sibyte/bcm1480] Error 2
make[1]: *** [arch/mips/sibyte] Error 2
make: *** [arch/mips] Error 2
The register moved around though it's otherwise the same but because of the changed address it now also has a different name.
--- arch/mips/sibyte/common/Makefile | 1 + arch/mips/sibyte/common/bus_watcher.c | 256 ++++++++++++++++++++++++++++++++++ arch/mips/sibyte/sb1250/Makefile | 1 - arch/mips/sibyte/sb1250/bus_watcher.c | 247 -------------------------------- 4 files changed, 257 insertions(+), 248 deletions(-)
arch/mips/sibyte/common/Makefile +1 -0
@@ -1,3 +1,4 @@ obj-y := cfe.o +obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o obj-$(CONFIG_SIBYTE_CFE_CONSOLE) += cfe_console.o obj-$(CONFIG_SIBYTE_TBPROF) += sb_tbprof.o
arch/mips/sibyte/common/bus_watcher.c new file +256 -0
256 lines not on this page · raw message
arch/mips/sibyte/sb1250/Makefile +0 -1
@@ -1,4 +1,3 @@ obj-y := setup.o irq.o time.o obj-$(CONFIG_SMP) += smp.o -obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o
arch/mips/sibyte/sb1250/bus_watcher.c deleted +0 -247
247 lines not on this page · raw message
Re: [PATCH 6/7] drivers: ssb: Kconfig: Amend SSB_EMBEDDED dependencies
In reply to Markos ChandrasQuoted 12 lines · Markos Chandras
SSB_EMBEDDEDneeds functions fromdriver_pcicorewhich are only available ifSSD_DRIVER_HOSTMODEis selected so make it depend on that symbol.Fixes the following linking problem:
drivers/ssb/embedded.c:202:
undefined reference tossb_pcicore_plat_dev_init' drivers/built-in.o: In functionssb_pcibios_map_irq':drivers/ssb/embedded.c:247:
undefined reference to `ssb_pcicore_pcibios_map_irq'
Quoted 5 lines
Signed-off-by Markos Chandras <[email protected]>Acked-by Steven J. Hill <[email protected]>Cc Michael Buesch <[email protected]>
No comments received but Florian acked it over IRC so applied.
And btw, why is sibyte-users on cc - we don't want to disrupt the silence of that list too badly ;-)
Ralf