On Sat, Mar 01, 2025 at 11:10:35AM +0000, Marc Zyngier wrote:
On Tue, 11 Feb 2025 19:21:55 +0000, Frank Li Frank.Li@nxp.com wrote:
Add the flag IRQ_DOMAIN_FLAG_MSI_IMMUTABLE and the API function irq_domain_is_msi_immutable() to check if the MSI controller retains an immutable address/data pair during irq_set_affinity().
Ensure compatibility with MSI users like PCIe Endpoint Doorbell, which require the address/data pair to remain unchanged after setup. Use this function to verify if the MSI controller is immutable.
Why is that a requirement? Why should a driver even care?
At v9, there were detail discussion about this https://lore.kernel.org/all/87v7w0s9a8.ffs@tglx/
let me summary:
Host driver workflow like:
1. read address/data from shared memory (PC bar<n>) 2. write data to address to trigger doorbell.
1 and 2 is not atomic. So EP side may call set_affinity function during 1 and 2, address/data may be changed in some MSI provider, so 2 write to previous address/data pair, which may not existed or map to other place and cause write to unexpected place.
Frank
M.
-- Without deviation from the norm, progress is not possible.