]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: SVM: Fix cross vendor migration issue with unusable bit
authorAndre Przywara <andre.przywara@amd.com>
Tue, 28 Apr 2009 10:45:30 +0000 (12:45 +0200)
committerAvi Kivity <avi@redhat.com>
Tue, 5 May 2009 18:35:44 +0000 (21:35 +0300)
AMDs VMCB does not have an explicit unusable segment descriptor field,
so we emulate it by using "not present". This has to be setup before
the fixups, because this field is used there.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/svm.c

index ef43a18c74d0ca58c389f23a8ede3368614f3f1b..1647e81696aad8d91f97816db6dec938b4a569c8 100644 (file)
@@ -769,6 +769,11 @@ static void svm_get_segment(struct kvm_vcpu *vcpu,
        var->db = (s->attrib >> SVM_SELECTOR_DB_SHIFT) & 1;
        var->g = (s->attrib >> SVM_SELECTOR_G_SHIFT) & 1;
 
+       /* AMD's VMCB does not have an explicit unusable field, so emulate it
+        * for cross vendor migration purposes by "not present"
+        */
+       var->unusable = !var->present || (var->type == 0);
+
        switch (seg) {
        case VCPU_SREG_CS:
                /*
@@ -800,8 +805,6 @@ static void svm_get_segment(struct kvm_vcpu *vcpu,
                        var->type |= 0x1;
                break;
        }
-
-       var->unusable = !var->present;
 }
 
 static int svm_get_cpl(struct kvm_vcpu *vcpu)