Skip to content

Commit 2185904

Browse files
shroffnibjorn-helgaas
authored andcommitted
powerpc/pci: Initialize msi_addr_mask for OF-created PCI devices
Recent changes replaced the use of no_64bit_msi with msi_addr_mask. As a result, msi_addr_mask is now expected to be initialized to DMA_BIT_MASK(64) when a pci_dev is set up. However, this initialization was missed on powerpc due to differences in the device initialization path compared to other (x86) architecture. Due to this, now PCI device probe method fails on powerpc system. On powerpc systems, struct pci_dev instances are created from device tree nodes via of_create_pci_dev(). Because msi_addr_mask was not initialized there, it remained zero. Later, during MSI setup, msi_verify_entries() validates the programmed MSI address against pdev->msi_addr_mask. Since the mask was not set correctly, the validation fails, causing PCI driver probe failures for devices on powerpc systems. Initialize pdev->msi_addr_mask to DMA_BIT_MASK(64) in of_create_pci_dev() so that MSI address validation succeeds and device probe works as expected. Fixes: 386ced1 ("PCI/MSI: Convert the boolean no_64bit_msi flag to a DMA address mask") Signed-off-by: Nilay Shroff <nilay@linux.ibm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> Tested-by: Nam Cao <namcao@linutronix.de> Reviewed-by: Nam Cao <namcao@linutronix.de> Reviewed-by: Vivian Wang <wangruikang@iscas.ac.cn> Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20260220070239.1693303-2-nilay@linux.ibm.com
1 parent 6de23f8 commit 2185904

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

arch/powerpc/kernel/pci_of_scan.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,13 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
212212
dev->error_state = pci_channel_io_normal;
213213
dev->dma_mask = 0xffffffff;
214214

215+
/*
216+
* Assume 64-bit addresses for MSI initially. Will be changed to 32-bit
217+
* if MSI (rather than MSI-X) capability does not have
218+
* PCI_MSI_FLAGS_64BIT. Can also be overridden by driver.
219+
*/
220+
dev->msi_addr_mask = DMA_BIT_MASK(64);
221+
215222
/* Early fixups, before probing the BARs */
216223
pci_fixup_device(pci_fixup_early, dev);
217224

0 commit comments

Comments
 (0)