aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/kvm_host.h3
-rw-r--r--arch/x86/kvm/emulate.c6
-rw-r--r--arch/x86/kvm/vmx.c18
3 files changed, 12 insertions, 15 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 7ba3d9dc7ca2..30b28dc76411 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -81,9 +81,6 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
81 (base_gfn >> KVM_HPAGE_GFN_SHIFT(level)); 81 (base_gfn >> KVM_HPAGE_GFN_SHIFT(level));
82} 82}
83 83
84#define SELECTOR_TI_MASK (1 << 2)
85#define SELECTOR_RPL_MASK 0x03
86
87#define KVM_PERMILLE_MMU_PAGES 20 84#define KVM_PERMILLE_MMU_PAGES 20
88#define KVM_MIN_ALLOC_MMU_PAGES 64 85#define KVM_MIN_ALLOC_MMU_PAGES 64
89#define KVM_MMU_HASH_SHIFT 10 86#define KVM_MMU_HASH_SHIFT 10
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index e49cabae377d..cf7d424b29d2 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2435,7 +2435,7 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt)
2435 return emulate_gp(ctxt, 0); 2435 return emulate_gp(ctxt, 0);
2436 2436
2437 ctxt->eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_IF); 2437 ctxt->eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_IF);
2438 cs_sel = (u16)msr_data & ~SELECTOR_RPL_MASK; 2438 cs_sel = (u16)msr_data & ~SEGMENT_RPL_MASK;
2439 ss_sel = cs_sel + 8; 2439 ss_sel = cs_sel + 8;
2440 if (efer & EFER_LMA) { 2440 if (efer & EFER_LMA) {
2441 cs.d = 0; 2441 cs.d = 0;
@@ -2502,8 +2502,8 @@ static int em_sysexit(struct x86_emulate_ctxt *ctxt)
2502 return emulate_gp(ctxt, 0); 2502 return emulate_gp(ctxt, 0);
2503 break; 2503 break;
2504 } 2504 }
2505 cs_sel |= SELECTOR_RPL_MASK; 2505 cs_sel |= SEGMENT_RPL_MASK;
2506 ss_sel |= SELECTOR_RPL_MASK; 2506 ss_sel |= SEGMENT_RPL_MASK;
2507 2507
2508 ops->set_segment(ctxt, cs_sel, &cs, 0, VCPU_SREG_CS); 2508 ops->set_segment(ctxt, cs_sel, &cs, 0, VCPU_SREG_CS);
2509 ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); 2509 ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS);
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index fdd9f8b88e10..63ca692fa673 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3263,8 +3263,8 @@ static void fix_pmode_seg(struct kvm_vcpu *vcpu, int seg,
3263 * default value. 3263 * default value.
3264 */ 3264 */
3265 if (seg == VCPU_SREG_CS || seg == VCPU_SREG_SS) 3265 if (seg == VCPU_SREG_CS || seg == VCPU_SREG_SS)
3266 save->selector &= ~SELECTOR_RPL_MASK; 3266 save->selector &= ~SEGMENT_RPL_MASK;
3267 save->dpl = save->selector & SELECTOR_RPL_MASK; 3267 save->dpl = save->selector & SEGMENT_RPL_MASK;
3268 save->s = 1; 3268 save->s = 1;
3269 } 3269 }
3270 vmx_set_segment(vcpu, save, seg); 3270 vmx_set_segment(vcpu, save, seg);
@@ -3837,7 +3837,7 @@ static bool code_segment_valid(struct kvm_vcpu *vcpu)
3837 unsigned int cs_rpl; 3837 unsigned int cs_rpl;
3838 3838
3839 vmx_get_segment(vcpu, &cs, VCPU_SREG_CS); 3839 vmx_get_segment(vcpu, &cs, VCPU_SREG_CS);
3840 cs_rpl = cs.selector & SELECTOR_RPL_MASK; 3840 cs_rpl = cs.selector & SEGMENT_RPL_MASK;
3841 3841
3842 if (cs.unusable) 3842 if (cs.unusable)
3843 return false; 3843 return false;
@@ -3865,7 +3865,7 @@ static bool stack_segment_valid(struct kvm_vcpu *vcpu)
3865 unsigned int ss_rpl; 3865 unsigned int ss_rpl;
3866 3866
3867 vmx_get_segment(vcpu, &ss, VCPU_SREG_SS); 3867 vmx_get_segment(vcpu, &ss, VCPU_SREG_SS);
3868 ss_rpl = ss.selector & SELECTOR_RPL_MASK; 3868 ss_rpl = ss.selector & SEGMENT_RPL_MASK;
3869 3869
3870 if (ss.unusable) 3870 if (ss.unusable)
3871 return true; 3871 return true;
@@ -3887,7 +3887,7 @@ static bool data_segment_valid(struct kvm_vcpu *vcpu, int seg)
3887 unsigned int rpl; 3887 unsigned int rpl;
3888 3888
3889 vmx_get_segment(vcpu, &var, seg); 3889 vmx_get_segment(vcpu, &var, seg);
3890 rpl = var.selector & SELECTOR_RPL_MASK; 3890 rpl = var.selector & SEGMENT_RPL_MASK;
3891 3891
3892 if (var.unusable) 3892 if (var.unusable)
3893 return true; 3893 return true;
@@ -3914,7 +3914,7 @@ static bool tr_valid(struct kvm_vcpu *vcpu)
3914 3914
3915 if (tr.unusable) 3915 if (tr.unusable)
3916 return false; 3916 return false;
3917 if (tr.selector & SELECTOR_TI_MASK) /* TI = 1 */ 3917 if (tr.selector & SEGMENT_TI_MASK) /* TI = 1 */
3918 return false; 3918 return false;
3919 if (tr.type != 3 && tr.type != 11) /* TODO: Check if guest is in IA32e mode */ 3919 if (tr.type != 3 && tr.type != 11) /* TODO: Check if guest is in IA32e mode */
3920 return false; 3920 return false;
@@ -3932,7 +3932,7 @@ static bool ldtr_valid(struct kvm_vcpu *vcpu)
3932 3932
3933 if (ldtr.unusable) 3933 if (ldtr.unusable)
3934 return true; 3934 return true;
3935 if (ldtr.selector & SELECTOR_TI_MASK) /* TI = 1 */ 3935 if (ldtr.selector & SEGMENT_TI_MASK) /* TI = 1 */
3936 return false; 3936 return false;
3937 if (ldtr.type != 2) 3937 if (ldtr.type != 2)
3938 return false; 3938 return false;
@@ -3949,8 +3949,8 @@ static bool cs_ss_rpl_check(struct kvm_vcpu *vcpu)
3949 vmx_get_segment(vcpu, &cs, VCPU_SREG_CS); 3949 vmx_get_segment(vcpu, &cs, VCPU_SREG_CS);
3950 vmx_get_segment(vcpu, &ss, VCPU_SREG_SS); 3950 vmx_get_segment(vcpu, &ss, VCPU_SREG_SS);
3951 3951
3952 return ((cs.selector & SELECTOR_RPL_MASK) == 3952 return ((cs.selector & SEGMENT_RPL_MASK) ==
3953 (ss.selector & SELECTOR_RPL_MASK)); 3953 (ss.selector & SEGMENT_RPL_MASK));
3954} 3954}
3955 3955
3956/* 3956/*