<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/pci/iov.c, branch v4.15-rc2</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>PCI: Restore ARI Capable Hierarchy before setting numVFs</title>
<updated>2017-10-11T00:15:29+00:00</updated>
<author>
<name>Tony Nguyen</name>
<email>anthony.l.nguyen@intel.com</email>
</author>
<published>2017-10-04T15:52:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ff26449e415a5601c8bb5b67ac4ae801f7165696'/>
<id>ff26449e415a5601c8bb5b67ac4ae801f7165696</id>
<content type='text'>
In the restore path, we previously read PCI_SRIOV_VF_OFFSET and
PCI_SRIOV_VF_STRIDE before restoring PCI_SRIOV_CTRL_ARI:

  pci_restore_state
    pci_restore_iov_state
      sriov_restore_state
        pci_iov_set_numvfs
          pci_read_config_word(... PCI_SRIOV_VF_OFFSET, &amp;iov-&gt;offset)
          pci_read_config_word(... PCI_SRIOV_VF_STRIDE, &amp;iov-&gt;stride)
        pci_write_config_word(... PCI_SRIOV_CTRL, iov-&gt;ctrl)

But per SR-IOV r1.1, sec 3.3.3.5, the device can use PCI_SRIOV_CTRL_ARI to
determine PCI_SRIOV_VF_OFFSET and PCI_SRIOV_VF_STRIDE.  Therefore, this
path, which is used for suspend/resume and AER recovery, can corrupt
iov-&gt;offset and iov-&gt;stride.

Since the iov state is associated with the device, not the driver, if we
reload the driver, it will use the the corrupted data, which may cause
crashes like this:

  kernel BUG at drivers/pci/iov.c:157!
  RIP: 0010:pci_iov_add_virtfn+0x2eb/0x350
  Call Trace:
   pci_enable_sriov+0x353/0x440
   ixgbe_pci_sriov_configure+0xd5/0x1f0 [ixgbe]
   sriov_numvfs_store+0xf7/0x170
   dev_attr_store+0x18/0x30
   sysfs_kf_write+0x37/0x40
   kernfs_fop_write+0x120/0x1b0
   vfs_write+0xb5/0x1a0
   SyS_write+0x55/0xc0

Restore PCI_SRIOV_CTRL_ARI before calling pci_iov_set_numvfs(), then
restore the rest of PCI_SRIOV_CTRL (which may set PCI_SRIOV_CTRL_VFE)
afterwards.

Signed-off-by: Tony Nguyen &lt;anthony.l.nguyen@intel.com&gt;
[bhelgaas: changelog, add comment, also clear ARI if necessary]
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Acked-by: Alexander Duyck &lt;alexander.h.duyck@intel.com&gt;
CC: Emil Tantilov &lt;emil.s.tantilov@intel.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the restore path, we previously read PCI_SRIOV_VF_OFFSET and
PCI_SRIOV_VF_STRIDE before restoring PCI_SRIOV_CTRL_ARI:

  pci_restore_state
    pci_restore_iov_state
      sriov_restore_state
        pci_iov_set_numvfs
          pci_read_config_word(... PCI_SRIOV_VF_OFFSET, &amp;iov-&gt;offset)
          pci_read_config_word(... PCI_SRIOV_VF_STRIDE, &amp;iov-&gt;stride)
        pci_write_config_word(... PCI_SRIOV_CTRL, iov-&gt;ctrl)

But per SR-IOV r1.1, sec 3.3.3.5, the device can use PCI_SRIOV_CTRL_ARI to
determine PCI_SRIOV_VF_OFFSET and PCI_SRIOV_VF_STRIDE.  Therefore, this
path, which is used for suspend/resume and AER recovery, can corrupt
iov-&gt;offset and iov-&gt;stride.

Since the iov state is associated with the device, not the driver, if we
reload the driver, it will use the the corrupted data, which may cause
crashes like this:

  kernel BUG at drivers/pci/iov.c:157!
  RIP: 0010:pci_iov_add_virtfn+0x2eb/0x350
  Call Trace:
   pci_enable_sriov+0x353/0x440
   ixgbe_pci_sriov_configure+0xd5/0x1f0 [ixgbe]
   sriov_numvfs_store+0xf7/0x170
   dev_attr_store+0x18/0x30
   sysfs_kf_write+0x37/0x40
   kernfs_fop_write+0x120/0x1b0
   vfs_write+0xb5/0x1a0
   SyS_write+0x55/0xc0

Restore PCI_SRIOV_CTRL_ARI before calling pci_iov_set_numvfs(), then
restore the rest of PCI_SRIOV_CTRL (which may set PCI_SRIOV_CTRL_VFE)
afterwards.

Signed-off-by: Tony Nguyen &lt;anthony.l.nguyen@intel.com&gt;
[bhelgaas: changelog, add comment, also clear ARI if necessary]
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Acked-by: Alexander Duyck &lt;alexander.h.duyck@intel.com&gt;
CC: Emil Tantilov &lt;emil.s.tantilov@intel.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: Create SR-IOV virtfn/physfn links before attaching driver</title>
<updated>2017-10-11T00:13:38+00:00</updated>
<author>
<name>Stuart Hayes</name>
<email>stuart.w.hayes@gmail.com</email>
</author>
<published>2017-10-04T15:57:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=27d6162944b9b34c32cd5841acd21786637ee743'/>
<id>27d6162944b9b34c32cd5841acd21786637ee743</id>
<content type='text'>
When creating virtual functions, create the "virtfn%u" and "physfn" links
in sysfs *before* attaching the driver instead of after.  When we attach
the driver to the new virtual network interface first, there is a race when
the driver attaches to the new sends out an "add" udev event, and the
network interface naming software (biosdevname or systemd, for example)
tries to look at these links.

Signed-off-by: Stuart Hayes &lt;stuart.w.hayes@gmail.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When creating virtual functions, create the "virtfn%u" and "physfn" links
in sysfs *before* attaching the driver instead of after.  When we attach
the driver to the new virtual network interface first, there is a race when
the driver attaches to the new sends out an "add" udev event, and the
network interface naming software (biosdevname or systemd, for example)
tries to look at these links.

Signed-off-by: Stuart Hayes &lt;stuart.w.hayes@gmail.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: Cache the VF device ID in the SR-IOV structure</title>
<updated>2017-10-05T20:54:58+00:00</updated>
<author>
<name>Filippo Sironi</name>
<email>sironi@amazon.de</email>
</author>
<published>2017-08-28T13:38:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3142d832af10d8cd456cdec5aa72da1c8572f557'/>
<id>3142d832af10d8cd456cdec5aa72da1c8572f557</id>
<content type='text'>
Cache the VF device ID in the SR-IOV structure and use it instead of
reading it over and over from the PF config space capability.

Signed-off-by: Filippo Sironi &lt;sironi@amazon.de&gt;
[bhelgaas: rename to "vf_device" to match pci_dev-&gt;device]
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Cache the VF device ID in the SR-IOV structure and use it instead of
reading it over and over from the PF config space capability.

Signed-off-by: Filippo Sironi &lt;sironi@amazon.de&gt;
[bhelgaas: rename to "vf_device" to match pci_dev-&gt;device]
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: Remove reset argument from pci_iov_{add,remove}_virtfn()</title>
<updated>2017-10-05T20:54:56+00:00</updated>
<author>
<name>Jan H. Schönherr</name>
<email>jschoenh@amazon.de</email>
</author>
<published>2017-09-26T17:53:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=753f612471819d3b3abba8c520eb3ce8f9d00fa5'/>
<id>753f612471819d3b3abba8c520eb3ce8f9d00fa5</id>
<content type='text'>
The "reset" argument passed to pci_iov_add_virtfn() and
pci_iov_remove_virtfn() is always zero since 46cb7b1bd86f ("PCI: Remove
unused SR-IOV VF Migration support")

Remove the argument together with the associated code.

Signed-off-by: Jan H. Schönherr &lt;jschoenh@amazon.de&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Acked-by: Russell Currey &lt;ruscur@russell.cc&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The "reset" argument passed to pci_iov_add_virtfn() and
pci_iov_remove_virtfn() is always zero since 46cb7b1bd86f ("PCI: Remove
unused SR-IOV VF Migration support")

Remove the argument together with the associated code.

Signed-off-by: Jan H. Schönherr &lt;jschoenh@amazon.de&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Acked-by: Russell Currey &lt;ruscur@russell.cc&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: Disable VF decoding before pcibios_sriov_disable() updates resources</title>
<updated>2017-08-29T22:24:02+00:00</updated>
<author>
<name>Gavin Shan</name>
<email>gwshan@linux.vnet.ibm.com</email>
</author>
<published>2017-08-11T08:19:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0fc690a7c3f7053613dcbab6a7613bb6586d8ee2'/>
<id>0fc690a7c3f7053613dcbab6a7613bb6586d8ee2</id>
<content type='text'>
A struct resource represents the address space consumed by a device.  We
should not modify that resource while the device is actively using the
address space.  For VFs, pci_iov_update_resource() enforces this by
printing a warning and doing nothing if the VFE (VF Enable) and MSE (VF
Memory Space Enable) bits are set.

Previously, both sriov_enable() and sriov_disable() called the
pcibios_sriov_disable() arch hook, which may update the struct resource,
while VFE and MSE were enabled.  This effectively dropped the resource
update pcibios_sriov_disable() intended to do.

Disable VF memory decoding before calling pcibios_sriov_disable().

Reported-by: Carol L Soto &lt;clsoto@us.ibm.com&gt;
Tested-by: Carol L Soto &lt;clsoto@us.ibm.com&gt;
Signed-off-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.com&gt;
Signed-off-by: Alexey Kardashevskiy &lt;aik@ozlabs.ru&gt;
[bhelgaas: changelog]
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Cc: shan.gavin@gmail.com
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A struct resource represents the address space consumed by a device.  We
should not modify that resource while the device is actively using the
address space.  For VFs, pci_iov_update_resource() enforces this by
printing a warning and doing nothing if the VFE (VF Enable) and MSE (VF
Memory Space Enable) bits are set.

Previously, both sriov_enable() and sriov_disable() called the
pcibios_sriov_disable() arch hook, which may update the struct resource,
while VFE and MSE were enabled.  This effectively dropped the resource
update pcibios_sriov_disable() intended to do.

Disable VF memory decoding before calling pcibios_sriov_disable().

Reported-by: Carol L Soto &lt;clsoto@us.ibm.com&gt;
Tested-by: Carol L Soto &lt;clsoto@us.ibm.com&gt;
Signed-off-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.com&gt;
Signed-off-by: Alexey Kardashevskiy &lt;aik@ozlabs.ru&gt;
[bhelgaas: changelog]
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Cc: shan.gavin@gmail.com
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: Protect pci_driver-&gt;sriov_configure() usage with device_lock()</title>
<updated>2017-06-14T22:41:19+00:00</updated>
<author>
<name>Jakub Kicinski</name>
<email>jakub.kicinski@netronome.com</email>
</author>
<published>2017-05-22T22:50:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=17530e71e0166a37f8e20a9b7bcf1d50ae3cff8e'/>
<id>17530e71e0166a37f8e20a9b7bcf1d50ae3cff8e</id>
<content type='text'>
Every method in struct device_driver or structures derived from it like
struct pci_driver MUST provide exclusion vs the driver's -&gt;remove() method,
usually by using device_lock().

Protect use of pci_driver-&gt;sriov_configure() by holding the device lock
while calling it.

The PCI core sets the pci_dev-&gt;driver pointer in local_pci_probe() before
calling -&gt;probe() and only clears it after -&gt;remove().  This means driver's
-&gt;sriov_configure() callback will happily race with probe() and remove(),
most likely leading to BUGs, since drivers don't expect this.

Remove the iov lock completely, since we remove the last user.

[bhelgaas: changelog, thanks to Christoph for locking rule]
Link: http://lkml.kernel.org/r/20170522225023.14010-1-jakub.kicinski@netronome.com
Signed-off-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Every method in struct device_driver or structures derived from it like
struct pci_driver MUST provide exclusion vs the driver's -&gt;remove() method,
usually by using device_lock().

Protect use of pci_driver-&gt;sriov_configure() by holding the device lock
while calling it.

The PCI core sets the pci_dev-&gt;driver pointer in local_pci_probe() before
calling -&gt;probe() and only clears it after -&gt;remove().  This means driver's
-&gt;sriov_configure() callback will happily race with probe() and remove(),
most likely leading to BUGs, since drivers don't expect this.

Remove the iov lock completely, since we remove the last user.

[bhelgaas: changelog, thanks to Christoph for locking rule]
Link: http://lkml.kernel.org/r/20170522225023.14010-1-jakub.kicinski@netronome.com
Signed-off-by: Jakub Kicinski &lt;jakub.kicinski@netronome.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: Add sysfs sriov_drivers_autoprobe to control VF driver binding</title>
<updated>2017-04-20T13:53:51+00:00</updated>
<author>
<name>Bodong Wang</name>
<email>bodong@mellanox.com</email>
</author>
<published>2017-04-12T22:51:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0e7df22401a3dfd403b26dea62dd00e0598b538b'/>
<id>0e7df22401a3dfd403b26dea62dd00e0598b538b</id>
<content type='text'>
Sometimes it is not desirable to bind SR-IOV VFs to drivers.  This can save
host side resource usage by VF instances that will be assigned to VMs.

Add a new PCI sysfs interface "sriov_drivers_autoprobe" to control that
from the PF.  To modify it, echo 0/n/N (disable probe) or 1/y/Y (enable
probe) to:

  /sys/bus/pci/devices/&lt;DOMAIN:BUS:DEVICE.FUNCTION&gt;/sriov_drivers_autoprobe

Note that this must be done before enabling VFs.  The change will not take
effect if VFs are already enabled.  Simply, one can disable VFs by setting
sriov_numvfs to 0, choose whether to probe or not, and then re-enable the
VFs by restoring sriov_numvfs.

[bhelgaas: changelog, ABI doc]
Signed-off-by: Bodong Wang &lt;bodong@mellanox.com&gt;
Signed-off-by: Eli Cohen &lt;eli@mellanox.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.com&gt;
Reviewed-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sometimes it is not desirable to bind SR-IOV VFs to drivers.  This can save
host side resource usage by VF instances that will be assigned to VMs.

Add a new PCI sysfs interface "sriov_drivers_autoprobe" to control that
from the PF.  To modify it, echo 0/n/N (disable probe) or 1/y/Y (enable
probe) to:

  /sys/bus/pci/devices/&lt;DOMAIN:BUS:DEVICE.FUNCTION&gt;/sriov_drivers_autoprobe

Note that this must be done before enabling VFs.  The change will not take
effect if VFs are already enabled.  Simply, one can disable VFs by setting
sriov_numvfs to 0, choose whether to probe or not, and then re-enable the
VFs by restoring sriov_numvfs.

[bhelgaas: changelog, ABI doc]
Signed-off-by: Bodong Wang &lt;bodong@mellanox.com&gt;
Signed-off-by: Eli Cohen &lt;eli@mellanox.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.com&gt;
Reviewed-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: Lock each enable/disable num_vfs operation in sysfs</title>
<updated>2017-02-03T19:42:38+00:00</updated>
<author>
<name>Emil Tantilov</name>
<email>emil.s.tantilov@intel.com</email>
</author>
<published>2017-01-06T21:59:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5b0948dfe138f0837699f46f5877f4f81c252dac'/>
<id>5b0948dfe138f0837699f46f5877f4f81c252dac</id>
<content type='text'>
Enabling/disabling SRIOV via sysfs by echo-ing multiple values
simultaneously:

  # echo 63 &gt; /sys/class/net/ethX/device/sriov_numvfs&amp;
  # echo 63 &gt; /sys/class/net/ethX/device/sriov_numvfs

  # sleep 5

  # echo 0 &gt; /sys/class/net/ethX/device/sriov_numvfs&amp;
  # echo 0 &gt; /sys/class/net/ethX/device/sriov_numvfs

results in the following bug:

  kernel BUG at drivers/pci/iov.c:495!
  invalid opcode: 0000 [#1] SMP
  CPU: 1 PID: 8050 Comm: bash Tainted: G   W   4.9.0-rc7-net-next #2092
  RIP: 0010:[&lt;ffffffff813b1647&gt;]
	    [&lt;ffffffff813b1647&gt;] pci_iov_release+0x57/0x60

  Call Trace:
   [&lt;ffffffff81391726&gt;] pci_release_dev+0x26/0x70
   [&lt;ffffffff8155be6e&gt;] device_release+0x3e/0xb0
   [&lt;ffffffff81365ee7&gt;] kobject_cleanup+0x67/0x180
   [&lt;ffffffff81365d9d&gt;] kobject_put+0x2d/0x60
   [&lt;ffffffff8155bc27&gt;] put_device+0x17/0x20
   [&lt;ffffffff8139c08a&gt;] pci_dev_put+0x1a/0x20
   [&lt;ffffffff8139cb6b&gt;] pci_get_dev_by_id+0x5b/0x90
   [&lt;ffffffff8139cca5&gt;] pci_get_subsys+0x35/0x40
   [&lt;ffffffff8139ccc8&gt;] pci_get_device+0x18/0x20
   [&lt;ffffffff8139ccfb&gt;] pci_get_domain_bus_and_slot+0x2b/0x60
   [&lt;ffffffff813b09e7&gt;] pci_iov_remove_virtfn+0x57/0x180
   [&lt;ffffffff813b0b95&gt;] pci_disable_sriov+0x65/0x140
   [&lt;ffffffffa00a1af7&gt;] ixgbe_disable_sriov+0xc7/0x1d0 [ixgbe]
   [&lt;ffffffffa00a1e9d&gt;] ixgbe_pci_sriov_configure+0x3d/0x170 [ixgbe]
   [&lt;ffffffff8139d28c&gt;] sriov_numvfs_store+0xdc/0x130
  ...
  RIP  [&lt;ffffffff813b1647&gt;] pci_iov_release+0x57/0x60

Use the existing mutex lock to protect each enable/disable operation.

Signed-off-by: Emil Tantilov &lt;emil.s.tantilov@intel.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.com&gt;
CC: Alexander Duyck &lt;alexander.h.duyck@intel.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Enabling/disabling SRIOV via sysfs by echo-ing multiple values
simultaneously:

  # echo 63 &gt; /sys/class/net/ethX/device/sriov_numvfs&amp;
  # echo 63 &gt; /sys/class/net/ethX/device/sriov_numvfs

  # sleep 5

  # echo 0 &gt; /sys/class/net/ethX/device/sriov_numvfs&amp;
  # echo 0 &gt; /sys/class/net/ethX/device/sriov_numvfs

results in the following bug:

  kernel BUG at drivers/pci/iov.c:495!
  invalid opcode: 0000 [#1] SMP
  CPU: 1 PID: 8050 Comm: bash Tainted: G   W   4.9.0-rc7-net-next #2092
  RIP: 0010:[&lt;ffffffff813b1647&gt;]
	    [&lt;ffffffff813b1647&gt;] pci_iov_release+0x57/0x60

  Call Trace:
   [&lt;ffffffff81391726&gt;] pci_release_dev+0x26/0x70
   [&lt;ffffffff8155be6e&gt;] device_release+0x3e/0xb0
   [&lt;ffffffff81365ee7&gt;] kobject_cleanup+0x67/0x180
   [&lt;ffffffff81365d9d&gt;] kobject_put+0x2d/0x60
   [&lt;ffffffff8155bc27&gt;] put_device+0x17/0x20
   [&lt;ffffffff8139c08a&gt;] pci_dev_put+0x1a/0x20
   [&lt;ffffffff8139cb6b&gt;] pci_get_dev_by_id+0x5b/0x90
   [&lt;ffffffff8139cca5&gt;] pci_get_subsys+0x35/0x40
   [&lt;ffffffff8139ccc8&gt;] pci_get_device+0x18/0x20
   [&lt;ffffffff8139ccfb&gt;] pci_get_domain_bus_and_slot+0x2b/0x60
   [&lt;ffffffff813b09e7&gt;] pci_iov_remove_virtfn+0x57/0x180
   [&lt;ffffffff813b0b95&gt;] pci_disable_sriov+0x65/0x140
   [&lt;ffffffffa00a1af7&gt;] ixgbe_disable_sriov+0xc7/0x1d0 [ixgbe]
   [&lt;ffffffffa00a1e9d&gt;] ixgbe_pci_sriov_configure+0x3d/0x170 [ixgbe]
   [&lt;ffffffff8139d28c&gt;] sriov_numvfs_store+0xdc/0x130
  ...
  RIP  [&lt;ffffffff813b1647&gt;] pci_iov_release+0x57/0x60

Use the existing mutex lock to protect each enable/disable operation.

Signed-off-by: Emil Tantilov &lt;emil.s.tantilov@intel.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.com&gt;
CC: Alexander Duyck &lt;alexander.h.duyck@intel.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: Remove pci_resource_bar() and pci_iov_resource_bar()</title>
<updated>2016-11-30T00:05:09+00:00</updated>
<author>
<name>Bjorn Helgaas</name>
<email>bhelgaas@google.com</email>
</author>
<published>2016-11-28T22:51:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=286c2378aaccc7343ebf17ec6cd86567659caf70'/>
<id>286c2378aaccc7343ebf17ec6cd86567659caf70</id>
<content type='text'>
pci_std_update_resource() only deals with standard BARs, so we don't have
to worry about the complications of VF BARs in an SR-IOV capability.

Compute the BAR address inline and remove pci_resource_bar().  That makes
pci_iov_resource_bar() unused, so remove that as well.

Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
pci_std_update_resource() only deals with standard BARs, so we don't have
to worry about the complications of VF BARs in an SR-IOV capability.

Compute the BAR address inline and remove pci_resource_bar().  That makes
pci_iov_resource_bar() unused, so remove that as well.

Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: Don't update VF BARs while VF memory space is enabled</title>
<updated>2016-11-30T00:05:09+00:00</updated>
<author>
<name>Bjorn Helgaas</name>
<email>bhelgaas@google.com</email>
</author>
<published>2016-11-28T22:43:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=546ba9f8f22f71b0202b6ba8967be5cc6dae4e21'/>
<id>546ba9f8f22f71b0202b6ba8967be5cc6dae4e21</id>
<content type='text'>
If we update a VF BAR while it's enabled, there are two potential problems:

  1) Any driver that's using the VF has a cached BAR value that is stale
     after the update, and

  2) We can't update 64-bit BARs atomically, so the intermediate state
     (new lower dword with old upper dword) may conflict with another
     device, and an access by a driver unrelated to the VF may cause a bus
     error.

Warn about attempts to update VF BARs while they are enabled.  This is a
programming error, so use dev_WARN() to get a backtrace.

Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we update a VF BAR while it's enabled, there are two potential problems:

  1) Any driver that's using the VF has a cached BAR value that is stale
     after the update, and

  2) We can't update 64-bit BARs atomically, so the intermediate state
     (new lower dword with old upper dword) may conflict with another
     device, and an access by a driver unrelated to the VF may cause a bus
     error.

Warn about attempts to update VF BARs while they are enabled.  This is a
programming error, so use dev_WARN() to get a backtrace.

Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.com&gt;</pre>
</div>
</content>
</entry>
</feed>
