diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2013-01-24 23:04:09 +0100 |
---|---|---|
committer | Gleb Natapov <gleb@redhat.com> | 2013-01-27 11:41:41 +0100 |
commit | d47510e295c0f82699192a61d715351cf00f65de (patch) | |
tree | 77b842f1e1f04ac4650fc54e6a267747b30d2bd8 /virt/kvm/iommu.c | |
parent | kvm: Force IOMMU remapping on memory slot read-only flag changes (diff) | |
download | linux-d47510e295c0f82699192a61d715351cf00f65de.tar.xz linux-d47510e295c0f82699192a61d715351cf00f65de.zip |
kvm: Obey read-only mappings in iommu
We've been ignoring read-only mappings and programming everything
into the iommu as read-write. Fix this to only include the write
access flag when read-only is not set.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'virt/kvm/iommu.c')
-rw-r--r-- | virt/kvm/iommu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index 4a340cb23013..72a130bc448a 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c @@ -76,7 +76,9 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) gfn = slot->base_gfn; end_gfn = gfn + slot->npages; - flags = IOMMU_READ | IOMMU_WRITE; + flags = IOMMU_READ; + if (!(slot->flags & KVM_MEM_READONLY)) + flags |= IOMMU_WRITE; if (kvm->arch.iommu_flags & KVM_IOMMU_CACHE_COHERENCY) flags |= IOMMU_CACHE; |