Skip to content

Commit

Permalink
kvm: Obey read-only mappings in iommu
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Gleb Natapov <[email protected]>
  • Loading branch information
awilliam authored and Gleb Natapov committed Jan 27, 2013
1 parent 261874b commit d47510e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion virt/kvm/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit d47510e

Please sign in to comment.