From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.50]) by mx.groups.io with SMTP id smtpd.web09.16124.1620419950020460946 for ; Fri, 07 May 2021 13:39:10 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=ap06I6if; 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.243.50, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EvdW/f9KmKcy4GIRy0XPDujHVSblCA7OPPMsu4jfrJyNb7zimIb0CJj8F1gpOyun3+FEETeD+/+rKqBu0bqS18sel/B3lPTdi2zdJi5ajMPr5uTlRqnraMy9XLOcmq7ncr5t1Hdw48dMTUJ7ubuJA73m8cCq4Xp4knUgQx0RNFTOAJ1nkbQrg/cfSyBLoUKIwecTGkZno6HvYWwLyDJUbef4akFExqFJC8w7kjQesQ5cbsdW5Lj2RCfZcfeSWnKNcKoSAUOl1PKvRY7qX7cbjY9OjF9wWEEAJRy66WVqs+ypIz4jaQMF1xU0HHzUOQyE9i9/9F5Bu7pzHQwcKN/dVQ== 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=/xKbI0Sx6NzSnvs8sL8Sdt7+xlvAQ6HoiOt/lLZ/4cg=; b=aZml5cSM6fbr2UKV6u5HsNZS0hdGP1GIinVb/E0qglmxalsFg4/XulIeBMOuckxKDUXH6rhlAWHoptBuVkJgJox3mm7tMvyHM6YM5Puq93pHYg2C/JJsvTreo7Y00oRkK/QDR8oGH4wh6M+5xcF28Oxj7VmCwFqsvcZY4O2uWCi5kjYlpxgCG6eMMPClAh31je9Kzj6T/2V9Z7c4z5Z2Dci0WOkL1HvefIL9DV1A9+282LfCWTsE+3AYliKR/yBFhpEtpt62fVZlmNuq4wBWql/k8ocJIAZ55gP/RPnMjn0Ax9WGOb1EmQr+vQmbV3S0Ujw7PtoDUgaIpLmrDI/YYA== 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=/xKbI0Sx6NzSnvs8sL8Sdt7+xlvAQ6HoiOt/lLZ/4cg=; b=ap06I6ifOlZ+z+8OXF5QVualLImn1P/RHUUUx4Cj+d4wXg57mQvhic7M3t/W0AulDPQKGcsgDH3EvOiTom4jI62dBbEDBdxtJ3eUg0AOHABPwEBHKWB1/VxDqni/o83R8DRxfaadHInEafcSWzZOxoRMk9fGXO2QKRvQIAtMaFU= 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 SN6PR12MB2829.namprd12.prod.outlook.com (2603:10b6:805:e8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.27; Fri, 7 May 2021 20:39:08 +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.4108.029; Fri, 7 May 2021 20:39:08 +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 00/13] Add GHCBv2 macro and helpers Date: Fri, 7 May 2021 15:38:25 -0500 Message-ID: <20210507203838.23706-1-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN7PR04CA0020.namprd04.prod.outlook.com (2603:10b6:806:f2::25) 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 SN7PR04CA0020.namprd04.prod.outlook.com (2603:10b6:806:f2::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 20:39:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eed7c372-28bc-4f9e-db67-08d91198296f X-MS-TrafficTypeDiagnostic: SN6PR12MB2829: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:962; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mEPT1wIxF9kEe99aYV6qSDS0puCM+4wLQOwYSNNcETon8BrUuDfaDD6TEYJbdpgNRbT1Zo3PzZSQS01YYlIhHilqmr1gFtm9KmoW8TsmtI4OvkdaQOw0i/lhTV+p093PyCNeScTqIo4OSmB2WMxW3e+k0l34phHAsHCKUumTh4Wx2VUZWs0TD8PVPL/g9YYw9UDu/8shQ54b1tMUt82HZ/QNpu4Sc4QCtugzW5W2cTuRkLphSvaBqIqVWPnpwsvGgAHbFnqMqeHwIN0HqNv8N0bGFh8CDtVePG5lwb912scmAz/0FKKN7zqR1xRUnr0EDIcXYSxNJUMnoEfw4dLzrLsVVKR5C3CK3ibNhzzBjPFcXnMqdbMXsJIJRTCU3sBdQdTFWLlkZ5jXk1NU+klLEy0uZAFi61bN40gxFGKHg3sbwdr6X8ZBTNXfDo31YdpzMVYKZnVj/aM1I/z2Ojk4pKBt0EZoizB4D6nNGQ/1KTAEOeEhI5xSL46HyiuWXITzwcPHdXRZkStYR2WLPUttks4ql4oRp+EyB5JJpqN6wfiQEqJjtI233XRNeqKjchLqsOtigH5rhP5mV33OnvzqFJ2OafIc3Htn6di7ap4mQXpo5JFIaZemmPj+f24xuugCZsVphLKH0ruYhPiW4QDupazRx2WmY9chqzP9B7bCdic= 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)(396003)(376002)(366004)(136003)(346002)(39860400002)(2906002)(1076003)(86362001)(44832011)(8936002)(6916009)(186003)(8676002)(6666004)(956004)(478600001)(26005)(7696005)(2616005)(83380400001)(19627235002)(16526019)(52116002)(316002)(36756003)(66946007)(66476007)(54906003)(38100700002)(66556008)(38350700002)(4326008)(7416002)(6486002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?NFIsvb0N/RrcOXTTJeidZOpI7/S4x+m7F5X0e0XZYXW5ESl5x+9xCGT3RCSO?= =?us-ascii?Q?uWLMgLJJ22yi2zZiEip8V0Mcv/3VY+zjR1tOoUiXyJQtvUsfFqY0skJHPB4G?= =?us-ascii?Q?aEjVMZnzoEItfOvv0gzx36rvDwSxZ/z6JmDbkEE0ctBZjGY3O8xWWxfH1vPT?= =?us-ascii?Q?Jab16FZoqWzw9e89dKyJH8GAypNDIVHvb9xNUkihkqkfxXpfWbeHg/wpPp/n?= =?us-ascii?Q?qG2VMtzLXDj966dTifMgZZJSWgwvyFF0Ekuny5fQZkGoGjFgmR5ePMBkCTN0?= =?us-ascii?Q?UHbUOWP+7cj0AEKFyrxAh3xYZBUM+JNfXp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UhU0FOXy7qd2F33az0gwnMrhh6hy80xgESo5SYYHrDt8+t4kZMsyWl4HY?= =?us-ascii?Q?k8uZ/oToES/VBFLlLGWWNsYegx/6Rzs/PaaoqpiJu2ZO6SMHWctpTRGn9L8r?= =?us-ascii?Q?h6TrgAkDG834KS2lY+3tebNJ?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: eed7c372-28bc-4f9e-db67-08d91198296f X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2021 20:39:07.9592 (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: 57Ck0fQA+MHROLRP4SiIvphgdncYdqtRH8ovWVm2go9Yy2ByOJBQdYpXk6hHhiYXBBqApsWjoLEBCUURtzqe1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2829 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: f297b7f20010 UnitTestFrameworkPkg: Sample unit test hangs when running in = OVMF/QEMU=20 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 Brijesh Singh (11): MdePkg/Register/Amd: expand the SEV MSR to include the SNP definition MdePkg/Amd: add white spaces to retain alignment 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 | 80 ++++++++++++ MdePkg/Include/Register/Amd/Fam17Msr.h | 46 ++++++- MdePkg/Include/Register/Amd/Ghcb.h | 123 +++++++++++++++++- 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 | 63 +++++++-- .../X64/SecVirtualMemory.c | 8 +- .../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, 526 insertions(+), 92 deletions(-) create mode 100644 MdePkg/Library/BaseLib/X64/Pvalidate.nasm create mode 100644 MdePkg/Library/BaseLib/X64/RmpAdjust.nasm --=20 2.17.1