Commit 19bca6ab authored by Andre Przywara's avatar Andre Przywara Committed by Avi Kivity

KVM: SVM: Fix cross vendor migration issue with unusable bit

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: default avatarAndre Przywara <andre.przywara@amd.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent a4d7749b
...@@ -796,6 +796,11 @@ static void svm_get_segment(struct kvm_vcpu *vcpu, ...@@ -796,6 +796,11 @@ static void svm_get_segment(struct kvm_vcpu *vcpu,
var->db = (s->attrib >> SVM_SELECTOR_DB_SHIFT) & 1; var->db = (s->attrib >> SVM_SELECTOR_DB_SHIFT) & 1;
var->g = (s->attrib >> SVM_SELECTOR_G_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) { switch (seg) {
case VCPU_SREG_CS: case VCPU_SREG_CS:
/* /*
...@@ -827,8 +832,6 @@ static void svm_get_segment(struct kvm_vcpu *vcpu, ...@@ -827,8 +832,6 @@ static void svm_get_segment(struct kvm_vcpu *vcpu,
var->type |= 0x1; var->type |= 0x1;
break; break;
} }
var->unusable = !var->present;
} }
static int svm_get_cpl(struct kvm_vcpu *vcpu) static int svm_get_cpl(struct kvm_vcpu *vcpu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment