Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1197926pxy; Thu, 6 May 2021 02:41:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1qZ5ABZHa0xInPQhz2cp32RqcaHOxEqz7T2Cbik3P0hcwNmxziGmXLhB9MVzfeEyr3BQz X-Received: by 2002:a50:dac4:: with SMTP id s4mr4105138edj.353.1620294119629; Thu, 06 May 2021 02:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620294119; cv=none; d=google.com; s=arc-20160816; b=CV/EQ/kUx27vUiw+j8T289/rr35uvKEv54G7Yj8fdJp474SbWlyB+rvC1JKHk6pxsq mmVhzfLeSDkBW2d16ITrl3x+SOXOI8lIEIWx02pWytpdmAp3aQYfIeGk1Gmf9cvsnelj pY5h0C4ZfjMioXe0RjEFBp7udfra9rpjPJotdgM5sqs6TwW2RpgZbWdkl6ES73n0sZ4W ln0Rq/6gIaJdR8505R3Q6adwR8/NUEMg8qrYPh1nJv85yYXxhY51rZrvt5ajYYypLbMo JW1cBgjJioNEOJ/1y8hp9CyYVr9Mzmga0mENzb9AgG5cAAZYXCIjAy231EX1Fk38XgZe Po/w== 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=YV+N05R2FPBUVbFfqPghDUbohyqHtp2L97pulCGk2f8=; b=jib+qqCGqE11D7GBZQKlaOmsOLyYl5Adqpnm58zWWPNER76Zj6kFZnt+IKZTpxdewh AupnLBvOy3csyy5FfPan/aD+S8bJ263Hr6FSMYSnVX2+WqMHi+mp6lD/V//YZ9VdxorM qMGGpRBi8Ksvec4iqEXr7y9DIrRQOCcF2GRYs088GDA5bZ4cTEP7RNReQyyS8akVbaxR VVhpSypZXIgC+TIx420CGRCOvP0om9DVH5S4IptarvEcpKcQh+n4jFm1BROSZqq0WYMb R46EqdsYEpmY0CpQ7qhnWVsA6/1+BsMi8AMRka+9aauz/PohJ8ecc8zYZeR94TeNemFu Sd/Q== 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 lb23si1963050ejc.226.2021.05.06.02.41.31; Thu, 06 May 2021 02:41:59 -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 S234145AbhEFJdA (ORCPT + 99 others); Thu, 6 May 2021 05:33:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234106AbhEFJc5 (ORCPT ); Thu, 6 May 2021 05:32:57 -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 85529C061574; Thu, 6 May 2021 02:31:59 -0700 (PDT) Received: from cap.home.8bytes.org (p5b0069de.dip0.t-ipconnect.de [91.0.105.222]) (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 05B423FF; Thu, 6 May 2021 11:31:57 +0200 (CEST) From: Joerg Roedel To: Eric Biederman , x86@kernel.org 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 2/2] x86/kexec/64: Forbid kexec when running as an SEV-ES guest Date: Thu, 6 May 2021 11:31:22 +0200 Message-Id: <20210506093122.28607-3-joro@8bytes.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210506093122.28607-1-joro@8bytes.org> References: <20210506093122.28607-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 c078b0d3ab0e..f902cc9cc634 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -620,3 +620,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