Skip to content

Commit b9255a7

Browse files
committed
PCI/MSI: Enforce MSI[X] entry updates to be visible
Nothing enforces the posted writes to be visible when the function returns. Flush them even if the flush might be redundant when the entry is masked already as the unmask will flush as well. This is either setup or a rare affinity change event so the extra flush is not the end of the world. While this is more a theoretical issue especially the logic in the X86 specific msi_set_affinity() function relies on the assumption that the update has reached the hardware when the function returns. Again, as this never has been enforced the Fixes tag refers to a commit in: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git Fixes: f036d4e ("[PATCH] ia32 Message Signalled Interrupt support") Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Marc Zyngier <[email protected]> Reviewed-by: Marc Zyngier <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent da181dc commit b9255a7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/pci/msi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
311311

312312
if (unmasked)
313313
__pci_msix_desc_mask_irq(entry, 0);
314+
315+
/* Ensure that the writes are visible in the device */
316+
readl(base + PCI_MSIX_ENTRY_DATA);
314317
} else {
315318
int pos = dev->msi_cap;
316319
u16 msgctl;
@@ -331,6 +334,8 @@ void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
331334
pci_write_config_word(dev, pos + PCI_MSI_DATA_32,
332335
msg->data);
333336
}
337+
/* Ensure that the writes are visible in the device */
338+
pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl);
334339
}
335340

336341
skip:

0 commit comments

Comments
 (0)