From nobody Fri Dec 19 14:34:01 2025 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2076.outbound.protection.outlook.com [40.107.243.76]) (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 847B323BD04; Mon, 19 May 2025 23:56:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747699007; cv=fail; b=Dz6K06N7trz2ogdhZYUw40srZhzx4h+t/mpSQDKzkUD+N13h5Ptt7efE5rng4QGnVvjkAsdLRlQBam3JHhoZ1fJmssjfUne0UkBspJW0VJCSJMoXvPVr4boNxO7Iel8/kD1xIYQ6QqHdvaotV6x5IAOObH8wfnVaU6FUONksP+U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747699007; c=relaxed/simple; bh=iuvp7QQTCzbzbu2ifNUJ1n7IhP2Pi92rStx7EM4kNoU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ODuhGs4T2/ZkhkqdIKbdq0KER8GaPoUA7URG61VxDYGpVI3/sH42g3dG+4FONt3p18JO93RjksSkXZgJeKhFfMGajsRehqFlpv7GIm54Z0I1r5itreho/cp4/4GPF6yFiO9rmqxJ8KrJ8iLaLfJ9O7Eau9A4XDF75jgMR6lcEv0= 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=bnqwg33t; arc=fail smtp.client-ip=40.107.243.76 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="bnqwg33t" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eLvqtapEp84PoH4EoKFRRDz9/5dWbXY+gBBU/7VNxx5bJUGdRtVScoGtS5mzkef3OAvmcSgD0owop7ntFZ/mOqGbdOVZiPnHUxkQmOYh4JUU6dEfjBL7KKSX3urP+5YM1pZ7nGS1QrX5b5Qw8W2NBZqBK2ka81FEFro+N4ufKqfMHcJVWv43H9LBiTYNu0MAmss3rZx8Adv6KVvbrFI5DaeCbP1+hF6xAVLQe9spFd7YcSXXIXsfAJBHu3EkoWG/Q52sND6ImyZgVdbCCXTTh0jTAGXAsI4CJ4T5dRQJ8r+20Qaf3gxhIqLsH1ngMNixBTzp/12hgv0yiLKVnjU88g== 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=NYvwT5PreAuiHG1s1zbDu9qyWoPPUxadVhJp/06e0Vg=; b=TEjqOp2ydRX3EzP8B7QITYuc63AKCKWMY1nA85yMoEW6zm/OdkkWsqUSgYykDPlNbsqmE+92xLOsKjl5hQAzD5O+gVJP8WPi3Dxx6g+T1k+egm4LLsDEZkPGVtaoJdwWPgr1A+YljFdiwJOYtSm7wjanwzFXipwd3G2/rnebnuHfe/3LVcwwHFZjcpg4x4YFKcON2s6wQQ5d3W+SuZ8fIGjB36pQjdsIjTbKh7r7mXMu0NW9ShB2w+Eb9v8aMteWiLeor5Qoqbmglzho73uhMnlW5zYzYu0yQszQYJffEiFnV2XtGlTSpw9UjdH44oWyJhmzFJHt/7xIsMFPYSjGIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com 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=NYvwT5PreAuiHG1s1zbDu9qyWoPPUxadVhJp/06e0Vg=; b=bnqwg33tAdx7DXbLwVx3af7dmVBjVDSEydeVgspmc8XoakOOEN00+SIOCKyO3zoIfBiHD4LEs2yMj7/QNFSkIIxGHxw/UOk1Qj6OrTeff162htRZXwe5OvIQExE/1eQJQDIgt9bwPF03er3vIC9nXhp/RhgZbpSVDer68cva5e4= Received: from BYAPR06CA0018.namprd06.prod.outlook.com (2603:10b6:a03:d4::31) by IA0PR12MB8325.namprd12.prod.outlook.com (2603:10b6:208:407::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8746.30; Mon, 19 May 2025 23:56:38 +0000 Received: from SJ5PEPF000001F1.namprd05.prod.outlook.com (2603:10b6:a03:d4:cafe::f6) by BYAPR06CA0018.outlook.office365.com (2603:10b6:a03:d4::31) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8746.25 via Frontend Transport; Mon, 19 May 2025 23:56:38 +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 SJ5PEPF000001F1.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8769.18 via Frontend Transport; Mon, 19 May 2025 23:56:38 +0000 Received: from purico-ed09host.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; Mon, 19 May 2025 18:56:36 -0500 From: Ashish Kalra To: , , , , , , , CC: , , , , , , , Subject: [PATCH v4 1/5] crypto: ccp: New bit-field definitions for SNP_PLATFORM_STATUS command Date: Mon, 19 May 2025 23:56:27 +0000 Message-ID: <5f4bb8f321c57cddd06f4205ee3cbf6bde0b3915.1747696092.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: 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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001F1:EE_|IA0PR12MB8325:EE_ X-MS-Office365-Filtering-Correlation-Id: f9c34f7e-76dd-4d96-1912-08dd9730cb4a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?psOTe2qaud0GqXPdD2EBA6ZXjNCHV2u3YhD9Apmqxmb5V/SNC2GZ/nJNPtKw?= =?us-ascii?Q?H+sWu3mB+rw93+IK/ZM04Li+rR9uWrnfForeKL25ebbPtT1MI5XkWgwJGgBy?= =?us-ascii?Q?56uHyJkQMzLikRTgOt6k+nvM5wnMvrQnsNJB3joOMvMy4TjqpdDRYPVCdvyx?= =?us-ascii?Q?i8hQWOlEH0h9iWYPcZ5ygwCf5S8gMh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?e/eNLOCe+PYsldsOcfCrnl0HiICkoNnj0g9FrgGD5c/hOdPov4+RysHRjZ8w?= =?us-ascii?Q?xPnVmlp4FSOlBgtQvTXXE5rdBAeyansDDsx2K2mFwQQKi77HLackZg28HVQT?= =?us-ascii?Q?YbyLt2QvSLtiXVdfhrf4Fh/9W4seq6CxzfNIvQ9OQezIDqP1jNBTUuIxUf61?= =?us-ascii?Q?lkvLivu00QBOYV3xk39pFaatc5DmlUIvbPPdPLIfkQACIo0zJYhz7ExbJ9gX?= =?us-ascii?Q?eVvWBsbid2Xu0nSOUHkNyoBtJ0NGc439kBfxOGo33ftJcMDhZYW8DWMni1Xs?= =?us-ascii?Q?miEzT13f1AQOu/Wqd0vxfKDHntcPRytTLgPCYkTXEkl4Y5n2t0C03mAyXvOR?= =?us-ascii?Q?ABtKRcllLDUK3bHkXzKMLwmJNw2IsDz9tb1JGZrDxmPKgcru24a5c3JleOBt?= =?us-ascii?Q?cdGmnTPacuUhxj5Jj8Ud4ir5xmi5RzM3m05Y?= 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)(1800799024)(376014)(36860700013)(7416014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2025 23:56:38.0073 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9c34f7e-76dd-4d96-1912-08dd9730cb4a 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: SJ5PEPF000001F1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8325 Content-Type: text/plain; charset="utf-8" From: Ashish Kalra Define new bit-field definitions returned by SNP_PLATFORM_STATUS command such as new capabilities like SNP_FEATURE_INFO command availability, ciphertext hiding enabled and capability. Signed-off-by: Ashish Kalra Reviewed-by: Tom Lendacky --- include/uapi/linux/psp-sev.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/psp-sev.h b/include/uapi/linux/psp-sev.h index eeb20dfb1fda..c2fd324623c4 100644 --- a/include/uapi/linux/psp-sev.h +++ b/include/uapi/linux/psp-sev.h @@ -185,6 +185,10 @@ struct sev_user_data_get_id2 { * @mask_chip_id: whether chip id is present in attestation reports or not * @mask_chip_key: whether attestation reports are signed or not * @vlek_en: VLEK (Version Loaded Endorsement Key) hashstick is loaded + * @feature_info: whether SNP_FEATURE_INFO command is available + * @rapl_dis: whether RAPL is disabled + * @ciphertext_hiding_cap: whether platform has ciphertext hiding capabili= ty + * @ciphertext_hiding_en: whether ciphertext hiding is enabled * @rsvd1: reserved * @guest_count: the number of guest currently managed by the firmware * @current_tcb_version: current TCB version @@ -200,7 +204,11 @@ struct sev_user_data_snp_status { __u32 mask_chip_id:1; /* Out */ __u32 mask_chip_key:1; /* Out */ __u32 vlek_en:1; /* Out */ - __u32 rsvd1:29; + __u32 feature_info:1; /* Out */ + __u32 rapl_dis:1; /* Out */ + __u32 ciphertext_hiding_cap:1; /* Out */ + __u32 ciphertext_hiding_en:1; /* Out */ + __u32 rsvd1:25; __u32 guest_count; /* Out */ __u64 current_tcb_version; /* Out */ __u64 reported_tcb_version; /* Out */ --=20 2.34.1 From nobody Fri Dec 19 14:34:01 2025 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2065.outbound.protection.outlook.com [40.107.92.65]) (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 81A4D23BD04; Mon, 19 May 2025 23:56:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747699021; cv=fail; b=M0U1FU2Xb4gygv/ZoEYwRoU6scTSpzvzNmneplIOb4dvk2cYcpmv+1TB+YEwwcZRpuzjXGspSmWwLYJaAGljcHuJlHJ4Ll0HcfHfWhi9jYgXPmEVRZE26pmR0zMHvcOoUPfGOn9xW0SlGPdiDchZT/tcBkB05oWCv2KIMrGiQCM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747699021; c=relaxed/simple; bh=kZLcIU7QZnldYGsSKsdizS3lzPgflqHKvQAn0gJqXAg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gZrB+igiRDKLYD132e3++iRxU5TmD2IjRCUA9jqkBLHH3tKrck6C6PxhqktG3zonTrf6bNsd5EHWpf8MzRrNaP0oEyYoSy3SVAPC+Ixc+9B0kP+0mC8HE+2U5rmr87KptKPN6tfV+shxeRNa4lt0cGqmVPmaQ3VIMMLybkK0djw= 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=ImoHFwRW; arc=fail smtp.client-ip=40.107.92.65 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="ImoHFwRW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WjuJ9m6le4/nkUJdtQkF7eCN2QAp5KgAx78niyjgDj+Z3YhALffMUbofL2z+PELNLcpyjCr3RSeUAQPB+Zq5uiFdILqEzQWoOowqBhxLexRzZI9/6Qyt+dcqk2C6zQn8IdtsRj0h/Ayz5miuWIf4tUQ6gvp0ogy3aHo44lTZU4vHvgyvNj1qJ6uf/vFjRq6I6qukOOck9ugV6hrxqHAYcSUAjryfdgOt37ZHWc4XmoJ5PpuPw71Dcnv5jgCbvaHEbiQUsxb0M7njg/JkowytoHhMUPJtCR4/2jnE5WTFvc8qJVSqoMhyobHngmXA2m+0fgCSyGTy7BP1zk+Cv89/uQ== 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=PEzHrWEEZCwPvUaiypKb7J64aUHXXdOCZztwylwESTw=; b=FzyYdwsq1QAHzjejjmwPv37XX9wLPv2jQ2Koemxb7CkHO3+tEzN6jGOBree/GBzcjeMQW/jiDLJDAxMT8p8Dz46F6n/KHU09LPctVxoidPuUpd4leYzCBq7BIksizlRuCuUNGxsguDozOGx4UEPW/kSzrtELiFXW+sgCGnuo/Ant9g4KV7smb6kkIfoeq4TFBe1ODNXJ4mK3D2oon8CTlKl49TlXAw3yuRakD/1c9wZDm69DUxifZBHcAYgIOA997pOsxbYRz/ZRmbP1knAIRxgjZSRgCkWEdr/49zCl7NdmDfCAck7h8s2mzgemnhgRd1QGDND6CdVnSHNlFMGmWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com 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=PEzHrWEEZCwPvUaiypKb7J64aUHXXdOCZztwylwESTw=; b=ImoHFwRW0ft0VUwrCzYdYFDpjFBB7nXvuFu75tV84qZpKAn6t+YSRP9jb+kuuyJFXBWqokAa9RIfxsHvFfgSzEycI7VqucOtYS6IYk4n2KZJjWNl8unJtzCEjO71WjIY0mZ67WwkIbGvaYg379J7JXuEHOtu3fbIFIdhyQKP/hU= Received: from BYAPR06CA0034.namprd06.prod.outlook.com (2603:10b6:a03:d4::47) by MN0PR12MB6002.namprd12.prod.outlook.com (2603:10b6:208:37e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8746.30; Mon, 19 May 2025 23:56:54 +0000 Received: from SJ5PEPF000001F1.namprd05.prod.outlook.com (2603:10b6:a03:d4:cafe::66) by BYAPR06CA0034.outlook.office365.com (2603:10b6:a03:d4::47) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8746.31 via Frontend Transport; Mon, 19 May 2025 23:56:53 +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 SJ5PEPF000001F1.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8769.18 via Frontend Transport; Mon, 19 May 2025 23:56:53 +0000 Received: from purico-ed09host.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; Mon, 19 May 2025 18:56:51 -0500 From: Ashish Kalra To: , , , , , , , CC: , , , , , , , Subject: [PATCH v4 2/5] crypto: ccp: Add support for SNP_FEATURE_INFO command Date: Mon, 19 May 2025 23:56:42 +0000 Message-ID: <61fb0b9d9cae7d02476b8973cc72c8f2fe7a499a.1747696092.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: 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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001F1:EE_|MN0PR12MB6002:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c00859f-5d0c-4031-2d50-08dd9730d468 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|7416014|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rIY8TKU6gPoblMwRus7HlnmUD8gZsSfbcEEf+omk4f/HlQ+6Vv39ymZJyUCT?= =?us-ascii?Q?FTU9+aDqnHqsvjrIJarMw0IdVR+jGOr0dxM32Ualvs/zW7eYxvBEVgz/+Bki?= =?us-ascii?Q?SBRIrgWPnrXaYNi+qHRpFUGuwx4uDasHjGiZB03HVyU3Q0RnDE470v5XXQzO?= =?us-ascii?Q?dzfoc96+4F6ScgMkZ2eF6K2tOB22hRdUM4sDfrpOKU2/ZRKJzrSBURzicPrO?= =?us-ascii?Q?k8vs8o2+jEU5vC8iU+VhcZyCahPIfuJswUmsoxtKKa0dfNzTCz1u3REuBRHc?= =?us-ascii?Q?ASJiGzf5V8TO+h0S5NyGjunXw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J2BxYLbSzH3BKDU7/yuQecARl7lKPr6e0rceZi1SRdNXReQAHmKOoD/D/?= =?us-ascii?Q?x5wYvsbLhF3ZEJMg8eAD3ucMZRf3kOaV/xoeJle5WWIX+jWCm+ElFNpkcEyA?= =?us-ascii?Q?+BxBcIMtwFXPOvXlNUYdaO3sSvyCJV0IzFAqkfznJVM02zPihRVlHzYreTgy?= =?us-ascii?Q?6YBZB4PR0NFxl3+V+lpvTeXszKRoas/XZcc7TE1z1P0vUO9AVoDBsC87grUw?= =?us-ascii?Q?uO/VaP9w+pI7R6Lfd629HEJB1wAx8kVw+AwjI4lJgs5hm6pgVQUwaJezqzxz?= =?us-ascii?Q?4u1F2X6beuxT7PhWA/D4MoLtJ+JHqWoEMcKF?= 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)(1800799024)(36860700013)(7416014)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2025 23:56:53.3042 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c00859f-5d0c-4031-2d50-08dd9730d468 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: SJ5PEPF000001F1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6002 Content-Type: text/plain; charset="utf-8" From: Ashish Kalra The FEATURE_INFO command provides host and guests a programmatic means to learn about the supported features of the currently loaded firmware. FEATURE_INFO command leverages the same mechanism as the CPUID instruction. Instead of using the CPUID instruction to retrieve Fn8000_0024, software can use FEATURE_INFO. The hypervisor may provide Fn8000_0024 values to the guest via the CPUID page in SNP_LAUNCH_UPDATE. As with all CPUID output recorded in that page, the hypervisor can filter Fn8000_0024. The firmware will examine Fn8000_0024 and apply its CPUID policy. Switch to using SNP platform status instead of SEV platform status if SNP is enabled and cache SNP platform status and feature information from CPUID 0x8000_0024, sub-function 0, in the sev_device structure. Signed-off-by: Ashish Kalra --- drivers/crypto/ccp/sev-dev.c | 81 ++++++++++++++++++++++++++++++++++++ drivers/crypto/ccp/sev-dev.h | 3 ++ include/linux/psp-sev.h | 29 +++++++++++++ 3 files changed, 113 insertions(+) diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index 3451bada884e..b642f1183b8b 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -233,6 +233,7 @@ static int sev_cmd_buffer_len(int cmd) case SEV_CMD_SNP_GUEST_REQUEST: return sizeof(struct sev_data_snp_guest_= request); case SEV_CMD_SNP_CONFIG: return sizeof(struct sev_user_data_snp_config); case SEV_CMD_SNP_COMMIT: return sizeof(struct sev_data_snp_commit); + case SEV_CMD_SNP_FEATURE_INFO: return sizeof(struct sev_data_snp_feature= _info); default: return 0; } =20 @@ -1073,6 +1074,69 @@ static void snp_set_hsave_pa(void *arg) wrmsrq(MSR_VM_HSAVE_PA, 0); } =20 +static int snp_get_platform_data(struct sev_user_data_status *status, int = *error) +{ + struct sev_data_snp_feature_info snp_feat_info; + struct sev_device *sev =3D psp_master->sev_data; + struct snp_feature_info *feat_info; + struct sev_data_snp_addr buf; + struct page *page; + int rc; + + /* + * The output buffer must be firmware page if SEV-SNP is + * initialized. + */ + if (sev->snp_initialized) + return -EINVAL; + + buf.address =3D __psp_pa(&sev->snp_plat_status); + rc =3D __sev_do_cmd_locked(SEV_CMD_SNP_PLATFORM_STATUS, &buf, error); + + if (rc) { + dev_err(sev->dev, "SNP PLATFORM_STATUS command failed, ret =3D %d, error= =3D %#x\n", + rc, *error); + return rc; + } + + status->api_major =3D sev->snp_plat_status.api_major; + status->api_minor =3D sev->snp_plat_status.api_minor; + status->build =3D sev->snp_plat_status.build_id; + status->state =3D sev->snp_plat_status.state; + + /* + * Do feature discovery of the currently loaded firmware, + * and cache feature information from CPUID 0x8000_0024, + * sub-function 0. + */ + if (sev->snp_plat_status.feature_info) { + /* + * Use dynamically allocated structure for the SNP_FEATURE_INFO + * command to handle any alignment and page boundary check + * requirements. + */ + page =3D alloc_page(GFP_KERNEL); + if (!page) + return -ENOMEM; + feat_info =3D page_address(page); + snp_feat_info.length =3D sizeof(snp_feat_info); + snp_feat_info.ecx_in =3D 0; + snp_feat_info.feature_info_paddr =3D __psp_pa(feat_info); + + rc =3D __sev_do_cmd_locked(SEV_CMD_SNP_FEATURE_INFO, &snp_feat_info, err= or); + + if (!rc) + sev->feat_info =3D *feat_info; + else + dev_err(sev->dev, "SNP FEATURE_INFO command failed, ret =3D %d, error = =3D %#x\n", + rc, *error); + + __free_page(page); + } + + return rc; +} + static int snp_filter_reserved_mem_regions(struct resource *rs, void *arg) { struct sev_data_range_list *range_list =3D arg; @@ -1597,6 +1661,23 @@ static int sev_get_api_version(void) struct sev_user_data_status status; int error =3D 0, ret; =20 + /* + * Use SNP platform status if SNP is enabled and cache + * SNP platform status and SNP feature information. + */ + if (cc_platform_has(CC_ATTR_HOST_SEV_SNP)) { + ret =3D snp_get_platform_data(&status, &error); + if (ret) { + dev_err(sev->dev, + "SEV-SNP: failed to get status. Error: %#x\n", error); + return 1; + } + } + + /* + * Fallback to SEV platform status if SNP is not enabled + * or SNP platform status fails. + */ ret =3D sev_platform_status(&status, &error); if (ret) { dev_err(sev->dev, diff --git a/drivers/crypto/ccp/sev-dev.h b/drivers/crypto/ccp/sev-dev.h index 3e4e5574e88a..1c1a51e52d2b 100644 --- a/drivers/crypto/ccp/sev-dev.h +++ b/drivers/crypto/ccp/sev-dev.h @@ -57,6 +57,9 @@ struct sev_device { bool cmd_buf_backup_active; =20 bool snp_initialized; + + struct sev_user_data_snp_status snp_plat_status; + struct snp_feature_info feat_info; }; =20 int sev_dev_init(struct psp_device *psp); diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h index 0b3a36bdaa90..0149d4a6aceb 100644 --- a/include/linux/psp-sev.h +++ b/include/linux/psp-sev.h @@ -107,6 +107,7 @@ enum sev_cmd { SEV_CMD_SNP_DOWNLOAD_FIRMWARE_EX =3D 0x0CA, SEV_CMD_SNP_COMMIT =3D 0x0CB, SEV_CMD_SNP_VLEK_LOAD =3D 0x0CD, + SEV_CMD_SNP_FEATURE_INFO =3D 0x0CE, =20 SEV_CMD_MAX, }; @@ -812,6 +813,34 @@ struct sev_data_snp_commit { u32 len; } __packed; =20 +/** + * struct sev_data_snp_feature_info - SEV_SNP_FEATURE_INFO structure + * + * @length: len of the command buffer read by the PSP + * @ecx_in: subfunction index + * @feature_info_paddr : SPA of the FEATURE_INFO structure + */ +struct sev_data_snp_feature_info { + u32 length; + u32 ecx_in; + u64 feature_info_paddr; +} __packed; + +/** + * struct feature_info - FEATURE_INFO structure + * + * @eax: output of SNP_FEATURE_INFO command + * @ebx: output of SNP_FEATURE_INFO command + * @ecx: output of SNP_FEATURE_INFO command + * #edx: output of SNP_FEATURE_INFO command + */ +struct snp_feature_info { + u32 eax; + u32 ebx; + u32 ecx; + u32 edx; +} __packed; + #ifdef CONFIG_CRYPTO_DEV_SP_PSP =20 /** --=20 2.34.1 From nobody Fri Dec 19 14:34:01 2025 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2084.outbound.protection.outlook.com [40.107.102.84]) (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 6D67023BCFF; Mon, 19 May 2025 23:57:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747699039; cv=fail; b=ZZjJEqD/CbVy4iz6y3nxvnJiy0kMp10ZwXPRJ1ZQn7uOd1ceXrN2Un9hdqknE0CBcyOVO8P4wWirOO/Exwo+Qf0PUvZV0WHCQ/3220boevNiW62LNuwT8psq6p3WZIMguj4FLLM1Wcg9vmTVBERoEenJvnxayR9wAgx0gZuaeyk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747699039; c=relaxed/simple; bh=XwIJVAvkdGi+5qSqFvEpVYYGaUCzLZyDbzzimVbXsgo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KyV2NH+jbvfziVbzvD3kYye7kcCRb2lWan9i81l176GBcuu8u7Pu+IMhl+o5btVkwGjIf2RAapgVTjTfQmUhCWP92TTa83Mn3sMlSQQLLOTNa9/aupGXq9v7MHIErBCuy22SzesE9V8XlQPpP2HzXacwhCt65dWLXjGjCpthAQk= 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=pIEMzLc5; arc=fail smtp.client-ip=40.107.102.84 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="pIEMzLc5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QiIYuaNah5Q3/0xF6kP+dGAsuO6gzfJ0Kxj8wu90j6WgSqeFrITsFXYLZ2nh+3LGorVz/3JRzIWI4yn1WTwLmxfquXDo2Z3UdTM916uGkvYeXppWD2543oaFPSSCYMR0MyeK1QkhUOBcSM/hKtbIka6mtNPeEHUB5XSUwyDGlYN3RNU/o3tfllXhXnISZFnDNlUNHpUQzXlYy9hbJ8MjVYffUIYWEBMfUHgb7Bsup92NIGGET+X8FGATe0y9Usta2sHOBE8iyrkjGiV/360N5TY7T62Nm3/Nbr39xTo9FazLUNBIR/RK8K/Oov8X10CwQa0MV9l5C8ww5d/KPM9wwQ== 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=vNkjPS6nn7fxafRRCVEVr+xBTMw0ai5qm0iRQjKl8jo=; b=poZstmKnhZodlCqiUHIBq6k+Tk0T54IAw9BFpotqla2gmC2qf46XAfKUjqqrFittHAI8VZFE/1OwX9yIPiMOELf9lKCS1dwJBJhLcHBJdAP5qHfe3fTXiOxY/bWo5uGqg8BtHq5RiEPnEJ39KF7YEf8Q7ok592sW1QlPrORDbKakwJ/3E6nCbhp1cYzmEUg0f86aePccHUtz8ScSEnhQ/sFEiWx4zDTjBGvTy1/6ICRU0VrEbMp41Tib408lYZk+0cWvSKVnz7vEGPMHvoh3GDFarWROx4LMFh/UBSWNcjr0HDt9f51V/OUQD+Zwa/oEhxRGxz9CUAYPmLxPbb0t+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com 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=vNkjPS6nn7fxafRRCVEVr+xBTMw0ai5qm0iRQjKl8jo=; b=pIEMzLc52Mv8EnANBFclkkFizday1uF3kInNJEjW/Ujt5umTXBOdxdvEE8dPbqKPF2BrBm+R3a4I6rJ7e+kG4b625YShMZupBnS71Hf+1sHybYDRrdg/HOssmlGJo5djvfoMLJAdjZINS9VZe1VoNbXThFHnD5G/YG81mnqBJRg= Received: from BYAPR06CA0029.namprd06.prod.outlook.com (2603:10b6:a03:d4::42) by DM4PR12MB8498.namprd12.prod.outlook.com (2603:10b6:8:183::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8746.31; Mon, 19 May 2025 23:57:13 +0000 Received: from SJ5PEPF000001F1.namprd05.prod.outlook.com (2603:10b6:a03:d4:cafe::7f) by BYAPR06CA0029.outlook.office365.com (2603:10b6:a03:d4::42) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8746.25 via Frontend Transport; Mon, 19 May 2025 23:57:13 +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 SJ5PEPF000001F1.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8769.18 via Frontend Transport; Mon, 19 May 2025 23:57:13 +0000 Received: from purico-ed09host.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; Mon, 19 May 2025 18:57:11 -0500 From: Ashish Kalra To: , , , , , , , CC: , , , , , , , Subject: [PATCH v4 3/5] crypto: ccp: Add support to enable CipherTextHiding on SNP_INIT_EX Date: Mon, 19 May 2025 23:57:02 +0000 Message-ID: <0952165821cbf2d8fb69c85f2ccbf7f4290518e5.1747696092.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: 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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001F1:EE_|DM4PR12MB8498:EE_ X-MS-Office365-Filtering-Correlation-Id: bb5ec418-ed13-4727-ab2a-08dd9730e070 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|7416014|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?gY68x1yJIqlkefc7Ltfd4As0r/4wYKjHyxTPjRgc4k4wRSHfU68aWKoOHmIp?= =?us-ascii?Q?Kal2xTavnmwwgl2qhR5Of9zaMA4d17f2oSIX0hhd6ZhFt8i1yd7tHj+3V13I?= =?us-ascii?Q?Gv8GbhhvyqTnyjFnq42VB0Ue3rXMqkfBE9gQldvsfbOifOTeg0HsjDgVIld2?= =?us-ascii?Q?/MJIscsej/Ug18klzpMqXr57CbvT/hIbe0SKLRHYNte18jGayDyrbDNfDS9e?= =?us-ascii?Q?RIU59jflGEQ2GFahqGMCvhQFeACL1FAOIQFqvFpCGgjvhnuc8KuGZY0+BSp/?= =?us-ascii?Q?4R2idWRJJ0nVIFW3w+GXl43wRQiEHdPbeGJP+9tz5clP9dgd2N90G0Xa1zlg?= =?us-ascii?Q?JUuqHOr14eEjzn7bX64t09LyVUR62w/kF+dJSo5F2juK8V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qN7midfBxcjmUYxmYx5CWxcTGopF420eS9dRQBJkjz?= =?us-ascii?Q?fBY8vHf2CTvH4ULNiAYXBKsXSK8laZIYYZAy8odTvXdHKNq9HwA88ruFRjhp?= =?us-ascii?Q?SviKwBGgzQwSvh5MVry36srLw3tCkrqCCZKrTDncXmOIfn9VmCNZq6S2e3/v?= =?us-ascii?Q?wU6OKst0zI6rE19wm0HmYg+OPR11hH9WoW/jN0U10PzEFOcCrCSZMnXg6+gb?= =?us-ascii?Q?DwFbLwBgKANaS3Uj7TD+dIoDetdSI6OlNMUF?= 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)(1800799024)(82310400026)(36860700013)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2025 23:57:13.4916 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bb5ec418-ed13-4727-ab2a-08dd9730e070 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: SJ5PEPF000001F1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8498 Content-Type: text/plain; charset="utf-8" From: Ashish Kalra Ciphertext hiding needs to be enabled on SNP_INIT_EX. Add new argument to sev_platform_init_args to allow KVM module to specify during SNP initialization if CipherTextHiding feature is to be enabled and the maximum ASID usable for an SEV-SNP guest when CipherTextHiding feature is enabled. Add new API interface to indicate if SEV-SNP CipherTextHiding feature is supported by SEV firmware and additionally if CipherTextHiding feature is enabled in the Platform BIOS. Signed-off-by: Ashish Kalra --- drivers/crypto/ccp/sev-dev.c | 30 +++++++++++++++++++++++++++--- include/linux/psp-sev.h | 15 +++++++++++++-- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index b642f1183b8b..185668477182 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -1074,6 +1074,24 @@ static void snp_set_hsave_pa(void *arg) wrmsrq(MSR_VM_HSAVE_PA, 0); } =20 +bool sev_is_snp_ciphertext_hiding_supported(void) +{ + struct psp_device *psp =3D psp_master; + struct sev_device *sev; + + sev =3D psp->sev_data; + + /* + * Feature information indicates if CipherTextHiding feature is + * supported by the SEV firmware and additionally platform status + * indicates if CipherTextHiding feature is enabled in the + * Platform BIOS. + */ + return ((sev->feat_info.ecx & SNP_CIPHER_TEXT_HIDING_SUPPORTED) && + sev->snp_plat_status.ciphertext_hiding_cap); +} +EXPORT_SYMBOL_GPL(sev_is_snp_ciphertext_hiding_supported); + static int snp_get_platform_data(struct sev_user_data_status *status, int = *error) { struct sev_data_snp_feature_info snp_feat_info; @@ -1167,7 +1185,7 @@ static int snp_filter_reserved_mem_regions(struct res= ource *rs, void *arg) return 0; } =20 -static int __sev_snp_init_locked(int *error) +static int __sev_snp_init_locked(int *error, unsigned int snp_max_snp_asid) { struct psp_device *psp =3D psp_master; struct sev_data_snp_init_ex data; @@ -1228,6 +1246,12 @@ static int __sev_snp_init_locked(int *error) } =20 memset(&data, 0, sizeof(data)); + + if (snp_max_snp_asid) { + data.ciphertext_hiding_en =3D 1; + data.max_snp_asid =3D snp_max_snp_asid; + } + data.init_rmp =3D 1; data.list_paddr_en =3D 1; data.list_paddr =3D __psp_pa(snp_range_list); @@ -1412,7 +1436,7 @@ static int _sev_platform_init_locked(struct sev_platf= orm_init_args *args) if (sev->state =3D=3D SEV_STATE_INIT) return 0; =20 - rc =3D __sev_snp_init_locked(&args->error); + rc =3D __sev_snp_init_locked(&args->error, args->snp_max_snp_asid); if (rc && rc !=3D -ENODEV) return rc; =20 @@ -1495,7 +1519,7 @@ static int snp_move_to_init_state(struct sev_issue_cm= d *argp, bool *shutdown_req { int error, rc; =20 - rc =3D __sev_snp_init_locked(&error); + rc =3D __sev_snp_init_locked(&error, 0); if (rc) { argp->error =3D SEV_RET_INVALID_PLATFORM_STATE; return rc; diff --git a/include/linux/psp-sev.h b/include/linux/psp-sev.h index 0149d4a6aceb..66fecd0c0f88 100644 --- a/include/linux/psp-sev.h +++ b/include/linux/psp-sev.h @@ -746,10 +746,13 @@ struct sev_data_snp_guest_request { struct sev_data_snp_init_ex { u32 init_rmp:1; u32 list_paddr_en:1; - u32 rsvd:30; + u32 rapl_dis:1; + u32 ciphertext_hiding_en:1; + u32 rsvd:28; u32 rsvd1; u64 list_paddr; - u8 rsvd2[48]; + u16 max_snp_asid; + u8 rsvd2[46]; } __packed; =20 /** @@ -798,10 +801,13 @@ struct sev_data_snp_shutdown_ex { * @probe: True if this is being called as part of CCP module probe, which * will defer SEV_INIT/SEV_INIT_EX firmware initialization until needed * unless psp_init_on_probe module param is set + * @snp_max_snp_asid: maximum ASID usable for SEV-SNP guest if + * CipherTextHiding feature is to be enabled */ struct sev_platform_init_args { int error; bool probe; + unsigned int snp_max_snp_asid; }; =20 /** @@ -841,6 +847,8 @@ struct snp_feature_info { u32 edx; } __packed; =20 +#define SNP_CIPHER_TEXT_HIDING_SUPPORTED BIT(3) + #ifdef CONFIG_CRYPTO_DEV_SP_PSP =20 /** @@ -984,6 +992,7 @@ void *psp_copy_user_blob(u64 uaddr, u32 len); void *snp_alloc_firmware_page(gfp_t mask); void snp_free_firmware_page(void *addr); void sev_platform_shutdown(void); +bool sev_is_snp_ciphertext_hiding_supported(void); =20 #else /* !CONFIG_CRYPTO_DEV_SP_PSP */ =20 @@ -1020,6 +1029,8 @@ static inline void snp_free_firmware_page(void *addr)= { } =20 static inline void sev_platform_shutdown(void) { } =20 +static inline bool sev_is_snp_ciphertext_hiding_supported(void) { return f= alse; } + #endif /* CONFIG_CRYPTO_DEV_SP_PSP */ =20 #endif /* __PSP_SEV_H__ */ --=20 2.34.1 From nobody Fri Dec 19 14:34:01 2025 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2043.outbound.protection.outlook.com [40.107.220.43]) (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 AB51D23C505; Mon, 19 May 2025 23:57:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747699055; cv=fail; b=fzGuZul5jnj2VPAD+7cMyiW0HsYwqcEXTys1s6Mn++1AmFqQYmINzFBWgxSL2YOstkB5GJIRU2/iDl4CNBZjr6MMON19G36B51ZxPClQb+I1+vyAAjqLd6GrPp/QFWJKBkcnF5m+ZWMaiqSOnVVTejxvm5hm7nhRKJKPviOWRWY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747699055; c=relaxed/simple; bh=fjQpUBhPsLubwvrY+S8NfN/vqpEkH3GGdfv3XNc1Mk0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TXKaRSxKs4ZFmaAEsxAvnLnS8aR56Xfbyyij/NU/B6aqaNCg1GLHkeuhCDLZ4MYgRgBvlL8wz27sr8DkxmVyvbqRJfL2bbz2vlzhGQeea+Mm+z6T4cS9n1ssksHA/SBdjaeiUL4CXG4zLoKeDt64q2dgO/PoBt1eNCGYRIV9PXw= 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=bLExQDRe; arc=fail smtp.client-ip=40.107.220.43 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="bLExQDRe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kIl1bcbBxaJ3n1826xjSOyatKFRCu/07PVP4Fba1q/n3QRaEsclXeCze/5e00LjX0Bywhuu65gOznTpO7552eR3nkhwoLBld3CpN8oVOgy/adAujxLqjvKbuaSs/H5abuJLClwR/CnJ18OY+ZnfkA/GHhNK5rENYlISTrOwATbkL1ZlAmJ/4fW16Iaj9os7kjAtdu7yt4IGbqWdymKotlnyVsmxM1Z+s1mG4RsKa6KnFLm3bbabc8+lZRCoH8NYmSE8Rpx+qkmP26TI/JwgdhcJytlsy0yVP6ZYg8EKJ+odTZUGs8wCQYZpio/g32cr/0l8PgltaPYoyEsh8fW+QOQ== 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=7OsmNMsUqx9xnAa+JwL//gyjUtbhZ0EaUk9DuC9u+9c=; b=xQioCFi2oSrL9wWJc1dYUCbvbCq14gekfJNFkbQvFmAPZEOHyymh+jrbIufRY0B4tnF8JFx7sG9kC1GAXch5ICzWTrWXBUXZvZTMcNBBRvtAgY60hMesYkCeG5/8sLUPWX88Cm8XchCkNbY87wTmvKY1+01waXa/qWZsKBmXDTzS3HHyGzbUE5eaynDZwEVX3nxW3LNrV8Bcl0cyVecvDjtFb7FEsLX4GNGJ1dbb8TQfYDH0Xq+Q0iXNf523VHxivHXxuhoQAHPVaj07+WK7sCX3TStjzZiahSNW4hUIRvU6w8Mfw/7+RBlSwLMGpLQk0rztlE7tQZulH/vKrDo+Bg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com 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=7OsmNMsUqx9xnAa+JwL//gyjUtbhZ0EaUk9DuC9u+9c=; b=bLExQDReCqYxC26/gcFaZK6WLNnVPR2Eyefr8nOsrM6E1PAJJ4aYdbIU4M/CCVcAAYVhCRiD9Y8Bik/pnuWTpJuPGvhLYLOY+G6QhRv/sp8W97VEO/onPY2VQ8pXOo0u2ExUGH0AwkAyRuZFpRUgmMybImZU+wWH8ibtTk5Jdpg= Received: from MW3PR06CA0025.namprd06.prod.outlook.com (2603:10b6:303:2a::30) by CY5PR12MB6525.namprd12.prod.outlook.com (2603:10b6:930:32::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8722.32; Mon, 19 May 2025 23:57:30 +0000 Received: from SJ5PEPF000001F3.namprd05.prod.outlook.com (2603:10b6:303:2a:cafe::24) by MW3PR06CA0025.outlook.office365.com (2603:10b6:303:2a::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8746.30 via Frontend Transport; Mon, 19 May 2025 23:57:29 +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 SJ5PEPF000001F3.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8769.18 via Frontend Transport; Mon, 19 May 2025 23:57:29 +0000 Received: from purico-ed09host.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; Mon, 19 May 2025 18:57:28 -0500 From: Ashish Kalra To: , , , , , , , CC: , , , , , , , Subject: [PATCH v4 4/5] KVM: SEV: Introduce new min,max sev_es and sev_snp asid variables Date: Mon, 19 May 2025 23:57:19 +0000 Message-ID: <0196b4b50a01312097a18bc86014d9f47c22e640.1747696092.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: 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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001F3:EE_|CY5PR12MB6525:EE_ X-MS-Office365-Filtering-Correlation-Id: 3eebdcf6-debe-4062-164e-08dd9730ea1f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|7416014|1800799024|82310400026|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?fnTIytzb+3KRrkc6Jh6tTv4YHWnJiCtZsV7leMlX3RumCfYvLuxuuxAzk6Tt?= =?us-ascii?Q?Dn+K7sFQVdES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ii?Q?E5BBLl2DGjQ8H6Pd1kG7eRQ2lVeXsj8kzJJT80HUTyy0WqAxINv7pZznRC8a?= =?us-ascii?Q?1Z149vgM5S/5VaTsunKG0J/SBBgKLVGylYXOnc5TArPTDLMmg4goXbn2hUnv?= =?us-ascii?Q?xOTTUNTxsSXT8pJ9UmnYRRPLfRQjKNQymR4PGVjLdm8ClARBn5yqdnlEelqn?= =?us-ascii?Q?lft6WtLyFEG8wds7CiU9pLdpI/oR9csRvRZFTxtyCrphuxaA6sIaxu3PO/kZ?= =?us-ascii?Q?eGl2jAAgdU2+fHV9DWYknEPoI1px+aYE6cXjnpyXbbMXKDDCUwcaFWEKZBiu?= =?us-ascii?Q?/3Ynlt8w3RvOzi039wRQk/tsSZeSGVlmXBU3nDm0LFVLTjhYSIxPHAeZs+pF?= =?us-ascii?Q?Dj1EXJa4fpdOXTBZhCMNKuDrkeAjaomf/ecmHfGb5fL6SlBmhEWzoP5pMl6T?= =?us-ascii?Q?p7c1Kizqz6C9vke9CUn+diRaKA0pclyxXLnaLpbOJNVqsYgv9G3R0qtsvthE?= =?us-ascii?Q?hd5EoNz0FQq96pUnsF53cRJHMaasBRfLFRCa30tC3dM/soP7qn8NkVb5Oi3l?= =?us-ascii?Q?W7E3QcmSdFyDn3qkHXE47DtzW0aJ7aO41TNw?= 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)(376014)(36860700013)(7416014)(1800799024)(82310400026)(7053199007);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2025 23:57:29.7343 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3eebdcf6-debe-4062-164e-08dd9730ea1f 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: SJ5PEPF000001F3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6525 Content-Type: text/plain; charset="utf-8" From: Ashish Kalra Introduce new min, max sev_es_asid and sev_snp_asid variables. The new {min,max}_{sev_es,snp}_asid variables along with existing {min,max}_sev_asid variable simplifies partitioning of the SEV and SEV-ES+ ASID space. Suggested-by: Sean Christopherson Signed-off-by: Ashish Kalra --- arch/x86/kvm/svm/sev.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index dea9480b9ff6..383db1da8699 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -85,6 +85,10 @@ static DECLARE_RWSEM(sev_deactivate_lock); static DEFINE_MUTEX(sev_bitmap_lock); unsigned int max_sev_asid; static unsigned int min_sev_asid; +static unsigned int max_sev_es_asid; +static unsigned int min_sev_es_asid; +static unsigned int max_snp_asid; +static unsigned int min_snp_asid; static unsigned long sev_me_mask; static unsigned int nr_asids; static unsigned long *sev_asid_bitmap; @@ -172,20 +176,32 @@ static void sev_misc_cg_uncharge(struct kvm_sev_info = *sev) misc_cg_uncharge(type, sev->misc_cg, 1); } =20 -static int sev_asid_new(struct kvm_sev_info *sev) +static int sev_asid_new(struct kvm_sev_info *sev, unsigned long vm_type) { /* * SEV-enabled guests must use asid from min_sev_asid to max_sev_asid. * SEV-ES-enabled guest can use from 1 to min_sev_asid - 1. - * Note: min ASID can end up larger than the max if basic SEV support is - * effectively disabled by disallowing use of ASIDs for SEV guests. */ - unsigned int min_asid =3D sev->es_active ? 1 : min_sev_asid; - unsigned int max_asid =3D sev->es_active ? min_sev_asid - 1 : max_sev_asi= d; - unsigned int asid; + unsigned int min_asid, max_asid, asid; bool retry =3D true; int ret; =20 + if (vm_type =3D=3D KVM_X86_SNP_VM) { + min_asid =3D min_snp_asid; + max_asid =3D max_snp_asid; + } else if (sev->es_active) { + min_asid =3D min_sev_es_asid; + max_asid =3D max_sev_es_asid; + } else { + min_asid =3D min_sev_asid; + max_asid =3D max_sev_asid; + } + + /* + * The min ASID can end up larger than the max if basic SEV support is + * effectively disabled by disallowing use of ASIDs for SEV guests. + */ + if (min_asid > max_asid) return -ENOTTY; =20 @@ -439,7 +455,7 @@ static int __sev_guest_init(struct kvm *kvm, struct kvm= _sev_cmd *argp, if (vm_type =3D=3D KVM_X86_SNP_VM) sev->vmsa_features |=3D SVM_SEV_FEAT_SNP_ACTIVE; =20 - ret =3D sev_asid_new(sev); + ret =3D sev_asid_new(sev, vm_type); if (ret) goto e_no_asid; =20 @@ -3029,6 +3045,9 @@ void __init sev_hardware_setup(void) goto out; } =20 + min_sev_es_asid =3D min_snp_asid =3D 1; + max_sev_es_asid =3D max_snp_asid =3D min_sev_asid - 1; + /* Has the system been allocated ASIDs for SEV-ES? */ if (min_sev_asid =3D=3D 1) goto out; @@ -3048,11 +3067,11 @@ void __init sev_hardware_setup(void) if (boot_cpu_has(X86_FEATURE_SEV_ES)) pr_info("SEV-ES %s (ASIDs %u - %u)\n", str_enabled_disabled(sev_es_supported), - min_sev_asid > 1 ? 1 : 0, min_sev_asid - 1); + min_sev_es_asid, max_sev_es_asid); if (boot_cpu_has(X86_FEATURE_SEV_SNP)) pr_info("SEV-SNP %s (ASIDs %u - %u)\n", str_enabled_disabled(sev_snp_supported), - min_sev_asid > 1 ? 1 : 0, min_sev_asid - 1); + min_snp_asid, max_snp_asid); =20 sev_enabled =3D sev_supported; sev_es_enabled =3D sev_es_supported; --=20 2.34.1 From nobody Fri Dec 19 14:34:01 2025 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2066.outbound.protection.outlook.com [40.107.94.66]) (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 7CFB3335C7; Tue, 20 May 2025 00:03:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747699389; cv=fail; b=GIfnG3lcDJuREBymv4BNoJS8fbokNhKmxWZRfXxhXc1QoVa+QWVgOAGAxAN/iLsTVDRkl0yPjUTt2adreO2YhUvANf6W7+xDmdIjNdtjalQFgBO0US8flQu0MGIjvwsXYGbgoI6LI3TWHLSf8YvZ4y10Nbus+3NrAwwJQXbFiOs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747699389; c=relaxed/simple; bh=BaNzUTImRzdPjBturwi/5uz0NwWkgavQbTPx2vz7VqY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RVcg5JeaW2mwk/DblkoAPxcayWezGbV4sTw/d8wg3CpF/o/meUWFjoV/a4inh9ZpNYXbYls7lL6T/3Bu6cwbMmeRyS3JL6gg2mu6M93La5LgXhWxALh4CwEKUK5iX7ylGwUbyeKjc7+wEYqeWNLiHcwlyH+t3ln1CrHkEPwkdUs= 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=uzqgLw31; arc=fail smtp.client-ip=40.107.94.66 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="uzqgLw31" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hDn9Yy7IMH8qpl5ausOGJlWfI6NpeGwAtqXCA1I9sv4U4dnsVmNCzsqBpA1ts61sr60LHAxZnm+T3QekyoQQhgmxr7kkdZdIpWev0oAemjwW99HTqxEi3fzhjDbE183ZqeFIImPXWedQbLkNmQ39xr2IKd0DzhDRT2d8PzlWAel1kSate1OhvoyB2nCtYAgdkygs7WgtoWiy6ODi44hiPir5bTCmiem/9E8CIiJq/Smx257+m6IyxC9pMmsQcNJFv4IIncsMsYXb7oXRk8YlHIvAPhaBCY7xcOiwQv4Q+DUdqKJH66bFHxOixyIHLGM5OD2MuVc9FFMy9g+9DvX7gQ== 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=fqqNuGg2xxDWvpxqCX9OYUfVnJDf8MFJJeN4KOt7hLQ=; b=Mp9K89cwKa478ITEcbOQMMyFEI9KkQCTTKodxVR0USA36evuVD27/UBDUw9AaHM4EwNsd7fbD+S7g6RYjWhrh5Wn7A1DgA55+IdrqkQXq3zZSvRvh56IVKW50nWBZKnt623puyERNnr9ibERcmoeqc24CSlOi9z7JlNOdfImSfeAJFD2ktstX+vu9sJpj+1UXahiU/DbVW+lggQtSBy2OtwHoftmVfn0zY9oafPB0LkVO6DUVve23RQ7xM7XYXl25xdxxIfLAJQF3sPwyaWb7eeO1cA8KbgaEhjbS4pSM4Or+pPGZ0NvVeeyoBLISQflI9L7eZY0kn0aLf/UXn0RcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=fqqNuGg2xxDWvpxqCX9OYUfVnJDf8MFJJeN4KOt7hLQ=; b=uzqgLw31fAhBX+Dp0CjQn5DRZ92Y1qwhiPRlaDxIPH1+Dgf2TP4gnPef0yQJ3PD2/5ert8I1MfaXHewub/3BFUJupqzRrwAGXzCZP9oVAfgW6zA3EewfMqgM5ZGBZQFBQpOg7kUsghcyAsJdk1ud1nZStQQUAm21MGF6ka87D4c= Received: from SJ0PR05CA0085.namprd05.prod.outlook.com (2603:10b6:a03:332::30) by SJ5PPF1C7838BF6.namprd12.prod.outlook.com (2603:10b6:a0f:fc02::98d) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8699.24; Tue, 20 May 2025 00:02:59 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:a03:332:cafe::66) by SJ0PR05CA0085.outlook.office365.com (2603:10b6:a03:332::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8769.10 via Frontend Transport; Tue, 20 May 2025 00:02:59 +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 MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8769.18 via Frontend Transport; Tue, 20 May 2025 00:02:59 +0000 Received: from purico-ed09host.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; Mon, 19 May 2025 19:02:56 -0500 From: Ashish Kalra To: , , , , , , , , , , , CC: , , , , , , , , , , , Subject: [PATCH v4 5/5] KVM: SEV: Add SEV-SNP CipherTextHiding support Date: Tue, 20 May 2025 00:02:47 +0000 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: 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: MWH0EPF000989E7:EE_|SJ5PPF1C7838BF6:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d912732-340d-4839-01bb-08dd9731ae64 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|36860700013|1800799024|376014|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Zea+Md+zU0PAs6p4UQtqODtQXMdEMqmdiG6zmeyJC6/YChR6gwo8i9xukO09?= =?us-ascii?Q?TtV3HTm44yiYLl9e7zcqsoe3CUopC1B4kalNL/rKFyTgGhEH119oxcBvkmXq?= =?us-ascii?Q?d2utlNl3bKv/1AU/0NJ7jUoV1FeJuItntKvFnn55+rdUnuJZiHhCHuuy20IX?= =?us-ascii?Q?G9MKKQ+qvXWlIfQ0+c3B7IpA2hzVa6oAiwFN0uLgf7InHBwudgPWnUsE3Taz?= =?us-ascii?Q?+2aSuu8UxvjPECSoXXN9Bu1FnL5bOJrRBn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en73nIQOPq1Qu2+m8cczEwqtYkHMT036Ekg1vLdDeH0ToELqn?= =?us-ascii?Q?SyzkJB1bThRjXQsB4zVIvg9Y+Jpog3fUbJf/VNhvriSpCbNHPh5jq72H3MOE?= =?us-ascii?Q?NUySE5YjBN+p1LnX76yB0ia0aEoHF6AFg2vhG93lr7TA/Bq1kly2T4Kf6S1M?= =?us-ascii?Q?8yesJMjH7sWnPfTbR70byEgKcA+URAE+ihCN96jNi4aNhze61EgteWvAO4uW?= =?us-ascii?Q?jjklc1E5Hd/fHZ4zcx9vIFknRCROwgFhnCDZ6DkqjfFXUE0/BvUYKuCDlLo9?= =?us-ascii?Q?pW1pYdvTWpGcXAheRUrwr2zSoiQSmDWq0FUf0r4GBsHcxpDCWUQg09wVEO7h?= =?us-ascii?Q?a49VglfD9Lkt4JN6zUUPm3glcKWUWzN/9GDpolgMpFlRfBCpq9HA6zKzNQ?= =?us-ascii?Q?=3D=3D?= 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)(7416014)(36860700013)(1800799024)(376014)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2025 00:02:59.0076 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d912732-340d-4839-01bb-08dd9731ae64 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: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ5PPF1C7838BF6 Content-Type: text/plain; charset="utf-8" From: Ashish Kalra Ciphertext hiding prevents host accesses from reading the ciphertext of SNP guest private memory. Instead of reading ciphertext, the host reads will see constant default values (0xff). The SEV ASID space is basically split into legacy SEV and SEV-ES+. CipherTextHiding further partitions the SEV-ES+ ASID space into SEV-ES and SEV-SNP. Add new module parameter to the KVM module to enable CipherTextHiding support and a user configurable system-wide maximum SNP ASID value. If the module parameter value is -1 then the ASID space is equally divided between SEV-SNP and SEV-ES guests. Suggested-by: Sean Christopherson Signed-off-by: Ashish Kalra --- .../admin-guide/kernel-parameters.txt | 10 ++++++ arch/x86/kvm/svm/sev.c | 31 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index 1e5e76bba9da..2cddb2b5c59d 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2891,6 +2891,16 @@ (enabled). Disable by KVM if hardware lacks support for NPT. =20 + kvm-amd.ciphertext_hiding_nr_asids=3D + [KVM,AMD] Enables SEV-SNP CipherTextHiding feature and + controls show many ASIDs are available for SEV-SNP guests. + The ASID space is basically split into legacy SEV and + SEV-ES+. CipherTextHiding feature further splits the + SEV-ES+ ASID space into SEV-ES and SEV-SNP. + If the value is -1, then it is used as an auto flag + and splits the ASID space equally between SEV-ES and + SEV-SNP ASIDs. + kvm-arm.mode=3D [KVM,ARM,EARLY] Select one of KVM/arm64's modes of operation. diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 383db1da8699..68dcb13d98f2 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -59,6 +59,10 @@ static bool sev_es_debug_swap_enabled =3D true; module_param_named(debug_swap, sev_es_debug_swap_enabled, bool, 0444); static u64 sev_supported_vmsa_features; =20 +static int ciphertext_hiding_nr_asids; +module_param(ciphertext_hiding_nr_asids, int, 0444); +MODULE_PARM_DESC(max_snp_asid, " Number of ASIDs available for SEV-SNP gu= ests when CipherTextHiding is enabled"); + #define AP_RESET_HOLD_NONE 0 #define AP_RESET_HOLD_NAE_EVENT 1 #define AP_RESET_HOLD_MSR_PROTO 2 @@ -200,6 +204,9 @@ static int sev_asid_new(struct kvm_sev_info *sev, unsig= ned long vm_type) /* * The min ASID can end up larger than the max if basic SEV support is * effectively disabled by disallowing use of ASIDs for SEV guests. + * Similarly for SEV-ES guests the min ASID can end up larger than the + * max when CipherTextHiding is enabled, effectively disabling SEV-ES + * support. */ =20 if (min_asid > max_asid) @@ -2955,6 +2962,7 @@ void __init sev_hardware_setup(void) { unsigned int eax, ebx, ecx, edx, sev_asid_count, sev_es_asid_count; struct sev_platform_init_args init_args =3D {0}; + bool snp_cipher_text_hiding =3D false; bool sev_snp_supported =3D false; bool sev_es_supported =3D false; bool sev_supported =3D false; @@ -3052,6 +3060,27 @@ void __init sev_hardware_setup(void) if (min_sev_asid =3D=3D 1) goto out; =20 + /* + * The ASID space is basically split into legacy SEV and SEV-ES+. + * CipherTextHiding feature further partitions the SEV-ES+ ASID space + * into ASIDs for SEV-ES and SEV-SNP guests. + */ + if (ciphertext_hiding_nr_asids && sev_is_snp_ciphertext_hiding_supported(= )) { + /* Do sanity checks on user-defined ciphertext_hiding_nr_asids */ + if (ciphertext_hiding_nr_asids !=3D -1 && + ciphertext_hiding_nr_asids >=3D min_sev_asid) { + pr_info("ciphertext_hiding_nr_asids module parameter invalid, limiting = SEV-SNP ASIDs to %d\n", + min_sev_asid); + ciphertext_hiding_nr_asids =3D min_sev_asid - 1; + } + + min_sev_es_asid =3D ciphertext_hiding_nr_asids =3D=3D -1 ? (min_sev_asid= - 1) / 2 : + ciphertext_hiding_nr_asids + 1; + max_snp_asid =3D min_sev_es_asid - 1; + snp_cipher_text_hiding =3D true; + pr_info("SEV-SNP CipherTextHiding feature support enabled\n"); + } + sev_es_asid_count =3D min_sev_asid - 1; WARN_ON_ONCE(misc_cg_set_capacity(MISC_CG_RES_SEV_ES, sev_es_asid_count)); sev_es_supported =3D true; @@ -3092,6 +3121,8 @@ void __init sev_hardware_setup(void) * Do both SNP and SEV initialization at KVM module load. */ init_args.probe =3D true; + if (snp_cipher_text_hiding) + init_args.snp_max_snp_asid =3D max_snp_asid; sev_platform_init(&init_args); } =20 --=20 2.34.1