Merge branches 'pci/hotplug', 'pci/iommu', 'pci/irq' and 'pci/virtualization' into...
authorBjorn Helgaas <bhelgaas@google.com>
Fri, 14 Aug 2015 13:16:29 +0000 (08:16 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 14 Aug 2015 13:16:29 +0000 (08:16 -0500)
* pci/hotplug:
  PCI: pciehp: Remove ignored MRL sensor interrupt events
  PCI: pciehp: Remove unused interrupt events
  PCI: pciehp: Handle invalid data when reading from non-existent devices
  PCI: Hold pci_slot_mutex while searching bus->slots list
  PCI: Protect pci_bus->slots with pci_slot_mutex, not pci_bus_sem
  PCI: pciehp: Simplify pcie_poll_cmd()
  PCI: Use "slot" and "pci_slot" for struct hotplug_slot and struct pci_slot

* pci/iommu:
  PCI: Remove pci_ats_enabled()
  PCI: Stop caching ATS Invalidate Queue Depth
  PCI: Move ATS declarations to linux/pci.h so they're all together
  PCI: Clean up ATS error handling
  PCI: Use pci_physfn() rather than looking up physfn by hand
  PCI: Inline the ATS setup code into pci_ats_init()
  PCI: Rationalize pci_ats_queue_depth() error checking
  PCI: Reduce size of ATS structure elements
  PCI: Embed ATS info directly into struct pci_dev
  PCI: Allocate ATS struct during enumeration
  iommu/vt-d: Cache PCI ATS state and Invalidate Queue Depth

* pci/irq:
  PCI: Kill off set_irq_flags() usage

* pci/virtualization:
  PCI: Add ACS quirks for Intel I219-LM/V

43 files changed:
arch/alpha/kernel/pci.c
arch/arm64/boot/dts/apm/apm-storm.dtsi
arch/frv/mb93090-mb00/pci-frv.c
arch/frv/mb93090-mb00/pci-frv.h
arch/frv/mb93090-mb00/pci-vdk.c
arch/ia64/pci/pci.c
arch/microblaze/pci/pci-common.c
arch/mips/pci/pci.c
arch/mn10300/unit-asb2305/pci-asb2305.c
arch/mn10300/unit-asb2305/pci-asb2305.h
arch/mn10300/unit-asb2305/pci.c
arch/powerpc/kernel/pci-common.c
arch/sh/drivers/pci/pci-sh4.h
arch/x86/include/asm/pci_x86.h
arch/x86/pci/common.c
arch/x86/pci/fixup.c
arch/x86/pci/intel_mid_pci.c
arch/x86/pci/irq.c
arch/xtensa/kernel/pci.c
drivers/acpi/pci_irq.c
drivers/iommu/intel-iommu.c
drivers/parisc/dino.c
drivers/parisc/lba_pci.c
drivers/pci/access.c
drivers/pci/ats.c
drivers/pci/host/pci-dra7xx.c
drivers/pci/host/pci-keystone-dw.c
drivers/pci/host/pci-tegra.c
drivers/pci/host/pci-xgene-msi.c
drivers/pci/host/pci-xgene.c
drivers/pci/host/pcie-designware.c
drivers/pci/host/pcie-rcar.c
drivers/pci/host/pcie-xilinx.c
drivers/pci/msi.c
drivers/pci/pci-acpi.c
drivers/pci/pci-driver.c
drivers/pci/pci.c
drivers/pci/pci.h
drivers/pci/pcie/portdrv_core.c
drivers/pci/probe.c
drivers/pci/quirks.c
include/linux/pci-ats.h
include/linux/pci.h

index 82f738e5d54cb85f5b77c21304fd590d1e5bbbc5..cded02c890aacb5b32813332b61df3b4523fbd05 100644 (file)
@@ -242,12 +242,7 @@ pci_restore_srm_config(void)
 
 void pcibios_fixup_bus(struct pci_bus *bus)
 {
-       struct pci_dev *dev = bus->self;
-
-       if (pci_has_flag(PCI_PROBE_ONLY) && dev &&
-                  (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
-               pci_read_bridge_bases(bus);
-       } 
+       struct pci_dev *dev;
 
        list_for_each_entry(dev, &bus->devices, bus_list) {
                pdev_save_srm_config(dev);
index 0689c3fb56e3d84fe3ed7790f4a6b25835c86555..b49482e3ca9c01f88785b275efc71196f0a6505d 100644 (file)
                                0xe0 0xd0000000 0x0 0x00040000>; /* PCI config space */
                        reg-names = "csr", "cfg";
                        ranges = <0x01000000 0x00 0x00000000 0xe0 0x10000000 0x00 0x00010000   /* io */
-                                 0x02000000 0x00 0x80000000 0xe1 0x80000000 0x00 0x80000000>; /* mem */
+                                 0x02000000 0x00 0x80000000 0xe1 0x80000000 0x00 0x80000000   /* mem */
+                                 0x43000000 0xf0 0x00000000 0xf0 0x00000000 0x10 0x00000000>; /* mem */
                        dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000
                                      0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>;
                        interrupt-map-mask = <0x0 0x0 0x0 0x7>;
                        reg = < 0x00 0x1f2c0000 0x0 0x00010000   /* Controller registers */
                                0xd0 0xd0000000 0x0 0x00040000>; /* PCI config space */
                        reg-names = "csr", "cfg";
-                       ranges = <0x01000000 0x0 0x00000000 0xd0 0x10000000 0x00 0x00010000   /* io  */
-                                 0x02000000 0x0 0x80000000 0xd1 0x80000000 0x00 0x80000000>; /* mem */
+                       ranges = <0x01000000 0x00 0x00000000 0xd0 0x10000000 0x00 0x00010000   /* io  */
+                                 0x02000000 0x00 0x80000000 0xd1 0x80000000 0x00 0x80000000   /* mem */
+                                 0x43000000 0xd8 0x00000000 0xd8 0x00000000 0x08 0x00000000>; /* mem */
                        dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000
                                      0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>;
                        interrupt-map-mask = <0x0 0x0 0x0 0x7>;
                        reg =  < 0x00 0x1f2d0000 0x0 0x00010000   /* Controller registers */
                                 0x90 0xd0000000 0x0 0x00040000>; /* PCI config space */
                        reg-names = "csr", "cfg";
-                       ranges = <0x01000000 0x0 0x00000000 0x90 0x10000000 0x0 0x00010000   /* io  */
-                                 0x02000000 0x0 0x80000000 0x91 0x80000000 0x0 0x80000000>; /* mem */
+                       ranges = <0x01000000 0x00 0x00000000 0x90 0x10000000 0x00 0x00010000   /* io  */
+                                 0x02000000 0x00 0x80000000 0x91 0x80000000 0x00 0x80000000   /* mem */
+                                 0x43000000 0x94 0x00000000 0x94 0x00000000 0x04 0x00000000>; /* mem */
                        dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000
                                      0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>;
                        interrupt-map-mask = <0x0 0x0 0x0 0x7>;
                        reg = < 0x00 0x1f500000 0x0 0x00010000   /* Controller registers */
                                0xa0 0xd0000000 0x0 0x00040000>; /* PCI config space */
                        reg-names = "csr", "cfg";
-                       ranges = <0x01000000 0x0 0x00000000 0xa0 0x10000000 0x0 0x00010000   /* io   */
-                                 0x02000000 0x0 0x80000000 0xa1 0x80000000 0x0 0x80000000>; /* mem  */
+                       ranges = <0x01000000 0x00 0x00000000 0xa0 0x10000000 0x00 0x00010000   /* io  */
+                                 0x02000000 0x00 0x80000000 0xa1 0x80000000 0x00 0x80000000   /* mem */
+                                 0x43000000 0xb0 0x00000000 0xb0 0x00000000 0x10 0x00000000>; /* mem */
                        dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000
                                      0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>;
                        interrupt-map-mask = <0x0 0x0 0x0 0x7>;
                        reg = < 0x00 0x1f510000 0x0 0x00010000   /* Controller registers */
                                0xc0 0xd0000000 0x0 0x00200000>; /* PCI config space */
                        reg-names = "csr", "cfg";
-                       ranges = <0x01000000 0x0 0x00000000 0xc0 0x10000000 0x0 0x00010000   /* io  */
-                                 0x02000000 0x0 0x80000000 0xc1 0x80000000 0x0 0x80000000>; /* mem */
+                       ranges = <0x01000000 0x00 0x00000000 0xc0 0x10000000 0x00 0x00010000   /* io  */
+                                 0x02000000 0x00 0x80000000 0xc1 0x80000000 0x00 0x80000000   /* mem */
+                                 0x43000000 0xc8 0x00000000 0xc8 0x00000000 0x08 0x00000000>; /* mem */
                        dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000
                                      0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>;
                        interrupt-map-mask = <0x0 0x0 0x0 0x7>;
index 0635bd6c2af392fc372b0e02002b1a669a88e33c..34bb4b13e079811f79e76598119c272625f774db 100644 (file)
@@ -175,14 +175,6 @@ static void __init pcibios_assign_resources(void)
                        if (!r->start && r->end)
                                pci_assign_resource(dev, idx);
                }
-
-               if (pci_probe & PCI_ASSIGN_ROMS) {
-                       r = &dev->resource[PCI_ROM_RESOURCE];
-                       r->end -= r->start;
-                       r->start = 0;
-                       if (r->end)
-                               pci_assign_resource(dev, PCI_ROM_RESOURCE);
-               }
        }
 }
 
index a7e487fe76edeaf7cf36846e779481535e13eb5e..d51992ff5a61b601a98b69d59af4f0f469e268ea 100644 (file)
 #define DBG(x...)
 #endif
 
-#define PCI_PROBE_BIOS         0x0001
-#define PCI_PROBE_CONF1                0x0002
-#define PCI_PROBE_CONF2                0x0004
-#define PCI_NO_CHECKS          0x0400
-#define PCI_ASSIGN_ROMS                0x1000
-#define PCI_BIOS_IRQ_SCAN      0x2000
-#define PCI_ASSIGN_ALL_BUSSES  0x4000
-
 extern unsigned int __nongpreldata pci_probe;
 
 /* pci-frv.c */
index f211839e2cae18f4d71999ec41ad8ed2a8ff1bca..f9c86c475bbdafdbd37771c6834d7376b25673ec 100644 (file)
@@ -294,8 +294,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
        printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number);
 #endif
 
-       pci_read_bridge_bases(bus);
-
        if (bus->number == 0) {
                struct pci_dev *dev;
                list_for_each_entry(dev, &bus->devices, bus_list) {
index 7cc3be9fa7c65a0dd700dfd30c04cc7be822922d..d89b6013c9412c7f2ef5d72a3a5f9710f7544d3e 100644 (file)
@@ -533,10 +533,9 @@ void pcibios_fixup_bus(struct pci_bus *b)
 {
        struct pci_dev *dev;
 
-       if (b->self) {
-               pci_read_bridge_bases(b);
+       if (b->self)
                pcibios_fixup_bridge_resources(b->self);
-       }
+
        list_for_each_entry(dev, &b->devices, bus_list)
                pcibios_fixup_device_resources(dev);
        platform_pci_fixup_bus(b);
index ae838ed5fcf2535ca5c047a2837adadc434735cd..6b8b75266801aaf25fe509985d2a5edd66ed3e8c 100644 (file)
@@ -863,14 +863,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus)
 
 void pcibios_fixup_bus(struct pci_bus *bus)
 {
-       /* When called from the generic PCI probe, read PCI<->PCI bridge
-        * bases. This is -not- called when generating the PCI tree from
-        * the OF device-tree.
-        */
-       if (bus->self != NULL)
-               pci_read_bridge_bases(bus);
-
-       /* Now fixup the bus bus */
+       /* Fixup the bus */
        pcibios_setup_bus_self(bus);
 
        /* Now fixup devices on that bus */
index b8a0bf5766f2efb64380ae3dedddca3b4782da03..c6996cf67a5c83e91e465d7d03e25c3ff7d3c89d 100644 (file)
@@ -311,12 +311,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
 
 void pcibios_fixup_bus(struct pci_bus *bus)
 {
-       struct pci_dev *dev = bus->self;
-
-       if (pci_has_flag(PCI_PROBE_ONLY) && dev &&
-           (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
-               pci_read_bridge_bases(bus);
-       }
 }
 
 EXPORT_SYMBOL(PCIBIOS_MIN_IO);
index b5b036f64275b0fe0176132b74f4715f185f7503..b7ab8378964ce5e9ca55acdd869d249f18a3d49b 100644 (file)
@@ -183,18 +183,16 @@ static int __init pcibios_assign_resources(void)
        struct pci_dev *dev = NULL;
        struct resource *r;
 
-       if (!(pci_probe & PCI_ASSIGN_ROMS)) {
-               /* Try to use BIOS settings for ROMs, otherwise let
-                  pci_assign_unassigned_resources() allocate the new
-                  addresses. */
-               for_each_pci_dev(dev) {
-                       r = &dev->resource[PCI_ROM_RESOURCE];
-                       if (!r->flags || !r->start)
-                               continue;
-                       if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) {
-                               r->end -= r->start;
-                               r->start = 0;
-                       }
+       /* Try to use BIOS settings for ROMs, otherwise let
+          pci_assign_unassigned_resources() allocate the new
+          addresses. */
+       for_each_pci_dev(dev) {
+               r = &dev->resource[PCI_ROM_RESOURCE];
+               if (!r->flags || !r->start)
+                       continue;
+               if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) {
+                       r->end -= r->start;
+                       r->start = 0;
                }
        }
 
index 9e17aca5a2a19871d939d697a3688b454fcda578..96c484b12226566999248042c6182eb9a4af66d4 100644 (file)
 #define DBG(x...)
 #endif
 
-#define PCI_PROBE_BIOS 1
-#define PCI_PROBE_CONF1 2
-#define PCI_PROBE_CONF2 4
-#define PCI_NO_CHECKS 0x400
-#define PCI_ASSIGN_ROMS 0x1000
-#define PCI_BIOS_IRQ_SCAN 0x2000
-
 extern unsigned int pci_probe;
 
 /* pci-asb2305.c */
index 3dfe2d31c67b20971701cac89565af0531dec878..deaa893efba5969a92aed92e6c230f2e00658e6f 100644 (file)
@@ -324,7 +324,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
        struct pci_dev *dev;
 
        if (bus->self) {
-               pci_read_bridge_bases(bus);
                pcibios_fixup_bridge_resources(bus->self);
        }
 
index b9de34d44fcb877c388bcb54c98cc82bfb2ac3f2..02c1d5dcee4d8c10b0bf00d1f466bb1256725767 100644 (file)
@@ -1044,13 +1044,7 @@ void pcibios_set_master(struct pci_dev *dev)
 
 void pcibios_fixup_bus(struct pci_bus *bus)
 {
-       /* When called from the generic PCI probe, read PCI<->PCI bridge
-        * bases. This is -not- called when generating the PCI tree from
-        * the OF device-tree.
-        */
-       pci_read_bridge_bases(bus);
-
-       /* Now fixup the bus bus */
+       /* Fixup the bus */
        pcibios_setup_bus_self(bus);
 
        /* Now fixup devices on that bus */
index cbf763b3015eb6ccb50608f5f53efc909ed60570..0288efc17ff3787c53bbfdf41e7f0f8492a4bd16 100644 (file)
 
 #include <asm/io.h>
 
-/* startup values */
-#define PCI_PROBE_BIOS         1
-#define PCI_PROBE_CONF1                2
-#define PCI_PROBE_CONF2                4
-#define PCI_NO_CHECKS          0x400
-#define PCI_ASSIGN_ROMS                0x1000
-#define PCI_BIOS_IRQ_SCAN      0x2000
-
 #define SH4_PCICR              0x100           /* PCI Control Register */
   #define SH4_PCICR_PREFIX       0xA5000000    /* CR prefix for write */
   #define SH4_PCICR_FTO                  0x00000400    /* TRDY/IRDY Enable */
index 164e3f8d3c3dbb6eb4fc0ea60e01cae15fe5116e..fa1195dae42541aaa1d836782a3a65aa25640e74 100644 (file)
@@ -93,8 +93,6 @@ extern raw_spinlock_t pci_config_lock;
 extern int (*pcibios_enable_irq)(struct pci_dev *dev);
 extern void (*pcibios_disable_irq)(struct pci_dev *dev);
 
-extern bool mp_should_keep_irq(struct device *dev);
-
 struct pci_raw_ops {
        int (*read)(unsigned int domain, unsigned int bus, unsigned int devfn,
                                                int reg, int len, u32 *val);
index 8fd6f44aee8370958076fb4a8af3e13a2781fe33..09d3afc0a181c1ac44ca654f9fde35796dbe3843 100644 (file)
@@ -166,7 +166,6 @@ void pcibios_fixup_bus(struct pci_bus *b)
 {
        struct pci_dev *dev;
 
-       pci_read_bridge_bases(b);
        list_for_each_entry(dev, &b->devices, bus_list)
                pcibios_fixup_device_resources(dev);
 }
@@ -673,24 +672,22 @@ int pcibios_add_device(struct pci_dev *dev)
        return 0;
 }
 
-int pcibios_enable_device(struct pci_dev *dev, int mask)
+int pcibios_alloc_irq(struct pci_dev *dev)
 {
-       int err;
-
-       if ((err = pci_enable_resources(dev, mask)) < 0)
-               return err;
-
-       if (!pci_dev_msi_enabled(dev))
-               return pcibios_enable_irq(dev);
-       return 0;
+       return pcibios_enable_irq(dev);
 }
 
-void pcibios_disable_device (struct pci_dev *dev)
+void pcibios_free_irq(struct pci_dev *dev)
 {
-       if (!pci_dev_msi_enabled(dev) && pcibios_disable_irq)
+       if (pcibios_disable_irq)
                pcibios_disable_irq(dev);
 }
 
+int pcibios_enable_device(struct pci_dev *dev, int mask)
+{
+       return pci_enable_resources(dev, mask);
+}
+
 int pci_ext_cfg_avail(void)
 {
        if (raw_pci_ext_ops)
index 9a2b7101ae8af6d402f15c66831bcd15b7790325..e58565556703bfc781e29f4e387cbd0e2ea1ced8 100644 (file)
@@ -62,19 +62,6 @@ static void pci_fixup_umc_ide(struct pci_dev *d)
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, pci_fixup_umc_ide);
 
-static void pci_fixup_ncr53c810(struct pci_dev *d)
-{
-       /*
-        * NCR 53C810 returns class code 0 (at least on some systems).
-        * Fix class to be PCI_CLASS_STORAGE_SCSI
-        */
-       if (!d->class) {
-               dev_warn(&d->dev, "Fixing NCR 53C810 class code\n");
-               d->class = PCI_CLASS_STORAGE_SCSI << 8;
-       }
-}
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, pci_fixup_ncr53c810);
-
 static void pci_fixup_latency(struct pci_dev *d)
 {
        /*
index 27062303c88135b5d614455ed372861516903e53..22aaefb4f1cadf5bc136b4a72af08939fc4aae30 100644 (file)
@@ -211,7 +211,7 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
        struct irq_alloc_info info;
        int polarity;
 
-       if (dev->irq_managed && dev->irq > 0)
+       if (pci_has_managed_irq(dev))
                return 0;
 
        if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER)
@@ -234,10 +234,13 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
 
 static void intel_mid_pci_irq_disable(struct pci_dev *dev)
 {
-       if (!mp_should_keep_irq(&dev->dev) && dev->irq_managed &&
-           dev->irq > 0) {
+       if (pci_has_managed_irq(dev)) {
                mp_unmap_irq(dev->irq);
                dev->irq_managed = 0;
+               /*
+                * Don't reset dev->irq here, otherwise
+                * intel_mid_pci_irq_enable() will fail on next call.
+                */
        }
 }
 
index 9bd115484745703791c6515b289938546d2478ab..32e70343e6fdd0e58ab80644284dd01000dccd82 100644 (file)
@@ -1202,7 +1202,7 @@ static int pirq_enable_irq(struct pci_dev *dev)
                        struct pci_dev *temp_dev;
                        int irq;
 
-                       if (dev->irq_managed && dev->irq > 0)
+                       if (pci_has_managed_irq(dev))
                                return 0;
 
                        irq = IO_APIC_get_PCI_irq_vector(dev->bus->number,
@@ -1230,8 +1230,7 @@ static int pirq_enable_irq(struct pci_dev *dev)
                        }
                        dev = temp_dev;
                        if (irq >= 0) {
-                               dev->irq_managed = 1;
-                               dev->irq = irq;
+                               pci_set_managed_irq(dev, irq);
                                dev_info(&dev->dev, "PCI->APIC IRQ transform: "
                                         "INT %c -> IRQ %d\n", 'A' + pin - 1, irq);
                                return 0;
@@ -1257,24 +1256,10 @@ static int pirq_enable_irq(struct pci_dev *dev)
        return 0;
 }
 
-bool mp_should_keep_irq(struct device *dev)
-{
-       if (dev->power.is_prepared)
-               return true;
-#ifdef CONFIG_PM
-       if (dev->power.runtime_status == RPM_SUSPENDING)
-               return true;
-#endif
-
-       return false;
-}
-
 static void pirq_disable_irq(struct pci_dev *dev)
 {
-       if (io_apic_assign_pci_irqs && !mp_should_keep_irq(&dev->dev) &&
-           dev->irq_managed && dev->irq) {
+       if (io_apic_assign_pci_irqs && pci_has_managed_irq(dev)) {
                mp_unmap_irq(dev->irq);
-               dev->irq = 0;
-               dev->irq_managed = 0;
+               pci_reset_managed_irq(dev);
        }
 }
index b848cc3dc913d8de7dc5181fc140a9f83215e6cf..d27b4dcf221f8904e34198474d396c77b1034bb6 100644 (file)
@@ -210,10 +210,6 @@ subsys_initcall(pcibios_init);
 
 void pcibios_fixup_bus(struct pci_bus *bus)
 {
-       if (bus->parent) {
-               /* This is a subordinate bridge */
-               pci_read_bridge_bases(bus);
-       }
 }
 
 void pcibios_set_master(struct pci_dev *dev)
index 304eccb0ae5cf32042885ceebb4f1feeae98adce..afa16c557c170139abf5069a9b1c54b4550268b6 100644 (file)
@@ -412,7 +412,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
                return 0;
        }
 
-       if (dev->irq_managed && dev->irq > 0)
+       if (pci_has_managed_irq(dev))
                return 0;
 
        entry = acpi_pci_irq_lookup(dev, pin);
@@ -457,8 +457,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
                kfree(entry);
                return rc;
        }
-       dev->irq = rc;
-       dev->irq_managed = 1;
+       pci_set_managed_irq(dev, rc);
 
        if (link)
                snprintf(link_desc, sizeof(link_desc), " -> Link[%s]", link);
@@ -481,17 +480,9 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
        u8 pin;
 
        pin = dev->pin;
-       if (!pin || !dev->irq_managed || dev->irq <= 0)
+       if (!pin || !pci_has_managed_irq(dev))
                return;
 
-       /* Keep IOAPIC pin configuration when suspending */
-       if (dev->dev.power.is_prepared)
-               return;
-#ifdef CONFIG_PM
-       if (dev->dev.power.runtime_status == RPM_SUSPENDING)
-               return;
-#endif
-
        entry = acpi_pci_irq_lookup(dev, pin);
        if (!entry)
                return;
@@ -511,6 +502,6 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
        dev_dbg(&dev->dev, "PCI INT %c disabled\n", pin_name(pin));
        if (gsi >= 0) {
                acpi_unregister_gsi(gsi);
-               dev->irq_managed = 0;
+               pci_reset_managed_irq(dev);
        }
 }
index a98a7b27aca1dec2cb2f53319df8a49abcf8e645..c22a5490eea7cad69a5af4a1d79711ed35334afe 100644 (file)
@@ -408,6 +408,10 @@ struct device_domain_info {
        struct list_head global; /* link to global list */
        u8 bus;                 /* PCI bus number */
        u8 devfn;               /* PCI devfn number */
+       struct {
+               u8 enabled:1;
+               u8 qdep;
+       } ats;                  /* ATS state */
        struct device *dev; /* it's NULL for PCIe-to-PCI bridge */
        struct intel_iommu *iommu; /* IOMMU used by this device */
        struct dmar_domain *domain; /* pointer to domain */
@@ -1391,19 +1395,26 @@ iommu_support_dev_iotlb (struct dmar_domain *domain, struct intel_iommu *iommu,
 
 static void iommu_enable_dev_iotlb(struct device_domain_info *info)
 {
+       struct pci_dev *pdev;
+
        if (!info || !dev_is_pci(info->dev))
                return;
 
-       pci_enable_ats(to_pci_dev(info->dev), VTD_PAGE_SHIFT);
+       pdev = to_pci_dev(info->dev);
+       if (pci_enable_ats(pdev, VTD_PAGE_SHIFT))
+               return;
+
+       info->ats.enabled = 1;
+       info->ats.qdep = pci_ats_queue_depth(pdev);
 }
 
 static void iommu_disable_dev_iotlb(struct device_domain_info *info)
 {
-       if (!info->dev || !dev_is_pci(info->dev) ||
-           !pci_ats_enabled(to_pci_dev(info->dev)))
+       if (!info->ats.enabled)
                return;
 
        pci_disable_ats(to_pci_dev(info->dev));
+       info->ats.enabled = 0;
 }
 
 static void iommu_flush_dev_iotlb(struct dmar_domain *domain,
@@ -1415,16 +1426,11 @@ static void iommu_flush_dev_iotlb(struct dmar_domain *domain,
 
        spin_lock_irqsave(&device_domain_lock, flags);
        list_for_each_entry(info, &domain->devices, link) {
-               struct pci_dev *pdev;
-               if (!info->dev || !dev_is_pci(info->dev))
-                       continue;
-
-               pdev = to_pci_dev(info->dev);
-               if (!pci_ats_enabled(pdev))
+               if (!info->ats.enabled)
                        continue;
 
                sid = info->bus << 8 | info->devfn;
-               qdep = pci_ats_queue_depth(pdev);
+               qdep = info->ats.qdep;
                qi_flush_dev_iotlb(info->iommu, sid, qdep, addr, mask);
        }
        spin_unlock_irqrestore(&device_domain_lock, flags);
@@ -2272,6 +2278,8 @@ static struct dmar_domain *dmar_insert_dev_info(struct intel_iommu *iommu,
 
        info->bus = bus;
        info->devfn = devfn;
+       info->ats.enabled = 0;
+       info->ats.qdep = 0;
        info->dev = dev;
        info->domain = domain;
        info->iommu = iommu;
index a0580afe1713a5f58db5e96da635028856200a08..baec33c4e6981ffdb19df8d767f5aff8cb72bb77 100644 (file)
@@ -560,9 +560,6 @@ dino_fixup_bus(struct pci_bus *bus)
        } else if (bus->parent) {
                int i;
 
-               pci_read_bridge_bases(bus);
-
-
                for(i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) {
                        if((bus->self->resource[i].flags & 
                            (IORESOURCE_IO | IORESOURCE_MEM)) == 0)
index dceb9ddfd99af6d754b0190fe2eb99431f64f4a6..901e1a3fa4e2689e6cfd31a01d01a80520dc3a22 100644 (file)
@@ -693,7 +693,6 @@ lba_fixup_bus(struct pci_bus *bus)
        if (bus->parent) {
                int i;
                /* PCI-PCI Bridge */
-               pci_read_bridge_bases(bus);
                for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++)
                        pci_claim_bridge_resource(bus->self, i);
        } else {
index d9b64a175990cfc4b9bc93c339ae3270b8dcb025..769f7e35f1a2efecabd75b731465e29e71a4fd62 100644 (file)
@@ -439,6 +439,56 @@ static const struct pci_vpd_ops pci_vpd_pci22_ops = {
        .release = pci_vpd_pci22_release,
 };
 
+static ssize_t pci_vpd_f0_read(struct pci_dev *dev, loff_t pos, size_t count,
+                              void *arg)
+{
+       struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn));
+       ssize_t ret;
+
+       if (!tdev)
+               return -ENODEV;
+
+       ret = pci_read_vpd(tdev, pos, count, arg);
+       pci_dev_put(tdev);
+       return ret;
+}
+
+static ssize_t pci_vpd_f0_write(struct pci_dev *dev, loff_t pos, size_t count,
+                               const void *arg)
+{
+       struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn));
+       ssize_t ret;
+
+       if (!tdev)
+               return -ENODEV;
+
+       ret = pci_write_vpd(tdev, pos, count, arg);
+       pci_dev_put(tdev);
+       return ret;
+}
+
+static const struct pci_vpd_ops pci_vpd_f0_ops = {
+       .read = pci_vpd_f0_read,
+       .write = pci_vpd_f0_write,
+       .release = pci_vpd_pci22_release,
+};
+
+static int pci_vpd_f0_dev_check(struct pci_dev *dev)
+{
+       struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn));
+       int ret = 0;
+
+       if (!tdev)
+               return -ENODEV;
+       if (!tdev->vpd || !tdev->multifunction ||
+           dev->class != tdev->class || dev->vendor != tdev->vendor ||
+           dev->device != tdev->device)
+               ret = -ENODEV;
+
+       pci_dev_put(tdev);
+       return ret;
+}
+
 int pci_vpd_pci22_init(struct pci_dev *dev)
 {
        struct pci_vpd_pci22 *vpd;
@@ -447,12 +497,21 @@ int pci_vpd_pci22_init(struct pci_dev *dev)
        cap = pci_find_capability(dev, PCI_CAP_ID_VPD);
        if (!cap)
                return -ENODEV;
+       if (dev->dev_flags & PCI_DEV_FLAGS_VPD_REF_F0) {
+               int ret = pci_vpd_f0_dev_check(dev);
+
+               if (ret)
+                       return ret;
+       }
        vpd = kzalloc(sizeof(*vpd), GFP_ATOMIC);
        if (!vpd)
                return -ENOMEM;
 
        vpd->base.len = PCI_VPD_PCI22_SIZE;
-       vpd->base.ops = &pci_vpd_pci22_ops;
+       if (dev->dev_flags & PCI_DEV_FLAGS_VPD_REF_F0)
+               vpd->base.ops = &pci_vpd_f0_ops;
+       else
+               vpd->base.ops = &pci_vpd_pci22_ops;
        mutex_init(&vpd->lock);
        vpd->cap = cap;
        vpd->busy = false;
@@ -531,6 +590,14 @@ static inline int pcie_cap_version(const struct pci_dev *dev)
        return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS;
 }
 
+static bool pcie_downstream_port(const struct pci_dev *dev)
+{
+       int type = pci_pcie_type(dev);
+
+       return type == PCI_EXP_TYPE_ROOT_PORT ||
+              type == PCI_EXP_TYPE_DOWNSTREAM;
+}
+
 bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
 {
        int type = pci_pcie_type(dev);
@@ -546,10 +613,7 @@ bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
 
 static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev)
 {
-       int type = pci_pcie_type(dev);
-
-       return (type == PCI_EXP_TYPE_ROOT_PORT ||
-               type == PCI_EXP_TYPE_DOWNSTREAM) &&
+       return pcie_downstream_port(dev) &&
               pcie_caps_reg(dev) & PCI_EXP_FLAGS_SLOT;
 }
 
@@ -628,10 +692,9 @@ int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val)
         * State bit in the Slot Status register of Downstream Ports,
         * which must be hardwired to 1b.  (PCIe Base Spec 3.0, sec 7.8)
         */
-       if (pci_is_pcie(dev) && pos == PCI_EXP_SLTSTA &&
-                pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM) {
+       if (pci_is_pcie(dev) && pcie_downstream_port(dev) &&
+           pos == PCI_EXP_SLTSTA)
                *val = PCI_EXP_SLTSTA_PDS;
-       }
 
        return 0;
 }
@@ -657,10 +720,9 @@ int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val)
                return ret;
        }
 
-       if (pci_is_pcie(dev) && pos == PCI_EXP_SLTCTL &&
-                pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM) {
+       if (pci_is_pcie(dev) && pcie_downstream_port(dev) &&
+           pos == PCI_EXP_SLTSTA)
                *val = PCI_EXP_SLTSTA_PDS;
-       }
 
        return 0;
 }
index a8099d4d0c9ddb335e80fddabdf1d0a2daa04e53..eeb9fb2b47aa07f01381a7cd82b2c73f93206fed 100644 (file)
 
 #include "pci.h"
 
-static int ats_alloc_one(struct pci_dev *dev, int ps)
+void pci_ats_init(struct pci_dev *dev)
 {
        int pos;
-       u16 cap;
-       struct pci_ats *ats;
 
        pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS);
        if (!pos)
-               return -ENODEV;
-
-       ats = kzalloc(sizeof(*ats), GFP_KERNEL);
-       if (!ats)
-               return -ENOMEM;
-
-       ats->pos = pos;
-       ats->stu = ps;
-       pci_read_config_word(dev, pos + PCI_ATS_CAP, &cap);
-       ats->qdep = PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) :
-                                           PCI_ATS_MAX_QDEP;
-       dev->ats = ats;
-
-       return 0;
-}
+               return;
 
-static void ats_free_one(struct pci_dev *dev)
-{
-       kfree(dev->ats);
-       dev->ats = NULL;
+       dev->ats_cap = pos;
 }
 
 /**
@@ -56,43 +37,36 @@ static void ats_free_one(struct pci_dev *dev)
  */
 int pci_enable_ats(struct pci_dev *dev, int ps)
 {
-       int rc;
        u16 ctrl;
+       struct pci_dev *pdev;
 
-       BUG_ON(dev->ats && dev->ats->is_enabled);
-
-       if (ps < PCI_ATS_MIN_STU)
+       if (!dev->ats_cap)
                return -EINVAL;
 
-       if (dev->is_physfn || dev->is_virtfn) {
-               struct pci_dev *pdev = dev->is_physfn ? dev : dev->physfn;
-
-               mutex_lock(&pdev->sriov->lock);
-               if (pdev->ats)
-                       rc = pdev->ats->stu == ps ? 0 : -EINVAL;
-               else
-                       rc = ats_alloc_one(pdev, ps);
-
-               if (!rc)
-                       pdev->ats->ref_cnt++;
-               mutex_unlock(&pdev->sriov->lock);
-               if (rc)
-                       return rc;
-       }
+       if (WARN_ON(dev->ats_enabled))
+               return -EBUSY;
 
-       if (!dev->is_physfn) {
-               rc = ats_alloc_one(dev, ps);
-               if (rc)
-                       return rc;
-       }
+       if (ps < PCI_ATS_MIN_STU)
+               return -EINVAL;
 
+       /*
+        * Note that enabling ATS on a VF fails unless it's already enabled
+        * with the same STU on the PF.
+        */
        ctrl = PCI_ATS_CTRL_ENABLE;
-       if (!dev->is_virtfn)
-               ctrl |= PCI_ATS_CTRL_STU(ps - PCI_ATS_MIN_STU);
-       pci_write_config_word(dev, dev->ats->pos + PCI_ATS_CTRL, ctrl);
-
-       dev->ats->is_enabled = 1;
+       if (dev->is_virtfn) {
+               pdev = pci_physfn(dev);
+               if (pdev->ats_stu != ps)
+                       return -EINVAL;
+
+               atomic_inc(&pdev->ats_ref_cnt);  /* count enabled VFs */
+       } else {
+               dev->ats_stu = ps;
+               ctrl |= PCI_ATS_CTRL_STU(dev->ats_stu - PCI_ATS_MIN_STU);
+       }
+       pci_write_config_word(dev, dev->ats_cap + PCI_ATS_CTRL, ctrl);
 
+       dev->ats_enabled = 1;
        return 0;
 }
 EXPORT_SYMBOL_GPL(pci_enable_ats);
@@ -103,28 +77,25 @@ EXPORT_SYMBOL_GPL(pci_enable_ats);
  */
 void pci_disable_ats(struct pci_dev *dev)
 {
+       struct pci_dev *pdev;
        u16 ctrl;
 
-       BUG_ON(!dev->ats || !dev->ats->is_enabled);
-
-       pci_read_config_word(dev, dev->ats->pos + PCI_ATS_CTRL, &ctrl);
-       ctrl &= ~PCI_ATS_CTRL_ENABLE;
-       pci_write_config_word(dev, dev->ats->pos + PCI_ATS_CTRL, ctrl);
-
-       dev->ats->is_enabled = 0;
+       if (WARN_ON(!dev->ats_enabled))
+               return;
 
-       if (dev->is_physfn || dev->is_virtfn) {
-               struct pci_dev *pdev = dev->is_physfn ? dev : dev->physfn;
+       if (atomic_read(&dev->ats_ref_cnt))
+               return;         /* VFs still enabled */
 
-               mutex_lock(&pdev->sriov->lock);
-               pdev->ats->ref_cnt--;
-               if (!pdev->ats->ref_cnt)
-                       ats_free_one(pdev);
-               mutex_unlock(&pdev->sriov->lock);
+       if (dev->is_virtfn) {
+               pdev = pci_physfn(dev);
+               atomic_dec(&pdev->ats_ref_cnt);
        }
 
-       if (!dev->is_physfn)
-               ats_free_one(dev);
+       pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CTRL, &ctrl);
+       ctrl &= ~PCI_ATS_CTRL_ENABLE;
+       pci_write_config_word(dev, dev->ats_cap + PCI_ATS_CTRL, ctrl);
+
+       dev->ats_enabled = 0;
 }
 EXPORT_SYMBOL_GPL(pci_disable_ats);
 
@@ -132,16 +103,13 @@ void pci_restore_ats_state(struct pci_dev *dev)
 {
        u16 ctrl;
 
-       if (!pci_ats_enabled(dev))
+       if (!dev->ats_enabled)
                return;
-       if (!pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS))
-               BUG();
 
        ctrl = PCI_ATS_CTRL_ENABLE;
        if (!dev->is_virtfn)
-               ctrl |= PCI_ATS_CTRL_STU(dev->ats->stu - PCI_ATS_MIN_STU);
-
-       pci_write_config_word(dev, dev->ats->pos + PCI_ATS_CTRL, ctrl);
+               ctrl |= PCI_ATS_CTRL_STU(dev->ats_stu - PCI_ATS_MIN_STU);
+       pci_write_config_word(dev, dev->ats_cap + PCI_ATS_CTRL, ctrl);
 }
 EXPORT_SYMBOL_GPL(pci_restore_ats_state);
 
@@ -159,23 +127,16 @@ EXPORT_SYMBOL_GPL(pci_restore_ats_state);
  */
 int pci_ats_queue_depth(struct pci_dev *dev)
 {
-       int pos;
        u16 cap;
 
+       if (!dev->ats_cap)
+               return -EINVAL;
+
        if (dev->is_virtfn)
                return 0;
 
-       if (dev->ats)
-               return dev->ats->qdep;
-
-       pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS);
-       if (!pos)
-               return -ENODEV;
-
-       pci_read_config_word(dev, pos + PCI_ATS_CAP, &cap);
-
-       return PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) :
-                                      PCI_ATS_MAX_QDEP;
+       pci_read_config_word(dev, dev->ats_cap + PCI_ATS_CAP, &cap);
+       return PCI_ATS_CAP_QDEP(cap) ? PCI_ATS_CAP_QDEP(cap) : PCI_ATS_MAX_QDEP;
 }
 EXPORT_SYMBOL_GPL(pci_ats_queue_depth);
 
index 80db09e47800dffb017d64177fe00775539d27b0..1a0d124b199aa3f8198f19a0408cbe0438a2dd21 100644 (file)
@@ -155,7 +155,6 @@ static int dra7xx_pcie_intx_map(struct irq_domain *domain, unsigned int irq,
 {
        irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq);
        irq_set_chip_data(irq, domain->host_data);
-       set_irq_flags(irq, IRQF_VALID);
 
        return 0;
 }
index f34892e0edb4f973e4dd3e9ab39b24cf0c2f0716..f1d0749ebbf066d99e02c73a8c609aaf55b4baa4 100644 (file)
@@ -196,7 +196,6 @@ static int ks_dw_pcie_msi_map(struct irq_domain *domain, unsigned int irq,
        irq_set_chip_and_handler(irq, &ks_dw_pcie_msi_irq_chip,
                                 handle_level_irq);
        irq_set_chip_data(irq, domain->host_data);
-       set_irq_flags(irq, IRQF_VALID);
 
        return 0;
 }
@@ -277,7 +276,6 @@ static int ks_dw_pcie_init_legacy_irq_map(struct irq_domain *d,
        irq_set_chip_and_handler(irq, &ks_dw_pcie_legacy_irq_chip,
                                 handle_level_irq);
        irq_set_chip_data(irq, d->host_data);
-       set_irq_flags(irq, IRQF_VALID);
 
        return 0;
 }
index 10c05718dbfdcb27c31617b6b6ea725ff9d437d7..81df0c1fe063ff164aef16eb2cfc449539a8a107 100644 (file)
@@ -1248,7 +1248,6 @@ static int tegra_msi_map(struct irq_domain *domain, unsigned int irq,
 {
        irq_set_chip_and_handler(irq, &tegra_msi_irq_chip, handle_simple_irq);
        irq_set_chip_data(irq, domain->host_data);
-       set_irq_flags(irq, IRQF_VALID);
 
        tegra_cpuidle_pcie_irqs_in_use();
 
index 2d31d4d6fd08dffa41adad3f887b1b130585ff63..398c9bfe13a92166f747d67fcc676eb42eadeec3 100644 (file)
@@ -223,7 +223,6 @@ static int xgene_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
        irq_domain_set_info(domain, virq, msi_irq,
                            &xgene_msi_bottom_irq_chip, domain->host_data,
                            handle_simple_irq, NULL, NULL);
-       set_irq_flags(virq, IRQF_VALID);
 
        return 0;
 }
@@ -582,7 +581,6 @@ error:
 static struct platform_driver xgene_msi_driver = {
        .driver = {
                .name = "xgene-msi",
-               .owner = THIS_MODULE,
                .of_match_table = xgene_msi_match_table,
        },
        .probe = xgene_msi_probe,
index a9dfb70d623ae0acbb54d96ada58a68ecc3074fe..55fe86548d77a9be11763c8b0689e595b6568499 100644 (file)
@@ -321,8 +321,16 @@ static int xgene_pcie_map_ranges(struct xgene_pcie_port *port,
                                return ret;
                        break;
                case IORESOURCE_MEM:
-                       xgene_pcie_setup_ob_reg(port, res, OMR1BARL, res->start,
-                                               res->start - window->offset);
+                       if (res->flags & IORESOURCE_PREFETCH)
+                               xgene_pcie_setup_ob_reg(port, res, OMR2BARL,
+                                                       res->start,
+                                                       res->start -
+                                                       window->offset);
+                       else
+                               xgene_pcie_setup_ob_reg(port, res, OMR1BARL,
+                                                       res->start,
+                                                       res->start -
+                                                       window->offset);
                        break;
                case IORESOURCE_BUS:
                        break;
index 69486be7181e18287a8a8bd421055b902233e3c4..308957f09873c298c042a0fb491b5b13ad4a7328 100644 (file)
@@ -350,7 +350,6 @@ static int dw_pcie_msi_map(struct irq_domain *domain, unsigned int irq,
 {
        irq_set_chip_and_handler(irq, &dw_msi_irq_chip, handle_simple_irq);
        irq_set_chip_data(irq, domain->host_data);
-       set_irq_flags(irq, IRQF_VALID);
 
        return 0;
 }
@@ -388,7 +387,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
                addrp = of_get_address(np, index, NULL, NULL);
                pp->cfg0_mod_base = of_read_number(addrp, ns);
                pp->cfg1_mod_base = pp->cfg0_mod_base + pp->cfg0_size;
-       } else {
+       } else if (!pp->va_cfg0_base) {
                dev_err(pp->dev, "missing *config* reg space\n");
        }
 
index c086210f2ffd1d0962ff253e98d06946e4236e89..7678fe0820d712d00fe189e8bf3d0651d4277ae9 100644 (file)
@@ -664,7 +664,6 @@ static int rcar_msi_map(struct irq_domain *domain, unsigned int irq,
 {
        irq_set_chip_and_handler(irq, &rcar_msi_irq_chip, handle_simple_irq);
        irq_set_chip_data(irq, domain->host_data);
-       set_irq_flags(irq, IRQF_VALID);
 
        return 0;
 }
index f1a06a091ccb578359656b1d9c4b32c0e99b2d99..0e1f480b9db4ef1c85a1c54f22456ed55ab0761d 100644 (file)
@@ -338,7 +338,6 @@ static int xilinx_pcie_msi_map(struct irq_domain *domain, unsigned int irq,
 {
        irq_set_chip_and_handler(irq, &xilinx_msi_irq_chip, handle_simple_irq);
        irq_set_chip_data(irq, domain->host_data);
-       set_irq_flags(irq, IRQF_VALID);
 
        return 0;
 }
@@ -377,7 +376,6 @@ static int xilinx_pcie_intx_map(struct irq_domain *domain, unsigned int irq,
 {
        irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq);
        irq_set_chip_data(irq, domain->host_data);
-       set_irq_flags(irq, IRQF_VALID);
 
        return 0;
 }
@@ -449,14 +447,17 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
                        return IRQ_HANDLED;
                }
 
-               /* Clear interrupt FIFO register 1 */
-               pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK,
-                          XILINX_PCIE_REG_RPIFR1);
+               if (!(val & XILINX_PCIE_RPIFR1_MSI_INTR)) {
+                       /* Clear interrupt FIFO register 1 */
+                       pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK,
+                                  XILINX_PCIE_REG_RPIFR1);
 
-               /* Handle INTx Interrupt */
-               val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
-                       XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
-               generic_handle_irq(irq_find_mapping(port->irq_domain, val));
+                       /* Handle INTx Interrupt */
+                       val = ((val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
+                               XILINX_PCIE_RPIFR1_INTR_SHIFT) + 1;
+                       generic_handle_irq(irq_find_mapping(port->irq_domain,
+                                                           val));
+               }
        }
 
        if (status & XILINX_PCIE_INTR_MSI) {
index f66be868ad2122efdb40e742f8ecb9fc43cbc508..bb74238c0cb6736394783fdfe275107b2e464b1f 100644 (file)
@@ -665,6 +665,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec)
        pci_msi_set_enable(dev, 1);
        dev->msi_enabled = 1;
 
+       pcibios_free_irq(dev);
        dev->irq = entry->irq;
        return 0;
 }
@@ -792,9 +793,9 @@ static int msix_capability_init(struct pci_dev *dev,
        /* Set MSI-X enabled bits and unmask the function */
        pci_intx_for_msi(dev, 0);
        dev->msix_enabled = 1;
-
        pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL, 0);
 
+       pcibios_free_irq(dev);
        return 0;
 
 out_avail:
@@ -909,6 +910,7 @@ void pci_msi_shutdown(struct pci_dev *dev)
 
        /* Restore dev->irq to its default pin-assertion irq */
        dev->irq = desc->msi_attrib.default_irq;
+       pcibios_alloc_irq(dev);
 }
 
 void pci_disable_msi(struct pci_dev *dev)
@@ -1009,6 +1011,7 @@ void pci_msix_shutdown(struct pci_dev *dev)
        pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0);
        pci_intx_for_msi(dev, 1);
        dev->msix_enabled = 0;
+       pcibios_alloc_irq(dev);
 }
 
 void pci_disable_msix(struct pci_dev *dev)
index 314a625b78d6360093eff3be221ffc04193b771e..a32ba753e4135862825c60690f83f1f9b145fa07 100644 (file)
@@ -594,7 +594,7 @@ static struct acpi_device *acpi_pci_find_companion(struct device *dev)
 /**
  * pci_acpi_optimize_delay - optimize PCI D3 and D3cold delay from ACPI
  * @pdev: the PCI device whose delay is to be updated
- * @adev: the companion ACPI device of this PCI device
+ * @handle: ACPI handle of this device
  *
  * Update the d3_delay and d3cold_delay of a PCI device from the ACPI _DSM
  * control method of either the device itself or the PCI host bridge.
index 3cb2210de5530e3edffd3286df3a66f455f6b2ec..52a880ca1768362ec41399e8df11c3504a28a107 100644 (file)
@@ -388,18 +388,31 @@ static int __pci_device_probe(struct pci_driver *drv, struct pci_dev *pci_dev)
        return error;
 }
 
+int __weak pcibios_alloc_irq(struct pci_dev *dev)
+{
+       return 0;
+}
+
+void __weak pcibios_free_irq(struct pci_dev *dev)
+{
+}
+
 static int pci_device_probe(struct device *dev)
 {
-       int error = 0;
-       struct pci_driver *drv;
-       struct pci_dev *pci_dev;
+       int error;
+       struct pci_dev *pci_dev = to_pci_dev(dev);
+       struct pci_driver *drv = to_pci_driver(dev->driver);
+
+       error = pcibios_alloc_irq(pci_dev);
+       if (error < 0)
+               return error;
 
-       drv = to_pci_driver(dev->driver);
-       pci_dev = to_pci_dev(dev);
        pci_dev_get(pci_dev);
        error = __pci_device_probe(drv, pci_dev);
-       if (error)
+       if (error) {
+               pcibios_free_irq(pci_dev);
                pci_dev_put(pci_dev);
+       }
 
        return error;
 }
@@ -415,6 +428,7 @@ static int pci_device_remove(struct device *dev)
                        drv->remove(pci_dev);
                        pm_runtime_put_noidle(dev);
                }
+               pcibios_free_irq(pci_dev);
                pci_dev->driver = NULL;
        }
 
index 0008c950452c31e71f8f591354449980893e58f6..8037c27beb05c940db3a6af9fab1473a1e03ebdc 100644 (file)
@@ -140,7 +140,6 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
 EXPORT_SYMBOL_GPL(pci_ioremap_bar);
 #endif
 
-#define PCI_FIND_CAP_TTL       48
 
 static int __pci_find_next_cap_ttl(struct pci_bus *bus, unsigned int devfn,
                                   u8 pos, int cap, int *ttl)
@@ -196,8 +195,6 @@ static int __pci_bus_find_cap_start(struct pci_bus *bus,
                return PCI_CAPABILITY_LIST;
        case PCI_HEADER_TYPE_CARDBUS:
                return PCI_CB_CAPABILITY_LIST;
-       default:
-               return 0;
        }
 
        return 0;
@@ -972,7 +969,7 @@ static int pci_save_pcix_state(struct pci_dev *dev)
        struct pci_cap_saved_state *save_state;
 
        pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
-       if (pos <= 0)
+       if (!pos)
                return 0;
 
        save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX);
@@ -995,7 +992,7 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
 
        save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX);
        pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
-       if (!save_state || pos <= 0)
+       if (!save_state || !pos)
                return;
        cap = (u16 *)&save_state->cap.data[0];
 
@@ -1092,6 +1089,9 @@ void pci_restore_state(struct pci_dev *dev)
 
        pci_restore_pcix_state(dev);
        pci_restore_msi_state(dev);
+
+       /* Restore ACS and IOV configuration state */
+       pci_enable_acs(dev);
        pci_restore_iov_state(dev);
 
        dev->state_saved = false;
@@ -2159,7 +2159,7 @@ static int _pci_add_cap_save_buffer(struct pci_dev *dev, u16 cap,
        else
                pos = pci_find_capability(dev, cap);
 
-       if (pos <= 0)
+       if (!pos)
                return 0;
 
        save_state = kzalloc(sizeof(*save_state) + size, GFP_KERNEL);
index 4ff0ff1c4088ff68f8ca7bb515e54ad382e74680..24ba9dc8910a2ccf7c8735d7c8601e147ad13cb1 100644 (file)
@@ -4,6 +4,8 @@
 #define PCI_CFG_SPACE_SIZE     256
 #define PCI_CFG_SPACE_EXP_SIZE 4096
 
+#define PCI_FIND_CAP_TTL       48
+
 extern const unsigned char pcie_link_speed[];
 
 bool pcie_cap_has_lnkctl(const struct pci_dev *dev);
index 2f0ce668a775eda0ccc15ea6bbfeea133ac6c823..88122dc2e1b1375f1715f8b8ca431673cee8d3e9 100644 (file)
@@ -448,7 +448,7 @@ static int resume_iter(struct device *dev, void *data)
 }
 
 /**
- * pcie_port_device_suspend - resume port services associated with a PCIe port
+ * pcie_port_device_resume - resume port services associated with a PCIe port
  * @dev: PCI Express port to handle
  */
 int pcie_port_device_resume(struct device *dev)
index 2a9ce16cb374736f6ceb2d4d54eced71b2983b5b..51ebb9783f5e0b30a4cac63ce754f86d7fb4b292 100644 (file)
@@ -826,6 +826,9 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
                        child->bridge_ctl = bctl;
                }
 
+               /* Read and initialize bridge resources */
+               pci_read_bridge_bases(child);
+
                cmax = pci_scan_child_bus(child);
                if (cmax > subordinate)
                        dev_warn(&dev->dev, "bridge has subordinate %02x but max busn %02x\n",
@@ -886,6 +889,9 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
 
                if (!is_cardbus) {
                        child->bridge_ctl = bctl;
+
+                       /* Read and initialize bridge resources */
+                       pci_read_bridge_bases(child);
                        max = pci_scan_child_bus(child);
                } else {
                        /*
@@ -1264,7 +1270,7 @@ int pci_setup_device(struct pci_dev *dev)
        bad:
                dev_err(&dev->dev, "ignoring class %#08x (doesn't match header type %02x)\n",
                        dev->class, dev->hdr_type);
-               dev->class = PCI_CLASS_NOT_DEFINED;
+               dev->class = PCI_CLASS_NOT_DEFINED << 8;
        }
 
        /* We found a fine healthy device, go go go... */
@@ -1536,6 +1542,9 @@ static void pci_init_capabilities(struct pci_dev *dev)
        /* Single Root I/O Virtualization */
        pci_iov_init(dev);
 
+       /* Address Translation Services */
+       pci_ats_init(dev);
+
        /* Enable ACS P2P upstream forwarding */
        pci_enable_acs(dev);
 }
index e9fd0e90fa3b5c6656f7d8939a522add97c29b06..7741250f109595904255322b6391b7522894ef9a 100644 (file)
@@ -163,7 +163,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,        PCI_DEVICE_ID_INTEL_82439TX,    quirk_
  *     VIA Apollo KT133 needs PCI latency patch
  *     Made according to a windows driver based patch by George E. Breese
  *     see PCI Latency Adjust on http://www.viahardware.com/download/viatweak.shtm
- *     and http://www.georgebreese.com/net/software/#PCI
  *     Also see http://www.au-ja.org/review-kt133a-1-en.phtml for
  *     the info on which Mr Breese based his work.
  *
@@ -424,10 +423,12 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI,        PCI_DEVICE_ID_ATI_RS100,   quirk_ati_
  */
 static void quirk_amd_nl_class(struct pci_dev *pdev)
 {
-       /*
-        * Use 'USB Device' (0x0c03fe) instead of PCI header provided
-        */
-       pdev->class = 0x0c03fe;
+       u32 class = pdev->class;
+
+       /* Use "USB Device (not host controller)" class */
+       pdev->class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe;
+       dev_info(&pdev->dev, "PCI class overridden (%#08x -> %#08x) so dwc3 driver can claim this instead of xhci\n",
+                class, pdev->class);
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB,
                quirk_amd_nl_class);
@@ -1894,6 +1895,15 @@ static void quirk_netmos(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID,
                         PCI_CLASS_COMMUNICATION_SERIAL, 8, quirk_netmos);
 
+static void quirk_f0_vpd_link(struct pci_dev *dev)
+{
+       if (!dev->multifunction || !PCI_FUNC(dev->devfn))
+               return;
+       dev->dev_flags |= PCI_DEV_FLAGS_VPD_REF_F0;
+}
+DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID,
+                             PCI_CLASS_NETWORK_ETHERNET, 8, quirk_f0_vpd_link);
+
 static void quirk_e100_interrupt(struct pci_dev *dev)
 {
        u16 command, pmcsr;
@@ -1986,14 +1996,18 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
 
 static void fixup_rev1_53c810(struct pci_dev *dev)
 {
-       /* rev 1 ncr53c810 chips don't set the class at all which means
+       u32 class = dev->class;
+
+       /*
+        * rev 1 ncr53c810 chips don't set the class at all which means
         * they don't get their resources remapped. Fix that here.
         */
+       if (class)
+               return;
 
-       if (dev->class == PCI_CLASS_NOT_DEFINED) {
-               dev_info(&dev->dev, "NCR 53c810 rev 1 detected; setting PCI class\n");
-               dev->class = PCI_CLASS_STORAGE_SCSI;
-       }
+       dev->class = PCI_CLASS_STORAGE_SCSI << 8;
+       dev_info(&dev->dev, "NCR 53c810 rev 1 PCI class overridden (%#08x -> %#08x)\n",
+                class, dev->class);
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);
 
@@ -2241,7 +2255,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x9601, quirk_amd_780_apc_msi);
  * return 1 if a HT MSI capability is found and enabled */
 static int msi_ht_cap_enabled(struct pci_dev *dev)
 {
-       int pos, ttl = 48;
+       int pos, ttl = PCI_FIND_CAP_TTL;
 
        pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
        while (pos && ttl--) {
@@ -2300,7 +2314,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
 /* Force enable MSI mapping capability on HT bridges */
 static void ht_enable_msi_mapping(struct pci_dev *dev)
 {
-       int pos, ttl = 48;
+       int pos, ttl = PCI_FIND_CAP_TTL;
 
        pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
        while (pos && ttl--) {
@@ -2379,7 +2393,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA,
 
 static int ht_check_msi_mapping(struct pci_dev *dev)
 {
-       int pos, ttl = 48;
+       int pos, ttl = PCI_FIND_CAP_TTL;
        int found = 0;
 
        /* check if there is HT MSI cap or enabled on this device */
@@ -2504,7 +2518,7 @@ out:
 
 static void ht_disable_msi_mapping(struct pci_dev *dev)
 {
-       int pos, ttl = 48;
+       int pos, ttl = PCI_FIND_CAP_TTL;
 
        pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
        while (pos && ttl--) {
@@ -2829,12 +2843,15 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x3c28, vtd_mask_spec_errors);
 
 static void fixup_ti816x_class(struct pci_dev *dev)
 {
+       u32 class = dev->class;
+
        /* TI 816x devices do not have class code set when in PCIe boot mode */
-       dev_info(&dev->dev, "Setting PCI class for 816x PCIe device\n");
-       dev->class = PCI_CLASS_MULTIMEDIA_VIDEO;
+       dev->class = PCI_CLASS_MULTIMEDIA_VIDEO << 8;
+       dev_info(&dev->dev, "PCI class overridden (%#08x -> %#08x)\n",
+                class, dev->class);
 }
 DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_TI, 0xb800,
-                                PCI_CLASS_NOT_DEFINED, 0, fixup_ti816x_class);
+                             PCI_CLASS_NOT_DEFINED, 8, fixup_ti816x_class);
 
 /* Some PCIe devices do not work reliably with the claimed maximum
  * payload size supported.
@@ -3028,7 +3045,16 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c26, quirk_remove_d3_delay);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c4e, quirk_remove_d3_delay);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c02, quirk_remove_d3_delay);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c22, quirk_remove_d3_delay);
-
+/* Intel Cherrytrail devices do not need 10ms d3_delay */
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2280, quirk_remove_d3_delay);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b0, quirk_remove_d3_delay);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b8, quirk_remove_d3_delay);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22d8, quirk_remove_d3_delay);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22dc, quirk_remove_d3_delay);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b5, quirk_remove_d3_delay);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b7, quirk_remove_d3_delay);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2298, quirk_remove_d3_delay);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x229c, quirk_remove_d3_delay);
 /*
  * Some devices may pass our check in pci_intx_mask_supported if
  * PCI_COMMAND_INTX_DISABLE works though they actually do not properly
@@ -3326,28 +3352,6 @@ fs_initcall_sync(pci_apply_final_quirks);
  * reset a single function if other methods (e.g. FLR, PM D0->D3) are
  * not available.
  */
-static int reset_intel_generic_dev(struct pci_dev *dev, int probe)
-{
-       int pos;
-
-       /* only implement PCI_CLASS_SERIAL_USB at present */
-       if (dev->class == PCI_CLASS_SERIAL_USB) {
-               pos = pci_find_capability(dev, PCI_CAP_ID_VNDR);
-               if (!pos)
-                       return -ENOTTY;
-
-               if (probe)
-                       return 0;
-
-               pci_write_config_byte(dev, pos + 0x4, 1);
-               msleep(100);
-
-               return 0;
-       } else {
-               return -ENOTTY;
-       }
-}
-
 static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe)
 {
        /*
@@ -3506,8 +3510,6 @@ static const struct pci_dev_reset_methods pci_dev_reset_methods[] = {
                reset_ivb_igd },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IVB_M2_VGA,
                reset_ivb_igd },
-       { PCI_VENDOR_ID_INTEL, PCI_ANY_ID,
-               reset_intel_generic_dev },
        { PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
                reset_chelsio_generic_dev },
        { 0 }
@@ -3654,6 +3656,28 @@ DECLARE_PCI_FIXUP_HEADER(0x1283, 0x8892, quirk_use_pcie_bridge_dma_alias);
 /* Intel 82801, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c49 */
 DECLARE_PCI_FIXUP_HEADER(0x8086, 0x244e, quirk_use_pcie_bridge_dma_alias);
 
+/*
+ * Intersil/Techwell TW686[4589]-based video capture cards have an empty (zero)
+ * class code.  Fix it.
+ */
+static void quirk_tw686x_class(struct pci_dev *pdev)
+{
+       u32 class = pdev->class;
+
+       /* Use "Multimedia controller" class */
+       pdev->class = (PCI_CLASS_MULTIMEDIA_OTHER << 8) | 0x01;
+       dev_info(&pdev->dev, "TW686x PCI class overridden (%#08x -> %#08x)\n",
+                class, pdev->class);
+}
+DECLARE_PCI_FIXUP_CLASS_EARLY(0x1797, 0x6864, PCI_CLASS_NOT_DEFINED, 8,
+                             quirk_tw686x_class);
+DECLARE_PCI_FIXUP_CLASS_EARLY(0x1797, 0x6865, PCI_CLASS_NOT_DEFINED, 8,
+                             quirk_tw686x_class);
+DECLARE_PCI_FIXUP_CLASS_EARLY(0x1797, 0x6868, PCI_CLASS_NOT_DEFINED, 8,
+                             quirk_tw686x_class);
+DECLARE_PCI_FIXUP_CLASS_EARLY(0x1797, 0x6869, PCI_CLASS_NOT_DEFINED, 8,
+                             quirk_tw686x_class);
+
 /*
  * AMD has indicated that the devices below do not support peer-to-peer
  * in any system where they are found in the southbridge with an AMD
@@ -3848,6 +3872,9 @@ static const struct pci_dev_acs_enabled {
        { PCI_VENDOR_ID_INTEL, 0x105F, pci_quirk_mf_endpoint_acs },
        { PCI_VENDOR_ID_INTEL, 0x1060, pci_quirk_mf_endpoint_acs },
        { PCI_VENDOR_ID_INTEL, 0x10D9, pci_quirk_mf_endpoint_acs },
+       /* I219 */
+       { PCI_VENDOR_ID_INTEL, 0x15b7, pci_quirk_mf_endpoint_acs },
+       { PCI_VENDOR_ID_INTEL, 0x15b8, pci_quirk_mf_endpoint_acs },
        /* Intel PCH root ports */
        { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_intel_pch_acs },
        { 0x19a2, 0x710, pci_quirk_mf_endpoint_acs }, /* Emulex BE3-R */
index 72031785fe1d810f186257a33e66ddb3147b9b59..57e0b8250947b099110e999246cba662684b3149 100644 (file)
@@ -3,55 +3,6 @@
 
 #include <linux/pci.h>
 
-/* Address Translation Service */
-struct pci_ats {
-       int pos;        /* capability position */
-       int stu;        /* Smallest Translation Unit */
-       int qdep;       /* Invalidate Queue Depth */
-       int ref_cnt;    /* Physical Function reference count */
-       unsigned int is_enabled:1;      /* Enable bit is set */
-};
-
-#ifdef CONFIG_PCI_ATS
-
-int pci_enable_ats(struct pci_dev *dev, int ps);
-void pci_disable_ats(struct pci_dev *dev);
-int pci_ats_queue_depth(struct pci_dev *dev);
-
-/**
- * pci_ats_enabled - query the ATS status
- * @dev: the PCI device
- *
- * Returns 1 if ATS capability is enabled, or 0 if not.
- */
-static inline int pci_ats_enabled(struct pci_dev *dev)
-{
-       return dev->ats && dev->ats->is_enabled;
-}
-
-#else /* CONFIG_PCI_ATS */
-
-static inline int pci_enable_ats(struct pci_dev *dev, int ps)
-{
-       return -ENODEV;
-}
-
-static inline void pci_disable_ats(struct pci_dev *dev)
-{
-}
-
-static inline int pci_ats_queue_depth(struct pci_dev *dev)
-{
-       return -ENODEV;
-}
-
-static inline int pci_ats_enabled(struct pci_dev *dev)
-{
-       return 0;
-}
-
-#endif /* CONFIG_PCI_ATS */
-
 #ifdef CONFIG_PCI_PRI
 
 int pci_enable_pri(struct pci_dev *pdev, u32 reqs);
index b3ba7fef291603bd1304be8a147c4f92a5839b53..5eb2bf9ff4566b0f8cfca079670d8d5531c243b0 100644 (file)
@@ -180,6 +180,8 @@ enum pci_dev_flags {
        PCI_DEV_FLAGS_NO_BUS_RESET = (__force pci_dev_flags_t) (1 << 6),
        /* Do not use PM reset even if device advertises NoSoftRst- */
        PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7),
+       /* Get VPD from function 0 VPD */
+       PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8),
 };
 
 enum pci_irq_reroute_variant {
@@ -343,6 +345,7 @@ struct pci_dev {
        unsigned int    msi_enabled:1;
        unsigned int    msix_enabled:1;
        unsigned int    ari_enabled:1;  /* ARI forwarding */
+       unsigned int    ats_enabled:1;  /* Address Translation Service */
        unsigned int    is_managed:1;
        unsigned int    needs_freset:1; /* Dev requires fundamental reset */
        unsigned int    state_saved:1;
@@ -375,7 +378,9 @@ struct pci_dev {
                struct pci_sriov *sriov;        /* SR-IOV capability related */
                struct pci_dev *physfn; /* the PF this VF is associated with */
        };
-       struct pci_ats  *ats;   /* Address Translation Service */
+       u16             ats_cap;        /* ATS Capability offset */
+       u8              ats_stu;        /* ATS Smallest Translation Unit */
+       atomic_t        ats_ref_cnt;    /* number of VFs with ATS enabled */
 #endif
        phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */
        size_t romlen; /* Length of ROM if it's not from the BAR */
@@ -969,6 +974,23 @@ static inline int pci_is_managed(struct pci_dev *pdev)
        return pdev->is_managed;
 }
 
+static inline void pci_set_managed_irq(struct pci_dev *pdev, unsigned int irq)
+{
+       pdev->irq = irq;
+       pdev->irq_managed = 1;
+}
+
+static inline void pci_reset_managed_irq(struct pci_dev *pdev)
+{
+       pdev->irq = 0;
+       pdev->irq_managed = 0;
+}
+
+static inline bool pci_has_managed_irq(struct pci_dev *pdev)
+{
+       return pdev->irq_managed && pdev->irq > 0;
+}
+
 void pci_disable_device(struct pci_dev *dev);
 
 extern unsigned int pcibios_max_latency;
@@ -1300,6 +1322,19 @@ int  ht_create_irq(struct pci_dev *dev, int idx);
 void ht_destroy_irq(unsigned int irq);
 #endif /* CONFIG_HT_IRQ */
 
+#ifdef CONFIG_PCI_ATS
+/* Address Translation Service */
+void pci_ats_init(struct pci_dev *dev);
+int pci_enable_ats(struct pci_dev *dev, int ps);
+void pci_disable_ats(struct pci_dev *dev);
+int pci_ats_queue_depth(struct pci_dev *dev);
+#else
+static inline void pci_ats_init(struct pci_dev *d) { }
+static inline int pci_enable_ats(struct pci_dev *d, int ps) { return -ENODEV; }
+static inline void pci_disable_ats(struct pci_dev *d) { }
+static inline int pci_ats_queue_depth(struct pci_dev *d) { return -ENODEV; }
+#endif
+
 void pci_cfg_access_lock(struct pci_dev *dev);
 bool pci_cfg_access_trylock(struct pci_dev *dev);
 void pci_cfg_access_unlock(struct pci_dev *dev);
@@ -1651,6 +1686,8 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev,
 int pcibios_add_device(struct pci_dev *dev);
 void pcibios_release_device(struct pci_dev *dev);
 void pcibios_penalize_isa_irq(int irq, int active);
+int pcibios_alloc_irq(struct pci_dev *dev);
+void pcibios_free_irq(struct pci_dev *dev);
 
 #ifdef CONFIG_HIBERNATE_CALLBACKS
 extern struct dev_pm_ops pcibios_pm_ops;
This page took 0.089917 seconds and 5 git commands to generate.