Re: [PATCH V3] VFIO driver: Non-privileged user level PCI drivers

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alex Williamson
Date: Sunday, July 18, 2010 - 9:56 pm

Hi Tom, Michael,

Comments for both of you below.  Tom, what does this build against?  Are
we still on 2.6.34?

On Sun, 2010-07-18 at 12:39 +0300, Michael S. Tsirkin wrote:

Is there a better default for this example?  Linux has already figured
out what the vendor and device IDs are for the VF, why burden every
userspace caller to go figure out what's in pcisysfs and do the same
trick?  If userspace wants to expose something different, they're free
to trap these config offsets and return whatever they please.  If
userspace wants direct access, they can use pcisysfs.


A reset ioctl may make sense, but what would we lose if we simply
trapped the flr write in vfio and issued a device reset?


This seems like a hole to me too.  I haven't looked in the spec for this
issue, but an 82576 VF doesn't have working mem/io bits, so I end up
falling back to qemu for the command register.


I believe the code doesn't allow access outside of known config space or
capabilities.  It does seem like we could simply skip unknown caps
though, but that would require virtualizing the capability next pointer,
which isn't very amenable to how virtualized reads are currently done.
We'd need something more like how qemu virtualizes config space for
that.


Seems like we'd need to reach some agreement that this should look a lot
more like pci-sysfs config access first, no?


Tom, there's a kernel memory leak here.  val always needs to be
initialized if we're going to stuff it back in the user buffer.


I just submitted a patch to be able to do read/write to ioport
resources, but I still think these serve a different purpose.  PCI sysfs
config and resource files don't have the same tie in to DMA mapping as
vfio does, so they'll happily let you setup the device without the added
security of an iommu.  We have to trust that the user is going to be
safe and use the iommu.  I believe vfio is trying to create a safe
interface that provides iommu enforcement and simple config space
virtualization, so does need to reimplement a few things that we may be
able to get unsafely through pci-sysfs.


Aren't BAR number and resource number synonymous?  I would have assumed
that if BAR0 is 64bit, pci_resource_len(, BAR1) is zero, which should
work just fine for the way it's coded up here.




--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH V3] VFIO driver: Non-privileged user level PCI ..., Piotr Jaroszyński, (Sat Jul 17, 1:45 am)
Re: [PATCH V3] VFIO driver: Non-privileged user level PCI ..., Michael S. Tsirkin, (Sun Jul 18, 2:39 am)
Re: [PATCH V3] VFIO driver: Non-privileged user level PCI ..., Alex Williamson, (Sun Jul 18, 9:56 pm)
Re: [PATCH V3] VFIO driver: Non-privileged user level PCI ..., Michael S. Tsirkin, (Mon Jul 19, 3:06 am)
Re: [PATCH V3] VFIO driver: Non-privileged user level PCI ..., Michael S. Tsirkin, (Tue Jul 27, 4:53 pm)
Re: [PATCH V3] VFIO driver: Non-privileged user level PCI ..., Michael S. Tsirkin, (Wed Jul 28, 2:46 pm)
Re: [PATCH V3] VFIO driver: Non-privileged user level PCI ..., Michael S. Tsirkin, (Wed Jul 28, 2:57 pm)
Re: [PATCH V3] VFIO driver: Non-privileged user level PCI ..., Michael S. Tsirkin, (Thu Jul 29, 7:27 am)