aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2016-09-06 18:53:17 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2016-09-06 18:53:17 +0000
commit5fb03c3780809f666f89a9e6bbca2f7b8fb513f3 (patch)
treeea3959e187dccb3822b04f045af1c88440553fd3
parentd945328992cdfced70ff3cf4ceb3c4c5445b837c (diff)
Notes
-rw-r--r--sys/amd64/vmm/io/iommu.c8
-rw-r--r--sys/amd64/vmm/io/ppt.c2
2 files changed, 3 insertions, 7 deletions
diff --git a/sys/amd64/vmm/io/iommu.c b/sys/amd64/vmm/io/iommu.c
index 524b150ed914..b17953549e9b 100644
--- a/sys/amd64/vmm/io/iommu.c
+++ b/sys/amd64/vmm/io/iommu.c
@@ -158,7 +158,6 @@ iommu_init(void)
{
int error, bus, slot, func;
vm_paddr_t maxaddr;
- const char *name;
device_t dev;
if (!iommu_enable)
@@ -203,12 +202,7 @@ iommu_init(void)
if (dev == NULL)
continue;
- /* skip passthrough devices */
- name = device_get_name(dev);
- if (name != NULL && strcmp(name, "ppt") == 0)
- continue;
-
- /* everything else belongs to the host domain */
+ /* Everything belongs to the host domain. */
iommu_add_device(host_domain,
pci_get_rid(dev));
}
diff --git a/sys/amd64/vmm/io/ppt.c b/sys/amd64/vmm/io/ppt.c
index 692190a5c2b1..6541d7d2994a 100644
--- a/sys/amd64/vmm/io/ppt.c
+++ b/sys/amd64/vmm/io/ppt.c
@@ -363,6 +363,7 @@ ppt_assign_device(struct vm *vm, int bus, int slot, int func)
return (EBUSY);
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);
}
@@ -385,6 +386,7 @@ ppt_unassign_device(struct vm *vm, int bus, int slot, int func)
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);
}