From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.86]) by mx.groups.io with SMTP id smtpd.web11.5477.1595366406360363975 for ; Tue, 21 Jul 2020 14:20:06 -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=I1C1d+Kn; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.223.86, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oGbNGK/dxYTciZCq350u71zQtIyWuo66a/46xPA7DkAS7kGdFHekgLT/o+XCwyoY3r1zYWmNCxg9Tnu/ArLR9c8MIlrQAW7xj/PWtCa0ZklXp1Lq6pYf5WzkSDuzIJHbTvCYxrCe0WangIpoMKEkTgiXrpGOGd9Ga+kL609mwBjPQi8NNWuSHdiS+WL6VGYYISuHkWs37ch//J/gkJMHMchs/J3eIpyzM50k8m3zWc89BgYOjqwMQU0eDdGuzymGnjnLq7HL5MQjr+bD5p5OG3mGcldY8fkNF6gGBSGT4gIFBbdQ8VujnukDwAvBfkEymFbFHXF3uUM5SC/zvLEzsg== 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=zoB4WdNcnMndSIE8frIBiBw/orhv555JRD+2P5oKvXs=; b=YvvPlXhoKWVJ2mOutxIJNvf9M7Y2Kh4ADFMVRiS5pY6fXoVoeklD77qBuBFXID7DJf/dz4NK8rX40T02ihsSJR37psWam2SebF/KkArK/Qk6cIZsGJZqZvbkaF9S1FUZ3u8v9XmyydpU8NBTLMbdhceAiKpw6JefZLvUcqW2QOo1E2tSfhsEFRSYGzdavhA+zkBpZ01xxhNCXb51Oj/is+6YSVEcRSyDgIhmF3hjuZlCtf7NmFKM5CxjJ04c9S5OVQzee8d4cNM526q8WHmmRizbUVKf5mRKNlkgu21P5sCD/ewA53OfzbpD85XXfppyy28IGG/cmsxtvPkIeBZBDg== 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=zoB4WdNcnMndSIE8frIBiBw/orhv555JRD+2P5oKvXs=; b=I1C1d+KnZ1IC5wr6bGTqTf/VYH5IcYft5UdHKpVtUNhpqEs8zLXkzvEO1w2gn7IqbWrfAO7ZxPQZe5a8zp1UBtbEVOM0VZH30/UPhPt/cPEa+Q3fO4o1x+YnDaUC1R7jPT3dncHGzEk9tAHMzs1A5lrF5eEUnzxqhEcGiMnELVI= 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 CY4PR12MB1606.namprd12.prod.outlook.com (2603:10b6:910:10::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.23; Tue, 21 Jul 2020 21:20:04 +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.3216.020; Tue, 21 Jul 2020 21:20:04 +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 v11 03/46] MdePkg: Add the MSR definition for the GHCB register Date: Tue, 21 Jul 2020 16:18:40 -0500 Message-ID: <74e9ee3de48dfe101aebdebc0304e002a88e74f7.1595366363.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-ClientProxiedBy: SA9PR11CA0020.namprd11.prod.outlook.com (2603:10b6:806:6e::25) 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 SA9PR11CA0020.namprd11.prod.outlook.com (2603:10b6:806:6e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20 via Frontend Transport; Tue, 21 Jul 2020 21:20:03 +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: 964d01cb-352d-435d-e845-08d82dbbd5b8 X-MS-TrafficTypeDiagnostic: CY4PR12MB1606: 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: lOIj37A+8RH451HV1SOU8JVXL6MoJ2UFChQ78xuQn3jw2f7rhKO/oxcz6JzBTKlbfRcZrvqTnLHM+cqDAP3bZIhfGjOIWYDiMa++r21USJT+b/4z/ucH237uUWLcY5DzBYxgHj1Q8k0yuh7DhmQziQx8hfcoQuNh0IvFF/LxZFSx6/sPSuoGt8IxecM7svqv2uY/XnmBek11UtLNK/BX6N7AdhJk0pwYWzC6O70tVJaS40Mnam0e/IdunDGkeed4zWY5O4YkLznJImLAnclsAv0IRkmlMEDGRYPfw0wH8roZIi7KHi10e+sWEWCi2S0D83pWDUzPk4OxQ47tm2OpZ35C2MSwiVvQl91BW9rZbzn21G6Es5viaFbeDEwzrVZy+DHmkX5HOOnHtDlBaf2w0kU2RbsxKZZqbuYuuOjCMUklB9fIlbpkrUKICSb5Kvti0ne6rdvAapn5G6NSSfYqlA== 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)(136003)(39860400002)(346002)(396003)(366004)(376002)(6916009)(54906003)(2616005)(956004)(316002)(6666004)(26005)(4326008)(186003)(66476007)(19627235002)(36756003)(16526019)(66556008)(66946007)(2906002)(6486002)(8676002)(52116002)(83380400001)(966005)(5660300002)(478600001)(86362001)(8936002)(7696005)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: VIu8Lrnba0IVw2UCBrncOk2CK3uM/5kw2fXMXG8LoadC+Ryu0MOz/VKhBnPw0ZNQmHXIzJMTWlb9EqWyDhW96pkXO/vCZSsh1eKCl+tBMKiq6MrRJi2A+BjeTydfq0k583G9pkgxI2u/EnJuYdwDj70kS5PdfT3UWtGfqnAHeyxjX4m8QnxJGAOT0/LuLBQkbtw0Q3467SCGgsEMmgE6R14hE5FieZ/JATix/GMO6sOPPIPUov+XnbgRnjt6So5zrwqDWkTDipFNWPNDmhdB3ecjeb41hoWCfU1AmdRzCUu5crhVVPlP0P4Bj2SEph80Smr4iYU15QO+5IQ80seWcc9y61l9qw8bhrxjw0OGkPnEbxB7mj2yvuRlrTXkM+301Vc5xc5lQaCPznJGGTJmubAL5ebr0aGTejiL+LtrpWn0LPDrQzqXD1qASlbA72Bb2Uljj0AKIOXUXJLvYij4DsbnJlm+BAH5KcS/oxWJ2Fs= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 964d01cb-352d-435d-e845-08d82dbbd5b8 X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1352.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2020 21:20:04.3833 (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: /Isj5RdKSoVYkrPYdlseribeaotoYMLskt7X9AkvGRVLaPR4qIk7hsiJabUeNELfICO9yRX0zglyRnP6pXO/ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1606 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 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