From patchwork Fri Jan 3 20:00:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 13925874 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2058.outbound.protection.outlook.com [40.107.244.58]) (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 32F5A1BEF9C; Fri, 3 Jan 2025 20:01:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735934469; cv=fail; b=SoeQlMMTMpGolNOCY8DZV8147rUTGnhLvr5NtwhYosiobWcy6qv7fpV5NxW4O6KaT/TTmaKeZCetg0VoTPdEk+s2/sDQUR6n4eGB31tdJAi7M7owuvCxQURYAiGX3OX37p6MD/7w7s9qZwvJ5aUTXQXuR24L/1GwpWSs70o57l8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735934469; c=relaxed/simple; bh=e3L9DsLMZta3TZFGP3V8ILR11hrCz4RTozquZEk9UcQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YFXCki4y/AcfXYEbRImLJoWLeEPr8p4UYaJoyNYiSWJVowFJZ+K5auydtm/1IUbad15ODWsAuuCCCBfW36axtx+R988hEVF/OylvphMRyjwv+6VRThJLLuWSmOVnBNjGwJ03fImE2C80bCM0V38WVWbDgSf3Pdus2Y5W7tUY3Ug= 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=FWICDPq4; arc=fail smtp.client-ip=40.107.244.58 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="FWICDPq4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BgwcR8gsbz26EsNv7smAiSd1k1RsbU9JdQ4s3JD8Awzu1b5cKP7/wJ8QsdCq5dmhaUk25oJK00A2emQqhVYXkwv4Bl6b72htMS2x0c4PWQ0A4UqwcDwuU5K0tkAu6vUg1TzxDAhV8Q/NT2ybZKKFfuMtEGy3K6wLBc2rISpGhSMDqJ5CmUFt+TcrEEk0kLVi50uh3R1BkbFqhgVd/PE8jAa9Wr5WOqv5twUCzOAUPBd28H0mYxvK2XLF/xj3uW0GWX6iBkoti0+B9NatAjUEjynHKFZXiJnzz8d5Y+iyLscj+lGQTXOA410YjdoldKR2inzG8mf2qrBkhbawO/l5LA== 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=wsggXyd3M7q7o8HxFouKHNcmagYw1VBF1z16lrf7JSA=; b=pzZjG+wUglQVetRkTMWWQKH+/xM0g7ZSV4hdz4O/MkHJZ1LvhLSNucklEXG08H56h8ihC5t9BPZottadXZZrFGMMJn/JORhCczM/vBuhmxqPTa2l3xrPQ30auCNurVnTR+OMVV4qwDr+UPLetQlDrwqy3weV/0alSI22vOnCfgWpi73nSSC+uIkaxn2tWLVYm5r5zSYolSKSkehjxeD5g74Co9bPe7IKAW1KDUP444ps2EG3abU9DTc2pPS3qpEGe6cgh7Os1SWgkYSKnJzOOyEisdhjuv+DC/5tVwUpgK4msDcrp0FNIXL7OdrQih6IkTTtyEgmmP8gpT1uBmWRPQ== 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=wsggXyd3M7q7o8HxFouKHNcmagYw1VBF1z16lrf7JSA=; b=FWICDPq4IGitU3wOJ3N+L6Jet3RQ9vn3MmVKxlJVWnbDNgZlk3zKtGuPvmuDCcRPMUbvCEpw++22pjtg8zZf40HpvZpAOtMckfXJXdPGCYQxyppseIeqFjoIHD9uj7w9vgn/j0PlbciwPShL2c5YsvxKp8P0TflVMTJNzv4ohEM= Received: from BL1P222CA0014.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::19) by IA1PR12MB8538.namprd12.prod.outlook.com (2603:10b6:208:455::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.12; Fri, 3 Jan 2025 20:00:56 +0000 Received: from BL02EPF0001A100.namprd03.prod.outlook.com (2603:10b6:208:2c7:cafe::d6) by BL1P222CA0014.outlook.office365.com (2603:10b6:208:2c7::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.14 via Frontend Transport; Fri, 3 Jan 2025 20:00:56 +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 BL02EPF0001A100.mail.protection.outlook.com (10.167.242.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8335.7 via Frontend Transport; Fri, 3 Jan 2025 20:00:56 +0000 Received: from ethanolx7e2ehost.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; Fri, 3 Jan 2025 14:00:52 -0600 From: Ashish Kalra To: , , , , , , , , , , , CC: , , , , , Subject: [PATCH v3 3/7] crypto: ccp: Reset TMR size at SNP Shutdown Date: Fri, 3 Jan 2025 20:00:38 +0000 Message-ID: <425ecdc1df6566d1b76f7a8deb30471b0ce8dca3.1735931639.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: BL02EPF0001A100:EE_|IA1PR12MB8538:EE_ X-MS-Office365-Filtering-Correlation-Id: 867449e4-cfba-47e9-b044-08dd2c3155f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|82310400026|36860700013|921020; X-Microsoft-Antispam-Message-Info: INNlcRBG3wtigH37cNoHXQAMmrmgNaEY4PjII+e4ISd+sxBHr6GYU3sclpWSjLDFZlpOkVqd+qII9IrQB2DR2eTzrIHNKE3pgkvyW/eLEoieQuInOqBtJBnCMeUcU9ln+v8ZiQR8bhCl37ELJ7gNpan2H6AqF+oXEvtydQ2pWfmHtWeSSOwAUmhK9zTFd1iFS6jIh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hUYKy+wwdcxjduBvhEwUJxoCE4mkbg4/YxDI1cR3Jz5qVN2+X1hsgLebFdMu60pjURQllm/SplwWulZKTQdwWVV5Qk2FyiOC2eZlK6ozS6DoQ4/0Xgx+PyV5cAizcUUPtxfHyGD10PsIFLoI4ZggZj5Mwdy6oTtdJ/Ak+dbSf34mJm8dBO4wfgtCnt1MJ2V2zJo0TTVo0Ks2NRfyhvuye16bUoS1ixZ4ARKwJ2I0rvqHJ9GM9B+2Q8sT6Mlz1kPymP4E2Py/m8cVvAhrHCm 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)(7416014)(376014)(82310400026)(36860700013)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2025 20:00:56.3103 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 867449e4-cfba-47e9-b044-08dd2c3155f6 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: BL02EPF0001A100.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8538 From: Ashish Kalra When SEV-SNP is enabled the TMR needs to be 2MB aligned and 2MB sized, ensure that TMR size is reset back to default when SNP is shutdown as SNP initialization and shutdown as part of some SNP ioctls may leave TMR size modified and cause subsequent SEV only initialization to fail. Signed-off-by: Ashish Kalra --- drivers/crypto/ccp/sev-dev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index 0ec2e8191583..9632a9a5c92e 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -1751,6 +1751,9 @@ static int __sev_snp_shutdown_locked(int *error, bool panic) sev->snp_initialized = false; dev_dbg(sev->dev, "SEV-SNP firmware shutdown\n"); + /* Reset TMR size back to default */ + sev_es_tmr_size = SEV_TMR_SIZE; + return ret; }