Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4416890pxb; Mon, 21 Feb 2022 20:57:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5hznoN2PZzhtnwVZfzaBE7B+b2sT/VcDdT+Fdr3p641icT6UXxToOY2T3Nq23ezOCN0ob X-Received: by 2002:a63:b62:0:b0:36c:6f6a:5f9a with SMTP id a34-20020a630b62000000b0036c6f6a5f9amr17831051pgl.324.1645505849215; Mon, 21 Feb 2022 20:57:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645505849; cv=none; d=google.com; s=arc-20160816; b=ktyO/EwBqoEwkqd+2Y+llJOgozTrTvq2u1xGWV++hT7zf99kc8W+J4XzhbVstkN3Q5 dZrhz9xcNFblO/b7T2czCUiXEqBMHJF+8zGEPxuyNcFJp4M3cBq/MzUxaiBYMRwa2mi5 +38/XIDaaAPvAn5Ls4kDdN7l9jlpl+KyOr45ITkTDoSGEWj4VZWmZkqyv+vmGZIy+EPc R8//va4nRUcBZjg635Wt6umtywphhFI7u2SOdOzY5mo1Ww0bokvMHc5XOIvLkRQcW9Lk O7QK4A8CS0xF2m1AxZDP26Q8End9Ohpgq8icn4nEba96pXslcfhAq7nXn+75kdHtIRNP TsZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dq9oXCP1hEnnFcCeYcO3s5HcR1OC5GjG4dob2vU6kHY=; b=cSX77TfnLUmjp7ZvMwZPXEdOFsFUcl+aECh19/MnAQGEceGlPV9iXY2/0Di5t1GaOw UAyPm1s1X6CgJWPLqwDh96vOwIbdh1xWmU++y6XA0tNtozT4YlBdwTK2SA7qNxS6Hj/U ZdGODi6cIQ7DQXl2NchXz4Ci6y4Epn95x3mPSaQgIyZjN0O+klKzUn7djaHvMDPMqG5T PjtCtuvXY9ck4JfQHsagYQpxuNHkndWCKL60Y+vGZF/YvmEXQKTQNELsuNQOIC2SGnP1 w1Rgq3+S8bnubVq7ugoYzz07CiPiSo3CKPFVIjvBbBFeKIcuVmfjAVZ4j8BhaxPtNhjU 4QcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dotv4y9w; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x190si5026811pgx.151.2022.02.21.20.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 20:57:29 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dotv4y9w; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 506EB35DC9; Mon, 21 Feb 2022 20:34:37 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349702AbiBUJbs (ORCPT + 99 others); Mon, 21 Feb 2022 04:31:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350189AbiBUJWN (ORCPT ); Mon, 21 Feb 2022 04:22:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3421B37A9E; Mon, 21 Feb 2022 01:09:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C3C9660B23; Mon, 21 Feb 2022 09:09:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A636FC36AE7; Mon, 21 Feb 2022 09:09:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645434575; bh=o5gkH2Xv/3W6KkrbX56TKpiDHWD1wxf42jM4NdYGyi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dotv4y9wwu5uCCDgdqbUZSXvPTH+pChaP25DrUOZLK1wdSh7VTXfNFPmeYuuSHf/Y 1E0+Tsu5xIdlQZfulpOTNPIxZjUsCFEjqID5XWLaRFRlgeUdvqLnPzzjHDIL0cYr0k uvgT2gFYXJA+l+xED04VWch7a4wdVSbMmZAbmRdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Paolo Bonzini Subject: [PATCH 5.15 056/196] KVM: x86: nSVM/nVMX: set nested_run_pending on VM entry which is a result of RSM Date: Mon, 21 Feb 2022 09:48:08 +0100 Message-Id: <20220221084932.808896029@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084930.872957717@linuxfoundation.org> References: <20220221084930.872957717@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Levitsky commit 759cbd59674a6c0aec616a3f4f0740ebd3f5fbef upstream. While RSM induced VM entries are not full VM entries, they still need to be followed by actual VM entry to complete it, unlike setting the nested state. This patch fixes boot of hyperv and SMM enabled windows VM running nested on KVM, which fail due to this issue combined with lack of dirty bit setting. Signed-off-by: Maxim Levitsky Cc: stable@vger.kernel.org Message-Id: <20220207155447.840194-5-mlevitsk@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/svm/svm.c | 5 +++++ arch/x86/kvm/vmx/vmx.c | 1 + 2 files changed, 6 insertions(+) --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -4388,6 +4388,11 @@ static int svm_leave_smm(struct kvm_vcpu nested_load_control_from_vmcb12(svm, &vmcb12->control); ret = enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12, false); + if (ret) + goto unmap_save; + + svm->nested.nested_run_pending = 1; + unmap_save: kvm_vcpu_unmap(vcpu, &map_save, true); unmap_map: --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7532,6 +7532,7 @@ static int vmx_leave_smm(struct kvm_vcpu if (ret) return ret; + vmx->nested.nested_run_pending = 1; vmx->nested.smm.guest_mode = false; } return 0;