All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] Generic PCIe host bridge legacy interrupts routing support
@ 2015-04-17  8:55 Pranavkumar Sawargaonkar
  2015-04-17  8:55 ` [Qemu-devel] [PATCH 1/2] hw: irq: Add API to get irq number from qemu_irq Pranavkumar Sawargaonkar
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Pranavkumar Sawargaonkar @ 2015-04-17  8:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, patches, agraf, pbonzini, christoffer.dall,
	Pranavkumar Sawargaonkar

This patch adds:
- Function to determine an irq number from qemu_irq.
- Function to determine and route legacy interrupts to a VM.


Pranavkumar Sawargaonkar (2):
  hw: irq: Add API to get irq number from qemu_irq
  pci: GPEX: Add support to route legacy interrupts

 hw/core/irq.c      |  9 +++++++++
 hw/pci-host/gpex.c | 12 ++++++++++++
 include/hw/irq.h   |  1 +
 3 files changed, 22 insertions(+)

-- 
1.9.1

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

* [Qemu-devel] [PATCH 1/2] hw: irq: Add API to get irq number from qemu_irq
  2015-04-17  8:55 [Qemu-devel] [PATCH 0/2] Generic PCIe host bridge legacy interrupts routing support Pranavkumar Sawargaonkar
@ 2015-04-17  8:55 ` Pranavkumar Sawargaonkar
  2015-04-17  8:55 ` [Qemu-devel] [PATCH 2/2] pci: GPEX: Add support to route legacy interrupts Pranavkumar Sawargaonkar
  2015-04-17  9:53 ` [Qemu-devel] [PATCH 0/2] Generic PCIe host bridge legacy interrupts routing support Peter Maydell
  2 siblings, 0 replies; 6+ messages in thread
From: Pranavkumar Sawargaonkar @ 2015-04-17  8:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, patches, agraf, Tushar Jagad, pbonzini,
	christoffer.dall, Pranavkumar Sawargaonkar

This patch adds a new function to get irq number from qemu irq.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
---
 hw/core/irq.c    | 9 +++++++++
 include/hw/irq.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/hw/core/irq.c b/hw/core/irq.c
index 8a62a36..0eeffdf 100644
--- a/hw/core/irq.c
+++ b/hw/core/irq.c
@@ -35,6 +35,15 @@ struct IRQState {
     int n;
 };
 
+int qemu_get_irq_num(qemu_irq irq)
+{
+    if (!irq) {
+        return -1;
+    }
+
+    return irq->n;
+}
+
 void qemu_set_irq(qemu_irq irq, int level)
 {
     if (!irq)
diff --git a/include/hw/irq.h b/include/hw/irq.h
index 4c4c2ea..dd5220c 100644
--- a/include/hw/irq.h
+++ b/include/hw/irq.h
@@ -9,6 +9,7 @@ typedef struct IRQState *qemu_irq;
 
 typedef void (*qemu_irq_handler)(void *opaque, int n, int level);
 
+int qemu_get_irq_num(qemu_irq irq);
 void qemu_set_irq(qemu_irq irq, int level);
 
 static inline void qemu_irq_raise(qemu_irq irq)
-- 
1.9.1

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

* [Qemu-devel] [PATCH 2/2] pci: GPEX: Add support to route legacy interrupts
  2015-04-17  8:55 [Qemu-devel] [PATCH 0/2] Generic PCIe host bridge legacy interrupts routing support Pranavkumar Sawargaonkar
  2015-04-17  8:55 ` [Qemu-devel] [PATCH 1/2] hw: irq: Add API to get irq number from qemu_irq Pranavkumar Sawargaonkar
@ 2015-04-17  8:55 ` Pranavkumar Sawargaonkar
  2015-04-21 19:32   ` Alexander Graf
  2015-04-17  9:53 ` [Qemu-devel] [PATCH 0/2] Generic PCIe host bridge legacy interrupts routing support Peter Maydell
  2 siblings, 1 reply; 6+ messages in thread
From: Pranavkumar Sawargaonkar @ 2015-04-17  8:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, patches, agraf, Tushar Jagad, pbonzini,
	christoffer.dall, Pranavkumar Sawargaonkar

This patch adds routine to route legacy interrupts to VM.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
---
 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 9d8fb5a..35842e4 100644
--- a/hw/pci-host/gpex.c
+++ b/hw/pci-host/gpex.c
@@ -42,6 +42,17 @@ static void gpex_set_irq(void *opaque, int irq_num, int level)
     qemu_set_irq(s->irq[irq_num], level);
 }
 
+static PCIINTxRoute gpex_route_intx_pin_to_irq(void *opaque, int pin)
+{
+    PCIINTxRoute route;
+    GPEXHost *s = opaque;
+
+    route.mode = PCI_INTX_ENABLED;
+    route.irq = qemu_get_irq_num(s->irq[pin]);
+
+    return route;
+}
+
 static void gpex_host_realize(DeviceState *dev, Error **errp)
 {
     PCIHostState *pci = PCI_HOST_BRIDGE(dev);
@@ -66,6 +77,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));
 }
 
-- 
1.9.1

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

* Re: [Qemu-devel] [PATCH 0/2] Generic PCIe host bridge legacy interrupts routing support
  2015-04-17  8:55 [Qemu-devel] [PATCH 0/2] Generic PCIe host bridge legacy interrupts routing support Pranavkumar Sawargaonkar
  2015-04-17  8:55 ` [Qemu-devel] [PATCH 1/2] hw: irq: Add API to get irq number from qemu_irq Pranavkumar Sawargaonkar
  2015-04-17  8:55 ` [Qemu-devel] [PATCH 2/2] pci: GPEX: Add support to route legacy interrupts Pranavkumar Sawargaonkar
@ 2015-04-17  9:53 ` Peter Maydell
  2015-04-17 10:30   ` Pranavkumar Sawargaonkar
  2 siblings, 1 reply; 6+ messages in thread
From: Peter Maydell @ 2015-04-17  9:53 UTC (permalink / raw)
  To: Pranavkumar Sawargaonkar
  Cc: Paolo Bonzini, patches, QEMU Developers, Christoffer Dall,
	Alexander Graf

On 17 April 2015 at 09:55, Pranavkumar Sawargaonkar
<pranavkumar@linaro.org> wrote:
> This patch adds:
> - Function to determine an irq number from qemu_irq.
> - Function to determine and route legacy interrupts to a VM.

Can you describe in more detail what this patch series
is supposed to do, please? Interrupt routing already
works fine, via the interrupt controller...

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH 0/2] Generic PCIe host bridge legacy interrupts routing support
  2015-04-17  9:53 ` [Qemu-devel] [PATCH 0/2] Generic PCIe host bridge legacy interrupts routing support Peter Maydell
@ 2015-04-17 10:30   ` Pranavkumar Sawargaonkar
  0 siblings, 0 replies; 6+ messages in thread
From: Pranavkumar Sawargaonkar @ 2015-04-17 10:30 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Paolo Bonzini, patches, QEMU Developers, Christoffer Dall,
	Alexander Graf

Hi PMM,

On 17 April 2015 at 15:23, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 17 April 2015 at 09:55, Pranavkumar Sawargaonkar
> <pranavkumar@linaro.org> wrote:
>> This patch adds:
>> - Function to determine an irq number from qemu_irq.
>> - Function to determine and route legacy interrupts to a VM.
>
> Can you describe in more detail what this patch series
> is supposed to do, please? Interrupt routing already
> works fine, via the interrupt controller...

GPEX driver is not registering a callback to route INTx and
pci_device_route_intx_to_irq() throws a following warning
"PCI: Bug - unimplemented PCI INTx routing".
It also returns -1 as an interrupt number as well as marking it as a
disabled one.
Hence to complete the GPEX driver in terms of INTx routing I have
added this patch but at the same time routing works without this
patchset :) .

>
> thanks
> -- PMM

Thanks,
Pranav

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

* Re: [Qemu-devel] [PATCH 2/2] pci: GPEX: Add support to route legacy interrupts
  2015-04-17  8:55 ` [Qemu-devel] [PATCH 2/2] pci: GPEX: Add support to route legacy interrupts Pranavkumar Sawargaonkar
@ 2015-04-21 19:32   ` Alexander Graf
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Graf @ 2015-04-21 19:32 UTC (permalink / raw)
  To: Pranavkumar Sawargaonkar, qemu-devel
  Cc: peter.maydell, patches, Tushar Jagad, christoffer.dall, pbonzini

On 04/17/2015 10:55 AM, Pranavkumar Sawargaonkar wrote:
> This patch adds routine to route legacy interrupts to VM.
>
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>

I don't think the device model should have awareness of any global irq 
number spaces. Can you move this into the board model instead? Then you 
also don't need the first patch.


Alex

> ---
>   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 9d8fb5a..35842e4 100644
> --- a/hw/pci-host/gpex.c
> +++ b/hw/pci-host/gpex.c
> @@ -42,6 +42,17 @@ static void gpex_set_irq(void *opaque, int irq_num, int level)
>       qemu_set_irq(s->irq[irq_num], level);
>   }
>   
> +static PCIINTxRoute gpex_route_intx_pin_to_irq(void *opaque, int pin)
> +{
> +    PCIINTxRoute route;
> +    GPEXHost *s = opaque;
> +
> +    route.mode = PCI_INTX_ENABLED;
> +    route.irq = qemu_get_irq_num(s->irq[pin]);
> +
> +    return route;
> +}
> +
>   static void gpex_host_realize(DeviceState *dev, Error **errp)
>   {
>       PCIHostState *pci = PCI_HOST_BRIDGE(dev);
> @@ -66,6 +77,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));
>   }
>   

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

end of thread, other threads:[~2015-04-21 19:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-17  8:55 [Qemu-devel] [PATCH 0/2] Generic PCIe host bridge legacy interrupts routing support Pranavkumar Sawargaonkar
2015-04-17  8:55 ` [Qemu-devel] [PATCH 1/2] hw: irq: Add API to get irq number from qemu_irq Pranavkumar Sawargaonkar
2015-04-17  8:55 ` [Qemu-devel] [PATCH 2/2] pci: GPEX: Add support to route legacy interrupts Pranavkumar Sawargaonkar
2015-04-21 19:32   ` Alexander Graf
2015-04-17  9:53 ` [Qemu-devel] [PATCH 0/2] Generic PCIe host bridge legacy interrupts routing support Peter Maydell
2015-04-17 10:30   ` Pranavkumar Sawargaonkar

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.