From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] When switching to a vm8086 task, load segments as 16-bit Date: Tue, 11 Aug 2009 11:45:40 -0500 Message-ID: <4A81A034.7050603@us.ibm.com> References: <1249952431-7764-1-git-send-email-aliguori@us.ibm.com> <4A819DD3.4060308@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Gleb Natapov To: Avi Kivity Return-path: Received: from e39.co.us.ibm.com ([32.97.110.160]:53941 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751699AbZHKQpo (ORCPT ); Tue, 11 Aug 2009 12:45:44 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e39.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id n7BGeoLx012578 for ; Tue, 11 Aug 2009 10:40:50 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n7BGjgY8210480 for ; Tue, 11 Aug 2009 10:45:43 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n7BGjgJx011977 for ; Tue, 11 Aug 2009 10:45:42 -0600 In-Reply-To: <4A819DD3.4060308@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > On 08/11/2009 04:00 AM, Anthony Liguori wrote: > > kvm_load_segment_descriptor() can already load plain segments: > > if (!(vcpu->arch.cr0 & X86_CR0_PE)) > return kvm_load_realmode_segment(vcpu, selector, seg); > > so we can simplify the patch a bit by extending the check. I went down that road but you need to check the to-be-switched-into tss, which isn't available directly from vcpu so we would have to either pass the tss as a parameter to the function or at least a flag indicating that we're going into vm8086 mode. There are other callers of kvm_load_segment_descriptor that would need updating and it already takes a few extra parameters. That's why I went down this road. Happy to change though if you'd prefer a different approach. -- Regards, Anthony Liguori