From: Alex Williamson <alex.williamson@redhat.com>
To: gleb@redhat.com, kvm@vger.kernel.org
Cc: yoshikawa_takuya_b1@lab.ntt.co.jp, linux-kernel@vger.kernel.org,
xiaoguangrong@linux.vnet.ibm.com
Subject: [PATCH 2/2] kvm: Obey read-only mappings in iommu
Date: Thu, 24 Jan 2013 15:04:09 -0700 [thread overview]
Message-ID: <20130124220409.11061.85576.stgit@bling.home> (raw)
In-Reply-To: <20130124220027.11061.76400.stgit@bling.home>
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>
---
virt/kvm/iommu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index 4a340cb..72a130b 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;
next prev parent reply other threads:[~2013-01-24 22:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-24 22:03 [PATCH 0/2] kvm: IOMMU read-only mapping support Alex Williamson
2013-01-24 22:04 ` [PATCH 1/2] kvm: Force IOMMU remapping on memory slot read-only flag changes Alex Williamson
2013-01-25 2:58 ` Xiao Guangrong
2013-01-24 22:04 ` Alex Williamson [this message]
2013-01-25 1:17 ` [PATCH 0/2] kvm: IOMMU read-only mapping support Takuya Yoshikawa
2013-01-25 3:28 ` Xiao Guangrong
2013-01-25 3:59 ` Takuya Yoshikawa
2013-01-25 4:28 ` Takuya Yoshikawa
2013-01-28 10:59 ` Gleb Natapov
2013-01-28 12:25 ` Takuya Yoshikawa
2013-01-28 15:36 ` Alex Williamson
2013-01-29 2:12 ` Takuya Yoshikawa
2013-01-29 3:06 ` Xiao Guangrong
2013-01-29 6:50 ` Gleb Natapov
2013-01-29 7:37 ` Xiao Guangrong
[not found] ` <20130129074852.GH22871@redhat.com>
2013-01-30 4:06 ` Xiao Guangrong
2013-01-30 4:26 ` Takuya Yoshikawa
2013-01-27 15:29 ` Gleb Natapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130124220409.11061.85576.stgit@bling.home \
--to=alex.williamson@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiaoguangrong@linux.vnet.ibm.com \
--cc=yoshikawa_takuya_b1@lab.ntt.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox