summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2010-12-23 16:09:29 +0800
committerAvi Kivity <avi@redhat.com>2011-01-12 11:31:19 +0200
commitf8e453b00cf1d90a047eb0ef8eefe6200e0f4512 (patch)
tree7347af552a9a0ca0ba2bf8e19e3c33721a7637e5 /arch/x86/kvm/mmu.c
parentb034cf0105235e65ee1b0161dbe8fef0338d06e7 (diff)
downloadop-kernel-dev-f8e453b00cf1d90a047eb0ef8eefe6200e0f4512.zip
op-kernel-dev-f8e453b00cf1d90a047eb0ef8eefe6200e0f4512.tar.gz
KVM: MMU: handle 'map_writable' in set_spte() function
Move the operation of 'writable' to set_spte() to clean up code [avi: remove unneeded booleanification] Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 892ffc6..9cafbb4 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1983,6 +1983,8 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
if (host_writable)
spte |= SPTE_HOST_WRITEABLE;
+ else
+ pte_access &= ~ACC_WRITE_MASK;
spte |= (u64)pfn << PAGE_SHIFT;
@@ -2222,8 +2224,6 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write,
if (iterator.level == level) {
unsigned pte_access = ACC_ALL;
- if (!map_writable)
- pte_access &= ~ACC_WRITE_MASK;
mmu_set_spte(vcpu, iterator.sptep, ACC_ALL, pte_access,
0, write, 1, &pt_write,
level, gfn, pfn, prefault, map_writable);
OpenPOWER on IntegriCloud