Add IOMMU hook to unmap IOMMU devices from a VM.
This can be used if the devices need to be selectively removed or to
provide extra assurance that the devices didn't get mapped in.
Change-Id: Id9d5ffb5fa5ed8d8f4cffb7592e198235bdc4b40
diff --git a/src/load.c b/src/load.c
index e2a272e..c9af05b 100644
--- a/src/load.c
+++ b/src/load.c
@@ -28,6 +28,7 @@
#include "hf/memiter.h"
#include "hf/mm.h"
#include "hf/plat/console.h"
+#include "hf/plat/iommu.h"
#include "hf/static_assert.h"
#include "hf/std.h"
#include "hf/vm.h"
@@ -186,6 +187,12 @@
goto out;
}
+ if (!plat_iommu_unmap_iommus(vm_locked, ppool)) {
+ dlog("Unable to unmap IOMMUs from primary VM\n");
+ ret = false;
+ goto out;
+ }
+
vcpu_locked = vcpu_lock(vm_get_vcpu(vm, 0));
vcpu_on(vcpu_locked, ipa_from_pa(primary_begin), params->kernel_arg);
vcpu_unlock(&vcpu_locked);