<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/vfio, branch v4.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.9</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-10-26T19:49:29Z</updated>
<entry>
<title>vfio/pci: Fix integer overflows, bitmask check</title>
<updated>2016-10-26T19:49:29Z</updated>
<author>
<name>Vlad Tsyrklevich</name>
<email>vlad@tsyrklevich.net</email>
</author>
<published>2016-10-12T16:51:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=05692d7005a364add85c6e25a6c4447ce08f913a'/>
<id>urn:sha1:05692d7005a364add85c6e25a6c4447ce08f913a</id>
<content type='text'>
The VFIO_DEVICE_SET_IRQS ioctl did not sufficiently sanitize
user-supplied integers, potentially allowing memory corruption. This
patch adds appropriate integer overflow checks, checks the range bounds
for VFIO_IRQ_SET_DATA_NONE, and also verifies that only single element
in the VFIO_IRQ_SET_DATA_TYPE_MASK bitmask is set.
VFIO_IRQ_SET_ACTION_TYPE_MASK is already correctly checked later in
vfio_pci_set_irqs_ioctl().

Furthermore, a kzalloc is changed to a kcalloc because the use of a
kzalloc with an integer multiplication allowed an integer overflow
condition to be reached without this patch. kcalloc checks for overflow
and should prevent a similar occurrence.

Signed-off-by: Vlad Tsyrklevich &lt;vlad@tsyrklevich.net&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio_pci: use pci_alloc_irq_vectors</title>
<updated>2016-09-29T19:36:38Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2016-09-11T13:31:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=61771468e0a567f007fc450725063bb9cf7eb199'/>
<id>urn:sha1:61771468e0a567f007fc450725063bb9cf7eb199</id>
<content type='text'>
Simplify the interrupt setup by using the new PCI layer helpers.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio-pci: Disable INTx after MSI/X teardown</title>
<updated>2016-09-26T19:52:19Z</updated>
<author>
<name>Alex Williamson</name>
<email>alex.williamson@redhat.com</email>
</author>
<published>2016-09-26T19:52:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c93a97ee0583cd65adaf872e7cc402493eae92a7'/>
<id>urn:sha1:c93a97ee0583cd65adaf872e7cc402493eae92a7</id>
<content type='text'>
The MSI/X shutdown path can gratuitously enable INTx, which is not
something we want to happen if we're dealing with broken INTx device.

Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio-pci: Virtualize PCIe &amp; AF FLR</title>
<updated>2016-09-26T19:52:16Z</updated>
<author>
<name>Alex Williamson</name>
<email>alex.williamson@redhat.com</email>
</author>
<published>2016-09-26T19:52:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ddf9dc0eb5314d6dac8b19b1cc37c739c6896e7e'/>
<id>urn:sha1:ddf9dc0eb5314d6dac8b19b1cc37c739c6896e7e</id>
<content type='text'>
We use a BAR restore trick to try to detect when a user has performed
a device reset, possibly through FLR or other backdoors, to put things
back into a working state.  This is important for backdoor resets, but
we can actually just virtualize the "front door" resets provided via
PCIe and AF FLR.  Set these bits as virtualized + writable, allowing
the default write to set them in vconfig, then we can simply check the
bit, perform an FLR of our own, and clear the bit.  We don't actually
have the granularity in PCI to specify the type of reset we want to
do, but generally devices don't implement both PCIe and AF FLR and
we'll favor these over other types of reset, so we should generally
lineup.  We do test whether the device provides the requested FLR type
to stay consistent with hardware capabilities though.

This seems to fix several instance of devices getting into bad states
with userspace drivers, like dpdk, running inside a VM.

Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
Reviewed-by: Greg Rose &lt;grose@lightfleet.com&gt;
</content>
</entry>
<entry>
<title>vfio: platform: mark symbols static where possible</title>
<updated>2016-09-13T22:11:37Z</updated>
<author>
<name>Baoyou Xie</name>
<email>baoyou.xie@linaro.org</email>
</author>
<published>2016-09-01T11:15:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2e06285655b59362847b610a7cfad204fee9640b'/>
<id>urn:sha1:2e06285655b59362847b610a7cfad204fee9640b</id>
<content type='text'>
We get a few warnings when building kernel with W=1:
drivers/vfio/platform/vfio_platform_common.c:76:5: warning: no previous prototype for 'vfio_platform_acpi_call_reset' [-Wmissing-prototypes]
drivers/vfio/platform/vfio_platform_common.c:98:6: warning: no previous prototype for 'vfio_platform_acpi_has_reset' [-Wmissing-prototypes]
drivers/vfio/platform/vfio_platform_common.c:640:5: warning: no previous prototype for 'vfio_platform_of_probe' [-Wmissing-prototypes]
drivers/vfio/platform/reset/vfio_platform_amdxgbe.c:59:5: warning: no previous prototype for 'vfio_platform_amdxgbe_reset' [-Wmissing-prototypes]
drivers/vfio/platform/reset/vfio_platform_calxedaxgmac.c:60:5: warning: no previous prototype for 'vfio_platform_calxedaxgmac_reset' [-Wmissing-prototypes]
....

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
so this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie &lt;baoyou.xie@linaro.org&gt;
Acked-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Reviewed-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Reviewed-by: Baptiste Reynal &lt;b.reynal@virtualopensystems.com&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio/pci: Fix typos in comments</title>
<updated>2016-08-29T18:39:09Z</updated>
<author>
<name>Wei Jiangang</name>
<email>weijg.fnst@cn.fujitsu.com</email>
</author>
<published>2016-08-17T06:37:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8138dabbab269d9d6ba2ffa17aad03aff22cfdb6'/>
<id>urn:sha1:8138dabbab269d9d6ba2ffa17aad03aff22cfdb6</id>
<content type='text'>
Signed-off-by: Wei Jiangang &lt;weijg.fnst@cn.fujitsu.com&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio/pci: Fix NULL pointer oops in error interrupt setup handling</title>
<updated>2016-08-08T22:16:23Z</updated>
<author>
<name>Alex Williamson</name>
<email>alex.williamson@redhat.com</email>
</author>
<published>2016-08-08T22:16:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c8952a707556e04374d7b2fdb3a079d63ddf6f2f'/>
<id>urn:sha1:c8952a707556e04374d7b2fdb3a079d63ddf6f2f</id>
<content type='text'>
There are multiple cases in vfio_pci_set_ctx_trigger_single() where
we assume we can safely read from our data pointer without actually
checking whether the user has passed any data via the count field.
VFIO_IRQ_SET_DATA_NONE in particular is entirely broken since we
attempt to pull an int32_t file descriptor out before even checking
the data type.  The other data types assume the data pointer contains
one element of their type as well.

In part this is good news because we were previously restricted from
doing much sanitization of parameters because it was missed in the
past and we didn't want to break existing users.  Clearly DATA_NONE
is completely broken, so it must not have any users and we can fix
it up completely.  For DATA_BOOL and DATA_EVENTFD, we'll just
protect ourselves, returning error when count is zero since we
previously would have oopsed.

Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
Reported-by: Chris Thompson &lt;the_cartographer@hotmail.com&gt;
Cc: stable@vger.kernel.org
Reviewed-by: Eric Auger &lt;eric.auger@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio: platform: check reset call return code during release</title>
<updated>2016-07-19T16:54:45Z</updated>
<author>
<name>Sinan Kaya</name>
<email>okaya@codeaurora.org</email>
</author>
<published>2016-07-19T13:01:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0991bbdbf5b85bd14a26e783f087b0f2913c93b1'/>
<id>urn:sha1:0991bbdbf5b85bd14a26e783f087b0f2913c93b1</id>
<content type='text'>
Release call is ignoring the return code from reset call and can
potentially continue even though reset call failed.

If reset_required module parameter is set, this patch is going
to validate the return code and will cause stack dump with
WARN_ON and warn the user of failure.

Signed-off-by: Sinan Kaya &lt;okaya@codeaurora.org&gt;
Reviewed-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Reviewed-by: Baptiste Reynal &lt;b.reynal@virtualopensystems.com&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio: platform: check reset call return code during open</title>
<updated>2016-07-19T16:54:45Z</updated>
<author>
<name>Sinan Kaya</name>
<email>okaya@codeaurora.org</email>
</author>
<published>2016-07-19T13:01:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e99442323f33470677deeed35619313b05837f35'/>
<id>urn:sha1:e99442323f33470677deeed35619313b05837f35</id>
<content type='text'>
Open call is ignoring the return code from reset call and can
potentially continue even though reset call failed.

If reset_required module parameter is set, this patch is going
to validate the return code and will abort open if reset fails.

Signed-off-by: Sinan Kaya &lt;okaya@codeaurora.org&gt;
Reviewed-by: Baptiste Reynal &lt;b.reynal@virtualopensystems.com&gt;
Reviewed-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio, platform: make reset driver a requirement by default</title>
<updated>2016-07-19T16:26:46Z</updated>
<author>
<name>Sinan Kaya</name>
<email>okaya@codeaurora.org</email>
</author>
<published>2016-07-19T13:01:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b5add544d677d36386c3559cf5db1485b59c4d7d'/>
<id>urn:sha1:b5add544d677d36386c3559cf5db1485b59c4d7d</id>
<content type='text'>
The code was allowing platform devices to be used without a supporting
VFIO reset driver. The hardware can be left in some inconsistent state
after a guest machine abort.

The reset driver will put the hardware back to safe state and disable
interrupts before returning the control back to the host machine.

Adding a new reset_required kernel module option to platform VFIO drivers.
The default value is true for the DT and ACPI based drivers.
The reset requirement value for AMBA drivers is set to false and is
unchangeable to maintain the existing functionality.

New requirements are:
1. A reset function needs to be implemented by the corresponding driver
via DT/ACPI.
2. The reset function needs to be discovered via DT/ACPI.

The probe of the driver will fail if any of the above conditions are
not satisfied.

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