Merge branches 'pci/enumeration', 'pci/misc' and 'pci/virtualization' into next
* pci/enumeration: PCI: Enable CRS Software Visibility for root port if it is supported PCI: Check only the Vendor ID to identify Configuration Request Retry * pci/misc: PCI: Parenthesize PCI_DEVID and PCI_VPD_LRDT_ID parameters PCI: Increase IBM ipr SAS Crocodile BARs to at least system page size PCI/AER: Make <linux/aer.h> standalone includable * pci/virtualization: PCI: Use device flag helper functions xen/pciback: Use PCI device flag helper functions KVM: Use PCI device flag helper functions PCI: Add device flag helper functions PCI: Assume all Mellanox devices have broken INTx masking
This commit is contained in:
commit
134cd00d76
|
@ -633,7 +633,7 @@ int pci_vfs_assigned(struct pci_dev *dev)
|
|||
* our dev as the physical function and the assigned bit is set
|
||||
*/
|
||||
if (vfdev->is_virtfn && (vfdev->physfn == dev) &&
|
||||
(vfdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED))
|
||||
pci_is_dev_assigned(vfdev))
|
||||
vfs_assigned++;
|
||||
|
||||
vfdev = pci_get_device(dev->vendor, dev_id, vfdev);
|
||||
|
|
|
@ -740,6 +740,17 @@ struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
|
|||
}
|
||||
EXPORT_SYMBOL(pci_add_new_bus);
|
||||
|
||||
static void pci_enable_crs(struct pci_dev *pdev)
|
||||
{
|
||||
u16 root_cap = 0;
|
||||
|
||||
/* Enable CRS Software Visibility if supported */
|
||||
pcie_capability_read_word(pdev, PCI_EXP_RTCAP, &root_cap);
|
||||
if (root_cap & PCI_EXP_RTCAP_CRSVIS)
|
||||
pcie_capability_set_word(pdev, PCI_EXP_RTCTL,
|
||||
PCI_EXP_RTCTL_CRSSVE);
|
||||
}
|
||||
|
||||
/*
|
||||
* If it's a bridge, configure it and scan the bus behind it.
|
||||
* For CardBus bridges, we don't scan behind as the devices will
|
||||
|
@ -787,6 +798,8 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
|
|||
pci_write_config_word(dev, PCI_BRIDGE_CONTROL,
|
||||
bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT);
|
||||
|
||||
pci_enable_crs(dev);
|
||||
|
||||
if ((secondary || subordinate) && !pcibios_assign_all_busses() &&
|
||||
!is_cardbus && !broken) {
|
||||
unsigned int cmax;
|
||||
|
@ -1292,8 +1305,13 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
|
|||
*l == 0x0000ffff || *l == 0xffff0000)
|
||||
return false;
|
||||
|
||||
/* Configuration request Retry Status */
|
||||
while (*l == 0xffff0001) {
|
||||
/*
|
||||
* Configuration Request Retry Status. Some root ports return the
|
||||
* actual device ID instead of the synthetic ID (0xFFFF) required
|
||||
* by the PCIe spec. Ignore the device ID and only check for
|
||||
* (vendor id == 1).
|
||||
*/
|
||||
while ((*l & 0xffff) == 0x0001) {
|
||||
if (!crs_timeout)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <linux/ioport.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/mm.h>
|
||||
#include <asm/dma.h> /* isa_dma_bridge_buggy */
|
||||
#include "pci.h"
|
||||
|
||||
|
@ -287,6 +288,25 @@ static void quirk_citrine(struct pci_dev *dev)
|
|||
}
|
||||
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE, quirk_citrine);
|
||||
|
||||
/* On IBM Crocodile ipr SAS adapters, expand BAR to system page size */
|
||||
static void quirk_extend_bar_to_page(struct pci_dev *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < PCI_STD_RESOURCE_END; i++) {
|
||||
struct resource *r = &dev->resource[i];
|
||||
|
||||
if (r->flags & IORESOURCE_MEM && resource_size(r) < PAGE_SIZE) {
|
||||
r->end = PAGE_SIZE - 1;
|
||||
r->start = 0;
|
||||
r->flags |= IORESOURCE_UNSET;
|
||||
dev_info(&dev->dev, "expanded BAR %d to page size: %pR\n",
|
||||
i, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, 0x034a, quirk_extend_bar_to_page);
|
||||
|
||||
/*
|
||||
* S3 868 and 968 chips report region size equal to 32M, but they decode 64M.
|
||||
* If it's needed, re-allocate the region.
|
||||
|
@ -2985,6 +3005,8 @@ DECLARE_PCI_FIXUP_HEADER(0x1814, 0x0601, /* Ralink RT2800 802.11n PCI */
|
|||
*/
|
||||
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x8169,
|
||||
quirk_broken_intx_masking);
|
||||
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MELLANOX, PCI_ANY_ID,
|
||||
quirk_broken_intx_masking);
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
/*
|
||||
|
|
|
@ -133,7 +133,7 @@ static void pcistub_device_release(struct kref *kref)
|
|||
xen_pcibk_config_free_dyn_fields(dev);
|
||||
xen_pcibk_config_free_dev(dev);
|
||||
|
||||
dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
|
||||
pci_clear_dev_assigned(dev);
|
||||
pci_dev_put(dev);
|
||||
|
||||
kfree(psdev);
|
||||
|
@ -413,7 +413,7 @@ static int pcistub_init_device(struct pci_dev *dev)
|
|||
dev_dbg(&dev->dev, "reset device\n");
|
||||
xen_pcibk_reset_device(dev);
|
||||
|
||||
dev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
|
||||
pci_set_dev_assigned(dev);
|
||||
return 0;
|
||||
|
||||
config_release:
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
* In the interest of not exposing interfaces to user-space unnecessarily,
|
||||
* the following kernel-only defines are being added here.
|
||||
*/
|
||||
#define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn)
|
||||
#define PCI_DEVID(bus, devfn) ((((u16)(bus)) << 8) | (devfn))
|
||||
/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */
|
||||
#define PCI_BUS_NUM(x) (((x) >> 8) & 0xff)
|
||||
|
||||
|
@ -1701,7 +1701,7 @@ bool pci_acs_path_enabled(struct pci_dev *start,
|
|||
struct pci_dev *end, u16 acs_flags);
|
||||
|
||||
#define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */
|
||||
#define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT)
|
||||
#define PCI_VPD_LRDT_ID(x) ((x) | PCI_VPD_LRDT)
|
||||
|
||||
/* Large Resource Data Type Tag Item Names */
|
||||
#define PCI_VPD_LTIN_ID_STRING 0x02 /* Identifier String */
|
||||
|
@ -1839,4 +1839,17 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
|
|||
*/
|
||||
struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev);
|
||||
|
||||
/* helper functions for operation of device flag */
|
||||
static inline void pci_set_dev_assigned(struct pci_dev *pdev)
|
||||
{
|
||||
pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
|
||||
}
|
||||
static inline void pci_clear_dev_assigned(struct pci_dev *pdev)
|
||||
{
|
||||
pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
|
||||
}
|
||||
static inline bool pci_is_dev_assigned(struct pci_dev *pdev)
|
||||
{
|
||||
return (pdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED) == PCI_DEV_FLAGS_ASSIGNED;
|
||||
}
|
||||
#endif /* LINUX_PCI_H */
|
||||
|
|
|
@ -552,6 +552,7 @@
|
|||
#define PCI_EXP_RTCTL_PMEIE 0x0008 /* PME Interrupt Enable */
|
||||
#define PCI_EXP_RTCTL_CRSSVE 0x0010 /* CRS Software Visibility Enable */
|
||||
#define PCI_EXP_RTCAP 30 /* Root Capabilities */
|
||||
#define PCI_EXP_RTCAP_CRSVIS 0x0001 /* CRS Software Visibility capability */
|
||||
#define PCI_EXP_RTSTA 32 /* Root Status */
|
||||
#define PCI_EXP_RTSTA_PME 0x00010000 /* PME status */
|
||||
#define PCI_EXP_RTSTA_PENDING 0x00020000 /* PME pending */
|
||||
|
|
|
@ -302,7 +302,7 @@ static void kvm_free_assigned_device(struct kvm *kvm,
|
|||
else
|
||||
pci_restore_state(assigned_dev->dev);
|
||||
|
||||
assigned_dev->dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
|
||||
pci_clear_dev_assigned(assigned_dev->dev);
|
||||
|
||||
pci_release_regions(assigned_dev->dev);
|
||||
pci_disable_device(assigned_dev->dev);
|
||||
|
|
|
@ -203,7 +203,7 @@ int kvm_assign_device(struct kvm *kvm,
|
|||
goto out_unmap;
|
||||
}
|
||||
|
||||
pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
|
||||
pci_set_dev_assigned(pdev);
|
||||
|
||||
dev_info(&pdev->dev, "kvm assign device\n");
|
||||
|
||||
|
@ -229,7 +229,7 @@ int kvm_deassign_device(struct kvm *kvm,
|
|||
|
||||
iommu_detach_device(domain, &pdev->dev);
|
||||
|
||||
pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
|
||||
pci_clear_dev_assigned(pdev);
|
||||
|
||||
dev_info(&pdev->dev, "kvm deassign device\n");
|
||||
|
||||
|
|
Loading…
Reference in New Issue