[PATCH 1/4] scsi: cxlflash: Access interrupt trigger page from xive directly
Cédric Le Goater
clg at kaod.org
Fri Apr 3 22:19:29 AEDT 2020
On 4/3/20 1:19 AM, Matthew R. Ochs wrote:
> On Thu, Apr 02, 2020 at 05:43:49PM +0200, Frederic Barrat wrote:
>> xive is already mapping the trigger page in kernel space and it can be
>> accessed through standard APIs, so let's reuse it and simplify the code.
>>
>> Signed-off-by: Frederic Barrat <fbarrat at linux.ibm.com>
>> ---
>> drivers/scsi/cxlflash/ocxl_hw.c | 17 +++++++----------
>> drivers/scsi/cxlflash/ocxl_hw.h | 1 -
>> 2 files changed, 7 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c
>> index 7018cd802569..59452850f71c 100644
>> --- a/drivers/scsi/cxlflash/ocxl_hw.c
>> +++ b/drivers/scsi/cxlflash/ocxl_hw.c
>> @@ -15,7 +15,8 @@
>> #include <linux/pseudo_fs.h>
>> #include <linux/poll.h>
>> #include <linux/sched/signal.h>
>> -
>> +#include <linux/interrupt.h>
>> +#include <asm/xive.h>
>> #include <misc/ocxl.h>
>>
>> #include <uapi/misc/cxl.h>
>> @@ -180,7 +181,7 @@ static int afu_map_irq(u64 flags, struct ocxlflash_context *ctx, int num,
>> struct ocxl_hw_afu *afu = ctx->hw_afu;
>> struct device *dev = afu->dev;
>> struct ocxlflash_irqs *irq;
>> - void __iomem *vtrig;
>> + struct xive_irq_data *xd;
>> u32 virq;
>> int rc = 0;
>>
>> @@ -204,15 +205,14 @@ static int afu_map_irq(u64 flags, struct ocxlflash_context *ctx, int num,
>> goto err1;
>> }
>>
>> - vtrig = ioremap(irq->ptrig, PAGE_SIZE);
>> - if (unlikely(!vtrig)) {
>> - dev_err(dev, "%s: Trigger page mapping failed\n", __func__);
>> - rc = -ENOMEM;
>> + xd = irq_get_handler_data(virq);
>> + if (unlikely(!xd)) {
>> + dev_err(dev, "%s: Can't get interrupt data\n", __func__);
>
> The removal of setting the return code injects a bug should this error leg
> ever be encountered. So we should either keep the rc statement e.g. -EINVAL,
> -ENXIO, -ENODEV, etc., or remove this error leg. I lean towards keeping the
> statement.
I like ENXIO for XIVE matters.
C.
>> goto err2;
>> }
>>
>> irq->virq = virq;
>> - irq->vtrig = vtrig;
>> + irq->vtrig = xd->trig_mmio;
>> out:
>>
More information about the Linuxppc-dev
mailing list