From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.80]) by mx.groups.io with SMTP id smtpd.web09.6268.1632478501666514859 for ; Fri, 24 Sep 2021 03:15:02 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=i+qq6AmL; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.94.80, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PcJ9zdfXEZ7tQStJWz23puLK8i7BMJdNm5bh2ZYRnGN9oVN1pH21W4tMQPhNLXj9bYZi4tBg1CgYjOgY/OHoYRaTts742DYdw2fZ31UzLwwTyzhawwdsdiglRugaCrre2kPmxPdlir8cIyIlYrYLwrxNvC/XWwg74fZYK05l4S5v3D7dFzYwgTaQMKMZYAkmgcGSsizLqVsdoVF8x93uoq0ktosf4uMIdFNuip48cfmNgo51H0Mfr+Y+fh+i3YYkDxuwu2QArdZLeMxywQYvb21AlSy9CsT22VrGqZJXx0pmMGwEVMigh9FINbO400mTagMqADrPYXhqRAwLGSX4Vg== 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; bh=1VLF/I26GNQ94OdhCbT33FTc8KbcEbLad2iQyoojV24=; b=X3cpexcFHQyV8aHKatENsugrb2tskEUhjTWOWGQlIa9kvi4/LmUv72Ye3Fqej+Rvetaf1+wOgc8/tfDjaPC0PGp1PPzu3djz0xVZ7luewBxqArnaYkeuceK06r+EC+Xxf5H9cS504U77QmWm0UKWwgPGlETsHG2GEsNaA5s9DVFkbI63KtjDFrT10yZLdzhf2eKTN06ftRMRIw+NL8cJ8mxG4uyw6bfIx4hA4JHIAx4POz8CHTRj6VCVhlaebLl6Zd5n5O6UmjJHzAMCvEHlZ9Z9CU02v8sKlpQMq/q1NChQSOa4fPgMsYAAST1lqJDXZICN1cAikDoDF8+s/8d0hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none 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=1VLF/I26GNQ94OdhCbT33FTc8KbcEbLad2iQyoojV24=; b=i+qq6AmLXt31h+z6IU4EgGvfYPLSGLQzRwIEnsxz/BK4qXRNuYCJmYF/grJ/cmHYdp31ht/Pg7tWluSNG9xqTIxhyzErWeXoU8Dfx4mmMwIIMY8w9IA8truDsTVqV28YElb24638fY/w1U91GvosohKkG5QyfP9zhNRDSvBOcSk= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SA0PR12MB4430.namprd12.prod.outlook.com (2603:10b6:806:70::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14; Fri, 24 Sep 2021 10:14:57 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::78b7:7336:d363:9be3]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::78b7:7336:d363:9be3%6]) with mapi id 15.20.4523.022; Fri, 24 Sep 2021 10:14:57 +0000 Subject: Re: [edk2-devel] [PATCH V7 1/1] OvmfPkg: Enable TDX in ResetVector To: "Yao, Jiewen" , Gerd Hoffmann CC: "Xu, Min M" , "devel@edk2.groups.io" , Ard Biesheuvel , "Justen, Jordan L" , Erdem Aktas , James Bottomley , Tom Lendacky References: <12721dade1f2f9905cc34271d9abec24650442ff.1632214561.git.min.m.xu@intel.com> <20210922074929.e5iwf24t6wyndgbu@sirius.home.kraxel.org> <20210923084821.yxizus3loa2p6hms@sirius.home.kraxel.org> <7c9aeb95-5c33-bd8d-4f0c-40133f4c7c3d@amd.com> <20210924045416.3vb7qxcetgtdggbs@sirius.home.kraxel.org> From: "Brijesh Singh" Message-ID: <64a78153-4a87-45d5-5230-faeaa4adf09e@amd.com> Date: Fri, 24 Sep 2021 05:14:54 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: X-ClientProxiedBy: SN4PR0201CA0010.namprd02.prod.outlook.com (2603:10b6:803:2b::20) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) Return-Path: brijesh.singh@amd.com MIME-Version: 1.0 Received: from Brijeshs-MacBook-Pro.local (70.112.153.56) by SN4PR0201CA0010.namprd02.prod.outlook.com (2603:10b6:803:2b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Fri, 24 Sep 2021 10:14:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 288a14a1-195a-4942-3a15-08d97f4428e1 X-MS-TrafficTypeDiagnostic: SA0PR12MB4430: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KJ3qJ+K6zN2RTjMAwqvR8cDbLQnrEJ4frDOa6FFLIrYIyPXbJfGF6ghRrv3LYG7SJ4nb4zpZ143Ndsn75DsUHPo0kGTiuFHqh1ulV7Wr8rMli7jOP57T3JAxPbABb+8OYvwWqW5v4MV0YgOjRHV9+r0XwOs+d0BQmGAal0cIeSLjfwnXLjVg5Ggc7PDPgzCqpT0o2jRCD992CnYSvy2GIo0Y0orJilgqH4BdG73FjjAn0LADE4IfdI7iXolRzniMgS2fsHpFamBk+NUnNzhT8fzQxWppLCcD8MRmlSFIuwSXkYGNuAJ3c3/3tug26pZC8hs8cicM37x6Blr2Fg8oQm48sHx8IGdPnzL5uere3Dq8yPaZwzplRvCatWgGbWUMBdcGxptaVtMVXaCZMAVZ89HNH5vfHytrgBK2QBMvQlJgHZwsOHMU8iV0L/PZBlIIJ3ifjCpJw4kWmty13wfSAek+52UnPT7X+vePIcOK6qkj7S/10S9uuZCcnAAn79Uuhb9PAcpfuHXiJl1E+tEL90Jpua0oc8GlIr55pSEPkfVdGZQYNeYX56dh2E4N627ioSSGZG/cJ8Wxh8hAeU9cf4DIOy4mDDpfIy6eqeK3da9nw8IOHbP367tVli5RzL9UfSWKSC+IrBEU+gYbO13BT+xornb4iKtVkwwf6pRdd3m5VefcDqErM6FTfi7cAPmIKRWbFnE80nmPRJ9sVNJmyKUrrd4WtulE3Vzk+z7djl5YILxiQQx6w+xsHdBdd8jaohWPWWKSvp3Vs7FXe4pad5FsULb+X+xEXdJtN86x1P2kFcx4MHfnc57Zk0JvhcDBrGtoEHAnfF4b0oB/RlD0RXvn08f7SDfOcQMBlx2z0LQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2718.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(38100700002)(6512007)(38350700002)(8676002)(4326008)(186003)(2906002)(8936002)(26005)(508600001)(31686004)(66946007)(36756003)(52116002)(110136005)(6506007)(44832011)(53546011)(31696002)(86362001)(54906003)(45080400002)(5660300002)(956004)(966005)(2616005)(6486002)(83380400001)(316002)(19627235002)(66476007)(66556008)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-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eLzxNTjUW7ZhVT1CRndBywCXKg2gYNm1WFnB2x3v0?= =?us-ascii?Q?B8FuWju05UeIHgwyJ3CtTtWS9GpGp9bQUrOBBOXRdF/Bk82RzAciNaa/vV+u?= =?us-ascii?Q?3VPbRMPmskwXtO3iOmm+ER8TIqJa+3PdgGlpYi5MrNwyVttmgxleXpVNDUr1?= =?us-ascii?Q?Nn3yk/UNtJP3fOFqb/XIeBllyIiU47jUv4Lm4SrMAqaHM6oBFUD/DXJBnsGa?= =?us-ascii?Q?IZ1a0+FTz5PqZKOn9z9UKu0NXQYz8iBCxMEDKVpHK6EbPkGxJ2rtxbsvrI9v?= =?us-ascii?Q?j6E70lEs+K0QsQoKz1o5lh8lR7DX8x+ifGymGt4um3gwAAVvWz++Ajpt3/bG?= =?us-ascii?Q?DlT43M8F++f5xU+5NXog9mGtWSiitDoJKLyrNdr4SQC3h7X0lmKGJcR+vKoO?= =?us-ascii?Q?V02d7jcKF1APDsZmcAcrcdW59jcn2TC9hQ8L4t8zh6LVmHhcHHCYtcIW3UdV?= =?us-ascii?Q?9GK1fm4+U9ap7dV14KTs1tj2?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 288a14a1-195a-4942-3a15-08d97f4428e1 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2021 10:14:57.0938 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WOw/XQHusN8sNmtIL93IKIxNh5cWOI+rIFDWYalELMVwfZSCC0BpqLrbzwcx9kHrxXzvxrwv20tovY7fP8vcpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4430 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US On 9/24/21 2:39 AM, Yao, Jiewen wrote: > Comment below: > >> -----Original Message----- >> From: Gerd Hoffmann >> Sent: Friday, September 24, 2021 12:54 PM >> To: Yao, Jiewen >> Cc: Xu, Min M ; devel@edk2.groups.io; >> brijesh.singh@amd.com; Ard Biesheuvel ; Juste= n, >> Jordan L ; Erdem Aktas ; >> James Bottomley ; Tom Lendacky >> >> Subject: Re: [edk2-devel] [PATCH V7 1/1] OvmfPkg: Enable TDX in ResetVec= tor >> >> On Thu, Sep 23, 2021 at 01:38:52PM +0000, Yao, Jiewen wrote: >>> Good point, Min. >>> >>> If https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2F= github.com%2FAMDESE%2Fovmf%2Fblob%2Fsnp-&data=3D04%7C01%7Cbrijesh.singh= %40amd.com%7C5452ded75af34b9c73aa08d97f2e8426%7C3dd8961fe4884e608e11a82d994= e183d%7C0%7C0%7C637680660025337914%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw= MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3D3yXoK= MmZndyiJkpr2gADbq6KvPLoF1r5sCv32MxK4Ms%3D&reserved=3D0 >> v8/OvmfPkg/ResetVector/X64/OvmfMetadata.asm is the proposal, then I have >> more comment: >>> Type: OVMF_SECTION_TYPE_CODE, OVMF_SECTION_TYPE_VARS are NOT >> used for SEV. I am not sure why they are there. >> >> tdx needs them (for measurement). It's not a tdx-specific concept, >> possibly sev-snp wants use that too in the future. > That means this is only for TDX. SEV does not need this type. Then this i= s TDX specific. FYI, SEV also measures code or data put by the VMM in the guest memory space. In SEV, qemu calls a routine to encrypt the pflash unit0 -- while handling the callback you can convert the GPA to HVA and thus avoid the section. But having the section available is not going to create any issues with the SEV and in some cases it may be useful. >>> Type: OVMF_SECTION_TYPE_CPUID should be SEV specific. TDX does not need >> CPUID page. >> >> A cpuid page can be used without sev too. > I don't think TDX need this field. This is SEV specific. > You are right that CPUID page is currently SEV specific but nothing stops another VMM to use CPUID page on the non-SEV platform to minimize the number of VM exits. I think once guest kernel gets support for using the CPUID page it may become reality sooner. >>> Type: OVMF_SECTION_TYPE_SEC_MEM also seems for SEV. TDX does not >> need this special memory, such as Page table. It is already covered by c= ode. >> >> These are "needs pre-validation / pre-acceptance" regions. >> TDX surely needs that too. > I don't think TDX need this. The page table should be covered by CODE alr= eady. > Page table is data page and are not covered by the CODE section.=C2=A0 IIUC= , TDX also need to accept memory before the access. There are several data pages (such page table, stack, heap, ...)=C2=A0 used in the SEC phase; you have two choice, you either accept them during the SEC phase boot or accept them before the boot. If accepted before the boot then they will be measured so that security is not compromised. For simplicity it seems both SNP and TDX decided to accept those data pages before the boot. The metadata simply provides the description of those pre accepted pages. >>> Type: OVMF_SECTION_TYPE_SNP_SECRETS / >> OVMF_SECTION_TYPE_SNP_SEC_MEM is SEV specific. >> >> Yes. >> >>> The SEV table is totally different with TDX metadata table. >> I can't see a fundamental difference. In both cases the VMM needs >> to know the firmware memory layout for (a) attestation, and (b) >> pre-validating/pre-acceptance of memory, and (c) some >> hardware-specific ranges such as snp secrets page. >> >>> I really cannot see the benefit to merge into one table. >> Keep reset vector small? >> Have common parser structs and code? > I think it is opposite. This proposal makes reset vector larger, if we ne= ed define more structure to satisfy TDX, but it is not needed by SEV. Or De= fine something purely for SEV, but not useful for TDX. > I don't treat it as benefit. Instead I think it is big burden. > > >> take care, >> Gerd