From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.73]) by mx.groups.io with SMTP id smtpd.web12.9704.1597325051253037943 for ; Thu, 13 Aug 2020 06:24:11 -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=0hcXRgeL; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.220.73, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kTX3aMjKjviHseZ7NPo1z2JYQY1CVT8R6bIO8ya/ItaWeVtsHrURAOatj4v3k06K4SS8BG+gYOAW9n7t6/R1WrGzqVW2NAiZgXf/o4fqgj2i1EDw7EZDefQnz042CpK0ZY5TYp0QgB6aNeCF6B6n7KaJlJQVJFXcDq7FvFkm5sNm6dYiwRxXoi9cFORazKokzWdwzRrBYj1LWuBhxp19m4eXRp+MasCfeB0NDm7ffbEmRyZUjfIuMDDQDF/Cmrh8oQcfhk7FwrN2c5hCnvPj2+x8rwF2ECOQnLZNnL+jEKNTN894L3Y6///HEwngERIoqzrMmAwk692kE4V3zoIKdQ== 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=YpAW9umAIEenK+RxZ2dMKZD0ZXsBsQ3EHYlFeZaY2Z0=; b=TptnNd6yU3aHkoKPR+0vgwNcaGj9o2aCnH0aNagxsg/aAQSZvUTezO3Hp85QLzGIwUxEan9QVSasJpfpEpFAs2YuLjaiRYFCg4bCRLqUihkNPS4OfF8LeuTzBagTlabiVHcd4X5brZ8zOh7TEwoJyoppGdRT+j0FRA78PBrREzETT+llIf7dOnS+x748sAdRDpHBg2KuBCizaqxtuwhNtSAbqnil/ySSzINY7paOmOePyu4MwT24yUoqVKOrtN/hXLBjQGxX4txVF88xsAjv418RnFsAmB9DfCGSDuRLuI64ch+lmHK5JPWZpCASzqdSaV1sCGcVyv+UxbDtyNGm3A== 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=YpAW9umAIEenK+RxZ2dMKZD0ZXsBsQ3EHYlFeZaY2Z0=; b=0hcXRgeLyQEH3LoJUryLh5Na/O5Bxw1PPDJo1TL9Epx8eTZ01AFtWWHUkq040rXvt/2lB5nDEIB+LFRgYWzbQvoRA14isPBBfnQJ0ll9DjS/KWHJIVIqXJ/vask5uVfBljDeUdjEoQXWmeG4xW3kAGjXli15WuhU9A5gMNXAN4c= 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 DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM5PR1201MB0026.namprd12.prod.outlook.com (2603:10b6:4:52::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.20; Thu, 13 Aug 2020 13:24:10 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::25ec:e6ba:197c:4eb0]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::25ec:e6ba:197c:4eb0%8]) with mapi id 15.20.3261.025; Thu, 13 Aug 2020 13:24:09 +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 v15 03/46] MdePkg: Add the MSR definition for the GHCB register Date: Thu, 13 Aug 2020 08:22:50 -0500 Message-ID: <19105fc3912e1636c2ca6372193cf81fe6e9a4ed.1597325013.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: References: X-ClientProxiedBy: SN4PR0801CA0014.namprd08.prod.outlook.com (2603:10b6:803:29::24) 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 tlendack-t1.amd.com (165.204.77.1) by SN4PR0801CA0014.namprd08.prod.outlook.com (2603:10b6:803:29::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.20 via Frontend Transport; Thu, 13 Aug 2020 13:24:09 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ac73cdbd-6807-448b-2317-08d83f8c297a X-MS-TrafficTypeDiagnostic: DM5PR1201MB0026: 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: 36NAfBgrJp3DdHzdyv9WdKNA0LSlLM3XYlJXd0o8M8qwWTnVm6QNyqY6crlIwhLr0+yEksO6aymexixYzuSVKke/ASjgjd/FQ608d80xIhD8ZTwvI06IG7xWf1wGfc2cBCz6wDzWupMxLOx6QImp/Rr3xhYDKmAl2laj7JLKD0viGMS7UktEvmg9MhcKtzxFu9CIRkHIrYPEBc20abBWhfIwEQSeWTG02nRlMV9/qAfvH8bMxajdmttxTqu981slG7QZRwwKFONUBDWQyygl+WSmb2+PIJHZMItHVkbMCANtKVCXdKzqVk9/AtX/8Jsw3MeEF/igpVMZYtveffWDCfi/02jBbx+aV7c6MZUYhjuJJ8zF0BTovQd1RPU7d2rRASmXavs27SwVTkR846Sh6XNH+6W0R01evN6s8Fy27Knh4B/JqlGFJ0NoJZKCxSFaKZiJ3rlHFevpUoxVQE9Uag== 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;SFTY:;SFS:(4636009)(376002)(136003)(346002)(396003)(366004)(39860400002)(316002)(8936002)(5660300002)(83380400001)(54906003)(8676002)(6486002)(2906002)(6666004)(6916009)(956004)(2616005)(4326008)(66476007)(26005)(52116002)(7696005)(66556008)(16526019)(36756003)(966005)(19627235002)(478600001)(66946007)(86362001)(186003)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: A82emqV6SFsEni/uEgKK2znWAuzFpzW9vn+3eeMO+A8ol0PAY1Kd7miziojSqvYE5GElTQMldiafG0m4o3aBXl4jDOZZ+JCSS042tY3WRCa0G2mv5TrXL7yPdmFUNqAKtOr6TN7BeWed2M0ofnMy1FsDF7W/SRBJ3fE11KciPRI9gbdKbXyyAVlIveW1DcomDmtzEIj1xS1SIXQONPPVl1ftxYkNQlkyV1gklWvmNAE+2F5B9m8xAsrIpwl/K4azUI5oBa49eRxOb2Som5RjSEvqkz/dTzFLZRLtmHUP2v9rrmY3VQgmE6WbfvDfPMEMJccsHvz6j3iyVlgLYn5pokF3RMTlbjYK1OsQAxTsTjhChbefKmdeciCxJcHp1z8l0E5E3hjMrtb5cg3CdzdL30brRPb5lWE1z6pTIt65OB+Cb5A2uFSQ6dkj1/ZFXEfJR4AJQB6yJLfe8WcqcP8OahQ+EwwvNfzBW8buy0BGq6mVtOhODogBKIK9a78/0abzPJ3C128azKAEaFQ3pWps6bSkBvtLjgRxUe8KyhjiEvNgq/Oq1ekK5eSfXvjKP02b0+7bGdUeQQnePPrBPLuBbyIgnko1ocsb4G1kf2baQVsK2Hq+GFDxHWou2s2ljhEBlIeTv/XH/UtYys28QYTsBw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac73cdbd-6807-448b-2317-08d83f8c297a X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2020 13:24:09.8865 (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: 92aEAXxuJr1wlFZnMk88NMoQ0WlXVKXP0HLX8TmKMPu16muT1qnf+gR82Sg3OtoNIlM0teMsn9aza7C9n1a5cQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0026 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.28.0