Subject: Re: [PATCH 2/4] ocxl: Access interrupt trigger page from xive directly

From: Greg Kurz <[email-masked]>
Date: Fri, 3 Apr 2020 11:17:33 +0200

On Thu,  2 Apr 2020 17:43:50 +0200
Frederic Barrat <[email-masked]> wrote:

> 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 <[email-masked]>
> ---

Reviewed-by: Greg Kurz <[email-masked]>

>  drivers/misc/ocxl/afu_irq.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/ocxl/afu_irq.c b/drivers/misc/ocxl/afu_irq.c
> index 70f8f1c3929d..b30ec0ef7be7 100644
> --- a/drivers/misc/ocxl/afu_irq.c
> +++ b/drivers/misc/ocxl/afu_irq.c
> @@ -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;
>  }