Subject: Re: [PATCH 4/7] vDPA/ifcvf: implement shared irq handlers for vqs

From: "Michael S. Tsirkin" <[email-masked]>
Date: Mon, 10 Jan 2022 01:10:04 -0500

On Mon, Jan 10, 2022 at 01:18:48PM +0800, Zhu Lingshan wrote:
> It has observed that a device may fail to alloc enough vectors on
> some platforms, e.g., requires 16 vectors, but only 2 or 4 vector
> slots allocated. The virt queues have to share a vector/irq under
> such circumstances.
> 
> This irq handlers has to kick every queue because it is not
> possible to tell which queue triggers the interrupt.
> 
> Signed-off-by: Zhu Lingshan <[email-masked]>
> ---
>  drivers/vdpa/ifcvf/ifcvf_main.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> index 64fc78eaa1a9..19e1d1cd71a3 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -37,6 +37,21 @@ static irqreturn_t ifcvf_intr_handler(int irq, void *arg)
>  	return IRQ_HANDLED;
>  }
>  
> +static irqreturn_t ifcvf_shared_intr_handler(int irq, void *arg)
> +{
> +	struct ifcvf_hw *vf = arg;
> +	struct vring_info *vring;
> +	int i;
> +
> +	for (i = 0; i < vf->nr_vring; i++) {
> +		vring = &vf->vring[i];
> +		if (vring->cb.callback)
> +			vf->vring->cb.callback(vring->cb.private);
> +	}
> +
> +	return IRQ_HANDLED;
> +}
> +
>  static void ifcvf_free_irq_vectors(void *data)
>  {
>  	pci_free_irq_vectors(data);

A static function with no caller. surprised gcc does not warn.

> -- 
> 2.27.0