<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/vfio, branch v3.12.10</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/vfio?h=v3.12.10</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/vfio?h=v3.12.10'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2013-10-11T16:40:46Z</updated>
<entry>
<title>VFIO: vfio_iommu_type1: fix bug caused by break in nested loop</title>
<updated>2013-10-11T16:40:46Z</updated>
<author>
<name>Antonios Motakis</name>
<email>a.motakis@virtualopensystems.com</email>
</author>
<published>2013-10-11T16:40:46Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d93b3ac0edb85b1c1e8fe0a065c1e5045783e2f6'/>
<id>urn:sha1:d93b3ac0edb85b1c1e8fe0a065c1e5045783e2f6</id>
<content type='text'>
In vfio_iommu_type1.c there is a bug in vfio_dma_do_map, when checking
that pages are not already mapped. Since the check is being done in a
for loop nested within the main loop, breaking out of it does not create
the intended behavior. If the underlying IOMMU driver returns a non-NULL
value, this will be ignored and mapping the DMA range will be attempted
anyway, leading to unpredictable behavior.

This interracts badly with the ARM SMMU driver issue fixed in the patch
that was submitted with the title:
"[PATCH 2/2] ARM: SMMU: return NULL on error in arm_smmu_iova_to_phys"
Both fixes are required in order to use the vfio_iommu_type1 driver
with an ARM SMMU.

This patch refactors the function slightly, in order to also make this
kind of bug less likely.

Signed-off-by: Antonios Motakis &lt;a.motakis@virtualopensystems.com&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio-pci: PCI hot reset interface</title>
<updated>2013-09-04T17:28:04Z</updated>
<author>
<name>Alex Williamson</name>
<email>alex.williamson@redhat.com</email>
</author>
<published>2013-09-04T17:28:04Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=8b27ee60bfd6bbb84d2df28fa706c5c5081066ca'/>
<id>urn:sha1:8b27ee60bfd6bbb84d2df28fa706c5c5081066ca</id>
<content type='text'>
The current VFIO_DEVICE_RESET interface only maps to PCI use cases
where we can isolate the reset to the individual PCI function.  This
means the device must support FLR (PCIe or AF), PM reset on D3hot-&gt;D0
transition, device specific reset, or be a singleton device on a bus
for a secondary bus reset.  FLR does not have widespread support,
PM reset is not very reliable, and bus topology is dictated by the
system and device design.  We need to provide a means for a user to
induce a bus reset in cases where the existing mechanisms are not
available or not reliable.

This device specific extension to VFIO provides the user with this
ability.  Two new ioctls are introduced:
 - VFIO_DEVICE_PCI_GET_HOT_RESET_INFO
 - VFIO_DEVICE_PCI_HOT_RESET

The first provides the user with information about the extent of
devices affected by a hot reset.  This is essentially a list of
devices and the IOMMU groups they belong to.  The user may then
initiate a hot reset by calling the second ioctl.  We must be
careful that the user has ownership of all the affected devices
found via the first ioctl, so the second ioctl takes a list of file
descriptors for the VFIO groups affected by the reset.  Each group
must have IOMMU protection established for the ioctl to succeed.

Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio-pci: Test for extended config space</title>
<updated>2013-09-04T16:58:52Z</updated>
<author>
<name>Alex Williamson</name>
<email>alex.williamson@redhat.com</email>
</author>
<published>2013-09-04T16:58:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=17638db1b88184d8895f3f4551c936d7480a1d3f'/>
<id>urn:sha1:17638db1b88184d8895f3f4551c936d7480a1d3f</id>
<content type='text'>
Having PCIe/PCI-X capability isn't enough to assume that there are
extended capabilities.  Both specs define that the first capability
header is all zero if there are no extended capabilities.  Testing
for this avoids an erroneous message about hiding capability 0x0 at
offset 0x100.

Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio-pci: Use fdget() rather than eventfd_fget()</title>
<updated>2013-08-28T15:49:55Z</updated>
<author>
<name>Alex Williamson</name>
<email>alex.williamson@redhat.com</email>
</author>
<published>2013-08-28T15:49:55Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=20e77457842f4cd253d093f08f0cce1a73afb7db'/>
<id>urn:sha1:20e77457842f4cd253d093f08f0cce1a73afb7db</id>
<content type='text'>
eventfd_fget() tests to see whether the file is an eventfd file, which
we then immediately pass to eventfd_ctx_fileget(), which again tests
whether the file is an eventfd file.  Simplify slightly by using
fdget() so that we only test that we're looking at an eventfd once.
fget() could also be used, but fdget() makes use of fget_light() for
another slight optimization.

Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio: Add O_CLOEXEC flag to vfio device fd</title>
<updated>2013-08-22T16:33:41Z</updated>
<author>
<name>Alex Williamson</name>
<email>alex.williamson@redhat.com</email>
</author>
<published>2013-08-22T16:33:41Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5d042fbdbb2df46c9185942a0c6fe280906ba70c'/>
<id>urn:sha1:5d042fbdbb2df46c9185942a0c6fe280906ba70c</id>
<content type='text'>
Add the default O_CLOEXEC flag for device file descriptors.  This is
generally considered a safer option as it allows the user a race free
option to decide whether file descriptors are inherited across exec,
with the default avoiding file descriptor leaks.

Reported-by: Yann Droneaud &lt;ydroneaud@opteya.com&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio: use get_unused_fd_flags(0) instead of get_unused_fd()</title>
<updated>2013-08-22T16:20:05Z</updated>
<author>
<name>Yann Droneaud</name>
<email>ydroneaud@opteya.com</email>
</author>
<published>2013-08-22T16:20:05Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a5d550703d2c2f0f9fc5fd4a249efa8984dc9353'/>
<id>urn:sha1:a5d550703d2c2f0f9fc5fd4a249efa8984dc9353</id>
<content type='text'>
Macro get_unused_fd() is used to allocate a file descriptor with
default flags. Those default flags (0) can be "unsafe":
O_CLOEXEC must be used by default to not leak file descriptor
across exec().

Instead of macro get_unused_fd(), functions anon_inode_getfd()
or get_unused_fd_flags() should be used with flags given by userspace.
If not possible, flags should be set to O_CLOEXEC to provide userspace
with a default safe behavor.

In a further patch, get_unused_fd() will be removed so that
new code start using anon_inode_getfd() or get_unused_fd_flags()
with correct flags.

This patch replaces calls to get_unused_fd() with equivalent call to
get_unused_fd_flags(0) to preserve current behavor for existing code.

The hard coded flag value (0) should be reviewed on a per-subsystem basis,
and, if possible, set to O_CLOEXEC.

Signed-off-by: Yann Droneaud &lt;ydroneaud@opteya.com&gt;
Link: http://lkml.kernel.org/r/cover.1376327678.git.ydroneaud@opteya.com
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio: add external user support</title>
<updated>2013-08-05T16:52:36Z</updated>
<author>
<name>Alexey Kardashevskiy</name>
<email>aik@ozlabs.ru</email>
</author>
<published>2013-08-05T16:52:36Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6cdd97821322352b94bb92f271b4466ad38a2468'/>
<id>urn:sha1:6cdd97821322352b94bb92f271b4466ad38a2468</id>
<content type='text'>
VFIO is designed to be used via ioctls on file descriptors
returned by VFIO.

However in some situations support for an external user is required.
The first user is KVM on PPC64 (SPAPR TCE protocol) which is going to
use the existing VFIO groups for exclusive access in real/virtual mode
on a host to avoid passing map/unmap requests to the user space which
would made things pretty slow.

The protocol includes:

1. do normal VFIO init operation:
	- opening a new container;
	- attaching group(s) to it;
	- setting an IOMMU driver for a container.
When IOMMU is set for a container, all groups in it are
considered ready to use by an external user.

2. User space passes a group fd to an external user.
The external user calls vfio_group_get_external_user()
to verify that:
	- the group is initialized;
	- IOMMU is set for it.
If both checks passed, vfio_group_get_external_user()
increments the container user counter to prevent
the VFIO group from disposal before KVM exits.

3. The external user calls vfio_external_user_iommu_id()
to know an IOMMU ID. PPC64 KVM uses it to link logical bus
number (LIOBN) with IOMMU ID.

4. When the external KVM finishes, it calls
vfio_group_put_external_user() to release the VFIO group.
This call decrements the container user counter.
Everything gets released.

The "vfio: Limit group opens" patch is also required for the consistency.

Signed-off-by: Alexey Kardashevskiy &lt;aik@ozlabs.ru&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio-pci: Avoid deadlock on remove</title>
<updated>2013-07-24T22:36:41Z</updated>
<author>
<name>Alex Williamson</name>
<email>alex.williamson@redhat.com</email>
</author>
<published>2013-06-10T22:40:57Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d24cdbfd28b7e0ffecb1e281d73e73c03a57f734'/>
<id>urn:sha1:d24cdbfd28b7e0ffecb1e281d73e73c03a57f734</id>
<content type='text'>
If an attempt is made to unbind a device from vfio-pci while that
device is in use, the request is blocked until the device becomes
unused.  Unfortunately, that unbind path still grabs the device_lock,
which certain things like __pci_reset_function() also want to take.
This means we need to try to acquire the locks ourselves and use the
pre-locked version, __pci_reset_function_locked().

Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio: Ignore sprurious notifies</title>
<updated>2013-07-24T22:36:40Z</updated>
<author>
<name>Alex Williamson</name>
<email>alex.williamson@redhat.com</email>
</author>
<published>2013-06-10T22:40:56Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c64019302bbb0b445484d870e674ab34a19a18a1'/>
<id>urn:sha1:c64019302bbb0b445484d870e674ab34a19a18a1</id>
<content type='text'>
Remove debugging WARN_ON if we get a spurious notify for a group that
no longer exists.  No reports of anyone hitting this, but it would
likely be a race and not a bug if they did.

Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio: Don't overreact to DEL_DEVICE</title>
<updated>2013-07-24T22:36:00Z</updated>
<author>
<name>Alex Williamson</name>
<email>alex.williamson@redhat.com</email>
</author>
<published>2013-06-10T22:40:56Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=de9c7602ca25f52bbfeb52e7d85765fe70b92dce'/>
<id>urn:sha1:de9c7602ca25f52bbfeb52e7d85765fe70b92dce</id>
<content type='text'>
BUS_NOTIFY_DEL_DEVICE triggers IOMMU drivers to remove devices from
their iommu group, but there's really nothing we can do about it at
this point.  If the device is in use, then the vfio sub-driver will
block the device_del from completing until it's released.  If the
device is not in use or not owned by a vfio sub-driver, then we
really don't care that it's being removed.

The current code can be triggered just by unloading an sr-iov driver
(ex. igb) while the VFs are attached to vfio-pci because it makes an
incorrect assumption about the ordering of driver remove callbacks
vs the DEL_DEVICE notification.

Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
</feed>
