Skip to contentSkip to conversation

generic IRQs for sparc32

DISCUSSION David Miller 2 participants 5 messages Sep 2, 2008 – Sep 3, 2008

Subsystems (2)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

One thing I've been wanting to do for a long time is convert the 32-bit sparc code over to the generic IRQ layer.

I had a prototype patch in my back pocket that I've been trying to resurrect, but there were some difficult issues to overcome as long as the EBUS and SBUS layers were still around.

So now that I've gotten rid of those turds, I can make a stronger push on the generic IRQ patch.

Even if I finish this work quickly I won't push it into sparc-next-2.6 until I get at least some testing feedback.

Is there anyone booting sparc32 successfully with sparc-next-2.6 any time after the SBUS removal changes went in? At least one person appeared to be trying, and ran into that build problem with CONFIG_PCI (which I fixed).

It would be good to know where things stand so that we can better compare the state of affairs after the generic IRQs changes get applied.

Thanks.

author maintainer
#1 lore raw

From: Robert Reif <[email protected]>
Date: Tue, 02 Sep 2008 17:24:51 -0400

Quoted 16 lines

SCSI subsystem initialized

Unable to handle kernel paging request at virtual address fd412000
tsk->{mm,active_mm}->context = 000000a7
tsk->{mm,active_mm}->pgd = fc016000
              \|/ ____ \|/
              "@'/ ,. \`@"
              /_| \__/ |_\
                 \__U_/
modprobe(313): Oops [#1]
PSR: 404000c0 PC: fe61001c NPC: fe610020 Y: 00000000    Not tainted
PC: <sbus_esp_read8+0x8/0x14 [sun_esp]>
%G: fb8f19cc fd412000  000061a8 00177190  00009c40 fe610a48  fb8f0000 00000000
%O: fb8e6e54 0000002c  0000002c fff01000  fff01000 f0267970  fb8f1a10 fe61eb7c
RPC: <scsi_esp_register+0x1b0/0x3ec [esp_scsi]>
%L: f0d084e0 00000024  fe62075c fe610e58  fb8e6e54 00000000  fb8f1a58 fb8f1a44
%I: fb8e6e54 fb8630e8  000000ff 408000e0  f02670e8 ffffffff  fb8f1a80 fe610934
Quoted 1 line

Caller[fe610934]: esp_sbus_probe+0x378/0x468 [sun_esp]

Ok, so we're faulting on the I/O read of location "esp->regs + 0x2c" in sbus_esp_read8().

But what's amusing is that we just did a sbus_esp_write8() using the same exact esp->regs, and that worked!

Here is a debugging patch against sparc-next-2.6 that might help debug this:

drivers/scsi/esp_scsi.c +7 -0
index 62a4618..48fc49f 100644
@@ -2151,10 +2151,17 @@ static void esp_get_revision(struct esp *esp)
 {
 	u8 val;
 
+#if 1
+	printk(KERN_ERR "ESP: In esp_get_revision(), regs at %p\n", esp->regs);
+#endif
 	esp->config1 = (ESP_CONFIG1_PENABLE | (esp->scsi_id & 7));
 	esp->config2 = (ESP_CONFIG2_SCSI2ENAB | ESP_CONFIG2_REGPARITY);
 	esp_write8(esp->config2, ESP_CFG2);
 
+#if 1
+	printk(KERN_ERR "ESP: In esp_get_revision(), about to read ESP_CFG2, "
+	       "regs now at %p\n", esp->regs);
+#endif
 	val = esp_read8(ESP_CFG2);
 	val &= ~ESP_CONFIG2_MAGIC;
 	if (val != (ESP_CONFIG2_SCSI2ENAB | ESP_CONFIG2_REGPARITY)) {
drivers/scsi/sun_esp.c +3 -0
index 3d73aad..5018210 100644
@@ -94,6 +94,9 @@ static int __devinit esp_sbus_map_regs(struct esp *esp, int hme)
 	esp->regs = of_ioremap(res, 0, SBUS_ESP_REG_SIZE, "ESP");
 	if (!esp->regs)
 		return -ENOMEM;
+#if 1
+	printk(KERN_ERR "ESP: Mapped regs at %p\n", esp->regs);
+#endif
 
 	return 0;
 }
#2 lore raw
In reply to David Miller
Quoted 4 lines · David Miller

Here is a debugging patch against sparc-next-2.6 that might help debug this:

I recompiled a new kernel from scratch starting out with a default config. I had to compile for size so it fit in memory. I'm booting off a SunSwift sbus card if that helps.

ESP: Mapped regs at fd016000
ESP: In esp_get_revision(), regs at fd016000
ESP: In esp_get_revision(), about to read ESP_CFG2, regs now at fd016000

Unable to handle kernel paging request at virtual address fd016000
tsk->{mm,active_mm}->context = ffffffff
tsk->{mm,active_mm}->pgd = fc000000
              \|/ ____ \|/
              "@'/ ,. \`@"
              /_| \__/ |_\
                 \__U_/

swapper(1): Oops [#1]
PSR: 404010c2 PC: f014768c NPC: f0147690 Y: 00000000 Not tainted
PC: <sbus_esp_read8+0x8/0x14>
%G: fb821ae0 fd016000 f023a96c 07200720 00000002 07200720 fb820000 f0cce4c0
%O: fb82e33c 0000002c 0000002c fff0e000 fff0e000 f0271bec fb821ae0 f01450a4
RPC: <scsi_esp_register+0x1d0/0x40c>
%L: 00000080 00000024 f0146cc0 f021cf20 fb82e33c fb821b24 80000000 fb821b18
%I: fb82e33c fb843c08 000000ff f027142c 00000000 00200200 fb821b50 f01d5d38
Caller[f01d5d38]: esp_sbus_probe+0x3b0/0x478 Caller[f0156e64]: of_platform_device_probe+0x4c/0xb8 Caller[f012e360]: driver_probe_device+0xd4/0x190 Caller[f012e454]: __driver_attach+0x38/0x68 Caller[f012dc14]: bus_for_each_dev+0x3c/0x7c Caller[f012d498]: bus_add_driver+0xa4/0x230 Caller[f012e674]: driver_register+0xc8/0x170 Caller[f0010044]: do_one_initcall+0x44/0x188 Caller[f024f9e4]: _etext+0x77dec/0x78408
Caller[f0013960]: kernel_thread+0x34/0x50 Caller[f01d4194]: rest_init+0x10/0x5c
Caller[f0250034]: _sinittext+0x34/0x48
Caller[f024f790]: _etext+0x77b98/0x78408
Caller[00000000]: 0x0
Instruction DUMP: 01000000 932a6002 c2020000 <d0084009> 81c3e008 01000000 c2022004 c2004000 82086003

author maintainer
#3 lore raw
In reply to David Miller

From: Robert Reif <[email protected]>
Date: Tue, 02 Sep 2008 23:48:39 -0400

Quoted 5 lines
Quoted 4 lines · David Miller

Here is a debugging patch against sparc-next-2.6 that might help debug this:

Quoted 8 lines

I recompiled a new kernel from scratch starting out with a default config. I had to compile for size so it fit in memory. I'm booting off a SunSwift sbus card if that helps.

ESP: Mapped regs at fd016000
ESP: In esp_get_revision(), regs at fd016000
ESP: In esp_get_revision(), about to read ESP_CFG2, regs now at fd016000

Unable to handle kernel paging request at virtual address fd016000

It's even more mysterious now. :(

A write to the register at that address works, but a read fails.

Strange :-/

author maintainer
#4 lore raw
In reply to David Miller

From: Robert Reif <[email protected]>
Date: Tue, 02 Sep 2008 23:48:39 -0400

Quoted 4 lines

ESP: Mapped regs at fd016000
ESP: In esp_get_revision(), regs at fd016000
ESP: In esp_get_revision(), about to read ESP_CFG2, regs now at fd016000

Unable to handle kernel paging request at virtual address fd016000

I think I figured it out. We're not calculating the physical I/O address of the ESP registers properly. So it's accessing some random location instead of the ESP chip.

This would have also tripped up Ultra1 systems.

Please try this patch, which I also pushed to sparc-next-2.6

Thanks!

sparc: Fix handling of LANCE and ESP parent nodes in of_device.c

The device nodes that sit above 'esp' and 'le' on SBUS lack a 'ranges' property, but we should pass the translation up to the parent node so that the SBUS level ranges get applied.

Based upon a bug report from Robert Reif.

---
 arch/sparc/kernel/of_device.c   |   26 ++++++++++++++++++++++----
 arch/sparc64/kernel/of_device.c |   11 ++++++++++-
 2 files changed, 32 insertions(+), 5 deletions(-)
arch/sparc/kernel/of_device.c +22 -4
index c590148..4ef1607 100644
@@ -344,6 +344,27 @@ static int __init build_one_resource(struct device_node *parent,
 	return 1;
 }
 
+static int __init use_1to1_mapping(struct device_node *pp)
+{
+	/* If we have a ranges property in the parent, use it.  */
+	if (of_find_property(pp, "ranges", NULL) != NULL)
+		return 0;
+
+	/* Some SBUS devices use intermediate nodes to express
+	 * hierarchy within the device itself.  These aren't
+	 * real bus nodes, and don't have a 'ranges' property.
+	 * But, we should still pass the translation work up
+	 * to the SBUS itself.
+	 */
+	if (!strcmp(pp->name, "dma") ||
+	    !strcmp(pp->name, "espdma") ||
+	    !strcmp(pp->name, "ledma") ||
+	    !strcmp(pp->name, "lebuffer"))
+		return 0;
+
+	return 1;
+}
+
 static int of_resource_verbose;
 
 static void __init build_device_resources(struct of_device *op,
@@ -389,10 +410,7 @@ static void __init build_device_resources(struct of_device *op,
 
 		memcpy(addr, reg, na * 4);
 
-		/* If the immediate parent has no ranges property to apply,
-		 * just use a 1<->1 mapping.
-		 */
-		if (of_find_property(pp, "ranges", NULL) = NULL) {
+		if (use_1to1_mapping(pp)) {
 			result = of_read_addr(addr, na);
 			goto build_res;
 		}
arch/sparc64/kernel/of_device.c +10 -1
index e427086..c15bcdf 100644
@@ -438,8 +438,17 @@ static int __init use_1to1_mapping(struct device_node *pp)
 
 	/* If the parent is the dma node of an ISA bus, pass
 	 * the translation up to the root.
+	 *
+	 * Some SBUS devices use intermediate nodes to express
+	 * hierarchy within the device itself.  These aren't
+	 * real bus nodes, and don't have a 'ranges' property.
+	 * But, we should still pass the translation work up
+	 * to the SBUS itself.
 	 */
-	if (!strcmp(pp->name, "dma"))
+	if (!strcmp(pp->name, "dma") ||
+	    !strcmp(pp->name, "espdma") ||
+	    !strcmp(pp->name, "ledma") ||
+	    !strcmp(pp->name, "lebuffer"))
 		return 0;
 
 	/* Similarly for all PCI bridges, if we get this far
Signature · 1 line
1.5.6.5.GIT