ocxl: Access interrupt trigger page from xive directly
authorFrederic Barrat <fbarrat@linux.ibm.com>
Fri, 3 Apr 2020 15:38:36 +0000 (17:38 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 24 Aug 2020 15:31:31 +0000 (01:31 +1000)
We can access the trigger page through standard APIs so let's use it
and avoid saving it when allocating the interrupt. It will also allow
to simplify allocation in a later patch.

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200403153838.29224-3-fbarrat@linux.ibm.com
drivers/misc/ocxl/afu_irq.c

index 70f8f1c..b30ec0e 100644 (file)
@@ -2,6 +2,7 @@
 // Copyright 2017 IBM Corp.
 #include <linux/interrupt.h>
 #include <asm/pnv-ocxl.h>
+#include <asm/xive.h>
 #include "ocxl_internal.h"
 #include "trace.h"
 
@@ -196,13 +197,16 @@ void ocxl_afu_irq_free_all(struct ocxl_context *ctx)
 
 u64 ocxl_afu_irq_get_addr(struct ocxl_context *ctx, int irq_id)
 {
+       struct xive_irq_data *xd;
        struct afu_irq *irq;
        u64 addr = 0;
 
        mutex_lock(&ctx->irq_lock);
        irq = idr_find(&ctx->irq_idr, irq_id);
-       if (irq)
-               addr = irq->trigger_page;
+       if (irq) {
+               xd = irq_get_handler_data(irq->virq);
+               addr = xd ? xd->trig_page : 0;
+       }
        mutex_unlock(&ctx->irq_lock);
        return addr;
 }