Re: [PATCH V2 05/13] powerpc/vas: Setup thread IRQ handler per VAS instance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 08, 2019 at 07:31:24PM -0800, Haren Myneni wrote:
> 
> Setup thread IRQ handler per each VAS instance. When NX sees a fault
> on CRB, kernel gets an interrupt and vas_fault_handler will be
> executed to process fault CRBs. Read all valid CRBs from fault FIFO,
> determine the corresponding send window from CRB and process fault
> requests.
> 
> Signed-off-by: Sukadev Bhattiprolu <sukadev@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Haren Myneni <haren@xxxxxxxxxx>
> ---
>  arch/powerpc/platforms/powernv/vas-fault.c  | 83 +++++++++++++++++++++++++++++
>  arch/powerpc/platforms/powernv/vas-window.c | 60 +++++++++++++++++++++
>  arch/powerpc/platforms/powernv/vas.c        | 15 +++++-
>  arch/powerpc/platforms/powernv/vas.h        |  4 ++
>  4 files changed, 161 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/vas-fault.c b/arch/powerpc/platforms/powernv/vas-fault.c
> index b0258ed..e1e34c6 100644
> --- a/arch/powerpc/platforms/powernv/vas-fault.c
> +++ b/arch/powerpc/platforms/powernv/vas-fault.c
> @@ -11,6 +11,7 @@
>  #include <linux/slab.h>
>  #include <linux/uaccess.h>
>  #include <linux/kthread.h>
> +#include <linux/mmu_context.h>
>  #include <asm/icswx.h>
>  
>  #include "vas.h"
> @@ -25,6 +26,88 @@
>  #define VAS_FAULT_WIN_FIFO_SIZE	(4 << 20)
>  
>  /*
> + * Process CRBs that we receive on the fault window.
> + */
> +irqreturn_t vas_fault_handler(int irq, void *data)
> +{
> +	struct vas_instance *vinst = (struct vas_instance *)data;

No need for the cast.

> +		crb = (struct coprocessor_request_block *)fifo;

Or this one.

> +		if (vinst->fault_crbs == vinst->fault_fifo_size/CRB_SIZE)

Missing whitespace before and after the /

> +	rc = request_threaded_irq(vinst->virq, NULL, vas_fault_handler,
> +					IRQF_ONESHOT, devname, vinst);
> +	if (rc) {
> +		pr_err("VAS[%d]: Request IRQ(%d) failed with %d\n",
> +				vinst->vas_id, vinst->virq, rc);
> +	} else {
> +		rc = vas_setup_fault_window(vinst);
> +		if (rc)
> +			free_irq(vinst->virq, vinst);
> +	}
>  
>  	return rc;

This would be a tad cleaner with proper goto unwinding:

	rc = request_threaded_irq(vinst->virq, NULL, vas_fault_handler,
					IRQF_ONESHOT, devname, vinst);
	if (rc) {
		pr_err("VAS[%d]: Request IRQ(%d) failed with %d\n",
				vinst->vas_id, vinst->virq, rc);
		goto out;
	}
	rc = vas_setup_fault_window(vinst);
	if (rc)
		goto out_free_irq;
	return 0;
out_free_irq:
	free_irq(vinst->virq, vinst);
out:
 	return rc;



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux