* [PATCH] kvm: Disable device assignment without interrupt remapping
@ 2011-07-14 19:27 Alex Williamson
2011-07-19 14:43 ` Marcelo Tosatti
0 siblings, 1 reply; 2+ messages in thread
From: Alex Williamson @ 2011-07-14 19:27 UTC (permalink / raw)
To: kvm; +Cc: linux-kernel, alex.williamson, chrisw, ddutile, iommu
IOMMU interrupt remapping support provides a further layer of
isolation for device assignment by preventing arbitrary interrupt
block DMA writes by a malicious guest from reaching the host. By
default, we should require that the platform provides interrupt
remapping support, with an opt-in mechanism for existing behavior.
Both AMD IOMMU and Intel VT-d2 hardware support interrupt
remapping, however we currently only have software support on
the Intel side. Users wishing to re-enable device assignment
when interrupt remapping is not supported on the platform can
use the "allow_unsafe_assigned_interrupts=1" module option.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
virt/kvm/iommu.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index 62a9caf..243cb81 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -30,6 +30,12 @@
#include <linux/iommu.h>
#include <linux/intel-iommu.h>
+static int allow_unsafe_assigned_interrupts;
+module_param_named(allow_unsafe_assigned_interrupts,
+ allow_unsafe_assigned_interrupts, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(allow_unsafe_assigned_interrupts,
+ "Enable device assignment on platforms without interrupt remapping support.");
+
static int kvm_iommu_unmap_memslots(struct kvm *kvm);
static void kvm_iommu_put_pages(struct kvm *kvm,
gfn_t base_gfn, unsigned long npages);
@@ -231,6 +237,15 @@ int kvm_iommu_map_guest(struct kvm *kvm)
if (!kvm->arch.iommu_domain)
return -ENOMEM;
+ if (!allow_unsafe_assigned_interrupts &&
+ !iommu_domain_has_cap(kvm->arch.iommu_domain,
+ IOMMU_CAP_INTR_REMAP)) {
+ printk(KERN_WARNING "%s: No interrupt remapping support, disallowing device assignment. Re-enble with \"allow_unsafe_assigned_interrupts=1\" module option.\n", __func__);
+ iommu_domain_free(kvm->arch.iommu_domain);
+ kvm->arch.iommu_domain = NULL;
+ return -EPERM;
+ }
+
r = kvm_iommu_map_memslots(kvm);
if (r)
goto out_unmap;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kvm: Disable device assignment without interrupt remapping
2011-07-14 19:27 [PATCH] kvm: Disable device assignment without interrupt remapping Alex Williamson
@ 2011-07-19 14:43 ` Marcelo Tosatti
0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2011-07-19 14:43 UTC (permalink / raw)
To: Alex Williamson; +Cc: kvm, linux-kernel, chrisw, ddutile, iommu
On Thu, Jul 14, 2011 at 01:27:03PM -0600, Alex Williamson wrote:
> IOMMU interrupt remapping support provides a further layer of
> isolation for device assignment by preventing arbitrary interrupt
> block DMA writes by a malicious guest from reaching the host. By
> default, we should require that the platform provides interrupt
> remapping support, with an opt-in mechanism for existing behavior.
>
> Both AMD IOMMU and Intel VT-d2 hardware support interrupt
> remapping, however we currently only have software support on
> the Intel side. Users wishing to re-enable device assignment
> when interrupt remapping is not supported on the platform can
> use the "allow_unsafe_assigned_interrupts=1" module option.
>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-19 15:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-14 19:27 [PATCH] kvm: Disable device assignment without interrupt remapping Alex Williamson
2011-07-19 14:43 ` Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox