<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/drivers/pci/iov.c, branch v4.14.49</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>PCI: Create SR-IOV virtfn/physfn links before attaching driver</title>
<updated>2017-12-25T13:26:26+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.exis.tech/linux.git/commit/?id=7af9f9cd68c7b6f009c4a0c0d8ea7703aa46a26b'/>
<id>7af9f9cd68c7b6f009c4a0c0d8ea7703aa46a26b</id>
<content type='text'>
[ Upstream commit 27d6162944b9b34c32cd5841acd21786637ee743 ]

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;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 27d6162944b9b34c32cd5841acd21786637ee743 ]

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;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&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.exis.tech/linux.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.exis.tech/linux.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.exis.tech/linux.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.exis.tech/linux.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.exis.tech/linux.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.exis.tech/linux.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>
<entry>
<title>PCI: Separate VF BAR updates from standard BAR updates</title>
<updated>2016-11-30T00:05:09+00:00</updated>
<author>
<name>Bjorn Helgaas</name>
<email>bhelgaas@google.com</email>
</author>
<published>2016-11-28T15:15:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=6ffa2489c51da77564a0881a73765ea2169f955d'/>
<id>6ffa2489c51da77564a0881a73765ea2169f955d</id>
<content type='text'>
Previously pci_update_resource() used the same code path for updating
standard BARs and VF BARs in SR-IOV capabilities.

Split the VF BAR update into a new pci_iov_update_resource() internal
interface, which makes it simpler to compute the BAR address (we can get
rid of pci_resource_bar() and pci_iov_resource_bar()).

This patch:

  - Renames pci_update_resource() to pci_std_update_resource(),
  - Adds pci_iov_update_resource(),
  - Makes pci_update_resource() a wrapper that calls the appropriate one,

No functional change intended.

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>
Previously pci_update_resource() used the same code path for updating
standard BARs and VF BARs in SR-IOV capabilities.

Split the VF BAR update into a new pci_iov_update_resource() internal
interface, which makes it simpler to compute the BAR address (we can get
rid of pci_resource_bar() and pci_iov_resource_bar()).

This patch:

  - Renames pci_update_resource() to pci_std_update_resource(),
  - Adds pci_iov_update_resource(),
  - Makes pci_update_resource() a wrapper that calls the appropriate one,

No functional change intended.

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: Do any VF BAR updates before enabling the BARs</title>
<updated>2016-11-23T23:21:42+00:00</updated>
<author>
<name>Gavin Shan</name>
<email>gwshan@linux.vnet.ibm.com</email>
</author>
<published>2016-10-26T01:15:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=f40ec3c748c6912f6266c56a7f7992de61b255ed'/>
<id>f40ec3c748c6912f6266c56a7f7992de61b255ed</id>
<content type='text'>
Previously we enabled VFs and enable their memory space before calling
pcibios_sriov_enable().  But pcibios_sriov_enable() may update the VF BARs:
for example, on PPC PowerNV we may change them to manage the association of
VFs to PEs.

Because 64-bit BARs cannot be updated atomically, it's unsafe to update
them while they're enabled.  The half-updated state may conflict with other
devices in the system.

Call pcibios_sriov_enable() before enabling the VFs so any BAR updates
happen while the VF BARs are disabled.

[bhelgaas: changelog]
Tested-by: Carol Soto &lt;clsoto@us.ibm.com&gt;
Signed-off-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.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>
Previously we enabled VFs and enable their memory space before calling
pcibios_sriov_enable().  But pcibios_sriov_enable() may update the VF BARs:
for example, on PPC PowerNV we may change them to manage the association of
VFs to PEs.

Because 64-bit BARs cannot be updated atomically, it's unsafe to update
them while they're enabled.  The half-updated state may conflict with other
devices in the system.

Call pcibios_sriov_enable() before enabling the VFs so any BAR updates
happen while the VF BARs are disabled.

[bhelgaas: changelog]
Tested-by: Carol Soto &lt;clsoto@us.ibm.com&gt;
Signed-off-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>PCI: Check for pci_setup_device() failure in pci_iov_add_virtfn()</title>
<updated>2016-09-12T21:23:38+00:00</updated>
<author>
<name>Po Liu</name>
<email>po.liu@nxp.com</email>
</author>
<published>2016-08-29T07:28:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=156c55325d30261d250e88ed3a39f22008f4ca16'/>
<id>156c55325d30261d250e88ed3a39f22008f4ca16</id>
<content type='text'>
If pci_setup_device() returns failure, we must return failure from
pci_iov_add_virtfn().  If we ignore the failure and continue with an
uninitialized pci_dev for virtfn, we crash later when we try to use those
uninitialized parts.

Signed-off-by: Po Liu &lt;po.liu@nxp.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>
If pci_setup_device() returns failure, we must return failure from
pci_iov_add_virtfn().  If we ignore the failure and continue with an
uninitialized pci_dev for virtfn, we crash later when we try to use those
uninitialized parts.

Signed-off-by: Po Liu &lt;po.liu@nxp.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;</pre>
</div>
</content>
</entry>
</feed>
