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.55]) by mx.groups.io with SMTP id smtpd.web09.716.1583190452495300133 for ; Mon, 02 Mar 2020 15:07:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=YKRGrz79; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.220.55, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l4/jGxLGnR3H1XGpW2Ry6YZMEYhpGEyTcGbTyL/InATHomtK2qzZo5Z8w5FsQV0QYq8S4dYc7qQV8jdCjLOW9E7+P318oWKPyKWfBmtaUvv0ArZtFnt0zCNdrI75+22YZk7b7L7nTk3AhvAWDzZy19Ut84sZeXKi8N4W0i2TKRMrGTJ9PcMvEti0mQE9w3NdhLnah5UsxbcTNSvkAjMbMG5mNnrky8459nxXIi9KDQvVpNtLSO/pSsq578gnn4nhurmI4eLEtIpFU6aHl5Ik5sh2y/K1JyOeafwaWYv8uPQ/VHsetCmqsPDH9dn+/f91xfymO1rrQk3OP/j5hogymA== 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=l3ojZ8CbgPloJQdyqiVfJyKHXZ0KVTSBlRyirGVUmCE=; b=V8OFSTWxnOvBnU28Y+YW5kZc70DET0yKq/AtEwd44cOUo9mhsxYGi2yo+Zmhpj2AJdLscLWaQofR9P0t6nS02HkzE32kDuuPy3iqyH4rGiN/oIT+qfjXcbi53Mq8jGqmA61YITpJ7V6px0UfNonjkD+Dxd9hmIYkRrpa3hwoZ4g7UDm8d3r83KgkZqiL/ethlW8xbi3D2EP0CECmEMVXGCQJIgEdhj25riEp697lJaiWtg63fR252IJ3+ACBMtA9ekOGSLhUtp+JyO0Xj7WLVth1UzNXaf5RHPAvJB6Vy8FVqmnECppmvfbDrwRAyl7AAysZ+GnCR09jcnEIhEr9KA== 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=l3ojZ8CbgPloJQdyqiVfJyKHXZ0KVTSBlRyirGVUmCE=; b=YKRGrz79+8NmZJdyU7/cew+PVSWV/XfYITXJtZ/vnAVCtTDMP1+Xz7t0h98hLk/fqtyEDEakZ/040xcnT7uMpxTx7cRiavwl7TJWlY/VekzAk3xfYP5RAStUTTrNLF8OAqZ8pXgIgTInxvAK9CkipuOK3+Y6l/l9nZ1E/J0npis= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) by DM6PR12MB4041.namprd12.prod.outlook.com (2603:10b6:5:210::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.15; Mon, 2 Mar 2020 23:07:31 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::f0f9:a88f:f840:2733]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::f0f9:a88f:f840:2733%7]) with mapi id 15.20.2772.019; Mon, 2 Mar 2020 23:07:31 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Michael D Kinney , Liming Gao , Eric Dong , Ray Ni , Brijesh Singh Subject: [PATCH v5 02/42] MdePkg: Add the MSR definition for the GHCB register Date: Mon, 2 Mar 2020 17:06:33 -0600 Message-Id: <104a19634a77f60fa3e67cce321d4d722c4119fe.1583190432.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: DM5PR2001CA0013.namprd20.prod.outlook.com (2603:10b6:4:16::23) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) 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 DM5PR2001CA0013.namprd20.prod.outlook.com (2603:10b6:4:16::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.16 via Frontend Transport; Mon, 2 Mar 2020 23:07:30 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1e80d7db-d243-414f-0f7b-08d7befe7c1f X-MS-TrafficTypeDiagnostic: DM6PR12MB4041:|DM6PR12MB4041: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-Forefront-PRVS: 033054F29A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(39860400002)(366004)(346002)(396003)(136003)(199004)(189003)(478600001)(86362001)(5660300002)(81156014)(36756003)(6916009)(316002)(4326008)(54906003)(2906002)(6486002)(8936002)(81166006)(8676002)(966005)(956004)(2616005)(66476007)(66556008)(7696005)(52116002)(19627235002)(66946007)(186003)(26005)(16526019);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB4041;H:DM6PR12MB3163.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U50YUCvh4O9yOpN7fDRtJX2ZskryuAPnQYzOYMnsDLUJh0VkjgF9YRBtMK7wOZr/RVZJE5bzV1TGx0wLED476BsJyIc/rYC853ry0rIc87uPVV9zYSTV25X4DB/6q66YP5Ym0PfIJNSMKAZkDU26rxW8mdof2jFBPKg4G46dfgx+nN45bfWx0Qk4jg87b6YKAP2NTCNhWJ4UVlzgDKEY+oerOst0IDUzirCIAnSi4WpWRiZ1eG3fNujkW7wJN2q9DpOukYc7Lf7rERTRl68eWGFpWvSJhAwLha6JS8yz7zO+R8hE2l+divwZXEfFXgsSTclN+VZxUpgcc8kEK8q7f0Wz+z2LhGBYe3wpFYsuZz1B0Zbkhl8StvwQvBxjruluP49dvMB02ktPFpat9Gx+JopHOH/bV0fMZI0+09xtxyNg2hYw745XWZBcpzZsCw5ukGwCjcSjpIETdNTf09L6ucHqAciPkV2SALeHXc5Oihv8nIEZI/axolsSNaTiphreQz9CgENieauxYmHFWHP4rw== X-MS-Exchange-AntiSpam-MessageData: 5UrqDmAaWw1cfxo8z2YpvFj4GD1gX6otokVvwhJXNYNDWLSHrbKs27tXxsaoHoHxx4hd/xoSPRBaQhkNti6MEbDZgGSctAc7ubXiajW9IPblgYOczA6w83TxgIL8noqg91QLbRt62FpXP31YtUFUug== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e80d7db-d243-414f-0f7b-08d7befe7c1f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2020 23:07:31.2953 (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: ZQG6d9ZxrZ2Ex5vB4sr6sbOZn6tENLwlDB71/4MgIfGHCIeXyy4SBgCZjtVph6QZYkLx733CptB0aZJvYBtrsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4041 Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198 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 | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/MdePkg/Include/Register/Amd/Fam17Msr.h b/MdePkg/Include/Register/Amd/Fam17Msr.h index 6ef45a9b21d3..466a3143599c 100644 --- a/MdePkg/Include/Register/Amd/Fam17Msr.h +++ b/MdePkg/Include/Register/Amd/Fam17Msr.h @@ -17,6 +17,48 @@ #ifndef __FAM17_MSR_H__ #define __FAM17_MSR_H__ +/** + 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 { + UINT64 Function:12; + } GhcbInfo; + + struct { + UINT8 Reserved[3]; + UINT8 SevEncryptionBitPos; + UINT16 SevEsProtocolMin; + UINT16 SevEsProtocolMax; + } GhcbProtocol; + + struct { + UINT64 Function:12; + UINT64 ReasonCodeSet:4; + UINT64 ReasonCode:8; + } 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 -- 2.17.1