Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5708662pxv; Wed, 21 Jul 2021 11:55:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSoaQX4qf6QafpyRcCo68sOk8yklpWOCZKKVxERkO9M1ibBza7KZNkqNtsFuo3TpVuOpyd X-Received: by 2002:a17:907:d1b:: with SMTP id gn27mr39473978ejc.301.1626893738836; Wed, 21 Jul 2021 11:55:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626893738; cv=none; d=google.com; s=arc-20160816; b=d0jlOBP/ENecuk56b1hx+DZv530NdTbjXfOjJfrvCkgXZKJ262TkzKGU1F3dnaYKSk Mw7n7oHk9hC2YcSrVnJWw8CKegb0EHSJ04AfBrZ9F8Djzjauzg7RQEuMuTztPCWnMy5J s61HoNVi54qkMhjvmJ6ejqk0lKwXIASdnrtxep4F1RON37J7wqUaF9D0v+m+rtekGNeH WUKF06Z4uqK4e9M2SZW6zJ/LbOQxCk9/9coFQfZo5pBkFoiPrryT+nCiVccPs9a5G6hh KwY6yVCi3P7ByovCp4/PO4Nr8Ghpveuvvj84ThpBxZWP9cDERfXey9W6iCohFZ2mSGaK Wf1g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kE7CVHr9vx5yyPGRTw5WpNoZG9RlrxHRgBcjKzxpWAg=; b=rJyWIVaGdZlxLqDrXBtexVTdqAjh3eHBW2AHEOydNZYvVtZbnGxN/dvV3TJ21P8a+I a6ltTIksiLZLFou29ldzm8i0w4s843ekRtXaGQp8nMPUjQxHTtNaGuRjbiyxnT1ddwp4 HkPDSW4i0CYllPQW5Q4viFVEWV5DK8DNjF/Lzdr6VMTB9iAbodsFAtaLAODeanFxP8YB z/5puYdcAaZx8EDuHAAuysxm5sjDOoUfBPvOiJuZ2FmXXk6anGTGwbFdx2+/JW8lSeSy /bW1i/1hvIxxzyQZVFpLkUOf14SDgfZNdVervuReWyYSc3iUMilD1DNFzBqXK7jNfU3I 8/ng== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga14si25057660ejc.427.2021.07.21.11.55.14; Wed, 21 Jul 2021 11:55:38 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239212AbhGUNkH (ORCPT + 99 others); Wed, 21 Jul 2021 09:40:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239031AbhGUNkB (ORCPT ); Wed, 21 Jul 2021 09:40:01 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35C27C061575; Wed, 21 Jul 2021 07:20:38 -0700 (PDT) Received: from cap.home.8bytes.org (p4ff2b1ea.dip0.t-ipconnect.de [79.242.177.234]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by theia.8bytes.org (Postfix) with ESMTPSA id CCB49936; Wed, 21 Jul 2021 16:20:24 +0200 (CEST) From: Joerg Roedel To: x86@kernel.org, Eric Biederman Cc: kexec@lists.infradead.org, Joerg Roedel , stable@vger.kernel.org, hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , Arvind Sankar , Joerg Roedel , linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH 02/12] x86/kexec/64: Forbid kexec when running as an SEV-ES guest Date: Wed, 21 Jul 2021 16:20:05 +0200 Message-Id: <20210721142015.1401-3-joro@8bytes.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210721142015.1401-1-joro@8bytes.org> References: <20210721142015.1401-1-joro@8bytes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel For now, kexec is not supported when running as an SEV-ES guest. Doing so requires additional hypervisor support and special code to hand over the CPUs to the new kernel in a safe way. Until this is implemented, do not support kexec in SEV-ES guests. Cc: stable@vger.kernel.org # v5.10+ Signed-off-by: Joerg Roedel --- arch/x86/kernel/machine_kexec_64.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 131f30fdcfbd..a8e16a411b40 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -591,3 +591,11 @@ void arch_kexec_pre_free_pages(void *vaddr, unsigned int pages) */ set_memory_encrypted((unsigned long)vaddr, pages); } + +/* + * Kexec is not supported in SEV-ES guests yet + */ +bool arch_kexec_supported(void) +{ + return !sev_es_active(); +} -- 2.31.1