Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177957177
D61971.1795646195.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61971.1795646195.diff
View Options
diff --git a/sys/amd64/vmm/io/ppt.c b/sys/amd64/vmm/io/ppt.c
--- a/sys/amd64/vmm/io/ppt.c
+++ b/sys/amd64/vmm/io/ppt.c
@@ -469,15 +469,22 @@
if (error != 0)
goto out;
+ /*
+ * Stop DMA first, but keep memory decoding enabled until MSI-X has
+ * been torn down: tearing down an MSI-X vector masks it in the MSI-X
+ * table, which lives in a memory BAR.
+ */
cmd = pci_read_config(ppt->dev, PCIR_COMMAND, 2);
- cmd &= ~(PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN);
+ cmd &= ~PCIM_CMD_BUSMASTEREN;
+ pci_write_config(ppt->dev, PCIR_COMMAND, cmd, 2);
+ ppt_teardown_msi(ppt);
+ ppt_teardown_msix(ppt);
+ cmd &= ~(PCIM_CMD_PORTEN | PCIM_CMD_MEMEN);
pci_write_config(ppt->dev, PCIR_COMMAND, cmd, 2);
pci_save_state(ppt->dev);
ppt_pci_reset(ppt->dev);
pci_restore_state(ppt->dev);
ppt_unmap_all_mmio(vm, ppt);
- ppt_teardown_msi(ppt);
- ppt_teardown_msix(ppt);
error = iommu_remove_device(vm_iommu_domain(vm), ppt->dev,
pci_get_rid(ppt->dev));
ppt->vm = NULL;
@@ -518,13 +525,17 @@
/*
* Disable physical INTx before releasing its handler. This also makes
* an asserted Function send Deassert_INTx before FLR, as required by
- * PCIe. Gate decoding and DMA before tearing down MSI or MSI-X.
+ * PCIe. Gate DMA before tearing down MSI or MSI-X, but keep memory
+ * decoding enabled until then: masking an MSI-X vector accesses the
+ * MSI-X table in a memory BAR.
*/
cmd = original_cmd | PCIM_CMD_INTxDIS;
- cmd &= ~(PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN);
+ cmd &= ~PCIM_CMD_BUSMASTEREN;
pci_write_config(ppt->dev, PCIR_COMMAND, cmd, 2);
ppt_teardown_msi(ppt);
ppt_teardown_msix(ppt);
+ cmd &= ~(PCIM_CMD_PORTEN | PCIM_CMD_MEMEN);
+ pci_write_config(ppt->dev, PCIR_COMMAND, cmd, 2);
/*
* Save the host-owned state after interrupt teardown, then restore BARs
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 25, 10:36 PM (15 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41976507
Default Alt Text
D61971.1795646195.diff (1 KB)
Attached To
Mode
D61971: vmm: Tear down MSI-X before disabling memory decoding of a ppt device
Attached
Detach File
Event Timeline