Skip to content

Commit 1e74618

Browse files
author
Fox Snowpatch
committed
1 parent 960c1fd commit 1e74618

10 files changed

Lines changed: 32 additions & 25 deletions

File tree

arch/powerpc/platforms/powernv/pci-ioda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,7 @@ static int __pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
16661666
return -ENXIO;
16671667

16681668
/* Force 32-bit MSI on some broken devices */
1669-
if (dev->no_64bit_msi)
1669+
if (dev->msi_addr_mask < DMA_BIT_MASK(64))
16701670
is_64 = 0;
16711671

16721672
/* Assign XIVE to PE */

arch/powerpc/platforms/pseries/msi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static int rtas_prepare_msi_irqs(struct pci_dev *pdev, int nvec_in, int type,
388388
*/
389389
again:
390390
if (type == PCI_CAP_ID_MSI) {
391-
if (pdev->no_64bit_msi) {
391+
if (pdev->msi_addr_mask < DMA_BIT_MASK(64)) {
392392
rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec);
393393
if (rc < 0) {
394394
/*
@@ -414,7 +414,7 @@ static int rtas_prepare_msi_irqs(struct pci_dev *pdev, int nvec_in, int type,
414414
if (use_32bit_msi_hack && rc > 0)
415415
rtas_hack_32bit_msi_gen2(pdev);
416416
} else {
417-
if (pdev->no_64bit_msi)
417+
if (pdev->msi_addr_mask < DMA_BIT_MASK(64))
418418
rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSIX_FN, nvec);
419419
else
420420
rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec);

drivers/gpu/drm/radeon/radeon_device.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,6 +1374,7 @@ int radeon_device_init(struct radeon_device *rdev,
13741374
pr_warn("radeon: No suitable DMA available\n");
13751375
return r;
13761376
}
1377+
rdev->pdev->msi_addr_mask = DMA_BIT_MASK(dma_bits);
13771378
rdev->need_swiotlb = drm_need_swiotlb(dma_bits);
13781379

13791380
/* Registers mapping */

drivers/gpu/drm/radeon/radeon_irq_kms.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,6 @@ static bool radeon_msi_ok(struct radeon_device *rdev)
245245
if (rdev->flags & RADEON_IS_AGP)
246246
return false;
247247

248-
/*
249-
* Older chips have a HW limitation, they can only generate 40 bits
250-
* of address for "64-bit" MSIs which breaks on some platforms, notably
251-
* IBM POWER servers, so we limit them
252-
*/
253-
if (rdev->family < CHIP_BONAIRE) {
254-
dev_info(rdev->dev, "radeon: MSI limited to 32-bit\n");
255-
rdev->pdev->no_64bit_msi = 1;
256-
}
257-
258248
/* force MSI on */
259249
if (radeon_msi == 1)
260250
return true;

drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
331331

332332
#ifdef CONFIG_PPC64
333333
/* Ensure MSI/MSI-X interrupts lie within addressable physical memory */
334-
pdev->no_64bit_msi = 1;
334+
pdev->msi_addr_mask = DMA_BIT_MASK(32);
335335
#endif
336336

337337
err = ionic_setup_one(ionic);

drivers/pci/msi/msi.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,17 @@ static int msi_setup_msi_desc(struct pci_dev *dev, int nvec,
321321
static int msi_verify_entries(struct pci_dev *dev)
322322
{
323323
struct msi_desc *entry;
324+
u64 address;
324325

325-
if (!dev->no_64bit_msi)
326+
if (dev->msi_addr_mask == DMA_BIT_MASK(64))
326327
return 0;
327328

328329
msi_for_each_desc(entry, &dev->dev, MSI_DESC_ALL) {
329-
if (entry->msg.address_hi) {
330-
pci_err(dev, "arch assigned 64-bit MSI address %#x%08x but device only supports 32 bits\n",
331-
entry->msg.address_hi, entry->msg.address_lo);
330+
address = (u64)entry->msg.address_hi << 32 |
331+
entry->msg.address_lo;
332+
if (address & ~dev->msi_addr_mask) {
333+
pci_err(dev, "arch assigned 64-bit MSI address %#llx above device MSI address mask %#llx\n",
334+
address, dev->msi_addr_mask);
332335
break;
333336
}
334337
}

drivers/pci/msi/pcidev_msi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void pci_msi_init(struct pci_dev *dev)
2424
}
2525

2626
if (!(ctrl & PCI_MSI_FLAGS_64BIT))
27-
dev->no_64bit_msi = 1;
27+
dev->msi_addr_mask = DMA_BIT_MASK(32);
2828
}
2929

3030
void pci_msix_init(struct pci_dev *dev)

drivers/pci/probe.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,13 @@ int pci_setup_device(struct pci_dev *dev)
20472047
*/
20482048
dev->dma_mask = 0xffffffff;
20492049

2050+
/*
2051+
* Assume 64-bit addresses for MSI initially. Will be changed to 32-bit
2052+
* if MSI (rather than MSI-X) capability does not have
2053+
* PCI_MSI_FLAGS_64BIT. Can also be overridden by driver.
2054+
*/
2055+
dev->msi_addr_mask = DMA_BIT_MASK(64);
2056+
20502057
dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(dev->bus),
20512058
dev->bus->number, PCI_SLOT(dev->devfn),
20522059
PCI_FUNC(dev->devfn));

include/linux/pci.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,13 @@ struct pci_dev {
377377
0xffffffff. You only need to change
378378
this if your device has broken DMA
379379
or supports 64-bit transfers. */
380+
u64 msi_addr_mask; /* Mask of the bits of bus address for
381+
MSI that this device implements.
382+
Normally set based on device
383+
capabilities. You only need to
384+
change this if your device claims
385+
to support 64-bit MSI but implements
386+
fewer than 64 address bits. */
380387

381388
struct device_dma_parameters dma_parms;
382389

@@ -441,7 +448,6 @@ struct pci_dev {
441448

442449
unsigned int is_busmaster:1; /* Is busmaster */
443450
unsigned int no_msi:1; /* May not use MSI */
444-
unsigned int no_64bit_msi:1; /* May only use 32-bit MSIs */
445451
unsigned int block_cfg_access:1; /* Config space access blocked */
446452
unsigned int broken_parity_status:1; /* Generates false positive parity */
447453
unsigned int irq_reroute_variant:2; /* Needs IRQ rerouting variant */

sound/hda/controllers/intel.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,11 +1903,6 @@ static int azx_first_init(struct azx *chip)
19031903
chip->gts_present = true;
19041904
#endif
19051905

1906-
if (chip->msi && chip->driver_caps & AZX_DCAPS_NO_MSI64) {
1907-
dev_dbg(card->dev, "Disabling 64bit MSI\n");
1908-
pci->no_64bit_msi = true;
1909-
}
1910-
19111906
pci_set_master(pci);
19121907

19131908
gcap = azx_readw(chip, GCAP);
@@ -1958,6 +1953,11 @@ static int azx_first_init(struct azx *chip)
19581953
dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32));
19591954
dma_set_max_seg_size(&pci->dev, UINT_MAX);
19601955

1956+
if (chip->msi && chip->driver_caps & AZX_DCAPS_NO_MSI64) {
1957+
dev_dbg(card->dev, "Restricting MSI to %u-bit\n", dma_bits);
1958+
pci->msi_addr_mask = DMA_BIT_MASK(dma_bits);
1959+
}
1960+
19611961
/* read number of streams from GCAP register instead of using
19621962
* hardcoded value
19631963
*/

0 commit comments

Comments
 (0)