Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp260541lqp; Mon, 10 Jun 2024 03:22:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWsjesQBWVdxPXRTBiHMZBhxSLcTwdKqyeuiANFTDt9ObmNycY3/qIwHGagR8wPqRczF5YM5MCbzCwnlZDMXCLjntWO1sh8QoLu+F/Emg== X-Google-Smtp-Source: AGHT+IF1abxvpPaDwvGPcPhnTv5jQLQ/EsNKYXJos+w0GBJfwzjhuhJviwAG5D4StBAyqnB0SHmZ X-Received: by 2002:a17:902:ecc5:b0:1f7:b24:3e8d with SMTP id d9443c01a7336-1f70b243fa6mr43669225ad.38.1718014942292; Mon, 10 Jun 2024 03:22:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718014942; cv=pass; d=google.com; s=arc-20160816; b=xs8HGIOrx9vKDEEUn7qx7xJR1ldmKJhiqm0lzKP9IU/xI1UMUpcJ5A/JH2p+ex6Tks MlK+Ms86kmIRmM+ftuFiUWFiRRcrGB3ZigYXc8Ggwno0hiOWP1UL/Py1M1xgrDkvZWUz FE7P/9FMUX/oVq3vSsE7yK2C8X1wbPZzlbwOFcqp24YOZK7ker9wodou6vFfQA2Z8f6Q 2yZCHEorMeHD/aD41JToXi/D+hBpNV4kf8Nxbs3baBbnzWX2NFPyCABHtviS0WIxArzP AWt/pHIUq2PE0XdIK0/ZZdkHv0y9GpLKD8/sFGDw/Uy44kwM0xg/Usvy43LbwOQnJLC3 p8/g== 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=iEfSemHRxgSOfPiZYMvW6KyDv2YGLxFXvDUpF+fStco=; fh=Nrt5IRBaS0EQz2zwnkh0hFu/m/Ym/cZ6167zFPWHGTc=; b=VN985TS24A2WJgq4IicR+fTA3x6OyQpK0qfbMqU8b9JYtRbkHxTlT5er6RtghjFpYx L2HlkpPJo0gOd3q8ZvuJw82V7sD1n4iXXr1Q/PS/VlrKmcpLbcyIYrfbK40r1PLGtl8p FSz2FLkLMf2Dy9yn+T4tFA+ubDYfS1nnjTr1AtNmYdQqMj7wtPkDLMklYLiWInzCwNAi 0cOuCo3fPTXCiY9VqDnvetzUeOy36RPlBpIgrqaVNO+dzKs+fB11fya/cz8HYzruapUf feN42ZN/4ZhY+LarTuYvRifNwnlXGI/MXs66kIWYsKb9im1RaDk/2Ayg+NImtdIpz4pc o6Lg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="GuHJaB/E"; 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-208004-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208004-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7d4c67si41930005ad.221.2024.06.10.03.22.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 03:22:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208004-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="GuHJaB/E"; 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-208004-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208004-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4A226284CB0 for ; Mon, 10 Jun 2024 10:22:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 825D67E0E9; Mon, 10 Jun 2024 10:21:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GuHJaB/E" Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 11FB07A15A; Mon, 10 Jun 2024 10:21:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718014888; cv=none; b=P4JuoP124iOQEYPw2QfIqnNHEN310lqpbJtlvb0z/0aQzc8v9aGtEM7SFC7LDXooSAPd+eQWwBnTY0VEz/sv8SsZDgMOUnd/m7IFv9jf2jC1nemrbAb8dVJCHbG1NCkTDZ7Xri3YZxitcigdnu7U5R3qsSzKdQWgHhU4XYJlSDg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718014888; c=relaxed/simple; bh=B2wImS6jYkVNxmJNAz/7Rmlae+jcWsMN5Euy7uX8VsY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TZLL7lZn2Vl+Pt/Jwmiu6INtBMasAykZHMoAobFCNpyb0hRB5nBLSjuO0fmA6WhUubR2PiKlvCkzjbFnFeW+09l88XMWtrARyQI2vcgNDT/1tsgQ7U4NCWri6rIfvZm9YKiOXa4e+pEvy9UUwu2YWmBhzpDOJIi8haPOpg50bm8= 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=GuHJaB/E; arc=none smtp.client-ip=209.85.218.54 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-ej1-f54.google.com with SMTP id a640c23a62f3a-a68b41ef3f6so462290966b.1; Mon, 10 Jun 2024 03:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718014885; x=1718619685; 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=iEfSemHRxgSOfPiZYMvW6KyDv2YGLxFXvDUpF+fStco=; b=GuHJaB/E1SHWPw4NrPkg8fcdUM6LTFVZ6p9rnjQn+YbkwCRwnjbL6f+JA7W++oLmh4 pf3ojqbyulcyQvlctxFJooEjsYThs54n7eez5YGnltoHmdCzmZiJjGcH5W4j1PaIeKsV wrBXlpyYJNlPCrtHLvOi9CV6Em4dA5qr1FeArxZa7FxdOIqblFfQHH+QaMULJYjpd/7J 2ZRhmJ9DtEkJJWnSi7jbhQ8ZFEUkbf8d4tr7y32jjfUcIZJg9u00TQDK8FJNLDSb6WUx D9NWBfLtmeMBX6i/zo0UvQCOWYwuMe+YA7ZTpVBoJfyFrYnwqVY0oYlpk+SrBn3aALHy 9lnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718014885; x=1718619685; 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=iEfSemHRxgSOfPiZYMvW6KyDv2YGLxFXvDUpF+fStco=; b=wYmveTqzMROK4m6hxGtaJOJMyf3qtZTuNW1MTySN5kXkP0BmPy8s8d0R/b76sjPJ6l xz9runq9TY33jvObwbnAxQpGmIIFojqrxiBn7vNgWA5+OWaUpNU4ZqaRHP2f8HxgH1Kx /WKckjym8sBnKlBViSKoA6nsdBWbGOrNIOEl3kBp9AvNHAtrRTSuSZ3P6IFh/7TCwSUp zZLWOl3Q5Ru4FibKLFDjTJn65PRki6ONA4RNAdYvATh5XNNq46XfF/8FS9ScdbRTEYT8 V0IswnXDiOEGh0q+hhiSLHZ3G8PfXr52r8pRP0fals3GD/no+VU8Fx2tufIHK22d4YwZ ++gA== X-Forwarded-Encrypted: i=1; AJvYcCXsPWxaBSMA3gNw3bL3ZX/xhejhOaEa0J5WpiSdCa1Lx5yLMZbSCOIOK3Z6CUd+LERs+RLfTqu3QbLZ2lc1dhZw4HVFbno52y8+F47VE/dcvAKBOVc94XTGIbmTwq61EmLGKchivSQYPSB1y5SFOmmXCUE24o60bXi5 X-Gm-Message-State: AOJu0Yy8DLBxjxrb1FxSm+JdUyoUJCinNx6j3ifbx9WZGF7pVZh8TWcp JsDxPNjkDGuzTS78HVcfL9LpmqROZmbZUWcneb1+hrEXutJMLlI7 X-Received: by 2002:a17:906:3289:b0:a69:1a11:d396 with SMTP id a640c23a62f3a-a6cdc0e252amr568492666b.71.1718014885293; Mon, 10 Jun 2024 03:21:25 -0700 (PDT) Received: from vasant-suse.fritz.box ([2001:9e8:ab68:af00:6f43:17ee:43bd:e0a9]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f0d7b35d5sm290887766b.192.2024.06.10.03.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 03:21:24 -0700 (PDT) From: vsntk18@gmail.com To: vsntk18@gmail.com Cc: x86@kernel.org, Borislav.Petkov@amd.com, Dhaval.Giani@amd.com, ashish.kalra@amd.com, 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, jroedel@suse.de, 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, michael.roth@amd.com, 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, vkarasulli@suse.de Subject: [PATCH v6 01/10] x86/kexec/64: Disable kexec when SEV-ES is active Date: Mon, 10 Jun 2024 12:21:04 +0200 Message-Id: <20240610102113.20969-2-vsntk18@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240610102113.20969-1-vsntk18@gmail.com> References: <20240610102113.20969-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. Cc: stable@vger.kernel.org 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 cc0f7f70b17b..1dfb47df5c01 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