All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: kvm@vger.kernel.org, avi@redhat.com
Subject: Re: [PATCH corrected RFC] uio: add generic driver for PCI 2.3 devices
Date: Thu, 09 Jul 2009 09:54:43 -0500	[thread overview]
Message-ID: <4A5604B3.2090508@codemonkey.ws> (raw)
In-Reply-To: <20090709114834.GB26479@redhat.com>

Michael S. Tsirkin wrote:
> Resending with corrected addresses. Sorry about the churn.
>
> -----------
>
> I got annoyed by the fact that we don't support shared interrupts
> with PCI in assigned devides, so here's a draft patch to add that
> support in kernel through uio.
>
> I intend to send this to lkml, but meanwhile I'd appreciate some early
> feedback/flames from people on the list.
>
> Thanks!
>
>
> ----------->
>
> This adds a generic uio driver that can bind to any PCI device.  First
> user will be virtualization where a qemu userspace process needs to give
> guest OS access to the device.
>
> Interrupts are handled using the Interrupt Disable bit in the PCI command
> register and Interrupt Status bit in the PCI status register.  All devices
> compliant to PCI 2.3 (circa 2002) and all compliant PCI Express devices should
> support these bits.  Driver detects this support, and won't bind to devices
> which do not support the Interrupt Disable Bit in the command register.
>
> It's expected that MSI/MSI-X support will be added to this driver in the
> future, to interface with virtualization irqfd/eventfd infrastructure.
> Another area to examine, and of interest to virtualization, is iommu.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>   

I didn't know this was possible...  so we could also use this driver for 
vm-channel.

> +
> +	err = pci_request_regions(pdev, "uio_pci_generic");
> +	if (err) {
> +		dev_err(&pdev->dev, "%s: pci_request_regions failed: %d\n",
> +			 __func__, err);
> +		goto err_verify;
> +	}
> +
> +	dev = kzalloc(sizeof(struct generic_dev), GFP_KERNEL);
> +	if (!dev) {
> +		err = -ENOMEM;
> +		goto err_alloc;
> +	}
> +
> +	dev->info.name = "uio_pci_generic";
> +	dev->info.version = "0.01";
> +	dev->info.irq = pdev->irq;
> +	dev->info.irq_flags = IRQF_SHARED;
> +	dev->info.handler = irqhandler;
> +	dev->info.irqcontrol = irqcontrol;
> +	dev->pdev = pdev;
> +	spin_lock_init(&dev->lock)
>   

I know it's not strictly needed for PCI pass through, but it would be 
useful to register the IO regions via UIO.  The userspace implementation 
would then use UIO strictly instead of poking the sysfs pci info 
directly.  I think that ends up being cleaner.

Regards,

ANthony Liguori

  reply	other threads:[~2009-07-09 15:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09 11:48 [PATCH corrected RFC] uio: add generic driver for PCI 2.3 devices Michael S. Tsirkin
2009-07-09 14:54 ` Anthony Liguori [this message]
2009-07-09 18:12   ` Michael S. Tsirkin
2009-07-09 20:14     ` Anthony Liguori
2009-07-09 20:21       ` Michael S. Tsirkin
2009-07-10  2:22   ` Chris Wright
2009-07-12  6:17     ` Avi Kivity
2009-07-10  2:19 ` Chris Wright
2009-07-10 13:56   ` Michael S. Tsirkin
2009-07-09 18:13 Michael S. Tsirkin

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=4A5604B3.2090508@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    /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.