Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 340e01248478ba8b78a6d4d1809b1eff > files > 498

kvm-83-270.el5_11.src.rpm

From 611f8afbe65b575f936c4a649907997c560801bc Mon Sep 17 00:00:00 2001
From: Alex Williamson <alex.williamson@redhat.com>
Date: Thu, 7 Apr 2011 17:45:38 -0300
Subject: [PATCH 2/2] KVM: VMX: update live TR selector if it changes in real mode

RH-Author: Alex Williamson <alex.williamson@redhat.com>
Message-id: <20110407174529.9017.84296.stgit@localhost6.localdomain6>
Patchwork-id: 21654
O-Subject: [RHEL5.7 kmod-kvm PATCH 2/2] KVM: VMX: update live TR selector if it
	changes in real mode
Bugzilla: 693918
RH-Acked-by: Avi Kivity <avi@redhat.com>
RH-Acked-by: Gleb Natapov <gleb@redhat.com>
RH-Acked-by: Don Dutile <ddutile@redhat.com>
RH-Acked-by: Glauber Costa <glommer@redhat.com>

From: Gleb Natapov <gleb@redhat.com>

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=693918
Brew build: https://brewweb.devel.redhat.com/taskinfo?taskID=3240237
Upstream commit: a8ba6c2622036101d0c6a195f97546bcb1a056ab

When rmode.vm86 is active TR descriptor is updated with vm86 task values,
but selector is left intact. vmx_set_segment() makes sure that if TR
register is written into while vm86 is active the new values are saved
for use after vm86 is deactivated, but since selector is not updated on
vm86 activation/deactivation new value is lost. Fix this by writing new
selector into vmcs immediately.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
---

 arch/x86/kvm/vmx.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 arch/x86/kvm/vmx.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 660f42e..e62e4ce 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1735,6 +1735,7 @@ static void vmx_set_segment(struct kvm_vcpu *vcpu,
 	u32 ar;
 
 	if (vcpu->arch.rmode.active && seg == VCPU_SREG_TR) {
+		vmcs_write16(sf->selector, var->selector);
 		vcpu->arch.rmode.tr.selector = var->selector;
 		vcpu->arch.rmode.tr.base = var->base;
 		vcpu->arch.rmode.tr.limit = var->limit;
-- 
1.7.3.2