On 4/30/25 21:32, Niklas Cassel wrote: > While the parameter 'interrupts' to the functions pci_epc_set_msi() and > pci_epc_set_msix() represent the actual number of interrupts, and > pci_epc_get_msi() and pci_epc_get_msix() return the actual number of > interrupts. > > These endpoint library functions just mentioned will however supply > "interrupts - 1" to the EPC callback functions pci_epc_ops->set_msi() and > pci_epc_ops->set_msix(), and likewise add 1 to return value from > pci_epc_ops->get_msi() and pci_epc_ops->get_msix(), even though the > parameter name for the callback function is also named 'interrupts'. > > While the set_msix() callback function in pcie-cadence-ep writes the > Table Size field correctly (N-1), the calculation of the PBA offset > is wrong because it calculates space for (N-1) entries instead of N. > > This results in e.g. the following error when using QEMU with PCI > passthrough on a device which relies on the PCI endpoint subsystem: > failed to add PCI capability 0x11[0x50]@0xb0: table & pba overlap, or they don't fit in BARs, or don't align > > Fix the calculation of PBA offset in the MSI-X capability. > > Fixes: 3ef5d16f50f8 ("PCI: cadence: Add MSI-X support to Endpoint driver") > Signed-off-by: Niklas Cassel <cassel@xxxxxxxxxx> Looks good to me. Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx> -- Damien Le Moal Western Digital Research