Re: [PATCHv2 1/2] powerpc/pci: Initialize msi_addr_mask for OF-created PCI devices
Venkat <[email protected]>
| Newsgroups | org.kernel.vger.sparclinux,org.kernel.vger.linux-pci,org.ozlabs.lists.linuxppc-dev |
|---|---|
| Message-ID | <[email protected]> |
> On 20 Feb 2026, at 12:32 PM, Nilay Shroff <[email protected]> wrote: > > 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 agains > 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: 386ced19e9a3 ("PCI/MSI: Convert the boolean no_64bit_msi flag to a DMA address mask") > Signed-off-by: Nilay Shroff <[email protected]> > --- > arch/powerpc/kernel/pci_of_scan.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c > index 756043dd06e9..fb9fbf0d1796 100644 > --- a/arch/powerpc/kernel/pci_of_scan.c > +++ b/arch/powerpc/kernel/pci_of_scan.c > @@ -212,6 +212,13 @@ struct pci_dev *of_create_pci_dev(struct device_node *node, > dev->error_state = pci_channel_io_normal; > dev->dma_mask = 0xffffffff; > > + /* > + * Assume 64-bit addresses for MSI initially. Will be changed to 32-bit > + * if MSI (rather than MSI-X) capability does not have > + * PCI_MSI_FLAGS_64BIT. Can also be overridden by driver. > + */ > + dev->msi_addr_mask = DMA_BIT_MASK(64); > + > /* Early fixups, before probing the BARs */ > pci_fixup_device(pci_fixup_early, dev); > > -- > 2.52.0 > Tested-by: Venkat Rao Bagalkote <[email protected]> Tested on an IBM Power System LPAR (pseries). On an unpatched kernel, all LPFC functions failed MSI/MSI-X setup with: [ 0.175139] Running MSI bitmap self-tests ... [ 1.521630] lpfc 0152:60:00.0: arch assigned 64-bit MSI address 0xffff3840 above device MSI address mask 0x0 [ 1.536203] lpfc 0152:60:00.0: arch assigned 64-bit MSI address 0xffff3a00 above device MSI address mask 0x0 [ 1.536318] lpfc 0152:60:00.0: 14: [ 1.521874] 0:0484 PCI enable MSI-X failed (-5) [ 1.536321] lpfc 0152:60:00.0: 15: [ 1.536251] 0:0488 PCI enable MSI mode failed (-5) After applying this patch, lpfc driver probe completes successfully and MSI/MSI-X setup works normally. [ 0.206925] Running MSI bitmap self-tests ... [ 3.040737] lpfc 0152:60:00.1: 1:3238 Reducing IO channels to match number of MSI-X vectors, requested 32 got 2 [ 4.162067] lpfc 0152:60:00.2: 2:3238 Reducing IO channels to match number of MSI-X vectors, requested 32 got 1 [ 5.270672] lpfc 0152:60:00.3: 3:3238 Reducing IO channels to match number of MSI-X vectors, requested 32 got 1 Regards, Venkat.