diff options
author | Avi Kivity <avi@redhat.com> | 2009-12-29 11:43:06 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:35:50 -0500 |
commit | e8467fda83cdc9de53972fee0cd2e6916cf66f41 (patch) | |
tree | 3a1644bf9b26f29eee74614f70e9d9a82c079ea9 /arch/x86/kvm/vmx.c | |
parent | 4d4ec0874583b127caac1d0f84033c8971b2fd2a (diff) |
KVM: VMX: Allow the guest to own some cr0 bits
We will use this later to give the guest ownership of cr0.ts.
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 4c7177c489ac..dbcdb55094f7 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -1653,6 +1653,14 @@ static void vmx_flush_tlb(struct kvm_vcpu *vcpu) | |||
1653 | ept_sync_context(construct_eptp(vcpu->arch.mmu.root_hpa)); | 1653 | ept_sync_context(construct_eptp(vcpu->arch.mmu.root_hpa)); |
1654 | } | 1654 | } |
1655 | 1655 | ||
1656 | static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu) | ||
1657 | { | ||
1658 | ulong cr0_guest_owned_bits = vcpu->arch.cr0_guest_owned_bits; | ||
1659 | |||
1660 | vcpu->arch.cr0 &= ~cr0_guest_owned_bits; | ||
1661 | vcpu->arch.cr0 |= vmcs_readl(GUEST_CR0) & cr0_guest_owned_bits; | ||
1662 | } | ||
1663 | |||
1656 | static void vmx_decache_cr4_guest_bits(struct kvm_vcpu *vcpu) | 1664 | static void vmx_decache_cr4_guest_bits(struct kvm_vcpu *vcpu) |
1657 | { | 1665 | { |
1658 | ulong cr4_guest_owned_bits = vcpu->arch.cr4_guest_owned_bits; | 1666 | ulong cr4_guest_owned_bits = vcpu->arch.cr4_guest_owned_bits; |
@@ -4106,6 +4114,7 @@ static struct kvm_x86_ops vmx_x86_ops = { | |||
4106 | .set_segment = vmx_set_segment, | 4114 | .set_segment = vmx_set_segment, |
4107 | .get_cpl = vmx_get_cpl, | 4115 | .get_cpl = vmx_get_cpl, |
4108 | .get_cs_db_l_bits = vmx_get_cs_db_l_bits, | 4116 | .get_cs_db_l_bits = vmx_get_cs_db_l_bits, |
4117 | .decache_cr0_guest_bits = vmx_decache_cr0_guest_bits, | ||
4109 | .decache_cr4_guest_bits = vmx_decache_cr4_guest_bits, | 4118 | .decache_cr4_guest_bits = vmx_decache_cr4_guest_bits, |
4110 | .set_cr0 = vmx_set_cr0, | 4119 | .set_cr0 = vmx_set_cr0, |
4111 | .set_cr3 = vmx_set_cr3, | 4120 | .set_cr3 = vmx_set_cr3, |