From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.76]) by mx.groups.io with SMTP id smtpd.web11.4200.1596829208536705463 for ; Fri, 07 Aug 2020 12:40:08 -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=iDlFWQAt; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.93.76, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JPUriJ05ZBIALw8SOBHTHi6hKw2fQL1E9kbqCbDvIx3Hy+ZBHKf+jeJM/0stNkNqdndGO5WEhpeTQ5mhf3DHnODyR/7mwMVxvR014UFB/4W2U+CGiEfxiJh2tKG/BmTH+O6KxLzeyKfLs9IACPd7d0LclE6z3P4j7Ua5bvtIHGFBFOzDz/mW1zYyiddJULhmnKRdDV35hKKd0o16war9k7UokazQsnGQSOnJ2qWsPQEMeKEUM+I1JpCzhsBWxB+RN4lRO5xGYUs0bOy6CfKwc/q9fHBZPzZYS6KGRRmBxO7JjXB9vUdxqin9CvfVlTLTko2ct1Kwuh8x6BhR9kgs2A== 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=tRE7SkFgGOeG66PvdkFIGd/IGhL7swQyOWx8HekFNVI=; b=FY8MUPDm0EsCsVZPdf3r1b9AQi+L+TZ2V46E6lQP+OmvU/sCUCCxt7bVVKF/xFpUsiVb69BfXm5sIUeVN6KIvLZ65ua+dQL4IMDP3lXV7U+/gMNTisOFkDo4NBFjUBamPrjAVr0z9CCAYxj9SASAP7q/xp8eD6Zpoew36M1P3SAPofljy1NQp9gNrxk4VCi3IKZWgFoK/5G/mJhp4slQFlGXLBuzDz2p2DmtMvfU0WddtmpESUXEizPJUesn9dac/A35ENNgYCR5DWvEyR43RAUMw7UYaHh1uTyVxZf3U+improVGd060zZmYbuKCSNzPosL9cFqoSwCxkAGph4S4Q== 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=tRE7SkFgGOeG66PvdkFIGd/IGhL7swQyOWx8HekFNVI=; b=iDlFWQAt76xiZHlqNDSiuZcyhlJWzvCveSMWcz30IyhDrYQ36CP7pkOKYQQdsS+cDl2JO+vw0/SXGbkGLkknDcQTHRHslnw/CrW/I5stH+Mguzx5jIa/qDW+NK+0N08qP0Mlj6P3CLsXGO/U3B8FLu5N5N/QlszAJCJiVNKhuBw= 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 CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) by CY4PR12MB1541.namprd12.prod.outlook.com (2603:10b6:910:7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 19:40:07 +0000 Received: from CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::9181:78bf:bf0:702b]) by CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::9181:78bf:bf0:702b%5]) with mapi id 15.20.3239.024; Fri, 7 Aug 2020 19:40:07 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Ard Biesheuvel , Eric Dong , Jordan Justen , Laszlo Ersek , Liming Gao , Michael D Kinney , Ray Ni Subject: [PATCH v14 03/46] MdePkg: Add the MSR definition for the GHCB register Date: Fri, 7 Aug 2020 14:38:48 -0500 Message-ID: <372b26f6ac52fd65bf069b51982c76d87ce91831.1596829170.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-ClientProxiedBy: SN6PR2101CA0021.namprd21.prod.outlook.com (2603:10b6:805:106::31) To CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by SN6PR2101CA0021.namprd21.prod.outlook.com (2603:10b6:805:106::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.2 via Frontend Transport; Fri, 7 Aug 2020 19:40:06 +0000 X-Mailer: git-send-email 2.27.0 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7d2f882b-e1c9-4a50-599b-08d83b09b024 X-MS-TrafficTypeDiagnostic: CY4PR12MB1541: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6ld/GK9FQ7a5yW24IjETd54TYlnU4Ky5FNJSwdbV0o6IrivdBhfNQ6qh24RxCdIGXsPxLebnMng3NxhY/EGgvT/9IaGp+BGeb9IWf6TUp4WN5BScOPsNSCW029IpLNs0uJIy7qvHetEZqNh67qmsXLpXWk5MtqwCF1zIYhL1H3WL96/0eMyqTKtDtIuisCvr4JIzRDzbgDXeOOLPSjlyR8WN0v1FIx2E3v9N92neHFMurFeMtatbFrgTMN0485FuP+JAMMT8Eju7tnHsiQLO3lRnoRAMwhbNU1z6UB7+y1a85UwmqLytu2qSF0WG4B1UfPOeGerUnnH1tZGyfJTOoHQq/yGp067m17Fih8PuEjFbFLtUyq7osuSOUdthWjGZu1bYqpv0Bo5CWc3axr90t6gIS8mfwUD0Aqb7T5c8g0KvwkZK5tHRz0dOobEb9caALqwEQnBcs6ALNEwvDNKw1w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR12MB1352.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(136003)(39860400002)(346002)(366004)(376002)(52116002)(7696005)(6486002)(8676002)(83380400001)(186003)(2616005)(16526019)(26005)(36756003)(2906002)(8936002)(19627235002)(956004)(6916009)(4326008)(86362001)(6666004)(54906003)(478600001)(5660300002)(316002)(966005)(66556008)(66476007)(66946007)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: z/rh5t2B5OV9AJ4/NUY7ZKcurMlecz79tCLj5IKudC6tKOCH9Bqck0h3MOkIsT40yepOJKsjU72i66kTeENxolj9+72yr7iOCRkZdywj4s0d3lZf9CD3YWoJU7g9Sgf/i/Y+a+FsQtXW7hRzCebgINV6m9Q8nrvnW4UaffZ8qpsxXL50H8G3Yn6QJEqLi34kiN0rD4qc9DPaJIgC/sv65FmIxvH+mUK3JKuNs8984KwGzRbDnIg4awg6ia0ZltOgh3s0epFaFqIwAh7DcyJ6DLtq1goYQXV/6ueKJBluYRgxrPhR9xIpKRoe1LSYiIkZK3B/M35rQAjwcFiaYQL8WepkN47x9lbe1u3GsXaIAa9HpZHrB/nkWPC+HL6h/N98vEEEznlufb9peI4b3eY24J0Urb8FV/XRGfb0EGNyyXDQ2tiFcqSY380jEYJ+sN8bVltiuNWk4kATI1RJRInz62V6BCJk+A6ivfSzLcoREZx2HXUolhURczbYHzFJyqnWwMAgsgbwZCMvRyGi5zGn8ZSPy1tjo7MEKyV3TffBqg58IfYpmbBwDLmG4P/DG5cE7fdqL9CRxjYiNqpT/CFEbPNxJdw8dp57MhkQD8MBIE7UOl4iYXzhO0LKy/oSsPkVpwe2HyLXN0K+5riQhLsySw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d2f882b-e1c9-4a50-599b-08d83b09b024 X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1352.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 19:40:07.0800 (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: HyS/RQf1+aw4V8MW3AypLMnOUoRX4YrTbz6vqGQAqIqAdVRWc8mopnd2SS3eBDeOEtciTppCjwXqmzG2e0iu4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1541 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable From: Tom Lendacky BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2198 For SEV-ES, the GHCB page address is stored in the GHCB MSR register (0xc0010130). Define the register and the format used for register during GHCB protocol negotiation. Cc: Michael D Kinney Cc: Liming Gao Reviewed-by: Liming Gao Signed-off-by: Tom Lendacky --- MdePkg/Include/Register/Amd/Fam17Msr.h | 46 ++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/MdePkg/Include/Register/Amd/Fam17Msr.h b/MdePkg/Include/Regist= er/Amd/Fam17Msr.h index 6ef45a9b21d3..e4db09c5184c 100644 --- a/MdePkg/Include/Register/Amd/Fam17Msr.h +++ b/MdePkg/Include/Register/Amd/Fam17Msr.h @@ -17,6 +17,52 @@ #ifndef __FAM17_MSR_H__ #define __FAM17_MSR_H__ =20 +/** + Secure Encrypted Virtualization - Encrypted State (SEV-ES) GHCB register + +**/ +#define MSR_SEV_ES_GHCB 0xc0010130 + +/** + MSR information returned for #MSR_SEV_ES_GHCB +**/ +typedef union { + struct { + UINT32 Function:12; + UINT32 Reserved1:20; + UINT32 Reserved2:32; + } GhcbInfo; + + struct { + UINT8 Reserved[3]; + UINT8 SevEncryptionBitPos; + UINT16 SevEsProtocolMin; + UINT16 SevEsProtocolMax; + } GhcbProtocol; + + struct { + UINT32 Function:12; + UINT32 ReasonCodeSet:4; + UINT32 ReasonCode:8; + UINT32 Reserved1:8; + UINT32 Reserved2:32; + } GhcbTerminate; + + VOID *Ghcb; + + UINT64 GhcbPhysicalAddress; +} MSR_SEV_ES_GHCB_REGISTER; + +#define GHCB_INFO_SEV_INFO 1 +#define GHCB_INFO_SEV_INFO_GET 2 +#define GHCB_INFO_CPUID_REQUEST 4 +#define GHCB_INFO_CPUID_RESPONSE 5 +#define GHCB_INFO_TERMINATE_REQUEST 256 + +#define GHCB_TERMINATE_GHCB 0 +#define GHCB_TERMINATE_GHCB_GENERAL 0 +#define GHCB_TERMINATE_GHCB_PROTOCOL 1 + /** Secure Encrypted Virtualization (SEV) status register =20 --=20 2.27.0