mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
PCI: dwc: ep: Flush cached MSI write before unmapping the iATU
The MSI-X path already flushes any posted MSI-X write before tearing down its iATU mapping. That was added by commitc22533c66c("PCI: dwc: ep: Flush MSI-X write before unmapping its ATU entry") to make sure the write reaches the Root Complex before the outbound window that translates it disappears. The MSI path has the same problem but no equivalent flush. When the Endpoint driver caches an MSI target address and later observes that the Root Complex has changed it, dw_pcie_ep_raise_msi_irq() unmaps the existing iATU entry and reprograms it for the new address. Between the last MSI writel() and the unmap there may still be a posted write sitting in the fabric, and unmapping the iATU entry can drop or misroute that write. Fix this by reading back from the mapped MSI window before the unmap. The readback drains any posted MSI writes through the same iATU entry that mapped them, which is the same logic the MSI-X path uses. Fixes:468711a40d("PCI: dwc: ep: Refresh MSI Message Address cache on change") Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://lore.kernel.org/linux-pci/20260729214859.B9E2B1F00A3A@smtp.kernel.org Signed-off-by: Niklas Cassel <cassel@kernel.org> [mani: commit log] Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Link: https://patch.msgid.link/20260730133123.1420413-5-cassel@kernel.org
This commit is contained in:
parent
6fc5fcd8ec
commit
1b01d725d8
|
|
@ -1032,6 +1032,8 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
|
|||
* there is no unified way to check if we have operations in
|
||||
* flight, thus we don't know if we should WARN() or not.
|
||||
*/
|
||||
/* flush posted write before unmap */
|
||||
readl(ep->msi_mem + ep->msi_iatu_mapped_offset);
|
||||
dw_pcie_ep_unmap_addr(epc, func_no, 0, ep->msi_mem_phys);
|
||||
ep->msi_iatu_mapped = false;
|
||||
}
|
||||
|
|
@ -1044,6 +1046,7 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
|
|||
return ret;
|
||||
|
||||
ep->msi_iatu_mapped = true;
|
||||
ep->msi_iatu_mapped_offset = offset;
|
||||
ep->msi_msg_addr = msg_addr;
|
||||
ep->msi_map_size = map_size;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -518,6 +518,7 @@ struct dw_pcie_ep {
|
|||
|
||||
/* MSI outbound iATU state */
|
||||
bool msi_iatu_mapped;
|
||||
size_t msi_iatu_mapped_offset;
|
||||
u64 msi_msg_addr;
|
||||
size_t msi_map_size;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user