ocxl: Don't return trigger page when allocating an interrupt
authorFrederic Barrat <fbarrat@linux.ibm.com>
Fri, 3 Apr 2020 15:38:37 +0000 (17:38 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 24 Aug 2020 15:31:31 +0000 (01:31 +1000)
Existing users of ocxl_link_irq_alloc() have been converted to obtain
the trigger page of an interrupt through xive directly, we therefore
have no need to return the trigger page when allocating an interrupt.

It also allows ocxl to use the xive native interface to allocate
interrupts, instead of its custom service.

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-4-fbarrat@linux.ibm.com
drivers/misc/ocxl/Kconfig
drivers/misc/ocxl/afu_irq.c
drivers/misc/ocxl/link.c
drivers/scsi/cxlflash/ocxl_hw.c
include/misc/ocxl.h

index 6551007a066ce62120143663d3b11969ec56df94..0d815b2a40b332c65997aa04c7efbe90c724db86 100644 (file)
@@ -9,7 +9,7 @@ config OCXL_BASE
 
 config OCXL
        tristate "OpenCAPI coherent accelerator support"
-       depends on PPC_POWERNV && PCI && EEH
+       depends on PPC_POWERNV && PCI && EEH && PPC_XIVE_NATIVE
        select OCXL_BASE
        select HOTPLUG_PCI_POWERNV
        default m
index b30ec0ef7be78669d74246b9af4ec94b38073c8c..ecdcfae025b7b35995e42ba6335dc1a9f0076ef3 100644 (file)
@@ -11,7 +11,6 @@ struct afu_irq {
        int hw_irq;
        unsigned int virq;
        char *name;
-       u64 trigger_page;
        irqreturn_t (*handler)(void *private);
        void (*free_private)(void *private);
        void *private;
@@ -125,8 +124,7 @@ int ocxl_afu_irq_alloc(struct ocxl_context *ctx, int *irq_id)
                goto err_unlock;
        }
 
-       rc = ocxl_link_irq_alloc(ctx->afu->fn->link, &irq->hw_irq,
-                               &irq->trigger_page);
+       rc = ocxl_link_irq_alloc(ctx->afu->fn->link, &irq->hw_irq);
        if (rc)
                goto err_idr;
 
index 58d111afd9f6ab5217812334ae2da26c4dc01b16..fd73d3bc0eb6c272b5f1bcfa2c6573ac679f2d20 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/mmu_context.h>
 #include <asm/copro.h>
 #include <asm/pnv-ocxl.h>
+#include <asm/xive.h>
 #include <misc/ocxl.h>
 #include "ocxl_internal.h"
 #include "trace.h"
@@ -682,23 +683,21 @@ unlock:
 }
 EXPORT_SYMBOL_GPL(ocxl_link_remove_pe);
 
-int ocxl_link_irq_alloc(void *link_handle, int *hw_irq, u64 *trigger_addr)
+int ocxl_link_irq_alloc(void *link_handle, int *hw_irq)
 {
        struct ocxl_link *link = (struct ocxl_link *) link_handle;
-       int rc, irq;
-       u64 addr;
+       int irq;
 
        if (atomic_dec_if_positive(&link->irq_available) < 0)
                return -ENOSPC;
 
-       rc = pnv_ocxl_alloc_xive_irq(&irq, &addr);
-       if (rc) {
+       irq = xive_native_alloc_irq();
+       if (!irq) {
                atomic_inc(&link->irq_available);
-               return rc;
+               return -ENXIO;
        }
 
        *hw_irq = irq;
-       *trigger_addr = addr;
        return 0;
 }
 EXPORT_SYMBOL_GPL(ocxl_link_irq_alloc);
@@ -707,7 +706,7 @@ void ocxl_link_free_irq(void *link_handle, int hw_irq)
 {
        struct ocxl_link *link = (struct ocxl_link *) link_handle;
 
-       pnv_ocxl_free_xive_irq(hw_irq);
+       xive_native_free_irq(hw_irq);
        atomic_inc(&link->irq_available);
 }
 EXPORT_SYMBOL_GPL(ocxl_link_free_irq);
index d6eec434a60704b0612b79182c65c9739311c905..e4e0d767b98e3a3124c4cf5d4395f66cb41524a8 100644 (file)
@@ -614,7 +614,6 @@ static int alloc_afu_irqs(struct ocxlflash_context *ctx, int num)
        struct ocxl_hw_afu *afu = ctx->hw_afu;
        struct device *dev = afu->dev;
        struct ocxlflash_irqs *irqs;
-       u64 addr;
        int rc = 0;
        int hwirq;
        int i;
@@ -639,7 +638,7 @@ static int alloc_afu_irqs(struct ocxlflash_context *ctx, int num)
        }
 
        for (i = 0; i < num; i++) {
-               rc = ocxl_link_irq_alloc(afu->link_token, &hwirq, &addr);
+               rc = ocxl_link_irq_alloc(afu->link_token, &hwirq);
                if (unlikely(rc)) {
                        dev_err(dev, "%s: ocxl_link_irq_alloc failed rc=%d\n",
                                __func__, rc);
index 357ef1aadbc002f750d470d10d8792298f53d0bb..e013736e275d0fd381d00a88d124861deff529c1 100644 (file)
@@ -460,14 +460,8 @@ int ocxl_link_remove_pe(void *link_handle, int pasid);
  * Allocate an AFU interrupt associated to the link.
  *
  * 'hw_irq' is the hardware interrupt number
- * 'obj_handle' is the 64-bit object handle to be passed to the AFU to
- * trigger the interrupt.
- * On P9, 'obj_handle' is an address, which, if written, triggers the
- * interrupt. It is an MMIO address which needs to be remapped (one
- * page).
- */
-int ocxl_link_irq_alloc(void *link_handle, int *hw_irq,
-                       u64 *obj_handle);
+ */
+int ocxl_link_irq_alloc(void *link_handle, int *hw_irq);
 
 /*
  * Free a previously allocated AFU interrupt