]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: MTRR: remove mtrr_state.have_fixed
authorXiao Guangrong <guangrong.xiao@linux.intel.com>
Mon, 15 Jun 2015 08:55:24 +0000 (16:55 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 19 Jun 2015 15:16:27 +0000 (17:16 +0200)
vMTRR does not depend on any host MTRR feature and fixed MTRRs have always
been implemented, so drop this field

Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mtrr.c
arch/x86/kvm/x86.c

index cf8d320dc7a5f893e934f86d297f5f2afbbf05b0..cbf9f076f57cbc3e4b61ea11ee4802aa566fa38e 100644 (file)
@@ -342,6 +342,13 @@ enum {
        KVM_DEBUGREG_RELOAD = 4,
 };
 
+struct kvm_mtrr {
+       struct mtrr_var_range var_ranges[MTRR_MAX_VAR_RANGES];
+       mtrr_type fixed_ranges[KVM_NR_FIXED_MTRR_REGION];
+       unsigned char enabled;
+       mtrr_type def_type;
+};
+
 struct kvm_vcpu_arch {
        /*
         * rip and regs accesses must go through
@@ -472,7 +479,7 @@ struct kvm_vcpu_arch {
        bool nmi_injected;    /* Trying to inject an NMI this entry */
        bool smi_pending;    /* SMI queued after currently running handler */
 
-       struct mtrr_state_type mtrr_state;
+       struct kvm_mtrr mtrr_state;
        u64 pat;
 
        unsigned switch_db_regs;
index a05846a524d936430f63e16f3c90a677770a2f96..ce061fffc0770f0b215eebb0b17e2036b00800b5 100644 (file)
@@ -103,7 +103,7 @@ EXPORT_SYMBOL_GPL(kvm_mtrr_valid);
 
 static void update_mtrr(struct kvm_vcpu *vcpu, u32 msr)
 {
-       struct mtrr_state_type *mtrr_state = &vcpu->arch.mtrr_state;
+       struct kvm_mtrr *mtrr_state = &vcpu->arch.mtrr_state;
        unsigned char mtrr_enabled = mtrr_state->enabled;
        gfn_t start, end, mask;
        int index;
@@ -247,7 +247,7 @@ int kvm_mtrr_get_msr(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
  * The function is based on mtrr_type_lookup() in
  * arch/x86/kernel/cpu/mtrr/generic.c
  */
-static int get_mtrr_type(struct mtrr_state_type *mtrr_state,
+static int get_mtrr_type(struct kvm_mtrr *mtrr_state,
                         u64 start, u64 end)
 {
        u64 base, mask;
@@ -262,8 +262,7 @@ static int get_mtrr_type(struct mtrr_state_type *mtrr_state,
        end--;
 
        /* Look in fixed ranges. Just return the type as per start */
-       if (mtrr_state->have_fixed && (mtrr_state->enabled & 0x1) &&
-             (start < 0x100000)) {
+       if ((mtrr_state->enabled & 0x1) && (start < 0x100000)) {
                int idx;
 
                if (start < 0x80000) {
index fb6c9a11b5c1845f1ab238c705982e01a5c7fcee..2ffad7f2a28ee5a323f5409bc87d912438c7c786 100644 (file)
@@ -7379,7 +7379,6 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
 {
        int r;
 
-       vcpu->arch.mtrr_state.have_fixed = 1;
        r = vcpu_load(vcpu);
        if (r)
                return r;