]> www.infradead.org Git - users/jedix/linux-maple.git/commit
vfio-pci: Virtualize PCIe & AF FLR
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 26 Sep 2016 19:52:16 +0000 (13:52 -0600)
committerBrian Maly <brian.maly@oracle.com>
Mon, 23 Apr 2018 20:21:22 +0000 (16:21 -0400)
commit1931adad0903d098cdfde85259d33898716a27e7
treec740ffaa3b2f6fd3ac4863e7616133597a772a38
parente06622fd3cbcf8051878016c35457d0eed883b90
vfio-pci: Virtualize PCIe & AF FLR

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.

OraBug: 27876914

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Greg Rose <grose@lightfleet.com>
(cherry picked from commit ddf9dc0eb5314d6dac8b19b1cc37c739c6896e7e)
Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/vfio/pci/vfio_pci_config.c