1. 11 12月, 2017 1 次提交
  2. 11 10月, 2017 2 次提交
    • T
      PCI: Restore ARI Capable Hierarchy before setting numVFs · ff26449e
      Tony Nguyen 提交于
      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, &iov->offset)
                pci_read_config_word(... PCI_SRIOV_VF_STRIDE, &iov->stride)
              pci_write_config_word(... PCI_SRIOV_CTRL, iov->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->offset and iov->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: NTony Nguyen <anthony.l.nguyen@intel.com>
      [bhelgaas: changelog, add comment, also clear ARI if necessary]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NAlexander Duyck <alexander.h.duyck@intel.com>
      CC: Emil Tantilov <emil.s.tantilov@intel.com>
      ff26449e
    • S
      PCI: Create SR-IOV virtfn/physfn links before attaching driver · 27d61629
      Stuart Hayes 提交于
      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: NStuart Hayes <stuart.w.hayes@gmail.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      27d61629
  3. 06 10月, 2017 2 次提交
  4. 30 8月, 2017 1 次提交
  5. 15 6月, 2017 1 次提交
  6. 20 4月, 2017 1 次提交
  7. 04 2月, 2017 1 次提交
    • E
      PCI: Lock each enable/disable num_vfs operation in sysfs · 5b0948df
      Emil Tantilov 提交于
      Enabling/disabling SRIOV via sysfs by echo-ing multiple values
      simultaneously:
      
        # echo 63 > /sys/class/net/ethX/device/sriov_numvfs&
        # echo 63 > /sys/class/net/ethX/device/sriov_numvfs
      
        # sleep 5
      
        # echo 0 > /sys/class/net/ethX/device/sriov_numvfs&
        # echo 0 > /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:[<ffffffff813b1647>]
      	    [<ffffffff813b1647>] pci_iov_release+0x57/0x60
      
        Call Trace:
         [<ffffffff81391726>] pci_release_dev+0x26/0x70
         [<ffffffff8155be6e>] device_release+0x3e/0xb0
         [<ffffffff81365ee7>] kobject_cleanup+0x67/0x180
         [<ffffffff81365d9d>] kobject_put+0x2d/0x60
         [<ffffffff8155bc27>] put_device+0x17/0x20
         [<ffffffff8139c08a>] pci_dev_put+0x1a/0x20
         [<ffffffff8139cb6b>] pci_get_dev_by_id+0x5b/0x90
         [<ffffffff8139cca5>] pci_get_subsys+0x35/0x40
         [<ffffffff8139ccc8>] pci_get_device+0x18/0x20
         [<ffffffff8139ccfb>] pci_get_domain_bus_and_slot+0x2b/0x60
         [<ffffffff813b09e7>] pci_iov_remove_virtfn+0x57/0x180
         [<ffffffff813b0b95>] pci_disable_sriov+0x65/0x140
         [<ffffffffa00a1af7>] ixgbe_disable_sriov+0xc7/0x1d0 [ixgbe]
         [<ffffffffa00a1e9d>] ixgbe_pci_sriov_configure+0x3d/0x170 [ixgbe]
         [<ffffffff8139d28c>] sriov_numvfs_store+0xdc/0x130
        ...
        RIP  [<ffffffff813b1647>] pci_iov_release+0x57/0x60
      
      Use the existing mutex lock to protect each enable/disable operation.
      Signed-off-by: NEmil Tantilov <emil.s.tantilov@intel.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      CC: Alexander Duyck <alexander.h.duyck@intel.com>
      5b0948df
  8. 30 11月, 2016 3 次提交
  9. 24 11月, 2016 1 次提交
    • G
      PCI: Do any VF BAR updates before enabling the BARs · f40ec3c7
      Gavin Shan 提交于
      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: NCarol Soto <clsoto@us.ibm.com>
      Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      f40ec3c7
  10. 13 9月, 2016 1 次提交
  11. 09 3月, 2016 1 次提交
  12. 01 3月, 2016 1 次提交
  13. 31 10月, 2015 4 次提交
  14. 30 10月, 2015 4 次提交
  15. 31 3月, 2015 9 次提交
  16. 20 11月, 2014 1 次提交
  17. 17 9月, 2014 1 次提交
  18. 30 5月, 2014 1 次提交
  19. 20 2月, 2014 1 次提交
  20. 11 1月, 2014 1 次提交
  21. 23 11月, 2013 1 次提交
    • E
      PCI: Clear NumVFs when disabling SR-IOV in sriov_init() · 045cc22e
      ethan.zhao 提交于
      When SR-IOV is disabled (VF Enable is cleared), NumVFs is not very useful,
      so this patch clears it out to prevent confusing lspci output like that
      below.  We already clear NumVFs in sriov_disable(), and this does the same
      when we disable SR-IOV as part of parsing the SR-IOV capability.
      
        $ lspci -vvv -s 13:00.0
        13:00.0 Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01)
            Capabilities: [160 v1] Single Root I/O Virtualization (SR-IOV)
                IOVCtl: Enable- Migration- Interrupt- MSE- ARIHierarchy+
                Initial VFs: 64, Total VFs: 64, Number of VFs: 64, ...
      
      [bhelgaas: changelog]
      Signed-off-by: Nethan.zhao <ethan.kernel@gmail.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      045cc22e
  22. 15 11月, 2013 1 次提交