diff options
author | Andre Przywara <andre.przywara@amd.com> | 2009-04-28 06:45:30 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-05-11 04:18:04 -0400 |
commit | 19bca6ab75d8118ae970fcc656359ddb467ac763 (patch) | |
tree | 3f63eba121f3dd7994330087d65ad085c7e79f3a | |
parent | a4d7749be5de4a7261bcbe3c7d96c748792ec455 (diff) |
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: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kvm/svm.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 1821c2078199..9184e32778ab 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -796,6 +796,11 @@ static void svm_get_segment(struct kvm_vcpu *vcpu, | |||
796 | var->db = (s->attrib >> SVM_SELECTOR_DB_SHIFT) & 1; | 796 | var->db = (s->attrib >> SVM_SELECTOR_DB_SHIFT) & 1; |
797 | var->g = (s->attrib >> SVM_SELECTOR_G_SHIFT) & 1; | 797 | var->g = (s->attrib >> SVM_SELECTOR_G_SHIFT) & 1; |
798 | 798 | ||
799 | /* AMD's VMCB does not have an explicit unusable field, so emulate it | ||
800 | * for cross vendor migration purposes by "not present" | ||
801 | */ | ||
802 | var->unusable = !var->present || (var->type == 0); | ||
803 | |||
799 | switch (seg) { | 804 | switch (seg) { |
800 | case VCPU_SREG_CS: | 805 | case VCPU_SREG_CS: |
801 | /* | 806 | /* |
@@ -827,8 +832,6 @@ static void svm_get_segment(struct kvm_vcpu *vcpu, | |||
827 | var->type |= 0x1; | 832 | var->type |= 0x1; |
828 | break; | 833 | break; |
829 | } | 834 | } |
830 | |||
831 | var->unusable = !var->present; | ||
832 | } | 835 | } |
833 | 836 | ||
834 | static int svm_get_cpl(struct kvm_vcpu *vcpu) | 837 | static int svm_get_cpl(struct kvm_vcpu *vcpu) |