From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.40]) by mx.groups.io with SMTP id smtpd.web11.1741.1596134685613652671 for ; Thu, 30 Jul 2020 11:44:45 -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=wIP8tgRq; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.236.40, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DjvdzuDtS/5nkkwzrA42x8UnGphdrbxFnyEuInmNrKWtVXS1OH5YLDlYPlooPiN0XGj3EYNtTq5wKX63yIIMVbDaVwVxFFaKRw3k9bgDTf7w2nOymRMQN0MBnDF5R7MWd5Nw/eNhZxBlJwrqTMmjYvj0za9NRDv+2Od5De3D6yBnzVuFvr7M0L9GfPJuCaIykSGdg+ba4vupAp+302QNS92iwpb4O3MsCGElaEedPfYXCS92rvZO3zFq65NI+zyXjGLcGieapvq0GnpVTvP3BQrxTNAjP+zIjkZALJ4nmIAuw7yDr2bfqHcgos0jnn1G+/XRFy97AVil8SH4p7o8Bg== 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=G/aLFOjpB9N49aZnWyB81Nm0vSRF3dmm3mdS/HUfbABC+iruYuCV86kIKAByJDMwid2F0Q8O8zXKjJSYsw+cDivjVoyo9SaXYBAgTcA4v5BbBiqvT6iPksyMu6+NUm5Cf9+kXeYS2iUj8l7mvUABoNA9Fz4DsUTNCBYoj6LMLbj2S3IFB1TzBRQBI6012KXW/gzM0i3wjEs0W3dU+8GmecJdS31k6i/OgAbdZwkc4tpbvj5ssuPxWzBR6/+sDBc9BpR/w9yrRduvnMtNv3K8mJTpKAV/9ts2ECxJHEjaXJUcjMeeneXTVLDo64tyRVproktZNa8tmn9JeTSYq2wKgQ== 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=wIP8tgRqTyboVHzEcVKAZK0mNzMb8m9pRcIUBqkIwIHK1V2l4KwgKsC9bLCp4U5y5FwSH2ofAeRa3W1bRenlaJmSmlAJw59R/cpnAtBXUCFnt/Vk9kzEhxCVhr6AmUxgU0SMuPKiVQKRqVpGdNd6Y+3jKONgPiJXmi+PhFurHik= 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 DM5PR12MB1161.namprd12.prod.outlook.com (2603:10b6:3:73::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.25; Thu, 30 Jul 2020 18:44:43 +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.3239.020; Thu, 30 Jul 2020 18:44:43 +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 v13 03/46] MdePkg: Add the MSR definition for the GHCB register Date: Thu, 30 Jul 2020 13:43:15 -0500 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-ClientProxiedBy: SN4PR0401CA0048.namprd04.prod.outlook.com (2603:10b6:803:2a::34) 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 SN4PR0401CA0048.namprd04.prod.outlook.com (2603:10b6:803:2a::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16 via Frontend Transport; Thu, 30 Jul 2020 18:44:41 +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: 48575941-1a20-4346-a0dd-08d834b89f6a X-MS-TrafficTypeDiagnostic: DM5PR12MB1161: 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: 1IwuNLl0jYm7jfByThOmqI8EB+gukLmU6C9gxPWJmFzapVKBoh1LjsGnaTfbfA5dFy9mgpTTP5EbMpOe8RFIHWEfOhD4PItNQq1rT0oP3A09goXW/hf5NEiP0LhPtIT7VWaYuD6ofrCADsJhaU/4mir+WHVyWSS7OvFSs+jfAxA9A+0ydOs7lDdiSIQYJceGM5B1reqxLhULspUghVlyEZO9CIjNBBZe+z/fk8NVzaQEkKXwp6ZqM15D9BlE0obqG7cyxM8fWVk0ZIswjXQzNgFIGuHSWr7UvB9tTmNYAN/+yzvxxxbjnOb/clIJSSl+o27LWW8rmglWmUke1pr/eoLgVP5+hr4zmNZCGeanOKHXd2uKWzkm7duoAzCP4j4GHLPJsoCTsgsXELsTOsswljfBQu7+lXO+2j0nH6oPw9zJ5Ubrm7fyh4AKhxy//95zltgC2T46yisPjZEgX6+D+A== 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)(366004)(346002)(376002)(136003)(396003)(39860400002)(2616005)(5660300002)(36756003)(966005)(316002)(52116002)(19627235002)(6916009)(6486002)(86362001)(7696005)(956004)(83380400001)(54906003)(8936002)(6666004)(2906002)(186003)(16526019)(8676002)(66946007)(26005)(66556008)(66476007)(478600001)(4326008)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Pj/GeqdqPYIHvV6jBeSshO4Iv4ytdgFIfppqrJ63JlTdnhPMZrVVTvyQUBhkqvsNt9nxqzHA0RPS/g3QY89n8g+XkL1nrvKnpT4W5tfP8WUCEgPkcuRkJJL9POn4r766cYJUBy5NURSy/PLj70OvTrNA6+5SJTJFoWGHMgScb++RJqrI8+jNsmhcfqKfxPwjr780IL7yheAgbmgInN5g00u+F9JoPOyjSwcoJs9PPqG6YvBwCteJ6cGzAelWHRWy9dYLxfd/OsmE9pICeuKHkK3MstcI98+1DNEvwtsX5yDdTAZ9uiSfpTnlzoU6WwVKANpUTO4QLHJNzQ3Twc5rmgEECVikA8jdJ9wT24hBPdpoK/q3Kq9yvTjhSJVCJDUN1bH0YXPzDL+7B0DDpOt2Ce/FgBMAisQJD8rBdqfPhlqUjUgd2B11dX8EIDqLsziZ/2MPHwzlOOVxYr8twVXfFGDW0F91DrzkXR2+2l2JrBQ= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48575941-1a20-4346-a0dd-08d834b89f6a X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2020 18:44:43.0305 (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: 9dJC7Tvl8coGDEsXmmNPZX4Vf6ziPlpqH9UCu4xk2bYAGd1Urv3zLX+gFRVEHVScRZc+nSp6Mz0kOz4YilmZEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1161 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