diff mbox series

[22/25] spapr: add XIVE support to spapr_irq_get_qirq()

Message ID 20171123132955.1261-23-clg@kaod.org
State New
Headers show
Series spapr: Guest exploitation of the XIVE interrupt controller (POWER9) | expand

Commit Message

Cédric Le Goater Nov. 23, 2017, 1:29 p.m. UTC
The XIVE object has its own set of qirqs which is to be used when the
XIVE interrupt mode is activated.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/ppc/spapr.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

David Gibson Dec. 4, 2017, 7:52 a.m. UTC | #1
On Thu, Nov 23, 2017 at 02:29:52PM +0100, Cédric Le Goater wrote:
> The XIVE object has its own set of qirqs which is to be used when the
> XIVE interrupt mode is activated.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  hw/ppc/spapr.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 734706c18cb3..a91ec1c0751a 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -3746,8 +3746,12 @@ qemu_irq spapr_irq_get_qirq(sPAPRMachineState *spapr, int irq)
>  {
>      ICSState *ics = spapr->ics;
>  
> -    if (ics_valid_irq(ics, irq)) {
> -        return ics->qirqs[irq - ics->offset];
> +    if (spapr_ovec_test(spapr->ov5_cas, OV5_XIVE_EXPLOIT)) {
> +        return spapr->xive->qirqs[irq];

You should have a xive helper function for this - spapr code shouldn't
be reaching into the internal XIVE structure.

> +    } else {
> +        if (ics_valid_irq(ics, irq)) {
> +            return ics->qirqs[irq - ics->offset];
> +        }
>      }
>  
>      return NULL;
diff mbox series

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 734706c18cb3..a91ec1c0751a 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3746,8 +3746,12 @@  qemu_irq spapr_irq_get_qirq(sPAPRMachineState *spapr, int irq)
 {
     ICSState *ics = spapr->ics;
 
-    if (ics_valid_irq(ics, irq)) {
-        return ics->qirqs[irq - ics->offset];
+    if (spapr_ovec_test(spapr->ov5_cas, OV5_XIVE_EXPLOIT)) {
+        return spapr->xive->qirqs[irq];
+    } else {
+        if (ics_valid_irq(ics, irq)) {
+            return ics->qirqs[irq - ics->offset];
+        }
     }
 
     return NULL;