As requested by Mark on qemu-devel list, update OpenBIOS to be consistent with QEMU change: https://lists.gnu.org/archive/html/qemu-devel/2020-10/msg03079.html
Philippe Mathieu-Daudé (3): 40p: Allow Raven controller to handle all IRQs 40p: use is_apple() macro 40p: simplify IRQ swizzling
drivers/pci.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-)
In commit ce7fa4d29b we adapted to match QEMU (invalid) code. Now than QEMU has been fixed and handle the 4 IRQs, update the OF device tree again.
Reported-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk Signed-off-by: Philippe Mathieu-Daudé f4bug@amsat.org --- drivers/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci.c b/drivers/pci.c index 34ae69a..b05ca3b 100644 --- a/drivers/pci.c +++ b/drivers/pci.c @@ -2009,7 +2009,7 @@ static void ob_pci_host_bus_interrupt(ucell dnode, u32 *props, int *ncells, u32 /* Use the same "physical" routing as QEMU's raven_map_irq() although ultimately all 4 PCI interrupts are ORd to IRQ 15 as indicated by the PReP specification */ - props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 1]; + props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 3]; } props[(*ncells)++] = 1; }
Simplify using the is_apple() macro.
Signed-off-by: Philippe Mathieu-Daudé f4bug@amsat.org --- drivers/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci.c b/drivers/pci.c index b05ca3b..a2774d2 100644 --- a/drivers/pci.c +++ b/drivers/pci.c @@ -1991,7 +1991,7 @@ static void ob_pci_host_bus_interrupt(ucell dnode, u32 *props, int *ncells, u32 { *ncells += pci_encode_phys_addr(props + *ncells, 0, 0, addr, 0, 0);
- if (is_oldworld() || is_newworld()) { + if (is_apple()) { /* Mac machines */ props[(*ncells)++] = intno; props[(*ncells)++] = dnode;
LSI SCSI on PReP is the unique particular case where we use fixed IRQ routing. All other cases use regular IRQ swizzling.
Signed-off-by: Philippe Mathieu-Daudé f4bug@amsat.org --- drivers/pci.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-)
diff --git a/drivers/pci.c b/drivers/pci.c index a2774d2..ef9a2da 100644 --- a/drivers/pci.c +++ b/drivers/pci.c @@ -1991,28 +1991,15 @@ static void ob_pci_host_bus_interrupt(ucell dnode, u32 *props, int *ncells, u32 { *ncells += pci_encode_phys_addr(props + *ncells, 0, 0, addr, 0, 0);
- if (is_apple()) { - /* Mac machines */ - props[(*ncells)++] = intno; - props[(*ncells)++] = dnode; - props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 3]; - props[(*ncells)++] = 1; + props[(*ncells)++] = intno; + props[(*ncells)++] = dnode; + if (!is_apple() && (PCI_DEV(addr) == 1 && PCI_FN(addr) == 0)) { + /* On PReP machine the LSI SCSI has fixed routing to IRQ 13 */ + props[(*ncells)++] = 13; } else { - /* PReP machines */ - props[(*ncells)++] = intno; - props[(*ncells)++] = dnode; - - if (PCI_DEV(addr) == 1 && PCI_FN(addr) == 0) { - /* LSI SCSI has fixed routing to IRQ 13 */ - props[(*ncells)++] = 13; - } else { - /* Use the same "physical" routing as QEMU's raven_map_irq() although - ultimately all 4 PCI interrupts are ORd to IRQ 15 as indicated - by the PReP specification */ - props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 3]; - } - props[(*ncells)++] = 1; + props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 3]; } + props[(*ncells)++] = 1; }
#elif defined(CONFIG_SPARC64)
On Wed, 3 Feb 2021, Philippe Mathieu-Daudé wrote:
LSI SCSI on PReP is the unique particular case where we use fixed IRQ routing. All other cases use regular IRQ swizzling.
Signed-off-by: Philippe Mathieu-Daudé f4bug@amsat.org
drivers/pci.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-)
diff --git a/drivers/pci.c b/drivers/pci.c index a2774d2..ef9a2da 100644 --- a/drivers/pci.c +++ b/drivers/pci.c @@ -1991,28 +1991,15 @@ static void ob_pci_host_bus_interrupt(ucell dnode, u32 *props, int *ncells, u32 { *ncells += pci_encode_phys_addr(props + *ncells, 0, 0, addr, 0, 0);
- if (is_apple()) {
/* Mac machines */
props[(*ncells)++] = intno;
props[(*ncells)++] = dnode;
props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 3];
props[(*ncells)++] = 1;
- props[(*ncells)++] = intno;
- props[(*ncells)++] = dnode;
- if (!is_apple() && (PCI_DEV(addr) == 1 && PCI_FN(addr) == 0)) {
/* On PReP machine the LSI SCSI has fixed routing to IRQ 13 */
I don't really care so feel free to ignore this comment but is there a way to check for what the comment says, i.e. we're on PReP and device vendor/product ID matches the SCSI controller, instead of what we have here that says if it's not a Mac then anything in this slot will use IRQ 13 which theoretically could match unwanted devices?
Regards, BALATON Zoltan
} else {props[(*ncells)++] = 13;
/* PReP machines */
props[(*ncells)++] = intno;
props[(*ncells)++] = dnode;
if (PCI_DEV(addr) == 1 && PCI_FN(addr) == 0) {
/* LSI SCSI has fixed routing to IRQ 13 */
props[(*ncells)++] = 13;
} else {
/* Use the same "physical" routing as QEMU's raven_map_irq() although
ultimately all 4 PCI interrupts are ORd to IRQ 15 as indicated
by the PReP specification */
props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 3];
}
props[(*ncells)++] = 1;
}props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 3];
- props[(*ncells)++] = 1;
}
#elif defined(CONFIG_SPARC64)
On 03/02/2021 14:23, BALATON Zoltan wrote:
On Wed, 3 Feb 2021, Philippe Mathieu-Daudé wrote:
LSI SCSI on PReP is the unique particular case where we use fixed IRQ routing. All other cases use regular IRQ swizzling.
Signed-off-by: Philippe Mathieu-Daudé f4bug@amsat.org
drivers/pci.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-)
diff --git a/drivers/pci.c b/drivers/pci.c index a2774d2..ef9a2da 100644 --- a/drivers/pci.c +++ b/drivers/pci.c @@ -1991,28 +1991,15 @@ static void ob_pci_host_bus_interrupt(ucell dnode, u32 *props, int *ncells, u32 { *ncells += pci_encode_phys_addr(props + *ncells, 0, 0, addr, 0, 0);
- if (is_apple()) { - /* Mac machines */ - props[(*ncells)++] = intno; - props[(*ncells)++] = dnode; - props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 3]; - props[(*ncells)++] = 1; + props[(*ncells)++] = intno; + props[(*ncells)++] = dnode; + if (!is_apple() && (PCI_DEV(addr) == 1 && PCI_FN(addr) == 0)) { + /* On PReP machine the LSI SCSI has fixed routing to IRQ 13 */
I don't really care so feel free to ignore this comment but is there a way to check for what the comment says, i.e. we're on PReP and device vendor/product ID matches the SCSI controller, instead of what we have here that says if it's not a Mac then anything in this slot will use IRQ 13 which theoretically could match unwanted devices?
Note that this version of ob_pci_host_bus_interrupt() is in a #if defined(CONFIG_PPC) ... #endif block and so !is_apple() is enough to distinguish between PReP and Mac machines. This pattern is used in quite a few places within OpenBIOS and so I'd expect quite a few things to break if this assumption ever changed...
ATB,
Mark.
On 03/02/2021 11:56, Philippe Mathieu-Daudé wrote:
As requested by Mark on qemu-devel list, update OpenBIOS to be
consistent with QEMU change:
https://lists.gnu.org/archive/html/qemu-devel/2020-10/msg03079.html
Philippe Mathieu-Daudé (3):
40p: Allow Raven controller to handle all IRQs
40p: use is_apple() macro
40p: simplify IRQ swizzling
drivers/pci.c | 27 +++++++--------------------
1 file changed, 7 insertions(+), 20 deletions(-)
These patches look good to me. I'll wait a few days for any further comments before pushing these to git.
ATB,
Mark.