Skip to content

Commit

Permalink
Merge branches 'pci/irq', 'pci/misc', 'pci/resource' and 'pci/virtual…
Browse files Browse the repository at this point in the history
…ization' into next

* pci/irq:
  PCI/MSI: Free legacy IRQ when enabling MSI/MSI-X
  PCI: Add helpers to manage pci_dev->irq and pci_dev->irq_managed
  PCI, x86: Implement pcibios_alloc_irq() and pcibios_free_irq()
  PCI: Add pcibios_alloc_irq() and pcibios_free_irq()

* pci/misc:
  PCI: Remove unused "pci_probe" flags
  PCI: Add VPD function 0 quirk for Intel Ethernet devices
  PCI: Add dev_flags bit to access VPD through function 0
  PCI / ACPI: Fix pci_acpi_optimize_delay() comment
  PCI: Remove a broken link in quirks.c
  PCI: Remove useless redundant code
  PCI: Simplify pci_find_(ext_)capability() return value checks
  PCI: Move PCI_FIND_CAP_TTL to pci.h and use it in quirks
  PCI: Add pcie_downstream_port() (true for Root and Switch Downstream Ports)
  PCI: Fix pcie_port_device_resume() comment
  PCI: Shift PCI_CLASS_NOT_DEFINED consistently with other classes
  PCI: Revert aeb3001 ("PCI: add Intel USB specific reset method")
  PCI: Fix TI816X class code quirk
  PCI: Fix generic NCR 53c810 class code quirk
  PCI: Use PCI_CLASS_SERIAL_USB instead of bare number
  PCI: Add quirk for Intersil/Techwell TW686[4589] AV capture cards
  PCI: Remove Intel Cherrytrail D3 delays

* pci/resource:
  PCI: Call pci_read_bridge_bases() from core instead of arch code

* pci/virtualization:
  PCI: Restore ACS configuration as part of pci_restore_state()
  • Loading branch information
Bjorn Helgaas committed Aug 5, 2015
5 parents cd66d5c + 5f22699 + 24b390a + dff22d2 + ccbc175 commit 5a4f3cf
Showing 31 changed files with 239 additions and 215 deletions.
7 changes: 1 addition & 6 deletions arch/alpha/kernel/pci.c
Original file line number Diff line number Diff line change
@@ -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);
8 changes: 0 additions & 8 deletions arch/frv/mb93090-mb00/pci-frv.c
Original file line number Diff line number Diff line change
@@ -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);
}
}
}

8 changes: 0 additions & 8 deletions arch/frv/mb93090-mb00/pci-frv.h
Original file line number Diff line number Diff line change
@@ -14,14 +14,6 @@
#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 */
2 changes: 0 additions & 2 deletions arch/frv/mb93090-mb00/pci-vdk.c
Original file line number Diff line number Diff line change
@@ -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) {
5 changes: 2 additions & 3 deletions arch/ia64/pci/pci.c
Original file line number Diff line number Diff line change
@@ -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);
9 changes: 1 addition & 8 deletions arch/microblaze/pci/pci-common.c
Original file line number Diff line number Diff line change
@@ -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 */
6 changes: 0 additions & 6 deletions arch/mips/pci/pci.c
Original file line number Diff line number Diff line change
@@ -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);
22 changes: 10 additions & 12 deletions arch/mn10300/unit-asb2305/pci-asb2305.c
Original file line number Diff line number Diff line change
@@ -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;
}
}

7 changes: 0 additions & 7 deletions arch/mn10300/unit-asb2305/pci-asb2305.h
Original file line number Diff line number Diff line change
@@ -20,13 +20,6 @@
#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 */
1 change: 0 additions & 1 deletion arch/mn10300/unit-asb2305/pci.c
Original file line number Diff line number Diff line change
@@ -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);
}

8 changes: 1 addition & 7 deletions arch/powerpc/kernel/pci-common.c
Original file line number Diff line number Diff line change
@@ -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 */
8 changes: 0 additions & 8 deletions arch/sh/drivers/pci/pci-sh4.h
Original file line number Diff line number Diff line change
@@ -11,14 +11,6 @@

#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 */
2 changes: 0 additions & 2 deletions arch/x86/include/asm/pci_x86.h
Original file line number Diff line number Diff line change
@@ -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);
21 changes: 9 additions & 12 deletions arch/x86/pci/common.c
Original file line number Diff line number Diff line change
@@ -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)
13 changes: 0 additions & 13 deletions arch/x86/pci/fixup.c
Original file line number Diff line number Diff line change
@@ -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)
{
/*
9 changes: 6 additions & 3 deletions arch/x86/pci/intel_mid_pci.c
Original file line number Diff line number Diff line change
@@ -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.
*/
}
}

23 changes: 4 additions & 19 deletions arch/x86/pci/irq.c
Original file line number Diff line number Diff line change
@@ -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);
}
}
4 changes: 0 additions & 4 deletions arch/xtensa/kernel/pci.c
Original file line number Diff line number Diff line change
@@ -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)
17 changes: 4 additions & 13 deletions drivers/acpi/pci_irq.c
Original file line number Diff line number Diff line change
@@ -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);
}
}
3 changes: 0 additions & 3 deletions drivers/parisc/dino.c
Original file line number Diff line number Diff line change
@@ -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)
1 change: 0 additions & 1 deletion drivers/parisc/lba_pci.c
Original file line number Diff line number Diff line change
@@ -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 {
Loading

0 comments on commit 5a4f3cf

Please sign in to comment.