From: Avi Kivity Date: Wed, 21 Mar 2007 16:11:36 +0000 (+0200) Subject: KVM: Don't allow the guest to turn off the cpu cache X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=6da63cf95f6a19fe0a302232048452c96b178e45;p=openwrt%2Fstaging%2Fblogic.git KVM: Don't allow the guest to turn off the cpu cache The cpu cache is a host resource; the guest should not be able to turn it off (even for itself). Signed-off-by: Avi Kivity --- diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index d3cc1157d23b..191bc45b83e0 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c @@ -737,8 +737,10 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) } #endif vcpu->svm->cr0 = cr0; - vcpu->svm->vmcb->save.cr0 = cr0 | CR0_PG_MASK | CR0_WP_MASK; vcpu->cr0 = cr0; + cr0 |= CR0_PG_MASK | CR0_WP_MASK; + cr0 &= ~(CR0_CD_MASK | CR0_NW_MASK); + vcpu->svm->vmcb->save.cr0 = cr0; } static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)