diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2007-07-17 09:19:08 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-10-13 04:18:18 -0400 |
commit | 707d92fa72b425bc919a84670c01402e81505c58 (patch) | |
tree | 9e3a55293e867e499fd625ebac45db565ff0fc38 /drivers/kvm/vmx.c | |
parent | 9a2b85c620b9779360c7726de4caeda78cac38d4 (diff) |
KVM: Trivial: Use standard CR0 flags macros from asm/cpu-features.h
The kernel now has asm/cpu-features.h: use those macros instead of
inventing our own.
Also spell out definition of CR0_RESEVED_BITS (no code change) and fix typo.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r-- | drivers/kvm/vmx.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 7fa62c780ce4..ebd93b4775af 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -436,9 +436,9 @@ static void vmx_fpu_activate(struct kvm_vcpu *vcpu) | |||
436 | if (vcpu->fpu_active) | 436 | if (vcpu->fpu_active) |
437 | return; | 437 | return; |
438 | vcpu->fpu_active = 1; | 438 | vcpu->fpu_active = 1; |
439 | vmcs_clear_bits(GUEST_CR0, CR0_TS_MASK); | 439 | vmcs_clear_bits(GUEST_CR0, X86_CR0_TS); |
440 | if (vcpu->cr0 & CR0_TS_MASK) | 440 | if (vcpu->cr0 & X86_CR0_TS) |
441 | vmcs_set_bits(GUEST_CR0, CR0_TS_MASK); | 441 | vmcs_set_bits(GUEST_CR0, X86_CR0_TS); |
442 | update_exception_bitmap(vcpu); | 442 | update_exception_bitmap(vcpu); |
443 | } | 443 | } |
444 | 444 | ||
@@ -447,7 +447,7 @@ static void vmx_fpu_deactivate(struct kvm_vcpu *vcpu) | |||
447 | if (!vcpu->fpu_active) | 447 | if (!vcpu->fpu_active) |
448 | return; | 448 | return; |
449 | vcpu->fpu_active = 0; | 449 | vcpu->fpu_active = 0; |
450 | vmcs_set_bits(GUEST_CR0, CR0_TS_MASK); | 450 | vmcs_set_bits(GUEST_CR0, X86_CR0_TS); |
451 | update_exception_bitmap(vcpu); | 451 | update_exception_bitmap(vcpu); |
452 | } | 452 | } |
453 | 453 | ||
@@ -1002,17 +1002,17 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) | |||
1002 | { | 1002 | { |
1003 | vmx_fpu_deactivate(vcpu); | 1003 | vmx_fpu_deactivate(vcpu); |
1004 | 1004 | ||
1005 | if (vcpu->rmode.active && (cr0 & CR0_PE_MASK)) | 1005 | if (vcpu->rmode.active && (cr0 & X86_CR0_PE)) |
1006 | enter_pmode(vcpu); | 1006 | enter_pmode(vcpu); |
1007 | 1007 | ||
1008 | if (!vcpu->rmode.active && !(cr0 & CR0_PE_MASK)) | 1008 | if (!vcpu->rmode.active && !(cr0 & X86_CR0_PE)) |
1009 | enter_rmode(vcpu); | 1009 | enter_rmode(vcpu); |
1010 | 1010 | ||
1011 | #ifdef CONFIG_X86_64 | 1011 | #ifdef CONFIG_X86_64 |
1012 | if (vcpu->shadow_efer & EFER_LME) { | 1012 | if (vcpu->shadow_efer & EFER_LME) { |
1013 | if (!is_paging(vcpu) && (cr0 & CR0_PG_MASK)) | 1013 | if (!is_paging(vcpu) && (cr0 & X86_CR0_PG)) |
1014 | enter_lmode(vcpu); | 1014 | enter_lmode(vcpu); |
1015 | if (is_paging(vcpu) && !(cr0 & CR0_PG_MASK)) | 1015 | if (is_paging(vcpu) && !(cr0 & X86_CR0_PG)) |
1016 | exit_lmode(vcpu); | 1016 | exit_lmode(vcpu); |
1017 | } | 1017 | } |
1018 | #endif | 1018 | #endif |
@@ -1022,14 +1022,14 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) | |||
1022 | (cr0 & ~KVM_GUEST_CR0_MASK) | KVM_VM_CR0_ALWAYS_ON); | 1022 | (cr0 & ~KVM_GUEST_CR0_MASK) | KVM_VM_CR0_ALWAYS_ON); |
1023 | vcpu->cr0 = cr0; | 1023 | vcpu->cr0 = cr0; |
1024 | 1024 | ||
1025 | if (!(cr0 & CR0_TS_MASK) || !(cr0 & CR0_PE_MASK)) | 1025 | if (!(cr0 & X86_CR0_TS) || !(cr0 & X86_CR0_PE)) |
1026 | vmx_fpu_activate(vcpu); | 1026 | vmx_fpu_activate(vcpu); |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) | 1029 | static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) |
1030 | { | 1030 | { |
1031 | vmcs_writel(GUEST_CR3, cr3); | 1031 | vmcs_writel(GUEST_CR3, cr3); |
1032 | if (vcpu->cr0 & CR0_PE_MASK) | 1032 | if (vcpu->cr0 & X86_CR0_PE) |
1033 | vmx_fpu_deactivate(vcpu); | 1033 | vmx_fpu_deactivate(vcpu); |
1034 | } | 1034 | } |
1035 | 1035 | ||
@@ -1778,7 +1778,7 @@ static int handle_cr(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1778 | case 2: /* clts */ | 1778 | case 2: /* clts */ |
1779 | vcpu_load_rsp_rip(vcpu); | 1779 | vcpu_load_rsp_rip(vcpu); |
1780 | vmx_fpu_deactivate(vcpu); | 1780 | vmx_fpu_deactivate(vcpu); |
1781 | vcpu->cr0 &= ~CR0_TS_MASK; | 1781 | vcpu->cr0 &= ~X86_CR0_TS; |
1782 | vmcs_writel(CR0_READ_SHADOW, vcpu->cr0); | 1782 | vmcs_writel(CR0_READ_SHADOW, vcpu->cr0); |
1783 | vmx_fpu_activate(vcpu); | 1783 | vmx_fpu_activate(vcpu); |
1784 | skip_emulated_instruction(vcpu); | 1784 | skip_emulated_instruction(vcpu); |