diff options
-rw-r--r-- | arch/powerpc/include/asm/pci-bridge.h | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci_64.c | 10 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/pci-ioda.c | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/pci.c | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/msi.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_irq_kms.c | 10 | ||||
-rw-r--r-- | drivers/pci/msi.c | 26 | ||||
-rw-r--r-- | include/linux/pci.h | 1 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 24 | ||||
-rw-r--r-- | sound/pci/hda/hda_priv.h | 1 |
10 files changed, 60 insertions, 22 deletions
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 4ca90a39d6d0..725247beebec 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h | |||
@@ -159,8 +159,6 @@ struct pci_dn { | |||
159 | 159 | ||
160 | int pci_ext_config_space; /* for pci devices */ | 160 | int pci_ext_config_space; /* for pci devices */ |
161 | 161 | ||
162 | bool force_32bit_msi; | ||
163 | |||
164 | struct pci_dev *pcidev; /* back-pointer to the pci device */ | 162 | struct pci_dev *pcidev; /* back-pointer to the pci device */ |
165 | #ifdef CONFIG_EEH | 163 | #ifdef CONFIG_EEH |
166 | struct eeh_dev *edev; /* eeh device */ | 164 | struct eeh_dev *edev; /* eeh device */ |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 155013da27e0..b15194e2c5fc 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -266,13 +266,3 @@ int pcibus_to_node(struct pci_bus *bus) | |||
266 | } | 266 | } |
267 | EXPORT_SYMBOL(pcibus_to_node); | 267 | EXPORT_SYMBOL(pcibus_to_node); |
268 | #endif | 268 | #endif |
269 | |||
270 | static void quirk_radeon_32bit_msi(struct pci_dev *dev) | ||
271 | { | ||
272 | struct pci_dn *pdn = pci_get_pdn(dev); | ||
273 | |||
274 | if (pdn) | ||
275 | pdn->force_32bit_msi = true; | ||
276 | } | ||
277 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x68f2, quirk_radeon_32bit_msi); | ||
278 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon_32bit_msi); | ||
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 468a0f23c7f2..7a8e806ff2a6 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -1509,7 +1509,6 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, | |||
1509 | unsigned int is_64, struct msi_msg *msg) | 1509 | unsigned int is_64, struct msi_msg *msg) |
1510 | { | 1510 | { |
1511 | struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); | 1511 | struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); |
1512 | struct pci_dn *pdn = pci_get_pdn(dev); | ||
1513 | unsigned int xive_num = hwirq - phb->msi_base; | 1512 | unsigned int xive_num = hwirq - phb->msi_base; |
1514 | __be32 data; | 1513 | __be32 data; |
1515 | int rc; | 1514 | int rc; |
@@ -1523,7 +1522,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, | |||
1523 | return -ENXIO; | 1522 | return -ENXIO; |
1524 | 1523 | ||
1525 | /* Force 32-bit MSI on some broken devices */ | 1524 | /* Force 32-bit MSI on some broken devices */ |
1526 | if (pdn && pdn->force_32bit_msi) | 1525 | if (dev->no_64bit_msi) |
1527 | is_64 = 0; | 1526 | is_64 = 0; |
1528 | 1527 | ||
1529 | /* Assign XIVE to PE */ | 1528 | /* Assign XIVE to PE */ |
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index b2187d0068b8..4b20f2c6b3b2 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c | |||
@@ -50,7 +50,6 @@ static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
50 | { | 50 | { |
51 | struct pci_controller *hose = pci_bus_to_host(pdev->bus); | 51 | struct pci_controller *hose = pci_bus_to_host(pdev->bus); |
52 | struct pnv_phb *phb = hose->private_data; | 52 | struct pnv_phb *phb = hose->private_data; |
53 | struct pci_dn *pdn = pci_get_pdn(pdev); | ||
54 | struct msi_desc *entry; | 53 | struct msi_desc *entry; |
55 | struct msi_msg msg; | 54 | struct msi_msg msg; |
56 | int hwirq; | 55 | int hwirq; |
@@ -60,7 +59,7 @@ static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
60 | if (WARN_ON(!phb) || !phb->msi_bmp.bitmap) | 59 | if (WARN_ON(!phb) || !phb->msi_bmp.bitmap) |
61 | return -ENODEV; | 60 | return -ENODEV; |
62 | 61 | ||
63 | if (pdn && pdn->force_32bit_msi && !phb->msi32_support) | 62 | if (pdev->no_64bit_msi && !phb->msi32_support) |
64 | return -ENODEV; | 63 | return -ENODEV; |
65 | 64 | ||
66 | list_for_each_entry(entry, &pdev->msi_list, list) { | 65 | list_for_each_entry(entry, &pdev->msi_list, list) { |
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c index 8ab5add4ac82..8b909e94fd9a 100644 --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c | |||
@@ -420,7 +420,7 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) | |||
420 | */ | 420 | */ |
421 | again: | 421 | again: |
422 | if (type == PCI_CAP_ID_MSI) { | 422 | if (type == PCI_CAP_ID_MSI) { |
423 | if (pdn->force_32bit_msi) { | 423 | if (pdev->no_64bit_msi) { |
424 | rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec); | 424 | rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec); |
425 | if (rc < 0) { | 425 | if (rc < 0) { |
426 | /* | 426 | /* |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 7784911d78ef..00fc59762e0d 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -185,6 +185,16 @@ static bool radeon_msi_ok(struct radeon_device *rdev) | |||
185 | if (rdev->flags & RADEON_IS_AGP) | 185 | if (rdev->flags & RADEON_IS_AGP) |
186 | return false; | 186 | return false; |
187 | 187 | ||
188 | /* | ||
189 | * Older chips have a HW limitation, they can only generate 40 bits | ||
190 | * of address for "64-bit" MSIs which breaks on some platforms, notably | ||
191 | * IBM POWER servers, so we limit them | ||
192 | */ | ||
193 | if (rdev->family < CHIP_BONAIRE) { | ||
194 | dev_info(rdev->dev, "radeon: MSI limited to 32-bit\n"); | ||
195 | rdev->pdev->no_64bit_msi = 1; | ||
196 | } | ||
197 | |||
188 | /* force MSI on */ | 198 | /* force MSI on */ |
189 | if (radeon_msi == 1) | 199 | if (radeon_msi == 1) |
190 | return true; | 200 | return true; |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 9fab30af0e75..084587d7cd13 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -590,6 +590,20 @@ static struct msi_desc *msi_setup_entry(struct pci_dev *dev) | |||
590 | return entry; | 590 | return entry; |
591 | } | 591 | } |
592 | 592 | ||
593 | static int msi_verify_entries(struct pci_dev *dev) | ||
594 | { | ||
595 | struct msi_desc *entry; | ||
596 | |||
597 | list_for_each_entry(entry, &dev->msi_list, list) { | ||
598 | if (!dev->no_64bit_msi || !entry->msg.address_hi) | ||
599 | continue; | ||
600 | dev_err(&dev->dev, "Device has broken 64-bit MSI but arch" | ||
601 | " tried to assign one above 4G\n"); | ||
602 | return -EIO; | ||
603 | } | ||
604 | return 0; | ||
605 | } | ||
606 | |||
593 | /** | 607 | /** |
594 | * msi_capability_init - configure device's MSI capability structure | 608 | * msi_capability_init - configure device's MSI capability structure |
595 | * @dev: pointer to the pci_dev data structure of MSI device function | 609 | * @dev: pointer to the pci_dev data structure of MSI device function |
@@ -627,6 +641,13 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) | |||
627 | return ret; | 641 | return ret; |
628 | } | 642 | } |
629 | 643 | ||
644 | ret = msi_verify_entries(dev); | ||
645 | if (ret) { | ||
646 | msi_mask_irq(entry, mask, ~mask); | ||
647 | free_msi_irqs(dev); | ||
648 | return ret; | ||
649 | } | ||
650 | |||
630 | ret = populate_msi_sysfs(dev); | 651 | ret = populate_msi_sysfs(dev); |
631 | if (ret) { | 652 | if (ret) { |
632 | msi_mask_irq(entry, mask, ~mask); | 653 | msi_mask_irq(entry, mask, ~mask); |
@@ -739,6 +760,11 @@ static int msix_capability_init(struct pci_dev *dev, | |||
739 | if (ret) | 760 | if (ret) |
740 | goto out_avail; | 761 | goto out_avail; |
741 | 762 | ||
763 | /* Check if all MSI entries honor device restrictions */ | ||
764 | ret = msi_verify_entries(dev); | ||
765 | if (ret) | ||
766 | goto out_free; | ||
767 | |||
742 | /* | 768 | /* |
743 | * Some devices require MSI-X to be enabled before we can touch the | 769 | * Some devices require MSI-X to be enabled before we can touch the |
744 | * MSI-X registers. We need to mask all the vectors to prevent | 770 | * MSI-X registers. We need to mask all the vectors to prevent |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 5be8db45e368..4c8ac5fcc224 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -331,6 +331,7 @@ struct pci_dev { | |||
331 | unsigned int is_added:1; | 331 | unsigned int is_added:1; |
332 | unsigned int is_busmaster:1; /* device is busmaster */ | 332 | unsigned int is_busmaster:1; /* device is busmaster */ |
333 | unsigned int no_msi:1; /* device may not use msi */ | 333 | unsigned int no_msi:1; /* device may not use msi */ |
334 | unsigned int no_64bit_msi:1; /* device may only use 32-bit MSIs */ | ||
334 | unsigned int block_cfg_access:1; /* config space access is blocked */ | 335 | unsigned int block_cfg_access:1; /* config space access is blocked */ |
335 | unsigned int broken_parity_status:1; /* Device generates false positive parity */ | 336 | unsigned int broken_parity_status:1; /* Device generates false positive parity */ |
336 | unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ | 337 | unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 16660f312043..48b6c5a3884f 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -298,7 +298,8 @@ enum { | |||
298 | 298 | ||
299 | /* quirks for ATI/AMD HDMI */ | 299 | /* quirks for ATI/AMD HDMI */ |
300 | #define AZX_DCAPS_PRESET_ATI_HDMI \ | 300 | #define AZX_DCAPS_PRESET_ATI_HDMI \ |
301 | (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB) | 301 | (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB|\ |
302 | AZX_DCAPS_NO_MSI64) | ||
302 | 303 | ||
303 | /* quirks for Nvidia */ | 304 | /* quirks for Nvidia */ |
304 | #define AZX_DCAPS_PRESET_NVIDIA \ | 305 | #define AZX_DCAPS_PRESET_NVIDIA \ |
@@ -1486,6 +1487,7 @@ static int azx_first_init(struct azx *chip) | |||
1486 | struct snd_card *card = chip->card; | 1487 | struct snd_card *card = chip->card; |
1487 | int err; | 1488 | int err; |
1488 | unsigned short gcap; | 1489 | unsigned short gcap; |
1490 | unsigned int dma_bits = 64; | ||
1489 | 1491 | ||
1490 | #if BITS_PER_LONG != 64 | 1492 | #if BITS_PER_LONG != 64 |
1491 | /* Fix up base address on ULI M5461 */ | 1493 | /* Fix up base address on ULI M5461 */ |
@@ -1509,9 +1511,14 @@ static int azx_first_init(struct azx *chip) | |||
1509 | return -ENXIO; | 1511 | return -ENXIO; |
1510 | } | 1512 | } |
1511 | 1513 | ||
1512 | if (chip->msi) | 1514 | if (chip->msi) { |
1515 | if (chip->driver_caps & AZX_DCAPS_NO_MSI64) { | ||
1516 | dev_dbg(card->dev, "Disabling 64bit MSI\n"); | ||
1517 | pci->no_64bit_msi = true; | ||
1518 | } | ||
1513 | if (pci_enable_msi(pci) < 0) | 1519 | if (pci_enable_msi(pci) < 0) |
1514 | chip->msi = 0; | 1520 | chip->msi = 0; |
1521 | } | ||
1515 | 1522 | ||
1516 | if (azx_acquire_irq(chip, 0) < 0) | 1523 | if (azx_acquire_irq(chip, 0) < 0) |
1517 | return -EBUSY; | 1524 | return -EBUSY; |
@@ -1522,9 +1529,14 @@ static int azx_first_init(struct azx *chip) | |||
1522 | gcap = azx_readw(chip, GCAP); | 1529 | gcap = azx_readw(chip, GCAP); |
1523 | dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap); | 1530 | dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap); |
1524 | 1531 | ||
1532 | /* AMD devices support 40 or 48bit DMA, take the safe one */ | ||
1533 | if (chip->pci->vendor == PCI_VENDOR_ID_AMD) | ||
1534 | dma_bits = 40; | ||
1535 | |||
1525 | /* disable SB600 64bit support for safety */ | 1536 | /* disable SB600 64bit support for safety */ |
1526 | if (chip->pci->vendor == PCI_VENDOR_ID_ATI) { | 1537 | if (chip->pci->vendor == PCI_VENDOR_ID_ATI) { |
1527 | struct pci_dev *p_smbus; | 1538 | struct pci_dev *p_smbus; |
1539 | dma_bits = 40; | ||
1528 | p_smbus = pci_get_device(PCI_VENDOR_ID_ATI, | 1540 | p_smbus = pci_get_device(PCI_VENDOR_ID_ATI, |
1529 | PCI_DEVICE_ID_ATI_SBX00_SMBUS, | 1541 | PCI_DEVICE_ID_ATI_SBX00_SMBUS, |
1530 | NULL); | 1542 | NULL); |
@@ -1554,9 +1566,11 @@ static int azx_first_init(struct azx *chip) | |||
1554 | } | 1566 | } |
1555 | 1567 | ||
1556 | /* allow 64bit DMA address if supported by H/W */ | 1568 | /* allow 64bit DMA address if supported by H/W */ |
1557 | if ((gcap & AZX_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) | 1569 | if (!(gcap & AZX_GCAP_64OK)) |
1558 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); | 1570 | dma_bits = 32; |
1559 | else { | 1571 | if (!pci_set_dma_mask(pci, DMA_BIT_MASK(dma_bits))) { |
1572 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(dma_bits)); | ||
1573 | } else { | ||
1560 | pci_set_dma_mask(pci, DMA_BIT_MASK(32)); | 1574 | pci_set_dma_mask(pci, DMA_BIT_MASK(32)); |
1561 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)); | 1575 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)); |
1562 | } | 1576 | } |
diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h index 949cd437eeb2..5016014e57f2 100644 --- a/sound/pci/hda/hda_priv.h +++ b/sound/pci/hda/hda_priv.h | |||
@@ -171,6 +171,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
171 | #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ | 171 | #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ |
172 | #define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 powerwell support */ | 172 | #define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 powerwell support */ |
173 | #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ | 173 | #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ |
174 | #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ | ||
174 | 175 | ||
175 | /* HD Audio class code */ | 176 | /* HD Audio class code */ |
176 | #define PCI_CLASS_MULTIMEDIA_HD_AUDIO 0x0403 | 177 | #define PCI_CLASS_MULTIMEDIA_HD_AUDIO 0x0403 |