All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jim Harris <james.r.harris@intel.com>
Cc: kvm@vger.kernel.org, gregkh@linuxfoundation.org,
	linux@vger.kernel.org, keith.busch@intel.com,
	jonathan.derrick@intel.com
Subject: Re: [PATCH] uio/uio_pci_generic: don't fail probe if pdev->irq == NULL
Date: Mon, 1 May 2017 04:17:28 +0300	[thread overview]
Message-ID: <20170501041652-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20170430192955.9098-1-james.r.harris@intel.com>

On Sun, Apr 30, 2017 at 12:29:55PM -0700, Jim Harris wrote:
> Some userspace drivers and frameworks only poll and do not
> require interrupts to be available and enabled on the
> PCI device.  So remove the requirement that an IRQ is
> assigned.  If an IRQ is not assigned and a userspace
> driver tries to read()/write(), the generic uio
> framework will just return -EIO.
> 
> This allows binding uio_pci_generic to devices which
> cannot get an IRQ assigned, such as an NVMe controller
> behind Intel Volume Management Device (VMD), since VMD
> does not support INTx interrupts.
> 
> Signed-off-by: Jim Harris <james.r.harris@intel.com>

Without interrupts, why do you want uio? All it does is
forward interrupts to userspace.

> ---
>  drivers/uio/uio_pci_generic.c | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c
> index d0b508b68f3c..81c59b4f8552 100644
> --- a/drivers/uio/uio_pci_generic.c
> +++ b/drivers/uio/uio_pci_generic.c
> @@ -66,14 +66,7 @@ static int probe(struct pci_dev *pdev,
>  		return err;
>  	}
>  
> -	if (!pdev->irq) {
> -		dev_warn(&pdev->dev, "No IRQ assigned to device: "
> -			 "no support for interrupts?\n");
> -		pci_disable_device(pdev);
> -		return -ENODEV;
> -	}
> -
> -	if (!pci_intx_mask_supported(pdev)) {
> +	if (pci->irq && !pci_intx_mask_supported(pdev)) {
>  		err = -ENODEV;
>  		goto err_verify;
>  	}
> @@ -86,10 +79,15 @@ static int probe(struct pci_dev *pdev,
>  
>  	gdev->info.name = "uio_pci_generic";
>  	gdev->info.version = DRIVER_VERSION;
> -	gdev->info.irq = pdev->irq;
> -	gdev->info.irq_flags = IRQF_SHARED;
> -	gdev->info.handler = irqhandler;
>  	gdev->pdev = pdev;
> +	if (pdev->irq) {
> +		gdev->info.irq = pdev->irq;
> +		gdev->info.irq_flags = IRQF_SHARED;
> +		gdev->info.handler = irqhandler;
> +	} else {
> +		dev_warn(&pdev->dev, "No IRQ assigned to device: "
> +			 "no support for interrupts?\n");
> +	}
>  
>  	err = uio_register_device(&pdev->dev, &gdev->info);
>  	if (err)
> -- 
> 2.12.2

  reply	other threads:[~2017-05-01  1:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-30 19:29 [PATCH] uio/uio_pci_generic: don't fail probe if pdev->irq == NULL Jim Harris
2017-05-01  1:17 ` Michael S. Tsirkin [this message]
2017-05-01 21:21   ` Harris, James R
2017-05-02  9:20 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170501041652-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=james.r.harris@intel.com \
    --cc=jonathan.derrick@intel.com \
    --cc=keith.busch@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.