From nobody Wed Oct 30 22:14:32 2024 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2064.outbound.protection.outlook.com [40.107.93.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF164145B28; Thu, 1 Aug 2024 20:57:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722545823; cv=fail; b=TpazZwEQAIEQxK81IkTokYrpSmXhNgZVRU4Ry085rxqbRwOFgSYIQlPZdqPC8borwVzcUWxd+1/R2pEHGiKFhUjqorxr41bS97+IStBwFZwNOZ0tCKLPd5SE3GJNxdNwA7LrARJ6s8LstoAVwwheitg73rotU1IkOy/yCWJoLBo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722545823; c=relaxed/simple; bh=pYUdW/i1EhPgH5yKr1dbqcp4JCatVkCX7KcXaAxReH4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jXu1MoUQ1ERJpeuekSe/yfOJk1naHOuS+K/f0/YIbl2MjcMYcVaXQG1rJ/npWpTPQHVq93Z0s2L+K36tCd7iC3SskN6lQOcJ/anXij/Tu9YUbkGZXrQxAogMtgh78uPJSGRHE/vWRLgjvPb/tnXY731sjHzMNAeNYicNlm2lPP8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=TbKhOuup; arc=fail smtp.client-ip=40.107.93.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="TbKhOuup" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G4s6/lFvrNXsfoZrwtAwkyyBHviuxIY0lDbAPc5wP1eU4hF/D2/2wLdtGjxt2LcBONBRlz6cnWzU/QMkSUtaLGTUqY05/tI1rk4c8c3CyTbVV8fdbxpDoh5jWO1yIN0xOaAgYJ2TsrJjhD1Kq3vSgUpcT0KIrvVUvwvW3mogWpWluAPANOMbbAo2uekTch3r9QsAYOrkaR8K1/d42ieq/TfAjWvYk7tqtF3rRMqa/ERXaEmxCoNtsHt+xklwOPH5l037m6ootIujzSqgFdosT2YwBoKqPiXKHaVHu33MMstDPnSExWDlglS5j2wpesxnT2lXrtRyP6nXvJPBjEmE4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tsekWvlF7gS8r/Mi3UrBRLHcHm2QSZ1Bkyybkk+yTh8=; b=tdT3RGlA7aAQjqSQDcjENkAvcfnHypTc6Ixu6WF7xhKAsoSU74eRHz3MBcTweu5xo2l77/5rYF7wAj08V/H/EkpDYERUEQjEP8aCaCLxol4e3ArYrdq8CKB3/mh4Drny7MojYP00RGdPY5X5wS8pBg6GQzSWJ5ZGJqMbP+3mgf35ZjmlWH3rE9LMAoUe5+g0XKfL891YEQ/udfmFrgmuPMuLD+mYgDX5kVekL4YHcsZ+6M9tnLf2LLjzmS8KVXmu9sKRELutWQicR2nY2HIk4sqn+vV/FISYVKWhYMYW+L1Bubbt/biVS10BM5D1SClnEbhwNGSH03QlzPhEsUngYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tsekWvlF7gS8r/Mi3UrBRLHcHm2QSZ1Bkyybkk+yTh8=; b=TbKhOuupjoOFq1PI6KgP41RWLbWg102BoMRF4T8ssiSksNNCiBZCmjkDCDDuhEODPzn9YFuDGUFh5Me3CXHNGA02swK1DJMJHUwb+ewJ6G1gxBVdFYYb4TUvzFOfo29coUf72vNP38L1CFw0JtY0ejO87Htw9y75uSEwpzIFjbk= Received: from SA9PR03CA0004.namprd03.prod.outlook.com (2603:10b6:806:20::9) by LV3PR12MB9403.namprd12.prod.outlook.com (2603:10b6:408:217::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Thu, 1 Aug 2024 20:56:58 +0000 Received: from SA2PEPF00001509.namprd04.prod.outlook.com (2603:10b6:806:20:cafe::68) by SA9PR03CA0004.outlook.office365.com (2603:10b6:806:20::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22 via Frontend Transport; Thu, 1 Aug 2024 20:56:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00001509.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7828.19 via Frontend Transport; Thu, 1 Aug 2024 20:56:58 +0000 Received: from ethanolx16dchost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 1 Aug 2024 15:56:57 -0500 From: Pavan Kumar Paluri To: , CC: Borislav Petkov , Thomas Gleixner , "Ingo Molnar" , Dave Hansen , "Eric Van Tassell" , Tom Lendacky , Ashish Kalra , Michael Roth , Brijesh Singh , "H . Peter Anvin" , Peter Zijlstra , "Pavan Kumar Paluri" Subject: [PATCH 1/2] x86, KVM:SVM: Move sev specific parsing into arch/x86/virt/svm Date: Thu, 1 Aug 2024 15:56:37 -0500 Message-ID: <20240801205638.6603-2-papaluri@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240801205638.6603-1-papaluri@amd.com> References: <20240801205638.6603-1-papaluri@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001509:EE_|LV3PR12MB9403:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c6dde5d-9102-46a0-d0ca-08dcb26c7bba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?HmAKRkftkmJDAiDhHtgbmp8Ic2qq8/qopqW59B07mBrujlGoDz5LsUKgKg8p?= =?us-ascii?Q?LNKTvV8oZcKPtjErLt9FAW5XCtkS8wx+/8My4qc+GCMVTb8a6dDy6WxNUiTT?= =?us-ascii?Q?6cQgcmnE+NJD/dgUnJBQewjbBXIM+MFew7+5N7e8ZrQz2VU5OXIpcKn7cL/T?= =?us-ascii?Q?IdkYot9Z4XDiO89ikm+r+7HfrAV4yMNlB4T373dZ+ieuYcfb1/LqQ+Iw5JYl?= =?us-ascii?Q?wWDn+iocURw9eMMBXyGA61yn8tCS7qyIRPLp6o9294DHDFuXcS4hrYOz7kY8?= =?us-ascii?Q?o5oAnJSW+eUKKpXf6VEZDmqfH8xGWVMSOzdimxjldE02QwN4QZOVN/1R5bmX?= =?us-ascii?Q?gqGyCe1HMdsjjeWmECiZqQ7bFaUR4jUfF6DzgwUYHM1h0x6yb+MBbBZIg3yi?= =?us-ascii?Q?bykxH8RJ7kcYmNnQ3fcwle7yejoR5xVi2ysQhGSpqrELpCOIguFStWLFtH2l?= =?us-ascii?Q?Dt0Nn6SQcC+3lf8fBo8yAGiJKLERq1Iz1PpeLea+v8ENfAyYFIG/S0yHAVdg?= =?us-ascii?Q?wZNcnwo2ZMQAJx6XAjNKm8zOs9/ZO9Efke/0teBQnxhz+E6JueMHmP+S/46d?= =?us-ascii?Q?/VuH2HLgTZyQ647135FIfs1+xUKjKIuGtW1G2oTZaqzhF8u7+QynmJq595MR?= =?us-ascii?Q?syv6sUXaIEss/ScCnuGCg7W5/ugt8QnRZr6C6TOBwaTQBPJl46XBG0neEWFw?= =?us-ascii?Q?qAA6dpg6BIpFUWR2Ja6SYiwk0ogxVY1sMN30gqCyjpPPbbfhKJi7CQ+8FU7r?= =?us-ascii?Q?MkPN87M8srXcidUUE8fftn2nE1N//N/SM1AHuZ8MoPcj3ovnd2Q35BCKcJyz?= =?us-ascii?Q?1U7jCO+I4o3cDKe75POd2Y3ASikoZ+zq72RdZFFY/v/rQVz28B8WM+8MO+CG?= =?us-ascii?Q?US1jFqt2+fx94idZMWhKF9IZNW4YLK9+HZdUSKwxxcAKmi6po4telJ3a0Ovm?= =?us-ascii?Q?40pdFW8j8QXJBgVA24Ls8Nz0OgYMQPGjaJ90SaD2g6FGSO26xSswbV+HO08w?= =?us-ascii?Q?4vRoOCkbUqqQTBH4WOcreWAEviecwitTZMgbFetEHSZupSydqYb829xkGrMj?= =?us-ascii?Q?WzVzYMyUekzTgMb6n46duoJXxM2C54JnO0GaRLcza1gNwWhnEOYHUF5+TU8M?= =?us-ascii?Q?O7Kw/7Gd8DgEnUiZaodu1rUUBP18zpNff3q3TdwfG47YTXWzvKR3JhUMpUp+?= =?us-ascii?Q?jAzVHIp+CJYDflAdr/3gubAh66hQ6Hx8JDmYwPvMg907yc2LOBdHYxQAnFG/?= =?us-ascii?Q?fc4ScGyGMQhOOT4BGP3gY08msm5GDtD4HpHBmEE4fUAuz6fUIREZtn4kkZTH?= =?us-ascii?Q?sBOtJmixFohPouAg+3r79sxAwy/yDXolnMH9nB2FVtJdNgOxihNG4HO8imBr?= =?us-ascii?Q?go8QDv16rMk2panFPmgwcjJxl3loAturKivr7LkNkdDmI4+GSmSKi33wG7qv?= =?us-ascii?Q?FGC7QI5acx1cBWEKC0By1a8Iv4eCdybv?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 20:56:58.0883 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3c6dde5d-9102-46a0-d0ca-08dcb26c7bba X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001509.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9403 Content-Type: text/plain; charset="utf-8" Move SEV specific kernel command line option parsing support from arch/x86/coco/sev/core.c to arch/x86/virt/svm/cmdline.c so that both host and guest related SEV command line options can be supported. No functional changes intended. Signed-off-by: Pavan Kumar Paluri Reviewed-by: Tom Lendacky --- arch/x86/coco/sev/core.c | 44 ------------------------------- arch/x86/include/asm/sev-common.h | 27 +++++++++++++++++++ arch/x86/virt/svm/Makefile | 1 + arch/x86/virt/svm/cmdline.c | 32 ++++++++++++++++++++++ 4 files changed, 60 insertions(+), 44 deletions(-) create mode 100644 arch/x86/virt/svm/cmdline.c diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c index de1df0cb45da..ff19e805e7a1 100644 --- a/arch/x86/coco/sev/core.c +++ b/arch/x86/coco/sev/core.c @@ -141,33 +141,6 @@ static DEFINE_PER_CPU(struct sev_es_save_area *, sev_v= msa); static DEFINE_PER_CPU(struct svsm_ca *, svsm_caa); static DEFINE_PER_CPU(u64, svsm_caa_pa); =20 -struct sev_config { - __u64 debug : 1, - - /* - * Indicates when the per-CPU GHCB has been created and registered - * and thus can be used by the BSP instead of the early boot GHCB. - * - * For APs, the per-CPU GHCB is created before they are started - * and registered upon startup, so this flag can be used globally - * for the BSP and APs. - */ - ghcbs_initialized : 1, - - /* - * Indicates when the per-CPU SVSM CA is to be used instead of the - * boot SVSM CA. - * - * For APs, the per-CPU SVSM CA is created as part of the AP - * bringup, so this flag can be used globally for the BSP and APs. - */ - use_cas : 1, - - __reserved : 61; -}; - -static struct sev_config sev_cfg __read_mostly; - static __always_inline bool on_vc_stack(struct pt_regs *regs) { unsigned long sp =3D regs->sp; @@ -2374,23 +2347,6 @@ static int __init report_snp_info(void) } arch_initcall(report_snp_info); =20 -static int __init init_sev_config(char *str) -{ - char *s; - - while ((s =3D strsep(&str, ","))) { - if (!strcmp(s, "debug")) { - sev_cfg.debug =3D true; - continue; - } - - pr_info("SEV command-line option '%s' was not recognized\n", s); - } - - return 1; -} -__setup("sev=3D", init_sev_config); - static void update_attest_input(struct svsm_call *call, struct svsm_attest= _call *input) { /* If (new) lengths have been returned, propagate them up */ diff --git a/arch/x86/include/asm/sev-common.h b/arch/x86/include/asm/sev-c= ommon.h index 98726c2b04f8..dd302fe49f04 100644 --- a/arch/x86/include/asm/sev-common.h +++ b/arch/x86/include/asm/sev-common.h @@ -220,4 +220,31 @@ struct snp_psc_desc { #define GHCB_ERR_INVALID_INPUT 5 #define GHCB_ERR_INVALID_EVENT 6 =20 +struct sev_config { + __u64 debug : 1, + + /* + * Indicates when the per-CPU GHCB has been created and registered + * and thus can be used by the BSP instead of the early boot GHCB. + * + * For APs, the per-CPU GHCB is created before they are started + * and registered upon startup, so this flag can be used globally + * for the BSP and APs. + */ + ghcbs_initialized : 1, + + /* + * Indicates when the per-CPU SVSM CA is to be used instead of the + * boot SVSM CA. + * + * For APs, the per-CPU SVSM CA is created as part of the AP + * bringup, so this flag can be used globally for the BSP and APs. + */ + use_cas : 1, + + __reserved : 61; +}; + +extern struct sev_config sev_cfg __read_mostly; + #endif diff --git a/arch/x86/virt/svm/Makefile b/arch/x86/virt/svm/Makefile index ef2a31bdcc70..eca6d71355fa 100644 --- a/arch/x86/virt/svm/Makefile +++ b/arch/x86/virt/svm/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 =20 obj-$(CONFIG_KVM_AMD_SEV) +=3D sev.o +obj-$(CONFIG_CPU_SUP_AMD) +=3D cmdline.o diff --git a/arch/x86/virt/svm/cmdline.c b/arch/x86/virt/svm/cmdline.c new file mode 100644 index 000000000000..507549a9c793 --- /dev/null +++ b/arch/x86/virt/svm/cmdline.c @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * AMD SVM-SEV command line parsing support + * + * Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. + * + * Author: Michael Roth + * + */ + +#include + +#include + +struct sev_config sev_cfg; + +static int __init init_sev_config(char *str) +{ + char *s; + + while ((s =3D strsep(&str, ","))) { + if (!strcmp(s, "debug")) { + sev_cfg.debug =3D true; + continue; + } + + pr_info("SEV command-line option '%s' was not recognized\n", s); + } + + return 1; +} +__setup("sev=3D", init_sev_config); --=20 2.34.1 From nobody Wed Oct 30 22:14:32 2024 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2045.outbound.protection.outlook.com [40.107.96.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2AE014B09F; Thu, 1 Aug 2024 20:57:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722545833; cv=fail; b=LzJQUvgzvNqnZSt2pn1Yk2Xv5RQhwY3katUhMp4xs/SsryvpZrKBIbDexBAfRfOivAkUfymmNTnzXZoYE1MimFWMFOrDn2MQhxR5VOvZYStmk2BfnpRb/1d7rhh4icxPaKnJ9TKV5PwAB4OBibo7cD0zHY8CWCcF1Wnv2oEqAWM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722545833; c=relaxed/simple; bh=0nVstud1AHpbKP7KIDd5jgNCNVIeEmiV6hYKhHsNpe4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=G4Py9ipVw3zqp36Fx7UCh+5M9WkufZPii3K/wtDQXT1tcB2dU/ChpAj88EG2JixEoeLJ9WJJzn08pKuUAAlcQQG6u6gl9Mz3IYmtztMucR+PvB7Ppyq3Mt/wIMDEZPY5Bs2owWSxy3ufX2Frh+HtQgURFdwOmIqXMlYzZCKg6Bo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=2VuUgf0H; arc=fail smtp.client-ip=40.107.96.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="2VuUgf0H" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a6nYW1FlZdNjygsKpviina2Ttdm1IyqPTF/L5K5jHR33CQ78o6eCj6h27PQacP+1X3E0kgXKp53ncA+S3zZjx6CIE0D4WEWDY67V+cZtitqim2wTGy8qacY6u/pmrQ9rTvoukmU1oYmDW+U0+qFbJyC+o5SJp1dR7yYD6HpOk9Bo0QpU7h1RmGn2qpROcL2geMD2eveskmLCdU/lrLaBZJD1bXhT70Y23jJ5v2JLX8l3+f1guKueyjyJ6LxcF6ycAoTtq9FX26q/UzSnqLhdGY0ZPYJYnT2KCJcNGK2dIXG+lA2DvQ2rUC+62qLtmJCPDTYvrb9C7mkslw7k1EUYKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QGfVJr7vigDF7yCcsU/twb2kHcxniQ40L+B4zC5/gh8=; b=jlpvAwyTwvUYFBI70bO6ZU7DcfM5t5Bi/C5/qL8GbSp8TojN+oc0hSOvPm/yigIS34gN8UW7CVnxKQ0xmE6VRxG3v/mgfi8WhFvj3ZfKZBS/Jm4DcUk6mUY2uv/y05046ebXZ79kxy5T0DA2J4I3TadpCg8d0/vciUPOevUvB3MAV0eVlJ49aUkXDUmlBTz4eOweUdctYtxXdJIgf5a1fU6kPxmQA28iM2/yAtnSFAGXfDe9u+0Qh2K+eFy6PYhTCrtDFYT9ycNhnsWhSb2aK+isfylWaHcIyjjabkq5j/Uh29ef0mGc5Dey3IRW3DmqNFEOBSow2gpd7ylgC5bugg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QGfVJr7vigDF7yCcsU/twb2kHcxniQ40L+B4zC5/gh8=; b=2VuUgf0HkbA2N/v9vgwKmeah4lqamYeXMC5UnB8qgzA3FWqm9Fa+pKmSnHuqzOpR2CdwVRxPAcOMdgbBIppSNF5NcfgRj2rO+hRkH7xTWyCRyEh6CNJy1DfPtyO3XOUY6fxz7usatPpJB2O7jaOJezGXd0iDVwsUgdNIRfd4gBM= Received: from SN6PR05CA0034.namprd05.prod.outlook.com (2603:10b6:805:de::47) by DM4PR12MB8559.namprd12.prod.outlook.com (2603:10b6:8:17d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.19; Thu, 1 Aug 2024 20:57:09 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:805:de:cafe::b) by SN6PR05CA0034.outlook.office365.com (2603:10b6:805:de::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.7 via Frontend Transport; Thu, 1 Aug 2024 20:57:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7828.19 via Frontend Transport; Thu, 1 Aug 2024 20:57:08 +0000 Received: from ethanolx16dchost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 1 Aug 2024 15:57:08 -0500 From: Pavan Kumar Paluri To: , CC: Borislav Petkov , Thomas Gleixner , "Ingo Molnar" , Dave Hansen , "Eric Van Tassell" , Tom Lendacky , Ashish Kalra , Michael Roth , Brijesh Singh , "H . Peter Anvin" , Peter Zijlstra , "Pavan Kumar Paluri" Subject: [PATCH 2/2] x86 KVM:SVM: Provide "nosnp" boot option for sev kernel command line Date: Thu, 1 Aug 2024 15:56:38 -0500 Message-ID: <20240801205638.6603-3-papaluri@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240801205638.6603-1-papaluri@amd.com> References: <20240801205638.6603-1-papaluri@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|DM4PR12MB8559:EE_ X-MS-Office365-Filtering-Correlation-Id: a09d2f7e-9550-42df-c1f6-08dcb26c8237 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?/uHWwl6Zr8BUwXq8eZ5nssNB2Qcyqyn0Kn3CZeNjhWCVykFBQphG/9Od1kN/?= =?us-ascii?Q?CwMhlwyqomprCBQshIFE6tM6EA4dHPrdj5I/9KUFuv5oe4iaIAFZueAWFtrI?= =?us-ascii?Q?nPecY8PZSypLmtGKgVflZ5NG+KzGdciqqOtZmw/DZ+3FnwpFV5u6bX9Ogj39?= =?us-ascii?Q?F3aA8PbcStTDV0xGrGI0e0DF4lSYIiaLpyzAzGLusbdIbd1c4mPRKsXnSria?= =?us-ascii?Q?2PA8r4JtZn3nSbcYA7PqFg5Bw3zHbilgTtUFtLsoI2b1MISIamPYGDrZ0Htb?= =?us-ascii?Q?ujqdLBpYL2K/PXQk66KVHjYNA4g06CMfIpgIzBhU/8gbkVLv7jxtiSrjTc6e?= =?us-ascii?Q?ApCOOX8GzaKyLyDxvqqyutqy6+an8jnmzwDhgTp1rW2ATWkulVos5tHXjxtV?= =?us-ascii?Q?94ejqNLnMbww52itpwT/75TKvb/QIYOYGjxKkRx/PS2Z2zF+oPFwvBTejGHn?= =?us-ascii?Q?qrMqXqF8Bu0iIzD+z0Zjp/4ozReWSAQxXAyUtdiNnQJ6q11ovwEQaewqD64V?= =?us-ascii?Q?MiJM+bUa4faZD9yISgtTIyY1fV5fFLI5WyOpL5mlfpQkCXhri0GGjDtluI0/?= =?us-ascii?Q?DxSN/4in3lNc6e/pmB7LpJEKZunHuryJzL5blN646eIoGs3AFN5eA5G4uMox?= =?us-ascii?Q?O8fp3ZKyjjpd+C1SpujYpDQMvQtkJsHPTkgeOq6C8t4QqzVeyoqMVAKnAb+q?= =?us-ascii?Q?iaZh5hFHAQaF1MR6eT2KtnG0jvSbGTa8sssgIeJxcxmHcqLXUuD8hYRsWSPI?= =?us-ascii?Q?aYji663Ppqmi12yrs2+OddPDaoM45t2eCYL5VaeSs9n8UJiZXXSZP5Xi5d6z?= =?us-ascii?Q?za92fHiEe5hkhSsRmgcic7n3viIhsC2atOia0rB7HbOR+0CJZtnE2rZLY+TA?= =?us-ascii?Q?+c5t7eo5NsiW2jDUn0PaBcKR+lZGq9D0D/mOTmKyDiVwnnhe1urgAVHtq8EZ?= =?us-ascii?Q?N0RwVlVcZwd0ULySt/YhXpYEYVm9tNs/lJZhqp2Zc97hcKDe2L7gtGBkkTQ0?= =?us-ascii?Q?7/HUMkxsRfIH2l0PTmiYzKil7AKz8NdxJTvNpINzdsZ+j3l4wbtQvFyruuiJ?= =?us-ascii?Q?aCxA+lPjSoUFuaAHIIIjuHqPgjong0oDdZESZRpyk2/pTNuvP6ZmM0JGwDL+?= =?us-ascii?Q?9xBsqbYCWQ7T6P+wwwptxAQRNKwWtjTkSaczNkX91RSigIFdkPFfWRLFF9mU?= =?us-ascii?Q?+S/4xOa0xW4Hbq2xWqZRqAgCe0IiESAj0FqMPNn+rFOuZQz50SXNfWBf7Jbx?= =?us-ascii?Q?PMqeOAmSmhPt0bo0eSyLgBQfn8unG0T1WIyXIU9c3ue1WhXaTdCnyUWYEcEq?= =?us-ascii?Q?PdjNwZNZ+cprNXL24FQjwGmFS263wTa6CS245deSMWtypkpIVinz9fFr317I?= =?us-ascii?Q?vKv5e8iFA6V1eTxuoX3v2DPAA6Vf5eSiZs9cFHqh2w25WyCcDIWMRQXBY2Su?= =?us-ascii?Q?a7GyBAdyCQ0U1H2EIDufhH+3YfU9gCUf?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 20:57:08.9890 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a09d2f7e-9550-42df-c1f6-08dcb26c8237 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8559 Content-Type: text/plain; charset="utf-8" Provide a "nosnp" kernel command line option to prevent enabling of the RMP and SEV-SNP features in the host/hypervisor. Not initializing the RMP removes system overhead associated with RMP checks. Co-developed-by: Eric Van Tassell Signed-off-by: Eric Van Tassell Signed-off-by: Pavan Kumar Paluri Reviewed-by: Tom Lendacky --- Documentation/arch/x86/x86_64/boot-options.rst | 3 +++ arch/x86/virt/svm/cmdline.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/Documentation/arch/x86/x86_64/boot-options.rst b/Documentation= /arch/x86/x86_64/boot-options.rst index 137432d34109..3d4e9a7dccf2 100644 --- a/Documentation/arch/x86/x86_64/boot-options.rst +++ b/Documentation/arch/x86/x86_64/boot-options.rst @@ -317,3 +317,6 @@ The available options are: =20 debug Enable debug messages. + + nosnp + Do not enable SEV-SNP (applies to host/hypervisor only). diff --git a/arch/x86/virt/svm/cmdline.c b/arch/x86/virt/svm/cmdline.c index 507549a9c793..1e71c75f0201 100644 --- a/arch/x86/virt/svm/cmdline.c +++ b/arch/x86/virt/svm/cmdline.c @@ -24,6 +24,12 @@ static int __init init_sev_config(char *str) continue; } =20 + if (!strcmp(s, "nosnp")) { + setup_clear_cpu_cap(X86_FEATURE_SEV_SNP); + cc_platform_clear(CC_ATTR_HOST_SEV_SNP); + continue; + } + pr_info("SEV command-line option '%s' was not recognized\n", s); } =20 --=20 2.34.1