Page MenuHomeFreeBSD

D12661.id.diff
No OneTemporary

D12661.id.diff

Index: head/sys/amd64/vmm/io/iommu.c
===================================================================
--- head/sys/amd64/vmm/io/iommu.c
+++ head/sys/amd64/vmm/io/iommu.c
@@ -174,6 +174,7 @@
{
int error, bus, slot, func;
vm_paddr_t maxaddr;
+ devclass_t dc;
device_t dev;
if (!iommu_enable)
@@ -214,6 +215,7 @@
add_tag = EVENTHANDLER_REGISTER(pci_add_device, iommu_pci_add, NULL, 0);
delete_tag = EVENTHANDLER_REGISTER(pci_delete_device, iommu_pci_delete,
NULL, 0);
+ dc = devclass_find("ppt");
for (bus = 0; bus <= PCI_BUSMAX; bus++) {
for (slot = 0; slot <= PCI_SLOTMAX; slot++) {
for (func = 0; func <= PCI_FUNCMAX; func++) {
@@ -221,7 +223,15 @@
if (dev == NULL)
continue;
- /* Everything belongs to the host domain. */
+ /* Skip passthrough devices. */
+ if (dc != NULL &&
+ device_get_devclass(dev) == dc)
+ continue;
+
+ /*
+ * Everything else belongs to the host
+ * domain.
+ */
iommu_add_device(host_domain,
pci_get_rid(dev));
}
Index: head/sys/amd64/vmm/io/ppt.c
===================================================================
--- head/sys/amd64/vmm/io/ppt.c
+++ head/sys/amd64/vmm/io/ppt.c
@@ -154,6 +154,7 @@
ppt = device_get_softc(dev);
+ iommu_remove_device(iommu_host_domain(), pci_get_rid(dev));
num_pptdevs++;
TAILQ_INSERT_TAIL(&pptdev_list, ppt, next);
ppt->dev = dev;
@@ -175,6 +176,8 @@
return (EBUSY);
num_pptdevs--;
TAILQ_REMOVE(&pptdev_list, ppt, next);
+ pci_disable_busmaster(dev);
+ iommu_add_device(iommu_host_domain(), pci_get_rid(dev));
return (0);
}
@@ -368,7 +371,6 @@
true);
pci_restore_state(ppt->dev);
ppt->vm = vm;
- iommu_remove_device(iommu_host_domain(), pci_get_rid(ppt->dev));
iommu_add_device(vm_iommu_domain(vm), pci_get_rid(ppt->dev));
return (0);
}
@@ -397,7 +399,6 @@
ppt_teardown_msi(ppt);
ppt_teardown_msix(ppt);
iommu_remove_device(vm_iommu_domain(vm), pci_get_rid(ppt->dev));
- iommu_add_device(iommu_host_domain(), pci_get_rid(ppt->dev));
ppt->vm = NULL;
return (0);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 23, 5:49 PM (4 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32036689
Default Alt Text
D12661.id.diff (2 KB)

Event Timeline