Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp244108pxf; Wed, 10 Mar 2021 05:31:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYRhPRHdnkt4PVjZXjIg/Qi2qvZC1EwBSlAqycaY1YzTHYa3Y8qyOtO/Dwz9Uzk5T+rQVN X-Received: by 2002:a50:ee10:: with SMTP id g16mr3260241eds.215.1615383110770; Wed, 10 Mar 2021 05:31:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615383110; cv=none; d=google.com; s=arc-20160816; b=gs4Rjb/XQEd7I13+u7vW0j26qS+k2CJ5DvWL1CphB6G2md3FKAfSs3dH77GcEa0M5t JHqxee2lbEA8AHGbzS1ZmZ/7zXMBs5J6MUf4I5IzrF4EpyvJ4b6E3/iQr6RlEtfrnbl7 MNKbTpMlurI5eTzSWzwLyM8jMIKCMs55ZCImGYZ4W/v6AQCz9DUgjcapHUg+szEVwEWD c+ZUZ1GPCg+qpMS98Mv/rSU/09T9EJJkJg/ssn3Pi/ktZR40XNqIxhI3LhJsZAIAqGwJ QmxTFx6VmexKY2qsJA6j6itJt0g9YHCUPjBdf/8QeWdIKNZjMejAGB8TNPhV/0KHtwdp 9e0A== 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=FkGOgzzwz7pJCGBkkjzjXnZcUoyZLJLpuTKNK5gJ27I=; b=hSYsipzsJS45tqHna24O0pIlmIYVcnj2BNwSsSNfDLyKNBK6VKvyhkMXS4eudyT+pT lOWuUfQ/2UWha9Oi3Djcdmcr1Wyd1j7JMTnMsBERZmWo3y/d1ZjpJMuct/vzO6mfdOlI rvWnXV4/Bq748uw6ihtyZ6REcHBvnrcSj0WwXJHgoksar7V9K/41Sp/X69FJyHvmIdxU 5NmtIe4d1eXHy+GrbYxdKPAR4m1ExEaDpnBuk2x42XoN+gCv3JlfdyPQFij8f7k6wdpO KYF6gb7j6SadYzdn2g8J3mAbJksM0MK3B/79A6C4SzUvKME9FKkmoItFRDJovKsED4ca SjHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dN62ONUA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d15si4362529edu.375.2021.03.10.05.31.27; Wed, 10 Mar 2021 05:31:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dN62ONUA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234456AbhCJNa0 (ORCPT + 99 others); Wed, 10 Mar 2021 08:30:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:47564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233416AbhCJNZf (ORCPT ); Wed, 10 Mar 2021 08:25:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3437F65022; Wed, 10 Mar 2021 13:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615382729; bh=Cs4qcLhhVfzQ3eIwmM7Eq/ZqOm3G1leQKz8IcEFb7Ko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dN62ONUAGDma70ioj2szrul8F+XChUk0n5sJ4VNHDyqGVl8etr+Rrpz4KeAPRFTyG jSVHEaF3ohHZu/kAHqHRT4SI/S10/HcI1QqD8plrWViCkhhqVjBx1iO3EvGLEY5Qd5 x5Wj6W6XplmgOABfXD31H+Bcr7VmnYVLf1PQAI6c= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Babu Moger , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.10 47/49] KVM: SVM: Clear the CR4 register on reset Date: Wed, 10 Mar 2021 14:23:58 +0100 Message-Id: <20210310132323.425631742@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210310132321.948258062@linuxfoundation.org> References: <20210310132321.948258062@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Babu Moger [ Upstream commit 9e46f6c6c959d9bb45445c2e8f04a75324a0dfd0 ] This problem was reported on a SVM guest while executing kexec. Kexec fails to load the new kernel when the PCID feature is enabled. When kexec starts loading the new kernel, it starts the process by resetting the vCPU's and then bringing each vCPU online one by one. The vCPU reset is supposed to reset all the register states before the vCPUs are brought online. However, the CR4 register is not reset during this process. If this register is already setup during the last boot, all the flags can remain intact. The X86_CR4_PCIDE bit can only be enabled in long mode. So, it must be enabled much later in SMP initialization. Having the X86_CR4_PCIDE bit set during SMP boot can cause a boot failures. Fix the issue by resetting the CR4 register in init_vmcb(). Signed-off-by: Babu Moger Message-Id: <161471109108.30811.6392805173629704166.stgit@bmoger-ubuntu> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/svm/svm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 76ab1ee0784a..642f0da31ac4 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -1192,6 +1192,7 @@ static void init_vmcb(struct vcpu_svm *svm) init_sys_seg(&save->ldtr, SEG_TYPE_LDT); init_sys_seg(&save->tr, SEG_TYPE_BUSY_TSS16); + svm_set_cr4(&svm->vcpu, 0); svm_set_efer(&svm->vcpu, 0); save->dr6 = 0xffff0ff0; kvm_set_rflags(&svm->vcpu, 2); -- 2.30.1