All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for INTx routing
@ 2017-07-09 21:02 Eric Auger
  2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 1/3] hw/pci-host/gpex: Set INTx index/gsi mapping Eric Auger
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Eric Auger @ 2017-07-09 21:02 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, peter.maydell, alex.williamson,
	qemu-arm, qemu-devel
  Cc: christoffer.dall, agraf, pranavkumar, drjones, wei

This series implements INTx to gsi routing for ARM VIRT/Gpex. This is
a respin of [1] which was lost in limbo.

ARM virt uses GPEX PCIe bridge. This latter does not implement INTx
to GSI routing. PCIe/INTx assignment works but the consequence is
irqfd is not used along with INTx interrupts and VFIO INTx handlers
are executed on userspace leading to an important performance degradation.

This issue is witnessed by the following messages;

qemu-system-aarch64: -device vfio-pci,host=0006:90:00.0: PCI: Bug -
unimplemented PCI INTx routing (gpex-pcihost)
qemu-system-aarch64: PCI: Bug - unimplemented PCI INTx routing (gpex-pcihost)
qemu-system-aarch64: PCI: Bug - unimplemented PCI INTx routing (gpex-pcihost)

So with this series, irqfd is set up for PCIe/INTx passthrough and we get
the optimal performance. Also we get rid of the above messages.

This series can be found at:
https://github.com/eauger/qemu/tree/v2.9-gpex-intx-v3

References:
[1] Generic PCIe host bridge INTx determination for INTx routing
   https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg04975.html


Pranavkumar Sawargaonkar (3):
  hw/pci-host/gpex: Set INTx index/gsi mapping
  hw/arm/virt: Set INTx/gsi mapping
  hw/pci-host/gpex: Implement PCI INTx routing

 hw/arm/virt.c              |  4 ++++
 hw/pci-host/gpex.c         | 22 ++++++++++++++++++++++
 include/hw/pci-host/gpex.h |  3 +++
 3 files changed, 29 insertions(+)

-- 
2.5.5

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH RESEND v3 1/3] hw/pci-host/gpex: Set INTx index/gsi mapping
  2017-07-09 21:02 [Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for INTx routing Eric Auger
@ 2017-07-09 21:02 ` Eric Auger
  2017-09-11 12:41   ` Andrew Jones
  2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 2/3] hw/arm/virt: Set INTx/gsi mapping Eric Auger
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Eric Auger @ 2017-07-09 21:02 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, peter.maydell, alex.williamson,
	qemu-arm, qemu-devel
  Cc: christoffer.dall, agraf, pranavkumar, drjones, wei

From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>

To implement INTx to gsi routing we need to pass the gpex host
bridge the gsi associated to each INTx index. Let's introduce
irq_num array and gpex_set_irq_num setter function.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
 hw/pci-host/gpex.c         | 10 ++++++++++
 include/hw/pci-host/gpex.h |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
index 83084b9..0d42ac2 100644
--- a/hw/pci-host/gpex.c
+++ b/hw/pci-host/gpex.c
@@ -43,6 +43,16 @@ static void gpex_set_irq(void *opaque, int irq_num, int level)
     qemu_set_irq(s->irq[irq_num], level);
 }
 
+int gpex_set_irq_num(GPEXHost *s, int index, uint32_t gsi)
+{
+    if (index >=  GPEX_NUM_IRQS) {
+        return -EINVAL;
+    }
+
+    s->irq_num[index] = gsi;
+    return 0;
+}
+
 static void gpex_host_realize(DeviceState *dev, Error **errp)
 {
     PCIHostState *pci = PCI_HOST_BRIDGE(dev);
diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h
index 68c9348..db26b3e 100644
--- a/include/hw/pci-host/gpex.h
+++ b/include/hw/pci-host/gpex.h
@@ -51,6 +51,9 @@ typedef struct GPEXHost {
     MemoryRegion io_ioport;
     MemoryRegion io_mmio;
     qemu_irq irq[GPEX_NUM_IRQS];
+    uint32_t irq_num[GPEX_NUM_IRQS];
 } GPEXHost;
 
+int gpex_set_irq_num(GPEXHost *s, int index, uint32_t gsi);
+
 #endif /* HW_GPEX_H */
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH RESEND v3 2/3] hw/arm/virt: Set INTx/gsi mapping
  2017-07-09 21:02 [Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for INTx routing Eric Auger
  2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 1/3] hw/pci-host/gpex: Set INTx index/gsi mapping Eric Auger
@ 2017-07-09 21:02 ` Eric Auger
  2017-09-11 12:42   ` Andrew Jones
  2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 3/3] hw/pci-host/gpex: Implement PCI INTx routing Eric Auger
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Eric Auger @ 2017-07-09 21:02 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, peter.maydell, alex.williamson,
	qemu-arm, qemu-devel
  Cc: christoffer.dall, agraf, pranavkumar, drjones, wei

From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>

Let's provide the GPEX host bridge with the INTx/gsi mapping. This is
needed for INTx/gsi routing.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
 hw/arm/virt.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 010f724..f86c229 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1012,6 +1012,7 @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
     char *nodename;
     int i;
     PCIHostState *pci;
+    GPEXHost *s;
 
     dev = qdev_create(NULL, TYPE_GPEX_HOST);
     qdev_init_nofail(dev);
@@ -1047,8 +1048,11 @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
     /* Map IO port space */
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 2, base_pio);
 
+    s = GPEX_HOST(dev);
+
     for (i = 0; i < GPEX_NUM_IRQS; i++) {
         sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, pic[irq + i]);
+        gpex_set_irq_num(s, i, irq + i);
     }
 
     pci = PCI_HOST_BRIDGE(dev);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH RESEND v3 3/3] hw/pci-host/gpex: Implement PCI INTx routing
  2017-07-09 21:02 [Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for INTx routing Eric Auger
  2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 1/3] hw/pci-host/gpex: Set INTx index/gsi mapping Eric Auger
  2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 2/3] hw/arm/virt: Set INTx/gsi mapping Eric Auger
@ 2017-07-09 21:02 ` Eric Auger
  2017-09-11 12:52   ` Andrew Jones
  2017-09-01  7:37 ` [Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for " Auger Eric
  2017-09-01 14:45 ` Feng Kan
  4 siblings, 1 reply; 9+ messages in thread
From: Eric Auger @ 2017-07-09 21:02 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, peter.maydell, alex.williamson,
	qemu-arm, qemu-devel
  Cc: christoffer.dall, agraf, pranavkumar, drjones, wei

From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>

Now we are able to retrieve the gsi from the INTx pin, let's
enable intx_to_irq routing. From that point on, irqfd becomes
usable along with INTx when assigning a PCIe device.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
---
 hw/pci-host/gpex.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
index 0d42ac2..94cc3c1 100644
--- a/hw/pci-host/gpex.c
+++ b/hw/pci-host/gpex.c
@@ -53,6 +53,17 @@ int gpex_set_irq_num(GPEXHost *s, int index, uint32_t gsi)
     return 0;
 }
 
+static PCIINTxRoute gpex_route_intx_pin_to_irq(void *opaque, int pin)
+{
+    PCIINTxRoute route;
+    GPEXHost *s = opaque;
+
+    route.mode = PCI_INTX_ENABLED;
+    route.irq = (int)s->irq_num[pin];
+
+    return route;
+}
+
 static void gpex_host_realize(DeviceState *dev, Error **errp)
 {
     PCIHostState *pci = PCI_HOST_BRIDGE(dev);
@@ -77,6 +88,7 @@ static void gpex_host_realize(DeviceState *dev, Error **errp)
                                 &s->io_ioport, 0, 4, TYPE_PCIE_BUS);
 
     qdev_set_parent_bus(DEVICE(&s->gpex_root), BUS(pci->bus));
+    pci_bus_set_route_irq_fn(pci->bus, gpex_route_intx_pin_to_irq);
     qdev_init_nofail(DEVICE(&s->gpex_root));
 }
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for INTx routing
  2017-07-09 21:02 [Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for INTx routing Eric Auger
                   ` (2 preceding siblings ...)
  2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 3/3] hw/pci-host/gpex: Implement PCI INTx routing Eric Auger
@ 2017-09-01  7:37 ` Auger Eric
  2017-09-01 14:45 ` Feng Kan
  4 siblings, 0 replies; 9+ messages in thread
From: Auger Eric @ 2017-09-01  7:37 UTC (permalink / raw)
  To: eric.auger.pro, peter.maydell, alex.williamson, qemu-arm, qemu-devel
  Cc: christoffer.dall, agraf, pranavkumar, drjones, wei, Feng Kan

Hi,

On 09/07/2017 23:02, Eric Auger wrote:
> This series implements INTx to gsi routing for ARM VIRT/Gpex. This is
> a respin of [1] which was lost in limbo.
> 
> ARM virt uses GPEX PCIe bridge. This latter does not implement INTx
> to GSI routing. PCIe/INTx assignment works but the consequence is
> irqfd is not used along with INTx interrupts and VFIO INTx handlers
> are executed on userspace leading to an important performance degradation.
> 
> This issue is witnessed by the following messages;
> 
> qemu-system-aarch64: -device vfio-pci,host=0006:90:00.0: PCI: Bug -
> unimplemented PCI INTx routing (gpex-pcihost)
> qemu-system-aarch64: PCI: Bug - unimplemented PCI INTx routing (gpex-pcihost)
> qemu-system-aarch64: PCI: Bug - unimplemented PCI INTx routing (gpex-pcihost)
> 
> So with this series, irqfd is set up for PCIe/INTx passthrough and we get
> the optimal performance. Also we get rid of the above messages.

If I haven't missed anything, I have not received any comment on this
series despite ping and resend since mid June. Now most of the 2.10 rush
is behind, please can anyone have a look?

The BUG message hits when your assign a PF and performance is largely
decreased whenever INTx are used during passthrough.

Thanks

Eric
> 
> This series can be found at:
> https://github.com/eauger/qemu/tree/v2.9-gpex-intx-v3
> 
> References:
> [1] Generic PCIe host bridge INTx determination for INTx routing
>    https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg04975.html
> 
> 
> Pranavkumar Sawargaonkar (3):
>   hw/pci-host/gpex: Set INTx index/gsi mapping
>   hw/arm/virt: Set INTx/gsi mapping
>   hw/pci-host/gpex: Implement PCI INTx routing
> 
>  hw/arm/virt.c              |  4 ++++
>  hw/pci-host/gpex.c         | 22 ++++++++++++++++++++++
>  include/hw/pci-host/gpex.h |  3 +++
>  3 files changed, 29 insertions(+)
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for INTx routing
  2017-07-09 21:02 [Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for INTx routing Eric Auger
                   ` (3 preceding siblings ...)
  2017-09-01  7:37 ` [Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for " Auger Eric
@ 2017-09-01 14:45 ` Feng Kan
  4 siblings, 0 replies; 9+ messages in thread
From: Feng Kan @ 2017-09-01 14:45 UTC (permalink / raw)
  To: Auger Eric
  Cc: Alex Williamson, qemu-devel, qemu-arm, pranavkumar, agraf, wei,
	drjones, peter.maydell, eric.auger.pro, christoffer.dall

On Jul 9, 2017 2:04 PM, "Eric Auger" <eric.auger@redhat.com> wrote:

This series implements INTx to gsi routing for ARM VIRT/Gpex. This is
a respin of [1] which was lost in limbo.

ARM virt uses GPEX PCIe bridge. This latter does not implement INTx
to GSI routing. PCIe/INTx assignment works but the consequence is
irqfd is not used along with INTx interrupts and VFIO INTx handlers
are executed on userspace leading to an important performance degradation.

This issue is witnessed by the following messages;

qemu-system-aarch64: -device vfio-pci,host=0006:90:00.0: PCI: Bug -
unimplemented PCI INTx routing (gpex-pcihost)
qemu-system-aarch64: PCI: Bug - unimplemented PCI INTx routing
(gpex-pcihost)
qemu-system-aarch64: PCI: Bug - unimplemented PCI INTx routing
(gpex-pcihost)

So with this series, irqfd is set up for PCIe/INTx passthrough and we get
the optimal performance. Also we get rid of the above messages.

This series can be found at:
https://github.com/eauger/qemu/tree/v2.9-gpex-intx-v3

References:
[1] Generic PCIe host bridge INTx determination for INTx routing
   https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg04975.html


Pranavkumar Sawargaonkar (3):
  hw/pci-host/gpex: Set INTx index/gsi mapping
  hw/arm/virt: Set INTx/gsi mapping
  hw/pci-host/gpex: Implement PCI INTx routing

 hw/arm/virt.c              |  4 ++++
 hw/pci-host/gpex.c         | 22 ++++++++++++++++++++++
 include/hw/pci-host/gpex.h |  3 +++
 3 files changed, 29 insertions(+)

--
2.5.5

Tested-by: Feng Kan <fkan@apm.com>

Works for APM XGene systems.
Thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH RESEND v3 1/3] hw/pci-host/gpex: Set INTx index/gsi mapping
  2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 1/3] hw/pci-host/gpex: Set INTx index/gsi mapping Eric Auger
@ 2017-09-11 12:41   ` Andrew Jones
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Jones @ 2017-09-11 12:41 UTC (permalink / raw)
  To: Eric Auger
  Cc: eric.auger.pro, peter.maydell, alex.williamson, qemu-arm,
	qemu-devel, wei, agraf, christoffer.dall, pranavkumar

On Sun, Jul 09, 2017 at 11:02:17PM +0200, Eric Auger wrote:
> From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> 
> To implement INTx to gsi routing we need to pass the gpex host
> bridge the gsi associated to each INTx index. Let's introduce
> irq_num array and gpex_set_irq_num setter function.
> 
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> ---
>  hw/pci-host/gpex.c         | 10 ++++++++++
>  include/hw/pci-host/gpex.h |  3 +++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
> index 83084b9..0d42ac2 100644
> --- a/hw/pci-host/gpex.c
> +++ b/hw/pci-host/gpex.c
> @@ -43,6 +43,16 @@ static void gpex_set_irq(void *opaque, int irq_num, int level)
>      qemu_set_irq(s->irq[irq_num], level);
>  }
>  
> +int gpex_set_irq_num(GPEXHost *s, int index, uint32_t gsi)
> +{
> +    if (index >=  GPEX_NUM_IRQS) {
                    ^extra space
> +        return -EINVAL;
> +    }
> +
> +    s->irq_num[index] = gsi;
> +    return 0;
> +}
> +
>  static void gpex_host_realize(DeviceState *dev, Error **errp)
>  {
>      PCIHostState *pci = PCI_HOST_BRIDGE(dev);
> diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h
> index 68c9348..db26b3e 100644
> --- a/include/hw/pci-host/gpex.h
> +++ b/include/hw/pci-host/gpex.h
> @@ -51,6 +51,9 @@ typedef struct GPEXHost {
>      MemoryRegion io_ioport;
>      MemoryRegion io_mmio;
>      qemu_irq irq[GPEX_NUM_IRQS];
> +    uint32_t irq_num[GPEX_NUM_IRQS];

This is an int when calling gpex_set_irq_num() and then used as an int
later, requiring a cast. Why not just make it an int here and in the API?

>  } GPEXHost;
>  
> +int gpex_set_irq_num(GPEXHost *s, int index, uint32_t gsi);
> +
>  #endif /* HW_GPEX_H */
> -- 
> 2.5.5
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH RESEND v3 2/3] hw/arm/virt: Set INTx/gsi mapping
  2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 2/3] hw/arm/virt: Set INTx/gsi mapping Eric Auger
@ 2017-09-11 12:42   ` Andrew Jones
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Jones @ 2017-09-11 12:42 UTC (permalink / raw)
  To: Eric Auger
  Cc: eric.auger.pro, peter.maydell, alex.williamson, qemu-arm,
	qemu-devel, wei, agraf, christoffer.dall, pranavkumar

On Sun, Jul 09, 2017 at 11:02:18PM +0200, Eric Auger wrote:
> From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> 
> Let's provide the GPEX host bridge with the INTx/gsi mapping. This is
> needed for INTx/gsi routing.
> 
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> ---
>  hw/arm/virt.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 010f724..f86c229 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1012,6 +1012,7 @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
>      char *nodename;
>      int i;
>      PCIHostState *pci;
> +    GPEXHost *s;
>  
>      dev = qdev_create(NULL, TYPE_GPEX_HOST);
>      qdev_init_nofail(dev);
> @@ -1047,8 +1048,11 @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
>      /* Map IO port space */
>      sysbus_mmio_map(SYS_BUS_DEVICE(dev), 2, base_pio);
>  
> +    s = GPEX_HOST(dev);
> +
>      for (i = 0; i < GPEX_NUM_IRQS; i++) {
>          sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, pic[irq + i]);
> +        gpex_set_irq_num(s, i, irq + i);

nit: don't need the 's' variable for the one use, just do
gpex_set_irq_num(GPEX_HOST(dev), ...)

>      }
>  
>      pci = PCI_HOST_BRIDGE(dev);
> -- 
> 2.5.5
> 
>

Otherwise

Reviewed-by: Andrew Jones <drjones@redhat.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH RESEND v3 3/3] hw/pci-host/gpex: Implement PCI INTx routing
  2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 3/3] hw/pci-host/gpex: Implement PCI INTx routing Eric Auger
@ 2017-09-11 12:52   ` Andrew Jones
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Jones @ 2017-09-11 12:52 UTC (permalink / raw)
  To: Eric Auger
  Cc: eric.auger.pro, peter.maydell, alex.williamson, qemu-arm,
	qemu-devel, wei, agraf, christoffer.dall, pranavkumar

On Sun, Jul 09, 2017 at 11:02:19PM +0200, Eric Auger wrote:
> From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> 
> Now we are able to retrieve the gsi from the INTx pin, let's
> enable intx_to_irq routing. From that point on, irqfd becomes
> usable along with INTx when assigning a PCIe device.
> 
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> ---
>  hw/pci-host/gpex.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
> index 0d42ac2..94cc3c1 100644
> --- a/hw/pci-host/gpex.c
> +++ b/hw/pci-host/gpex.c
> @@ -53,6 +53,17 @@ int gpex_set_irq_num(GPEXHost *s, int index, uint32_t gsi)
>      return 0;
>  }
>  
> +static PCIINTxRoute gpex_route_intx_pin_to_irq(void *opaque, int pin)
> +{
> +    PCIINTxRoute route;
> +    GPEXHost *s = opaque;
> +
> +    route.mode = PCI_INTX_ENABLED;
> +    route.irq = (int)s->irq_num[pin];
> +
> +    return route;
> +}
> +
>  static void gpex_host_realize(DeviceState *dev, Error **errp)
>  {
>      PCIHostState *pci = PCI_HOST_BRIDGE(dev);
> @@ -77,6 +88,7 @@ static void gpex_host_realize(DeviceState *dev, Error **errp)
>                                  &s->io_ioport, 0, 4, TYPE_PCIE_BUS);
>  
>      qdev_set_parent_bus(DEVICE(&s->gpex_root), BUS(pci->bus));
> +    pci_bus_set_route_irq_fn(pci->bus, gpex_route_intx_pin_to_irq);
>      qdev_init_nofail(DEVICE(&s->gpex_root));
>  }
>  
> -- 
> 2.5.5
> 
>

Wouldn't need the cast if irq_num was an array of ints, but otherwise
 
Reviewed-by: Andrew Jones <drjones@redhat.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-09-11 12:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-09 21:02 [Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for INTx routing Eric Auger
2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 1/3] hw/pci-host/gpex: Set INTx index/gsi mapping Eric Auger
2017-09-11 12:41   ` Andrew Jones
2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 2/3] hw/arm/virt: Set INTx/gsi mapping Eric Auger
2017-09-11 12:42   ` Andrew Jones
2017-07-09 21:02 ` [Qemu-devel] [PATCH RESEND v3 3/3] hw/pci-host/gpex: Implement PCI INTx routing Eric Auger
2017-09-11 12:52   ` Andrew Jones
2017-09-01  7:37 ` [Qemu-devel] [PATCH RESEND v3 0/3] Generic PCIe host bridge INTx determination for " Auger Eric
2017-09-01 14:45 ` Feng Kan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.