Message ID | 20231128125959.1810039-1-nikunj@amd.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3896877vqx; Tue, 28 Nov 2023 05:01:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IEllQundsNCAN7Sv4QcbcG1MX6HQ0R6fVMKLfXRsGy3wO32NQaRg1VL3PtEWFVIyW2hm2ub X-Received: by 2002:a05:6808:1802:b0:3b2:f461:b31e with SMTP id bh2-20020a056808180200b003b2f461b31emr6858794oib.29.1701176464373; Tue, 28 Nov 2023 05:01:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701176464; cv=pass; d=google.com; s=arc-20160816; b=ivW8UFduj73FuWLP4Imd5KEfgxbpuSNPdkotQB9lt+RHdrQUzhsf61Cg37lWDek0UY bDqB+N+oyXNuZ33QxG+h2Lj2g6nsJcFvzW6Ckzi9DMhWiqUDyiiIn/hpxuVue5nE8WtL Vi2jI4GF+G9BzDvoszdaMlFOy+5H47MD425l85CNUJ3+qj8tO+0pOP5ARLtpB+NN4Jn8 f55aOL6P8T9YT1sTYpj9OinhZphR+6ePkrL9cfDENyhJ8bF+An29EtErP3SRUfU1+5ZK RycYkg+nKAZAqDr0WS2XTrn90ZgyXswzlkDlyCmSSdaC+UygJbHcogLspxHsSXn/Szz6 OeHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Y/Sb3Cd+daEyZ4iYQl5u0qO7UzXLWixS1gcRcG118/k=; fh=GrBYTfaCmKSBoJ0OQBiloTDpWB/NcGHvBdTqN4MlWVs=; b=n2yO2r3HBSvKrqLI/+Tw6M9ZF5dSRFnOBMNZy3ra24kP00Oa+37+O6cTCVDHx7OagG 5mAcHhOnN5yvHjWbT8FqHLdwEJuHuNu+bJaIsEkyLQ1BwPZakLgYhuSXTJeSvB18PuHT RFMHFf72fKKxju5bnkfC5ucEANVTT6SVk33a4z0Nc7qlDknVWZaSN/9KUciaokDGCsB8 NGx48W5C1lQnH3zD315tzCZCuHnLNH3VxWOIKYKRa1FcNiP+aOMK2FbWDXeYu2joUvbp SSfzw82d8Q3Jb61Ka6auYX/49xLpxvlhPuAclDSFcRVDTUA0xHeQfQRvHyRYcAIalO/n sg/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=2gyp+yVM; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id o16-20020a0568080f9000b003ae0a23a571si4853383oiw.49.2023.11.28.05.01.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 05:01:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=2gyp+yVM; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id ED1838083AB7; Tue, 28 Nov 2023 05:00:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344833AbjK1NA2 (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Tue, 28 Nov 2023 08:00:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344839AbjK1NA2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Nov 2023 08:00:28 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2042.outbound.protection.outlook.com [40.107.244.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF0D3D60; Tue, 28 Nov 2023 05:00:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fZ0S37xWlYhBFAo24vsJUnxvmVfDxF78c0nUs5sdbVUOvddWvIKCQbhIiP5z1sPzyo9HABUX1U2qPspgAwitQF5Pmdu/x9ctMYiHX97IJJ7mZ7TkB9tMzzYJNSvMBoPrZ55WO+nCIfEQBt0Ix34LtNGNEdeeyxf1G1hhdr7XPzNBfakzykOnWrdGhRhYzHFLAtFRG2SGhAs+2wVkhxn7D9sBPLNGEr7gdIbRO5FyqhtUXTdNVmBZa/YxyeJBoqY2RyB3uxhTc1vVpPZyAMoPkfH5GctXTrPxmhPO8qmzzAWHeq0zyofzgOLgFYNP8Of2IK3v/XjCI3FIHxlKlyUpDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Y/Sb3Cd+daEyZ4iYQl5u0qO7UzXLWixS1gcRcG118/k=; b=NvD3ZQ+9Ved9TNzXgBY941Yd7uC+9+p1EkMEElb3rSDe5H6z0W8cYeQ+YfLW5CV6U/cVDwSDDCEnE9takM5VC7vOVy9NwfE8LTrD7IrdFVSkxfkZG6FQ2L0pJo4Dh8Eww2NdVuhyPMo+tF7PBQHxuScLZUoSSXsL4JbwjsloMo+2YqAw0PGAAg1o4THP+TGylcECGKU5Fy0z2zqd/UHmPKVKUMPaLf1FtuvVgoXl64fiPgb6wcrreY39ehUm02zeqnddG5IJsWNZ9rY+voq06KCZu4GSzxCPqYdmTKAzqMkxxPMWCALaSaWtGQLEeSJespC9Vx5fRviY0fk+HwUdIg== 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=Y/Sb3Cd+daEyZ4iYQl5u0qO7UzXLWixS1gcRcG118/k=; b=2gyp+yVMMFNFookgMVmlhaYT6OAdLQIkblRFYf53RYEXS4q3eh3WOwE76pyqcYEXQ0TAcwWC8LGRwHKdRNdwq0+4Unv96ssHf4noQxQtEVOJhhC0H7SQ+RnjrCZiAM5vRjqKIrCA35dmKskZ5Cr1PYsyJjXFogGyOgREf8E7Y2w= Received: from DM6PR07CA0131.namprd07.prod.outlook.com (2603:10b6:5:330::19) by DS7PR12MB5766.namprd12.prod.outlook.com (2603:10b6:8:75::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.28; Tue, 28 Nov 2023 13:00:30 +0000 Received: from CY4PEPF0000EE37.namprd05.prod.outlook.com (2603:10b6:5:330:cafe::d4) by DM6PR07CA0131.outlook.office365.com (2603:10b6:5:330::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.29 via Frontend Transport; Tue, 28 Nov 2023 13:00:30 +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 CY4PEPF0000EE37.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.7046.17 via Frontend Transport; Tue, 28 Nov 2023 13:00:30 +0000 Received: from gomati.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.34; Tue, 28 Nov 2023 07:00:22 -0600 From: Nikunj A Dadhania <nikunj@amd.com> To: <linux-kernel@vger.kernel.org>, <thomas.lendacky@amd.com>, <x86@kernel.org>, <kvm@vger.kernel.org> CC: <bp@alien8.de>, <mingo@redhat.com>, <tglx@linutronix.de>, <dave.hansen@linux.intel.com>, <dionnaglaze@google.com>, <pgonda@google.com>, <seanjc@google.com>, <pbonzini@redhat.com>, <nikunj@amd.com> Subject: [PATCH v6 00/16] Add Secure TSC support for SNP guests Date: Tue, 28 Nov 2023 18:29:43 +0530 Message-ID: <20231128125959.1810039-1-nikunj@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] 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: CY4PEPF0000EE37:EE_|DS7PR12MB5766:EE_ X-MS-Office365-Filtering-Correlation-Id: 3be59b70-71c3-485b-8582-08dbf0120006 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a6jK1RAUeVg68Gjo/gUgCXr5axPMp0zQIyMz/XdWE6xBAzcSivqvKnigDrPtPzvRQgbRka9jkBraK2Qt9y+iVID8ryoFqLKGk4Z8GfNwgF0+A78lntWNz7Y9I1cmT0od9BbD1IGGuLUANWYY6k0w1X8e4GMtvFhUtO8Z6NfmMkIaH1eJfVQAJL+y0fvsi8QtbuUIdXUUrhCBlDwJBYv3YR8O4ihblqp6/0wL9APq0XV06yluEUhcTZu5YM0MCDRFnEWCRO1CiArtgbELC9rG7eiqzLb836fcGaobzrEzJxPUfsdS+V7JbnRN82OY4qwVZUUEvnimIc6sQMRC+Op/EuF470+Ocuj3YokFpEfHgSb1c1aTVZgqgkLe1X1K4MGbaeeKpx4S3klPcBDkALtKtjrVWpfQtzCXGUd/TYnVJJ7Ddtqghf78+6DwL6xYFs026zU/MQU7bESC43n81NdH4QIuSy18wfXtZODc9qp8CMw/4EALgr4/wZMyr+vbBp5TdfwammlrrfT6D7wZ/0/snoIAv93y9WWo3A/n3tHwrxi29OdwQf/MtADiIAeMOue/NpWvMAdzMkvoxgjIAx8fuIX68PUgvVf7Hd7g9q+JCD5oJeY0ij4YukUgXkyPZdjyMQ5HPzBKFjGYqY7MrGpZjJ9MMlb8/PeHpWvxfoFyDi6GpBQOm6TJvVo1rdRyDaLY278aFh8rVDD1mu1TokiCkehmNO/+EJtO73oSh987261Cz+r+24VexsyVWM5pWxzq5YS/6VzsyWaTDyuQXowgmFA7dxZvbn5tHfTSoHIvG8U= 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:(13230031)(4636009)(136003)(396003)(39860400002)(346002)(376002)(230922051799003)(82310400011)(64100799003)(451199024)(186009)(1800799012)(36840700001)(40470700004)(46966006)(40480700001)(36860700001)(41300700001)(6666004)(40460700003)(5660300002)(2906002)(7416002)(83380400001)(356005)(8936002)(4326008)(54906003)(8676002)(966005)(110136005)(70586007)(1076003)(2616005)(316002)(16526019)(7696005)(26005)(336012)(82740400003)(70206006)(36756003)(426003)(81166007)(4743002)(47076005)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 13:00:30.2468 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3be59b70-71c3-485b-8582-08dbf0120006 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: CY4PEPF0000EE37.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5766 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 28 Nov 2023 05:00:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783812812105331096 X-GMAIL-MSGID: 1783812812105331096 |
Series |
Add Secure TSC support for SNP guests
|
|
Message
Nikunj A. Dadhania
Nov. 28, 2023, 12:59 p.m. UTC
Secure TSC allows guests to securely use RDTSC/RDTSCP instructions as the parameters being used cannot be changed by hypervisor once the guest is launched. More details in the AMD64 APM Vol 2, Section "Secure TSC". During the boot-up of the secondary cpus, SecureTSC enabled guests need to query TSC info from AMD Security Processor. This communication channel is encrypted between the AMD Security Processor and the guest, the hypervisor is just the conduit to deliver the guest messages to the AMD Security Processor. Each message is protected with an AEAD (AES-256 GCM). See "SEV Secure Nested Paging Firmware ABI Specification" document (currently at https://www.amd.com/system/files/TechDocs/56860.pdf) section "TSC Info" Use a minimal GCM library to encrypt/decrypt SNP Guest messages to communicate with the AMD Security Processor which is available at early boot. SEV-guest driver has the implementation for guest and AMD Security Processor communication. As the TSC_INFO needs to be initialized during early boot before smp cpus are started, move most of the sev-guest driver code to kernel/sev.c and provide well defined APIs to the sev-guest driver to use the interface to avoid code-duplication. Patches: 01-08: Preparation and movement of sev-guest driver code 09-16: SecureTSC enablement patches. Testing SecureTSC ----------------- SecureTSC hypervisor patches based on top of SEV-SNP Guest MEMFD series: https://github.com/nikunjad/linux/tree/snp-host-latest-securetsc_v5 QEMU changes: https://github.com/nikunjad/qemu/tree/snp_securetsc_v5 QEMU commandline SEV-SNP-UPM with SecureTSC: qemu-system-x86_64 -cpu EPYC-Milan-v2,+secure-tsc,+invtsc -smp 4 \ -object memory-backend-memfd-private,id=ram1,size=1G,share=true \ -object sev-snp-guest,id=sev0,cbitpos=51,reduced-phys-bits=1,secure-tsc=on \ -machine q35,confidential-guest-support=sev0,memory-backend=ram1,kvm-type=snp \ ... Changelog: ---------- v6: * Add synthetic SecureTSC x86 feature bit * Drop {__enc,dec}_payload() as they are pretty small and has one caller. * Instead of a pointer use data_npages as variable * Beautify struct snp_guest_req * Make vmpck_id as unsigned int in snp_assign_vmpck() * Move most of the functions to end of sev.c file * Update commit/comments/error messages * Mark free_shared_pages and alloc_shared_pages as inline * Free snp_dev->certs_data when guest driver is removed * Add lockdep assert in snp_inc_msg_seqno() * Drop redundant enc_init NULL check * Move SNP_TSC_INFO_REQ_SZ define out of structure * Rename guest_tsc_{scale,offset} to snp_tsc_{scale,offset} * Add new linux termination error code GHCB_TERM_SECURE_TSC * Initialize and use cmd_mutex in snp_get_tsc_info() * Set TSC as reliable in sme_early_init() * Do not print firmware bug for Secure TSC enabled guests v5: * Rebased on v6.6 kernel * Dropped link tag in first patch * Dropped get_ctx_authsize() as it was redundant https://lore.kernel.org/lkml/20231030063652.68675-1-nikunj@amd.com/ v4: * Drop handle_guest_request() and handle_guest_request_ext() * Drop NULL check for key * Corrected commit subject * Added Reviewed-by from Tom https://lore.kernel.org/lkml/20230814055222.1056404-1-nikunj@amd.com/ v3: * Updated commit messages * Made snp_setup_psp_messaging() generic that is accessed by both the kernel and the driver * Moved most of the context information to sev.c, sev-guest driver does not need to know the secrets page layout anymore * Add CC_ATTR_GUEST_SECURE_TSC early in the series therefore it can be used in later patches. * Removed data_gpa and data_npages from struct snp_req_data, as certs_data and its size is passed to handle_guest_request_ext() * Make vmpck_id as unsigned int * Dropped unnecessary usage of memzero_explicit() * Cache secrets_pa instead of remapping the cc_blob always * Rebase on top of v6.4 kernel https://lore.kernel.org/lkml/20230722111909.15166-1-nikunj@amd.com/ v2: * Rebased on top of v6.3-rc3 that has Boris's sev-guest cleanup series https://lore.kernel.org/r/20230307192449.24732-1-bp@alien8.de/ v1: https://lore.kernel.org/r/20230130120327.977460-1-nikunj@amd.com/ Nikunj A Dadhania (16): virt: sev-guest: Use AES GCM crypto library virt: sev-guest: Move mutex to SNP guest device structure virt: sev-guest: Replace dev_dbg with pr_debug virt: sev-guest: Add SNP guest request structure virt: sev-guest: Add vmpck_id to snp_guest_dev struct x86/sev: Cache the secrets page address x86/sev: Move and reorganize sev guest request api x86/mm: Add generic guest initialization hook x86/cpufeatures: Add synthetic Secure TSC bit x86/sev: Add Secure TSC support for SNP guests x86/sev: Change TSC MSR behavior for Secure TSC enabled guests x86/sev: Prevent RDTSC/RDTSCP interception for Secure TSC enabled guests x86/kvmclock: Skip kvmclock when Secure TSC is available x86/sev: Mark Secure TSC as reliable x86/cpu/amd: Do not print FW_BUG for Secure TSC x86/sev: Enable Secure TSC for SNP guests arch/x86/Kconfig | 1 + arch/x86/boot/compressed/sev.c | 3 +- arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/asm/sev-common.h | 1 + arch/x86/include/asm/sev-guest.h | 191 +++++++ arch/x86/include/asm/sev.h | 20 +- arch/x86/include/asm/svm.h | 6 +- arch/x86/include/asm/x86_init.h | 2 + arch/x86/kernel/cpu/amd.c | 3 +- arch/x86/kernel/kvmclock.c | 2 +- arch/x86/kernel/sev-shared.c | 10 + arch/x86/kernel/sev.c | 622 ++++++++++++++++++++-- arch/x86/kernel/x86_init.c | 2 + arch/x86/mm/mem_encrypt.c | 12 +- arch/x86/mm/mem_encrypt_amd.c | 11 + drivers/virt/coco/sev-guest/Kconfig | 3 - drivers/virt/coco/sev-guest/sev-guest.c | 661 +++--------------------- drivers/virt/coco/sev-guest/sev-guest.h | 63 --- 18 files changed, 888 insertions(+), 726 deletions(-) create mode 100644 arch/x86/include/asm/sev-guest.h delete mode 100644 drivers/virt/coco/sev-guest/sev-guest.h base-commit: 98b1cc82c4affc16f5598d4fa14b1858671b2263
Comments
On Tue, Nov 28, 2023 at 6:00 AM Nikunj A Dadhania <nikunj@amd.com> wrote: > > Secure TSC allows guests to securely use RDTSC/RDTSCP instructions as the > parameters being used cannot be changed by hypervisor once the guest is > launched. More details in the AMD64 APM Vol 2, Section "Secure TSC". > > During the boot-up of the secondary cpus, SecureTSC enabled guests need to > query TSC info from AMD Security Processor. This communication channel is > encrypted between the AMD Security Processor and the guest, the hypervisor > is just the conduit to deliver the guest messages to the AMD Security > Processor. Each message is protected with an AEAD (AES-256 GCM). See "SEV > Secure Nested Paging Firmware ABI Specification" document (currently at > https://www.amd.com/system/files/TechDocs/56860.pdf) section "TSC Info" > > Use a minimal GCM library to encrypt/decrypt SNP Guest messages to > communicate with the AMD Security Processor which is available at early > boot. > > SEV-guest driver has the implementation for guest and AMD Security > Processor communication. As the TSC_INFO needs to be initialized during > early boot before smp cpus are started, move most of the sev-guest driver > code to kernel/sev.c and provide well defined APIs to the sev-guest driver > to use the interface to avoid code-duplication. > > Patches: > 01-08: Preparation and movement of sev-guest driver code > 09-16: SecureTSC enablement patches. > > Testing SecureTSC > ----------------- > > SecureTSC hypervisor patches based on top of SEV-SNP Guest MEMFD series: > https://github.com/nikunjad/linux/tree/snp-host-latest-securetsc_v5 > > QEMU changes: > https://github.com/nikunjad/qemu/tree/snp_securetsc_v5 > > QEMU commandline SEV-SNP-UPM with SecureTSC: > > qemu-system-x86_64 -cpu EPYC-Milan-v2,+secure-tsc,+invtsc -smp 4 \ > -object memory-backend-memfd-private,id=ram1,size=1G,share=true \ > -object sev-snp-guest,id=sev0,cbitpos=51,reduced-phys-bits=1,secure-tsc=on \ > -machine q35,confidential-guest-support=sev0,memory-backend=ram1,kvm-type=snp \ > ... Thanks Nikunj! I was able to modify my SNP host kernel to support SecureTSC based off of your `snp-host-latest-securetsc_v5` and use that to test this series. Seemed to work as intended in the happy path but I didn't spend much time trying any corner cases. Also checked the series continues to work without SecureTSC enabled for the V. Tested-by: Peter Gonda <pgonda@google.com>