From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] Fixed KVM problems with old DOS programs. Compatibility can be forced by module parameter. Date: Wed, 4 Nov 2015 22:27:03 +0100 Message-ID: <563A7827.8030506@redhat.com> References: <563A5D7D.4080201@wiesinger.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit To: Gerhard Wiesinger , kvm@vger.kernel.org Return-path: Received: from mail-wm0-f41.google.com ([74.125.82.41]:38454 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932428AbbKDV1I (ORCPT ); Wed, 4 Nov 2015 16:27:08 -0500 Received: by wmeg8 with SMTP id g8so52469954wme.1 for ; Wed, 04 Nov 2015 13:27:07 -0800 (PST) In-Reply-To: <563A5D7D.4080201@wiesinger.com> Sender: kvm-owner@vger.kernel.org List-ID: On 04/11/2015 20:33, Gerhard Wiesinger wrote: > Signed-off-by: Gerhard Wiesinger > --- > arch/x86/kvm/svm.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > index 2f9ed1f..e0b00fc 100644 > --- a/arch/x86/kvm/svm.c > +++ b/arch/x86/kvm/svm.c > @@ -198,6 +198,10 @@ static bool npt_enabled; > static int npt = true; > module_param(npt, int, S_IRUGO); > +/* allow backward compatibility with e.g. old DOS application */ > +static int npt_task_switch_emulation = true; > +module_param(npt_task_switch_emulation, int, S_IRUGO); > + > /* allow nested virtualization in KVM/SVM */ > static int nested = true; > module_param(nested, int, S_IRUGO); > @@ -1177,6 +1181,9 @@ static void init_vmcb(struct vcpu_svm *svm, bool > init_event) > if (npt_enabled) { > /* Setup VMCB for Nested Paging */ > control->nested_ctl = 1; > + if (!npt_task_switch_emulation) { > + clr_intercept(svm, INTERCEPT_TASK_SWITCH); > + } > clr_intercept(svm, INTERCEPT_INVLPG); > clr_exception_intercept(svm, PF_VECTOR); > clr_cr_intercept(svm, INTERCEPT_CR3_READ); What is the problem you are seeing? KVM can emulate task switches; the intercept is set here because of a processor erratum that can mess them up even though, in theory, AMD supports task switching from guest mode. Paolo