aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2018-08-15 15:59:06 -0400
committerBjorn Helgaas <bhelgaas@google.com>2018-08-15 15:59:06 -0400
commit3a48dc6fc260c9cac302a9ffaeab95359431c485 (patch)
tree7dc85ea850ef81c756b55e2bdec5b7b6146f535e
parente7aaf90f9d9dbbba54f67c653a1c56c2bf117268 (diff)
parent7695e73f3db4576ef3ce05063c28e9a673425763 (diff)
Merge branch 'pci/virtualization'
- To avoid bus errors, enable PASID only if entire path supports End-End TLP prefixes (Sinan Kaya) - Unify slot and bus reset functions and remove hotplug knowledge from callers (Sinan Kaya) - Add Function-Level Reset quirks for Intel and Samsung NVMe devices to fix guest reboot issues (Alex Williamson) - Add function 1 DMA alias quirk for Marvell 88SS9183 PCIe SSD Controller (Bjorn Helgaas) * pci/virtualization: PCI: Add function 1 DMA alias quirk for Marvell 88SS9183 PCI: Delay after FLR of Intel DC P3700 NVMe PCI: Disable Samsung SM961/PM961 NVMe before FLR PCI: Export pcie_has_flr() PCI: Rename pci_try_reset_bus() to pci_reset_bus() PCI: Deprecate pci_reset_bus() and pci_reset_slot() functions PCI: Unify try slot and bus reset API PCI: Hide pci_reset_bridge_secondary_bus() from drivers IB/hfi1: Use pci_try_reset_bus() for initiating PCI Secondary Bus Reset PCI: Handle error return from pci_reset_bridge_secondary_bus() PCI/IOV: Tidy pci_sriov_set_totalvfs() PCI: Enable PASID only if entire path supports End-End TLP prefixes # Conflicts: # drivers/pci/hotplug/pciehp_hpc.c
-rw-r--r--drivers/infiniband/hw/hfi1/pcie.c4
-rw-r--r--drivers/pci/ats.c3
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c5
-rw-r--r--drivers/pci/iov.c4
-rw-r--r--drivers/pci/pci.c92
-rw-r--r--drivers/pci/pci.h1
-rw-r--r--drivers/pci/pcie/aer.c5
-rw-r--r--drivers/pci/pcie/err.c6
-rw-r--r--drivers/pci/probe.c24
-rw-r--r--drivers/pci/quirks.c108
-rw-r--r--drivers/vfio/pci/vfio_pci.c6
-rw-r--r--include/linux/pci.h8
-rw-r--r--include/uapi/linux/pci_regs.h1
13 files changed, 181 insertions, 86 deletions
diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1/pcie.c
index 4d4371bf2c7c..baf7c324f7b8 100644
--- a/drivers/infiniband/hw/hfi1/pcie.c
+++ b/drivers/infiniband/hw/hfi1/pcie.c
@@ -905,9 +905,7 @@ static int trigger_sbr(struct hfi1_devdata *dd)
905 * delay after a reset is required. Per spec requirements, 905 * delay after a reset is required. Per spec requirements,
906 * the link is either working or not after that point. 906 * the link is either working or not after that point.
907 */ 907 */
908 pci_reset_bridge_secondary_bus(dev->bus->self); 908 return pci_reset_bus(dev);
909
910 return 0;
911} 909}
912 910
913/* 911/*
diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
index 4923a2a8e14b..5b78f3b1b918 100644
--- a/drivers/pci/ats.c
+++ b/drivers/pci/ats.c
@@ -273,6 +273,9 @@ int pci_enable_pasid(struct pci_dev *pdev, int features)
273 if (WARN_ON(pdev->pasid_enabled)) 273 if (WARN_ON(pdev->pasid_enabled))
274 return -EBUSY; 274 return -EBUSY;
275 275
276 if (!pdev->eetlp_prefix_path)
277 return -EINVAL;
278
276 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PASID); 279 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PASID);
277 if (!pos) 280 if (!pos)
278 return -EINVAL; 281 return -EINVAL;
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 5b15e76f3564..7136e3430925 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -761,6 +761,7 @@ int pciehp_reset_slot(struct slot *slot, int probe)
761 struct controller *ctrl = slot->ctrl; 761 struct controller *ctrl = slot->ctrl;
762 struct pci_dev *pdev = ctrl_dev(ctrl); 762 struct pci_dev *pdev = ctrl_dev(ctrl);
763 u16 stat_mask = 0, ctrl_mask = 0; 763 u16 stat_mask = 0, ctrl_mask = 0;
764 int rc;
764 765
765 if (probe) 766 if (probe)
766 return 0; 767 return 0;
@@ -778,7 +779,7 @@ int pciehp_reset_slot(struct slot *slot, int probe)
778 ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, 779 ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
779 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, 0); 780 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, 0);
780 781
781 pci_reset_bridge_secondary_bus(ctrl->pcie->port); 782 rc = pci_bridge_secondary_bus_reset(ctrl->pcie->port);
782 783
783 pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, stat_mask); 784 pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, stat_mask);
784 pcie_write_cmd_nowait(ctrl, ctrl_mask, ctrl_mask); 785 pcie_write_cmd_nowait(ctrl, ctrl_mask, ctrl_mask);
@@ -786,7 +787,7 @@ int pciehp_reset_slot(struct slot *slot, int probe)
786 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, ctrl_mask); 787 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, ctrl_mask);
787 788
788 up_write(&ctrl->reset_lock); 789 up_write(&ctrl->reset_lock);
789 return 0; 790 return rc;
790} 791}
791 792
792int pcie_init_notification(struct controller *ctrl) 793int pcie_init_notification(struct controller *ctrl)
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 0f04ae648cf1..c5f3cd4ed766 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -818,15 +818,15 @@ int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
818{ 818{
819 if (!dev->is_physfn) 819 if (!dev->is_physfn)
820 return -ENOSYS; 820 return -ENOSYS;
821
821 if (numvfs > dev->sriov->total_VFs) 822 if (numvfs > dev->sriov->total_VFs)
822 return -EINVAL; 823 return -EINVAL;
823 824
824 /* Shouldn't change if VFs already enabled */ 825 /* Shouldn't change if VFs already enabled */
825 if (dev->sriov->ctrl & PCI_SRIOV_CTRL_VFE) 826 if (dev->sriov->ctrl & PCI_SRIOV_CTRL_VFE)
826 return -EBUSY; 827 return -EBUSY;
827 else
828 dev->sriov->driver_max_VFs = numvfs;
829 828
829 dev->sriov->driver_max_VFs = numvfs;
830 return 0; 830 return 0;
831} 831}
832EXPORT_SYMBOL_GPL(pci_sriov_set_totalvfs); 832EXPORT_SYMBOL_GPL(pci_sriov_set_totalvfs);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 77960fe9d9f3..80da4841c7d2 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4349,7 +4349,7 @@ static int pci_dev_wait(struct pci_dev *dev, char *reset_type, int timeout)
4349 * Returns true if the device advertises support for PCIe function level 4349 * Returns true if the device advertises support for PCIe function level
4350 * resets. 4350 * resets.
4351 */ 4351 */
4352static bool pcie_has_flr(struct pci_dev *dev) 4352bool pcie_has_flr(struct pci_dev *dev)
4353{ 4353{
4354 u32 cap; 4354 u32 cap;
4355 4355
@@ -4359,6 +4359,7 @@ static bool pcie_has_flr(struct pci_dev *dev)
4359 pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &cap); 4359 pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &cap);
4360 return cap & PCI_EXP_DEVCAP_FLR; 4360 return cap & PCI_EXP_DEVCAP_FLR;
4361} 4361}
4362EXPORT_SYMBOL_GPL(pcie_has_flr);
4362 4363
4363/** 4364/**
4364 * pcie_flr - initiate a PCIe function level reset 4365 * pcie_flr - initiate a PCIe function level reset
@@ -4534,19 +4535,18 @@ void __weak pcibios_reset_secondary_bus(struct pci_dev *dev)
4534} 4535}
4535 4536
4536/** 4537/**
4537 * pci_reset_bridge_secondary_bus - Reset the secondary bus on a PCI bridge. 4538 * pci_bridge_secondary_bus_reset - Reset the secondary bus on a PCI bridge.
4538 * @dev: Bridge device 4539 * @dev: Bridge device
4539 * 4540 *
4540 * Use the bridge control register to assert reset on the secondary bus. 4541 * Use the bridge control register to assert reset on the secondary bus.
4541 * Devices on the secondary bus are left in power-on state. 4542 * Devices on the secondary bus are left in power-on state.
4542 */ 4543 */
4543int pci_reset_bridge_secondary_bus(struct pci_dev *dev) 4544int pci_bridge_secondary_bus_reset(struct pci_dev *dev)
4544{ 4545{
4545 pcibios_reset_secondary_bus(dev); 4546 pcibios_reset_secondary_bus(dev);
4546 4547
4547 return pci_dev_wait(dev, "bus reset", PCIE_RESET_READY_POLL_MS); 4548 return pci_dev_wait(dev, "bus reset", PCIE_RESET_READY_POLL_MS);
4548} 4549}
4549EXPORT_SYMBOL_GPL(pci_reset_bridge_secondary_bus);
4550 4550
4551static int pci_parent_bus_reset(struct pci_dev *dev, int probe) 4551static int pci_parent_bus_reset(struct pci_dev *dev, int probe)
4552{ 4552{
@@ -4563,9 +4563,7 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe)
4563 if (probe) 4563 if (probe)
4564 return 0; 4564 return 0;
4565 4565
4566 pci_reset_bridge_secondary_bus(dev->bus->self); 4566 return pci_bridge_secondary_bus_reset(dev->bus->self);
4567
4568 return 0;
4569} 4567}
4570 4568
4571static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, int probe) 4569static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, int probe)
@@ -5097,7 +5095,7 @@ int pci_probe_reset_slot(struct pci_slot *slot)
5097EXPORT_SYMBOL_GPL(pci_probe_reset_slot); 5095EXPORT_SYMBOL_GPL(pci_probe_reset_slot);
5098 5096
5099/** 5097/**
5100 * pci_reset_slot - reset a PCI slot 5098 * __pci_reset_slot - Try to reset a PCI slot
5101 * @slot: PCI slot to reset 5099 * @slot: PCI slot to reset
5102 * 5100 *
5103 * A PCI bus may host multiple slots, each slot may support a reset mechanism 5101 * A PCI bus may host multiple slots, each slot may support a reset mechanism
@@ -5109,33 +5107,9 @@ EXPORT_SYMBOL_GPL(pci_probe_reset_slot);
5109 * through this function. PCI config space of all devices in the slot and 5107 * through this function. PCI config space of all devices in the slot and
5110 * behind the slot is saved before and restored after reset. 5108 * behind the slot is saved before and restored after reset.
5111 * 5109 *
5112 * Return 0 on success, non-zero on error.
5113 */
5114int pci_reset_slot(struct pci_slot *slot)
5115{
5116 int rc;
5117
5118 rc = pci_slot_reset(slot, 1);
5119 if (rc)
5120 return rc;
5121
5122 pci_slot_save_and_disable(slot);
5123
5124 rc = pci_slot_reset(slot, 0);
5125
5126 pci_slot_restore(slot);
5127