Skip to content

Commit dde6f18

Browse files
fbarratmpe
authored andcommitted
ocxl: Don't return trigger page when allocating an interrupt
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
1 parent ad857d4 commit dde6f18

5 files changed

Lines changed: 12 additions & 22 deletions

File tree

‎drivers/misc/ocxl/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ config OCXL_BASE
99

1010
config OCXL
1111
tristate "OpenCAPI coherent accelerator support"
12-
depends on PPC_POWERNV && PCI && EEH
12+
depends on PPC_POWERNV && PCI && EEH && PPC_XIVE_NATIVE
1313
select OCXL_BASE
1414
select HOTPLUG_PCI_POWERNV
1515
default m

‎drivers/misc/ocxl/afu_irq.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ struct afu_irq {
1111
int hw_irq;
1212
unsigned int virq;
1313
char *name;
14-
u64 trigger_page;
1514
irqreturn_t (*handler)(void *private);
1615
void (*free_private)(void *private);
1716
void *private;
@@ -125,8 +124,7 @@ int ocxl_afu_irq_alloc(struct ocxl_context *ctx, int *irq_id)
125124
goto err_unlock;
126125
}
127126

128-
rc = ocxl_link_irq_alloc(ctx->afu->fn->link, &irq->hw_irq,
129-
&irq->trigger_page);
127+
rc = ocxl_link_irq_alloc(ctx->afu->fn->link, &irq->hw_irq);
130128
if (rc)
131129
goto err_idr;
132130

‎drivers/misc/ocxl/link.c‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <linux/mmu_context.h>
77
#include <asm/copro.h>
88
#include <asm/pnv-ocxl.h>
9+
#include <asm/xive.h>
910
#include <misc/ocxl.h>
1011
#include "ocxl_internal.h"
1112
#include "trace.h"
@@ -682,23 +683,21 @@ int ocxl_link_remove_pe(void *link_handle, int pasid)
682683
}
683684
EXPORT_SYMBOL_GPL(ocxl_link_remove_pe);
684685

685-
int ocxl_link_irq_alloc(void *link_handle, int *hw_irq, u64 *trigger_addr)
686+
int ocxl_link_irq_alloc(void *link_handle, int *hw_irq)
686687
{
687688
struct ocxl_link *link = (struct ocxl_link *) link_handle;
688-
int rc, irq;
689-
u64 addr;
689+
int irq;
690690

691691
if (atomic_dec_if_positive(&link->irq_available) < 0)
692692
return -ENOSPC;
693693

694-
rc = pnv_ocxl_alloc_xive_irq(&irq, &addr);
695-
if (rc) {
694+
irq = xive_native_alloc_irq();
695+
if (!irq) {
696696
atomic_inc(&link->irq_available);
697-
return rc;
697+
return -ENXIO;
698698
}
699699

700700
*hw_irq = irq;
701-
*trigger_addr = addr;
702701
return 0;
703702
}
704703
EXPORT_SYMBOL_GPL(ocxl_link_irq_alloc);
@@ -707,7 +706,7 @@ void ocxl_link_free_irq(void *link_handle, int hw_irq)
707706
{
708707
struct ocxl_link *link = (struct ocxl_link *) link_handle;
709708

710-
pnv_ocxl_free_xive_irq(hw_irq);
709+
xive_native_free_irq(hw_irq);
711710
atomic_inc(&link->irq_available);
712711
}
713712
EXPORT_SYMBOL_GPL(ocxl_link_free_irq);

‎drivers/scsi/cxlflash/ocxl_hw.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,6 @@ static int alloc_afu_irqs(struct ocxlflash_context *ctx, int num)
614614
struct ocxl_hw_afu *afu = ctx->hw_afu;
615615
struct device *dev = afu->dev;
616616
struct ocxlflash_irqs *irqs;
617-
u64 addr;
618617
int rc = 0;
619618
int hwirq;
620619
int i;
@@ -639,7 +638,7 @@ static int alloc_afu_irqs(struct ocxlflash_context *ctx, int num)
639638
}
640639

641640
for (i = 0; i < num; i++) {
642-
rc = ocxl_link_irq_alloc(afu->link_token, &hwirq, &addr);
641+
rc = ocxl_link_irq_alloc(afu->link_token, &hwirq);
643642
if (unlikely(rc)) {
644643
dev_err(dev, "%s: ocxl_link_irq_alloc failed rc=%d\n",
645644
__func__, rc);

‎include/misc/ocxl.h‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,14 +460,8 @@ int ocxl_link_remove_pe(void *link_handle, int pasid);
460460
* Allocate an AFU interrupt associated to the link.
461461
*
462462
* 'hw_irq' is the hardware interrupt number
463-
* 'obj_handle' is the 64-bit object handle to be passed to the AFU to
464-
* trigger the interrupt.
465-
* On P9, 'obj_handle' is an address, which, if written, triggers the
466-
* interrupt. It is an MMIO address which needs to be remapped (one
467-
* page).
468-
*/
469-
int ocxl_link_irq_alloc(void *link_handle, int *hw_irq,
470-
u64 *obj_handle);
463+
*/
464+
int ocxl_link_irq_alloc(void *link_handle, int *hw_irq);
471465

472466
/*
473467
* Free a previously allocated AFU interrupt

0 commit comments

Comments
 (0)