From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.107.102.55]) by mx.groups.io with SMTP id smtpd.web09.6108.1620863205852451842 for ; Wed, 12 May 2021 16:46:46 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=f5fgE4g6; 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.102.55, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dkG25FA2saxoCh5g+2yT1mjiq04+lHqIysmMpmwEdXGgcny59/ct6OixpYVJeXUaKIF1YsGIASWWf1IlRyEBZsgDPpgdn1vqvQ3EqEESSc5mkymW6LFNZkKyntzKs+djd6ADVnNgJyz+uSn4BWfn0u+dZNwU+CHfyavpG6G8AhcayLdlVW4C2dhrNPl3YBBdPD/hZFBP76r1aC9hefHnnHIRCI4D8ysp7Sf+Nl7FOZADNM3pGFyC23BE/EtquuZbPVZicW4e0SYDP6IkfBFb9fLWs+QhQkiWb5l51DCGpzwZ1hZGICOqbo22yx2xtII8fwbohS3+ts6yg+9jzQHkPQ== 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=PMdA8P2kk2HPyaAxS+ccGgTOSoRrhITRKG1KT5vskDo=; b=KKG14fWuyaoSGavocqaHn+JZdu09gPWtF60MA73eEbz2G7Ma7/48HXDwbBTsnh6gG0ctIkLPlKPmHAUop3nTPFVywSuYXQCSnUyh4yVvZ1OEw5qGX/rS80iM2osza7cMWedI+zCQFGdjo+YA22RabFZhwKltWKPlpuhWrq/N/dlWJoooRS5K0tHgqzEUhNqMKvhm/EGHquVfethYU4D47kUrLw8cVPqTFuNywYEs8XDRylYCWK9lWnKkkYBCkIe+SeBsjX2YToOoBIL5aUFgAhyz+3prSInx1lafgX2arBq3VxUYlXoIFkogpGxqfM3w+7YVWLMjItyLILhjIY+wFw== 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=PMdA8P2kk2HPyaAxS+ccGgTOSoRrhITRKG1KT5vskDo=; b=f5fgE4g6fGiNF38nFP4pdTTOEwRErEZDfO+gtxb3pFlcrHNQenKK/8s8ZnKqXoU4gpsAV8U0fBDWV7g//YiYNBQeBtTVwlbRDF8Q+m767LWmyf9mqd6RZabGUZA5hoFKO30/kL+GPDLz+IqgWYyEd7h/P700KvgBhJHvCctT2Ec= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SN6PR12MB2781.namprd12.prod.outlook.com (2603:10b6:805:67::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Wed, 12 May 2021 23:46:39 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::9898:5b48:a062:db94]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::9898:5b48:a062:db94%6]) with mapi id 15.20.4129.025; Wed, 12 May 2021 23:46:39 +0000 From: "Brijesh Singh" To: devel@edk2.groups.io CC: Brijesh Singh , James Bottomley , Min Xu , Jiewen Yao , Tom Lendacky , Jordan Justen , Ard Biesheuvel , Laszlo Ersek , Erdem Aktas , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [PATCH v2 00/13] Add GHCBv2 macro and helpers Date: Wed, 12 May 2021 18:46:02 -0500 Message-ID: <20210512234615.1726-1-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SA0PR13CA0003.namprd13.prod.outlook.com (2603:10b6:806:130::8) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) Return-Path: brijesh.singh@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sbrijesh-desktop.amd.com (165.204.77.1) by SA0PR13CA0003.namprd13.prod.outlook.com (2603:10b6:806:130::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.11 via Frontend Transport; Wed, 12 May 2021 23:46:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aa7733da-d601-4b59-f052-08d915a0300c X-MS-TrafficTypeDiagnostic: SN6PR12MB2781: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1060; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6vgGCht4xTt9+8XNTOMqmpi+4w2qRqRSq/+b41ddy39ersw5DIaidcUQV4gTN6PJ8GMLRtZmyF/vh+bHIoUg4UKbBN5ctjcj12nCaa0ZCnRUDN128J3iQWw1y1rUoKQoXRZz7jp3rAhPKiw4dVSzWJP4MVd+l9tr557qPywVdda+gF5+NzxeYwmEAgCrAMToXVT592KFXiGGG+wDOpsvQjBeLaWX/HHHvoN0NqCzRTMgTd7phmNZhP2AVOZVa7PFfTCzO5NKrrleLgJ+cJg1zGX05sF/ax3jTIq+K1zoDW5EHXosulPLiaV39fvgWZFr3ZqSQMNrEYFJ6GcWai3UMlW6Za7NWXPMXwfQ99isc4bkTlT+oNxkU+3nZ1wZhznKUXeoovgfQbJ80eXNCPT84yh5e1yLudPoDn6NQrrjI/JXrCPGoC0kJwibchcok6Z6JG1b0C0kZfbT3sG6HMHMdjPUZMaumNpV9qs4cf8oaCFhyhP/qF88jsDkLKyTBm2Jde3jbgOPAZNKwURxM0cjTwcIL0jMMMpOASNrLrLPHJqu6x2pTFBtbnX/H2VnnNnSEyyFvf4ViqZnUrYBooV7OzcZuMzX8fbMJh3qHDQ5OAfI+kBtmzYM6AnSMbOJoTaiGJ6BXnZEHCpLywVQfPjJnH/lO5rKV6HvhxafcU65tIA= 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)(136003)(39850400004)(366004)(376002)(396003)(346002)(66946007)(36756003)(19627235002)(7416002)(66556008)(8676002)(956004)(8936002)(6486002)(6916009)(44832011)(7696005)(316002)(5660300002)(1076003)(52116002)(66476007)(6666004)(38350700002)(38100700002)(4326008)(2906002)(186003)(16526019)(26005)(83380400001)(478600001)(2616005)(86362001)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?cU8YE7MCRq22k/IabhCfhzwZ/eKzKI6EnNHSQMmuT3XJvlaZhzD9PAusVp59?= =?us-ascii?Q?BUWlz9hrPt5j9JicacECDrLmGh17o7WdB80SWdO7cX+5JUyPwzBmGSqQoh4u?= =?us-ascii?Q?vKFpRUiwPZZS5gkO7z+w9Kleee4O3OC9pwe8HxAnu116LUzMbV33AWTZh2pQ?= =?us-ascii?Q?8vu2V2RtoaMOHdBuq3xXaDGfpM4QAKZrwzykXZGOItCfaMS1Zh/Wj9lFN8bj?= =?us-ascii?Q?3c5Usv/qfByjTpnuDKHOgm+qnXPjQI4AoeWJ0EGUNBcVXc09qOE1+AMl+gPQ?= =?us-ascii?Q?VSUrB80KFw5BpPhXb67+Ry4ZneNtm8+4f6lzptOG/xYnYu1DM3iYCIO+JppL?=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dcEYZT6mY6LkcgUbmGXPNw5u?= =?us-ascii?Q?+4t3MDWgG28CAfm0V22I5U6GPVPodECMspHoti9AYYBRPYW9+C9qDwTTvxAP?= =?us-ascii?Q?5dWEW84Csef5Mz52i/KZI4uf?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa7733da-d601-4b59-f052-08d915a0300c X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 23:46:39.6359 (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: Vhn1sfGXn7hOj/snoOvzF2L7vXlLOMb5TTTmiSTzV5i7AZk9MD7KXS3/jfTsE2OJrryZoatR4XlIyJScKGAUYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2781 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain This series is taken from the SNP RFC. This series defines the GHCBv2 macros and NAE events. Additionally, it also introduces a helper to clear the page encryption mask from the Mmio region. The series is based on the commit: 5531fd48ded1 BaseTools: Add support for version 3 of FMP Image Header stru= cture Cc: James Bottomley Cc: Min Xu Cc: Jiewen Yao Cc: Tom Lendacky Cc: Jordan Justen Cc: Ard Biesheuvel Cc: Laszlo Ersek Cc: Erdem Aktas Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Change since v1: - address the review comments - drop the Mmio specific changes from 'remove Flush .." patch Brijesh Singh (11): MdePkg/Register/Amd: expand the SEV MSR to include the SNP definition MdePkg/Register/Amd: realign macros with more space for future expansion MdePkg/Register/Amd: define GHCB macros for hypervisor feature detection MdePkg/Register/Amd: define GHCB macro for Register GPA structure MdePkg/Register/Amd: define GHCB macro for the Page State Change MdePkg/BaseLib: add support for PVALIDATE instruction OvmfPkg/BaseMemEncryptSevLib: introduce MemEncryptSevClearMmioPageEncMask() OvmfPkg/AmdSevDxe: use MemEncryptSevClearMmioPageEncMask() to clear EncMask OvmfPkg/QemuFlashFvbServicesRuntimeDxe: use Mmio helper to clear enc mask OvmfPkg/TpmMmioSevDecryptPei: use MemEncryptSevClearMmioPageEncMask() OvmfPkg/BaseMemEncryptSevLib: remove Flush parameter Tom Lendacky (2): MdePkg/Register/Amd: define GHCB macros for SNP AP creation MdePkg/BaseLib: add support for RMPADJUST instruction MdePkg/Library/BaseLib/BaseLib.inf | 2 + MdePkg/Include/Library/BaseLib.h | 85 ++++++++++++ MdePkg/Include/Register/Amd/Fam17Msr.h | 46 ++++++- MdePkg/Include/Register/Amd/Ghcb.h | 129 +++++++++++++++++- OvmfPkg/Include/Library/MemEncryptSevLib.h | 35 +++-- .../BaseMemEncryptSevLib/X64/VirtualMemory.h | 33 +++-- OvmfPkg/AmdSevDxe/AmdSevDxe.c | 13 +- OvmfPkg/IoMmuDxe/AmdSevIoMmu.c | 6 +- .../Ia32/MemEncryptSevLib.c | 41 ++++-- .../X64/MemEncryptSevLib.c | 49 +++++-- .../X64/PeiDxeVirtualMemory.c | 47 +++++-- .../X64/SecVirtualMemory.c | 38 +++++- .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 3 +- OvmfPkg/PlatformPei/AmdSev.c | 3 +- .../FwBlockServiceDxe.c | 5 +- .../QemuFlashSmm.c | 5 +- .../TpmMmioSevDecryptPeim.c | 5 +- MdePkg/Include/X64/Nasm.inc | 16 +++ MdePkg/Library/BaseLib/X64/Pvalidate.nasm | 42 ++++++ MdePkg/Library/BaseLib/X64/RmpAdjust.nasm | 40 ++++++ 20 files changed, 554 insertions(+), 89 deletions(-) create mode 100644 MdePkg/Library/BaseLib/X64/Pvalidate.nasm create mode 100644 MdePkg/Library/BaseLib/X64/RmpAdjust.nasm --=20 2.17.1