summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2009-03-23 17:51:22 -0300
committerGreg Kroah-Hartman <gregkh@suse.de>2009-05-02 10:57:05 -0700
commitca4bd92990aadcbea84fa25ec0cc5b0cd387cb9a (patch)
tree2caae4418771310b9708d0a4e1c36e4753d34436 /arch
parentff896b463d96419ceef8465e2c3624501e4da4b0 (diff)
KVM: SVM: Set the 'g' bit of the cs selector for cross-vendor migration
(cherry picked from 25022acc3dd5f0b54071c7ba7c371860f2971b52) The hardware does not set the 'g' bit of the cs selector and this breaks migration from amd hosts to intel hosts. Set this bit if the segment limit is beyond 1 MB. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/svm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 9c4ce657d963..14ba6ff63cfc 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -772,6 +772,15 @@ static void svm_get_segment(struct kvm_vcpu *vcpu,
var->l = (s->attrib >> SVM_SELECTOR_L_SHIFT) & 1;
var->db = (s->attrib >> SVM_SELECTOR_DB_SHIFT) & 1;
var->g = (s->attrib >> SVM_SELECTOR_G_SHIFT) & 1;
+
+ /*
+ * SVM always stores 0 for the 'G' bit in the CS selector in
+ * the VMCB on a VMEXIT. This hurts cross-vendor migration:
+ * Intel's VMENTRY has a check on the 'G' bit.
+ */
+ if (seg == VCPU_SREG_CS)
+ var->g = s->limit > 0xfffff;
+
var->unusable = !var->present;
}