Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp521053lql; Mon, 11 Mar 2024 09:19:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWiPKlwm12MJuYtAB9AxnZTyRKQ+J1J0BH1IYKNzUclQPqSLBQBPe75+fhvjMlGM4/up8zNL346obC9/OgxYwNZgSp9K26d4+0Xl1ZxiA== X-Google-Smtp-Source: AGHT+IGxIyyjcG1+MDEPKMoQBs8VL9JzE89WCA1HJKvdebgAU5lgIv+Xc7fBS5NNikjCZYLCXF5d X-Received: by 2002:ac8:7d96:0:b0:42e:6b2f:e7 with SMTP id c22-20020ac87d96000000b0042e6b2f00e7mr14473526qtd.26.1710173950233; Mon, 11 Mar 2024 09:19:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710173950; cv=pass; d=google.com; s=arc-20160816; b=BlPkRgGhRE221s1mhpyEF/QFAhS8pGgN0XNfCZUk4JMOm8KOxH7cHHdpnco8Knsh55 Su7NtsRIsyhOzVYT8/FtS9SInBqLAnsJNqFc+fLU/U0s93MVcVW20TTdY1zkDzZ+XpIx MNuIV1iDjKfxvQHeMHFnYUAcUotZmPdH/zz/LTu6k/4tgZlqLYH1hhBXBRDUE534lP+r SYWgujx118Geq10XTr4QNz3M2/8SpLH45nmK3UftDhXYVaenGsDZXnRmHo46Up3GNCoN Fp5ZtK0mrApFyq57b0S0Q6IBeoZb9D504xVuaqdCEYi7u+uy/CLagOTGsU8mvjTLWpAc oUkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=KwrPOtCFWcQDMfUXPx+XS96HNczA3gaW/2MdY2qxab4=; fh=PJ1mzbe9Cno36wGg4Zj8paseJArkB3QepMcSIcfHakQ=; b=sCNubE37N06lpObrn5Ve8R4W7pG/M85Ze0T2BCeS8hODb6pUaO7bCH8fmbvT1ygsYQ fxE7lJPEQ4FJ6ghWV058n9VH/tLPv4T6qajrekXnNn0tbTnwcetU+q7hJHSBoQXME5Mh lvaxSQyl/wtEQgUvj29x6/2RcdxNg53jHjTmtjIcan39gQhR04sh1jnGlmy8tn+yQ1a2 P0s1gypQqx2hb8bYwO8Xsi40/obSHxJ9EmCub26R5HUEyv7qqiHbm21dYsIwwi+bLZmJ rcqH/33rMSnWj8CwQjNPoATVQuBl4AjsWtm2N5vRF7ZM9bbh0s+NVoxB//uhuJatFWqf ed2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=R8WGV4LY; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-99206-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d11-20020a05622a15cb00b0042f513f3bc1si540869qty.786.2024.03.11.09.19.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 09:19:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99206-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=R8WGV4LY; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-99206-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F19B51C20BDE for ; Mon, 11 Mar 2024 16:19:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EAFA74F8B2; Mon, 11 Mar 2024 16:17:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R8WGV4LY" Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BC3E48CCD; Mon, 11 Mar 2024 16:17:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710173861; cv=none; b=Se8GxmfMOZDxiGGBKHJcdPSilXyOsOOCI9OYn8itcOT4b+7NF5xjCGvT+QzxfvNWsbH5ew98HrWc/UsftnyMCKEhT6alR68HI38McQYRyKxh61IbNu/J/lz1n9fcHyZibWnQlFC0kNcHhUvPrK4GCo29Sq4iPxRSTWq+YnVVRAc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710173861; c=relaxed/simple; bh=uh321KuZzkIr6bov6gkL2gVcZHrVCSYkUtEmo3DNyRc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eAzlXBRv/ca2/7K/Xd/Qaa2QYePWyhMqOKZKMiUGj1SYoDRA6CQN2lPUSULLn3QyiyNHI0kYggG8QywN3GlOrldbjO5rTCGrinm3w4s8Qb7q6hOuCTc2tz48InIQe8v/ZVRNRwTq9QWV7GctZBl5vcufpUkEqI2smJIQWsuryZw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=R8WGV4LY; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-33e5978fc1bso1971279f8f.3; Mon, 11 Mar 2024 09:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710173854; x=1710778654; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KwrPOtCFWcQDMfUXPx+XS96HNczA3gaW/2MdY2qxab4=; b=R8WGV4LYJFYpU3dVc2AaxSoHFRQBUFD/wHB6lI/EIJ6B6Uw8Dy750PT2+jtSkzSvZI +j1tTu+t7/PBAVOn53aPdz9UBui9YtAFLstfaVw3CJD+65tF4gIJbz/wNkdnmMd9ENvU h7e4vkx9tSQhPIxT5AxrtNNTuWIOIt0zbzgHNGiDNIMi+6IcJYn2JjUbmP/kODveD4AT cWTx1CG4vznyiaeqnwWYps10H0YQuuouPE5pzXPBE8HLoF2bNeUlpdIHiQVqDUxk6oiO jYLFjONIyFcfuZxlSxGfxUi9JEgjdQBHFRiMXe1AC8n2dv6PpzokHitYYijGpA8sDWhd 9luA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710173854; x=1710778654; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KwrPOtCFWcQDMfUXPx+XS96HNczA3gaW/2MdY2qxab4=; b=CW+JS30OoNhkZVWvQ4Ewu7UYMlvg1W7xZJQtlLwMCI8aINQMD6UKBxN6ghhcpaUorL +/DqeTgOUC2Ajkj6RuSJLjqMKoW/CEIctU2mXHjGpbBLDJhK6TAlw3oeJU0/3St2NGYi WZCbC307toOWRNvxqfAx9FE0zoiWGFV/0ZSB7BGboxU/E4q7NQUfualoLIcRxZIXQQHJ Q2Pa6C32PVzB3hYMUz9Ty7UmbIvL40aPMGANiWS9bHrwBx+aSu8zwm3Xrp7OwCFTuDZP Cb1R18DF4PzvGL8MhSuxN1eKzjNyaibxkxqB92uIBP18Zz1VeiPzVEq7mlfn2qMWcMgW Yx+A== X-Forwarded-Encrypted: i=1; AJvYcCVdmf82kYWH5mIyEZtwJzXeLEMZhg8rPAFzQL0xI1CYmXTjkBE68+rkIW2T8ZaaZpxZYHNyMhh4RFRBMSEm9L/HTXpCdHZLfejGtkhUxEXdSW2zscuOv5W4TR/hTLbP9xKLw19N3JFUly/A3acRtNu5ccozG58HlT4M X-Gm-Message-State: AOJu0Yw3clnGJb6isL41L+BeUw5h5WPz6FNynHi5SH/kQ62n3jGo/ExR Bbs0zQ5b2ut3toYRMLK3/2LFAOtcJYBU6MJcAyBuMYyJ/mPICq1W X-Received: by 2002:a5d:45ce:0:b0:33d:3abb:6db4 with SMTP id b14-20020a5d45ce000000b0033d3abb6db4mr4095738wrs.69.1710173853730; Mon, 11 Mar 2024 09:17:33 -0700 (PDT) Received: from vasant-suse.suse.cz ([2001:9e8:ab47:8200:c3b9:43af:f8e1:76f9]) by smtp.gmail.com with ESMTPSA id ba14-20020a0560001c0e00b0033e96fe9479sm2823815wrb.89.2024.03.11.09.17.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 09:17:33 -0700 (PDT) From: Vasant Karasulli To: x86@kernel.org Cc: joro@8bytes.org, cfir@google.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, ebiederm@xmission.com, erdemaktas@google.com, hpa@zytor.com, jgross@suse.com, jslaby@suse.cz, keescook@chromium.org, kexec@lists.infradead.org, kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, luto@kernel.org, martin.b.radev@gmail.com, mhiramat@kernel.org, mstunes@vmware.com, nivedita@alum.mit.edu, peterz@infradead.org, rientjes@google.com, seanjc@google.com, stable@vger.kernel.org, thomas.lendacky@amd.com, virtualization@lists.linux-foundation.org, Joerg Roedel , Vasant Karasulli Subject: [PATCH v4 1/9] x86/kexec/64: Disable kexec when SEV-ES is active Date: Mon, 11 Mar 2024 17:17:19 +0100 Message-Id: <20240311161727.14916-2-vsntk18@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311161727.14916-1-vsntk18@gmail.com> References: <20240311161727.14916-1-vsntk18@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Joerg Roedel SEV-ES needs special handling to support kexec. Disable it when SEV-ES is active until support is implemented. Signed-off-by: Joerg Roedel Signed-off-by: Vasant Karasulli --- arch/x86/kernel/machine_kexec_64.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index bc0a5348b4a6..3671ea1a5045 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -267,11 +267,22 @@ static void load_segments(void) ); } +static bool machine_kexec_supported(void) +{ + if (cc_platform_has(CC_ATTR_GUEST_STATE_ENCRYPT)) + return false; + + return true; +} + int machine_kexec_prepare(struct kimage *image) { unsigned long start_pgtable; int result; + if (!machine_kexec_supported()) + return -ENOSYS; + /* Calculate the offsets */ start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; -- 2.34.1