From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (NAM04-BN3-obe.outbound.protection.outlook.com [40.107.68.71]) by mx.groups.io with SMTP id smtpd.web09.12382.1603111861292342975 for ; Mon, 19 Oct 2020 05:51:01 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=ToeADA5v; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.68.71, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=js0j2UParRdkd6Mu3sMN5YGytbZvRgGVHd9wD85jAE8/58u255t1lP+o5XYi9RhUihf/7Z4E3as59WTbp3jyXCPHs4OIq1+gOE+yftfvMz3hibCIMaV0hrjtGnaTda4PshZdyOzBYTy32evCuTaItoGZ53hyMv0ZunMSph7Vm46gT23fIQZzLOpzmC7sb3xAx5NXZO9BBmLEj/JQziFWrwSLE7BzSFsyaWkKe/YLoSkwo9sGnhgOwiJzjwxK2Iu3HUTowi41cuwe2YyucZ35aoDdYO63QrGJCJxXuvML58mF1zdc9OnssashLgh7Uy/5u1K83NyWQ+uFNH0qc9XIQw== 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-SenderADCheck; bh=tXEoGxheARjy3gkaXUzEer5ynxyyYDgQBOtY3K4V8SA=; b=Um9uApjLPyArUduJL5DiTA3Mte2SKmymdDoRJWQPJ/oqQEkIpsGh8gc1Xn3JwqcgTmS/bAxoacYKDmqD1ekGVvvOyGEu57IqSGSgO+cUgs7Ki4zARpr+rvSfw5uMXO4BtwP5gCawXtftIGGFqswjOjlVTjXx+0Ri2JKNGJoBGw3piiDq6ewKhL/xS9TzMMfkfZ+4vQrXjSKbIkDBVtEccaUBEEjg80Kmkcwz1pKJ+1xY/P8pqS5vOfu3WFl3rFauReJI1Yf1+Vxc6eWMM6u7Y/kwiLEdrHh/tXnh6MCVrZrQ15SaovlQaTjl1QSfkG1j4zS9e5mYcdxvyDnlO1KtfQ== 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=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tXEoGxheARjy3gkaXUzEer5ynxyyYDgQBOtY3K4V8SA=; b=ToeADA5vlnGXwS0Wj9kSFsfnc1v69PPC37yLkj7bsgXBDnilGmPuGHnFDc2Dqjsc0dwTUZoCIKS6Grll/rC01EnJb/M8elhW/4xyO0oENjPdpg+qPjwakpfvPU/WJePuX+H8QHR/cQxEvxxpBZKB7i3r8Qvv+AkoI9/Q42Iqer0= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=amd.com; Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM6PR12MB3466.namprd12.prod.outlook.com (2603:10b6:5:3b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.22; Mon, 19 Oct 2020 12:50:58 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::e442:c052:8a2c:5fba]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::e442:c052:8a2c:5fba%6]) with mapi id 15.20.3477.028; Mon, 19 Oct 2020 12:50:58 +0000 Subject: =?UTF-8?B?UmU6IOWbnuWkjTogW1BBVENIIHYyIDAxLzExXSBNZGVQa2csIE92bWZQa2c6IENsZWFuIHVwIEdIQ0IgZmllbGQgb2Zmc2V0cyBhbmQgc2F2ZSBhcmVh?= To: gaoliming , devel@edk2.groups.io CC: 'Brijesh Singh' , 'Michael D Kinney' , 'Zhiguang Liu' , 'Jordan Justen' , 'Laszlo Ersek' , 'Ard Biesheuvel' References: <523f270e4e6f7a62cdbebc541b442bd766e7ab3a.1602864557.git.thomas.lendacky@amd.com> <000d01d6a5b9$03d14ef0$0b73ecd0$@byosoft.com.cn> From: "Lendacky, Thomas" Message-ID: <93c3b271-ccdb-6242-ce23-957eb73a66c0@amd.com> Date: Mon, 19 Oct 2020 07:50:56 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: <000d01d6a5b9$03d14ef0$0b73ecd0$@byosoft.com.cn> X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN6PR01CA0009.prod.exchangelabs.com (2603:10b6:805:b6::22) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.236.30.118] (165.204.77.1) by SN6PR01CA0009.prod.exchangelabs.com (2603:10b6:805:b6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.23 via Frontend Transport; Mon, 19 Oct 2020 12:50:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 23b5dca7-d891-4ef2-4212-08d8742d9fde X-MS-TrafficTypeDiagnostic: DM6PR12MB3466: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:901; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KwFUuEx+x9KApOZSj6HxglRLsfLOs/8olCsQpvmED4rIurRNLocyGip0bg9zNNISUiyayK87UBQ1i9H7fCJBH6Lt/JAVj34EE4VSx3WoTzb67UrJ1ksnVEyd3OYYbIW7FS+VqyoW3mgMb+eOM5FsrekLGuLY4ZcOJTtJgdmdadKVnk1zm6BJlo0XwRhTti5q+TYVUf5+gmaVmnE6ji4Wq9XN61IhrrSweViX5UhoWpKy9HrC4u2KvTad9RTs+SNdA5CKzj19mj9HZ+I9MRZCdMDQbx5RKGLDOa+tzFx/cD0PHqxOmQz8f5NSg/50Y2wuy4zXapkEEaLSWzOW7+4+SR8zl15oJZqWQVtkD2N3cjOr6h5P72YcOruWyjATMazPjpCpNJbSX4F9ugMNoA4NB6NVbPE0sDDEmGRzyXrTgHWZwbN3ISqdo+faV/UNHAyCsYXPFeLJA05W1boqbXxCNw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR12MB1355.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(136003)(376002)(366004)(346002)(396003)(316002)(956004)(36756003)(2616005)(53546011)(8936002)(4326008)(224303003)(186003)(2906002)(26005)(45080400002)(16526019)(478600001)(966005)(31686004)(66476007)(66946007)(6486002)(86362001)(31696002)(83380400001)(66556008)(5660300002)(16576012)(52116002)(54906003)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: yRyylx2xI6x4mqngJYb2ub50fUrUQcFXFhXbbtk4BA4UFiZbABRj5x9sAy+0pkr1JjOVOqWO078rK3eNXTZMloVhVrHbQD/Eqq9OKn2tOTd2K2Qx8I1C6xZye0ZjlSDnHPI0WfyHzhZKw8eLJldQo4K2q/RdEi3x1Wz7sv1+iBQ6QeqzAat4gliecUd8UpTiDHg/7iccSEbHdZvn0UVhgHdseLraLpAYOFtZMO/y8A4C93gRTlot8eUEaIUSFl2o3lN+T6D8A2T3FrSn/fj3nDKW+MUpZ4F9RBlW1PN3LUtgJvQ5kxzG7/tARJiqYUSVp2RxuaybZhRZz24oeoNuAJ8pl/sParxYkEFm4MV44m/XVflShGWklOm6YEt4HJZqKkHA1O4xZExR/w9We4YPa2AWgQ+bSwIpV5KYhVG5+B86ceR9qvLp+wZmfYBssa3YccbFSfgJ5sD5RHPIP0qw3N4F9iIdzRnT4dHoyq4tp5jViUo3wBlFTEcZmgxaV8tmBwgnx9f9IR+hqWPlwGx00gMX1FknR7C0oAhb+djEz8n7zY15RK7WAsfrjqdUb51x+UHzygKrqlQWz8GIPjz+JUSpLv48u2q9NyqsapDRmkt8Pmr7jw9u5LFnWejkysZq0Gc3M+/0sEnum4K4s+ul/g== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23b5dca7-d891-4ef2-4212-08d8742d9fde X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2020 12:50:58.0577 (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: jZBLzkYNxwEkM7ESlY1aDYVT/2RuERuEIpSsuajFuWnQfHriV+p7ZywXlYD169dDPxNgqSpp8LqPnNPduXGyPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3466 Content-Type: text/plain; charset=gbk Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 10/18/20 8:41 PM, gaoliming wrote: > Tom: >=20 >> -----=D3=CA=BC=FE=D4=AD=BC=FE----- >> =B7=A2=BC=FE=C8=CB: Tom Lendacky >> =B7=A2=CB=CD=CA=B1=BC=E4: 2020=C4=EA10=D4=C217=C8=D5 0:09 >> =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io >> =B3=AD=CB=CD: Brijesh Singh ; Michael D Kinney >> ; Liming Gao ; >> Zhiguang Liu ; Jordan Justen >> ; Laszlo Ersek ; Ard >> Biesheuvel >> =D6=F7=CC=E2: [PATCH v2 01/11] MdePkg, OvmfPkg: Clean up GHCB field offs= ets and >> save area >> >> From: Tom Lendacky >> >> BZ: https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2F= bugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3008&data=3D04%7C01%7Cthom= as.lendacky%40amd.com%7C4fd17a68a915477d9d1508d873d027b1%7C3dd8961fe4884e60= 8e11a82d994e183d%7C0%7C0%7C637386685165902990%7CUnknown%7CTWFpbGZsb3d8eyJWI= joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sd= ata=3DNBPdQ98RyMUlma0qkEvhBjUdykQ24p7pTK9I61ttX7Q%3D&reserved=3D0 >> >> Use OFFSET_OF () and sizeof () to calculate the GHCB register field >> offsets instead of hardcoding the values in the GHCB_REGISTER enum. >> Rename GHCB_REGISTER to GHCB_QWORD_OFFSET to more appropriately >> describe >> the enum. While redefining the values, only include (and add) fields tha= t >> are used per the GHCB specification. >> >> Also, remove the DR7 field from the GHCB_SAVE_AREA structure since it is >> not used/defined in the GHCB specification and then rename the reserved >> fields as appropriate. >> >> Cc: Michael D Kinney >> Cc: Liming Gao >> Cc: Zhiguang Liu >> Cc: Jordan Justen >> Cc: Laszlo Ersek >> Cc: Ard Biesheuvel >> Cc: Tom Lendacky >> Cc: Brijesh Singh >> Signed-off-by: Tom Lendacky >> --- >> MdePkg/Include/Register/Amd/Ghcb.h | 40 >> +++++++------------- >> OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 4 +- >> 2 files changed, 16 insertions(+), 28 deletions(-) >> >=20 > Please separate the patch for the change in OvmfPkg.=20 > One commit can't cross the different packages.=20 > I understand this is the incompatible change. But, we still need to follo= w > this rule.=20 Ok, then I'll resubmit without the name change. To me, it's not worth doing 3 commits just to accomplish the rename from GHCB_REGISTER to GHCB_QWORD_OFFSET. Thanks, Tom >=20 >> diff --git a/MdePkg/Include/Register/Amd/Ghcb.h >> b/MdePkg/Include/Register/Amd/Ghcb.h >> index 54a80da0f6d7..93fb6e3cb0fc 100644 >> --- a/MdePkg/Include/Register/Amd/Ghcb.h >> +++ b/MdePkg/Include/Register/Amd/Ghcb.h >> @@ -82,35 +82,10 @@ >> #define IOIO_SEG_DS (BIT11 | BIT10) >> >> >> -typedef enum { >> - GhcbCpl =3D 25, >> - GhcbRflags =3D 46, >> - GhcbRip, >> - GhcbRsp =3D 59, >> - GhcbRax =3D 63, >> - GhcbRcx =3D 97, >> - GhcbRdx, >> - GhcbRbx, >> - GhcbRbp =3D 101, >> - GhcbRsi, >> - GhcbRdi, >> - GhcbR8, >> - GhcbR9, >> - GhcbR10, >> - GhcbR11, >> - GhcbR12, >> - GhcbR13, >> - GhcbR14, >> - GhcbR15, >> - GhcbXCr0 =3D 125, >> -} GHCB_REGISTER; >> - >> typedef PACKED struct { >> UINT8 Reserved1[203]; >> UINT8 Cpl; >> - UINT8 Reserved2[148]; >> - UINT64 Dr7; >> - UINT8 Reserved3[144]; >> + UINT8 Reserved8[300]; >> UINT64 Rax; >> UINT8 Reserved4[264]; >> UINT64 Rcx; >> @@ -136,6 +111,19 @@ typedef PACKED struct { >> UINT32 GhcbUsage; >> } GHCB; >> >> +typedef enum { >> + GhcbCpl =3D OFFSET_OF (GHCB, SaveArea.Cpl) / sizeof (UINT64)= , >=20 > OFFSET_OF (GHCB, SaveArea.Cpl) is 204. But, it can't fully divide 8 > (sizeof(UINT64)). Is it correct? >=20 > Thanks > Liming >> + GhcbRax =3D OFFSET_OF (GHCB, SaveArea.Rax) / sizeof >> (UINT64), >> + GhcbRbx =3D OFFSET_OF (GHCB, SaveArea.Rbx) / sizeof >> (UINT64), >> + GhcbRcx =3D OFFSET_OF (GHCB, SaveArea.Rcx) / sizeof >> (UINT64), >> + GhcbRdx =3D OFFSET_OF (GHCB, SaveArea.Rdx) / sizeof >> (UINT64), >> + GhcbXCr0 =3D OFFSET_OF (GHCB, SaveArea.XCr0) / sizeof >> (UINT64), >> + GhcbSwExitCode =3D OFFSET_OF (GHCB, SaveArea.SwExitCode) / sizeof >> (UINT64), >> + GhcbSwExitInfo1 =3D OFFSET_OF (GHCB, SaveArea.SwExitInfo1) / sizeof >> (UINT64), >> + GhcbSwExitInfo2 =3D OFFSET_OF (GHCB, SaveArea.SwExitInfo2) / sizeof >> (UINT64), >> + GhcbSwScratch =3D OFFSET_OF (GHCB, SaveArea.SwScratch) / sizeof >> (UINT64), >> +} GHCB_QWORD_OFFSET; >> + >> typedef union { >> struct { >> UINT32 Lower32Bits; >> diff --git a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c >> b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c >> index 8e42b305e83c..c5484a3f478c 100644 >> --- a/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c >> +++ b/OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c >> @@ -153,7 +153,7 @@ STATIC >> BOOLEAN >> GhcbIsRegValid ( >> IN GHCB *Ghcb, >> - IN GHCB_REGISTER Reg >> + IN GHCB_QWORD_OFFSET Reg >> ) >> { >> UINT32 RegIndex; >> @@ -179,7 +179,7 @@ STATIC >> VOID >> GhcbSetRegValid ( >> IN OUT GHCB *Ghcb, >> - IN GHCB_REGISTER Reg >> + IN GHCB_QWORD_OFFSET Reg >> ) >> { >> UINT32 RegIndex; >> -- >> 2.28.0 >=20 >=20 >=20