On 4/30/25 21:31, 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'. It would be nice to fix this discrepancy between the high level api and the driver operatrion as it is awfully confusing... But that is separate from this fix. > > While the set_msix() callback function in pcie-designware-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: 83153d9f36e2 ("PCI: endpoint: Fix ->set_msix() to take BIR and offset as arguments") > Signed-off-by: Niklas Cassel <cassel@xxxxxxxxxx> Looks good to me. Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx> -- Damien Le Moal Western Digital Research