[Qemu-devel] [PATCH v2 0/3] 40p: fix PCI interrupt routing

Mark Cave-Ayland posted 3 patches 7 years, 1 month ago
Failed in applying to current master (apply log)
There is a newer version of this series
hw/pci-host/prep.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++-------
hw/ppc/prep.c      | 12 ++++++----
2 files changed, 66 insertions(+), 13 deletions(-)
[Qemu-devel] [PATCH v2 0/3] 40p: fix PCI interrupt routing
Posted by Mark Cave-Ayland 7 years, 1 month ago
According to the PReP specification section 6.1.6 "System Interrupt
Assignments", all PCI interrupts are routed via IRQ 15.

In the case of the 40p machine this isn't quite true in that it has a routing
quirk: the LSI SCSI device is always routed to IRQ 13. At least Linux and
NetBSD compare the model name presented by the firmware to "IBM PPS Model
6015", and if it matches will active this quirk.

There is also a slight issue in that whilst the legacy PReP machine is still
present in the codebase, the old IRQ routing must still be preserved. This is
done by introducing a new "is-legacy-prep" qdev property to the raven PCI host
bridge which preserves the old routing for -M prep until that code is finally
removed.

In order for guest OSs to make use of the fixed IRQ routing, the model name
in the residual data must be changed in OpenBIOS using the diff below:

diff --git a/arch/ppc/qemu/context.c b/arch/ppc/qemu/context.c
index 06e0122..5815895 100644
--- a/arch/ppc/qemu/context.c
+++ b/arch/ppc/qemu/context.c
@@ -111,7 +111,7 @@ static void *
 residual_build(uint32_t memsize, uint32_t load_base, uint32_t load_size)
 {
     residual_t *res;
-    const unsigned char model[] = "Qemu\0PPC\0";
+    const unsigned char model[] = "IBM PPS Model 6015\0";
     int i;
 
     res = malloc(sizeof(residual_t));

With the above OpenBIOS patch applied as well as this patchset, it is now
possible to boot the sandalfoot zImage all the way through to a working
userspace when using OpenBIOS.

(Note: this patchset requires the changes in my previous patchset "scsi:
replace lsi53c895a_create() and lsi53c810_create() functions)

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Based-on: <20180907125653.5010-1-mark.cave-ayland@ilande.co.uk>

Mark Cave-Ayland (3):
  raven: some minor IRQ-related tidy-ups
  40p: use OR gate to wire up raven PCI interrupts
  40p: add fixed IRQ routing for LSI SCSI device

 hw/pci-host/prep.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++-------
 hw/ppc/prep.c      | 12 ++++++----
 2 files changed, 66 insertions(+), 13 deletions(-)

-- 
2.11.0


Re: [Qemu-devel] [PATCH v2 0/3] 40p: fix PCI interrupt routing
Posted by Hervé Poussineau 7 years, 1 month ago
Le 08/09/2018 à 11:08, Mark Cave-Ayland a écrit :
> According to the PReP specification section 6.1.6 "System Interrupt
> Assignments", all PCI interrupts are routed via IRQ 15.
> 
> In the case of the 40p machine this isn't quite true in that it has a routing
> quirk: the LSI SCSI device is always routed to IRQ 13. At least Linux and
> NetBSD compare the model name presented by the firmware to "IBM PPS Model
> 6015", and if it matches will active this quirk.
> 
> There is also a slight issue in that whilst the legacy PReP machine is still
> present in the codebase, the old IRQ routing must still be preserved. This is
> done by introducing a new "is-legacy-prep" qdev property to the raven PCI host
> bridge which preserves the old routing for -M prep until that code is finally
> removed.
> 

Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>


Re: [Qemu-devel] [PATCH v2 0/3] 40p: fix PCI interrupt routing
Posted by David Gibson 7 years, 1 month ago
On Sat, Sep 08, 2018 at 10:08:17AM +0100, Mark Cave-Ayland wrote:
11;rgb:ffff/ffff/ffff> According to the PReP specification section 6.1.6 "System Interrupt
> Assignments", all PCI interrupts are routed via IRQ 15.
> 
> In the case of the 40p machine this isn't quite true in that it has a routing
> quirk: the LSI SCSI device is always routed to IRQ 13. At least Linux and
> NetBSD compare the model name presented by the firmware to "IBM PPS Model
> 6015", and if it matches will active this quirk.
> 
> There is also a slight issue in that whilst the legacy PReP machine is still
> present in the codebase, the old IRQ routing must still be preserved. This is
> done by introducing a new "is-legacy-prep" qdev property to the raven PCI host
> bridge which preserves the old routing for -M prep until that code is finally
> removed.
> 
> In order for guest OSs to make use of the fixed IRQ routing, the model name
> in the residual data must be changed in OpenBIOS using the diff
> below:

I've merged patches 1 & 2.  I don't think 3 has the right approach,
detailed comments there.

> 
> diff --git a/arch/ppc/qemu/context.c b/arch/ppc/qemu/context.c
> index 06e0122..5815895 100644
> --- a/arch/ppc/qemu/context.c
> +++ b/arch/ppc/qemu/context.c
> @@ -111,7 +111,7 @@ static void *
>  residual_build(uint32_t memsize, uint32_t load_base, uint32_t load_size)
>  {
>      residual_t *res;
> -    const unsigned char model[] = "Qemu\0PPC\0";
> +    const unsigned char model[] = "IBM PPS Model 6015\0";
>      int i;
>  
>      res = malloc(sizeof(residual_t));
> 
> With the above OpenBIOS patch applied as well as this patchset, it is now
> possible to boot the sandalfoot zImage all the way through to a working
> userspace when using OpenBIOS.
> 
> (Note: this patchset requires the changes in my previous patchset "scsi:
> replace lsi53c895a_create() and lsi53c810_create() functions)
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Based-on: <20180907125653.5010-1-mark.cave-ayland@ilande.co.uk>
> 
> Mark Cave-Ayland (3):
>   raven: some minor IRQ-related tidy-ups
>   40p: use OR gate to wire up raven PCI interrupts
>   40p: add fixed IRQ routing for LSI SCSI device
> 
>  hw/pci-host/prep.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++-------
>  hw/ppc/prep.c      | 12 ++++++----
>  2 files changed, 66 insertions(+), 13 deletions(-)
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson