Skip to contentSkip to conversation

MIPS: sibyte build fixes

PATCH In review Markos Chandras 4 participants 15 messages Jun 17, 2013 – Jun 27, 2013

Subsystems (5)
lore
Share & tools
lore
#12 lore raw

PATCH 6/7 drivers: ssb: Kconfig: Amend SSB_EMBEDDED dependencies

In reply to Markos Chandras

SSB_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
index 5ff3a4f..36171fd 100644
@@ -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
#0 lore raw

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
#1 lore raw

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
index 576add3..1a24534 100644
@@ -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
#4 lore raw

PATCH 3/7 MIPS: sibyte: Add missing sched.h header

In reply to Markos Chandras

It'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
index 2188b39..059e28c 100644
@@ -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
#7 lore raw

PATCH 4/7 MIPS: sibyte: Amend dependencies for SIBYTE_BUS_WATCHER

In reply to Markos Chandras

SIBYTE_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
index 01cc1a7..5fbd360 100644
@@ -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
#9 lore raw

PATCH 5/7 drivers: watchdog: sb_wdog: Fix 32bit linking problems

In reply to Markos Chandras

Fixes 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
index 25c7a3f..2ea0427 100644
@@ -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
#14 lore raw

PATCH 7/7 MIPS: sibyte: Remove unused variable.

In reply to Markos Chandras

Fixes 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
index 8871e33..d0ca7b9 100644
@@ -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
#3 lore raw

PATCH 2/7 MIPS: sibyte: Declare the cfe_write() buffer as constant

In reply to Markos Chandras

The 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
index d06dc5a6..cf84f01 100644
@@ -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
index 1734755..a0ea69e 100644
@@ -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
#5 lore raw

Re: [PATCH 3/7] MIPS: sibyte: Add missing sched.h header

In reply to Markos Chandras
Quoted 5 lines · Markos Chandras

It'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)

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

#10 lore raw

Re: [PATCH 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems

In reply to Markos Chandras
Quoted 21 lines · Markos Chandras
---
 drivers/watchdog/sb_wdog.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/watchdog/sb_wdog.c +1 -0
index 25c7a3f..2ea0427 100644
@@ -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

#6 lore raw

Re: [PATCH 3/7] MIPS: sibyte: Add missing sched.h header

In reply to Ralf Baechle
Quoted 11 lines · Ralf Baechle
Quoted 5 lines · Markos Chandras

It'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)

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.

Oh man, there's include recursion hell waiting for you ;-)

#11 lore raw

Re: [PATCH 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems

In reply to Ralf Baechle
Quoted 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

#2 lore raw

Re: [PATCH 1/7] MIPS: sibyte: Fix build for SIBYTE_BW_TRACE

In reply to Markos Chandras
Quoted 23 lines · Markos Chandras

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 +0 -0
index 576add3..1a24534 100644

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.o
arch/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
index 576add3..ee5c1ff 100644
@@ -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
 
#8 lore raw

Re: [PATCH 4/7] MIPS: sibyte: Amend dependencies for SIBYTE_BUS_WATCHER

In reply to Markos Chandras
Quoted 6 lines · Markos Chandras

SIBYTE_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'

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.h
arch/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
index 36aa700..b3d6bf2 100644
@@ -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
index d3d969d..cdc4c56 100644
@@ -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

#13 lore raw

Re: [PATCH 6/7] drivers: ssb: Kconfig: Amend SSB_EMBEDDED dependencies

In reply to Markos Chandras
Quoted 12 lines · Markos Chandras

SSB_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'

Quoted 5 lines

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