From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.53]) by mx.groups.io with SMTP id smtpd.web10.15905.1621448410666870008 for ; Wed, 19 May 2021 11:20:10 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=xCe73kvx; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.95.53, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZhuQvPJQu9SGheipQFLKE6FF97N0J8m8bVdKSa8LdHu0H/J9y0JNQZboMY6KDaAXx6iW7iG9brTlGJomqcavJcIQnB3dYPTvJsYpiE7o0LwcnBj7UgHoqIE7VcfInh2apT6QTTSJ0huDt7R0C6zS8BUd2ec93z1bWOeFV3ddlADqCxCQARJCgpmEIZ+QTwF4iwEgiavatLuD/ioJQUIO+LZJpl/MZQkTfE0Q309mThMbGOvsbvHntranoMe/e0+gZHzOXnMLkU66vST4D0ALchkScuSAmxMWnbAwshUFzM6DUREJMlzHA1ssfjMCXDjj+aX93xaapBPKlBjq9ZmZRQ== 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=u2LbfNCJukhAV4ENQzPNVSk0e1OZDuJxnP30T12t8XU=; b=MRgGpUB3t4/yaIrbSvRa81u6qaYzBKAoWiPqZrulZJ7F1fzE9NhHTZLqpwn7MMJAMpiB4jtxWCB01p0Q5guablvpSu1GY8T9kSW+3Q97RGNIlG+3pTNm/Bph4Bdq4/tdktyEVgNdT2HPYquHeDUMNYXpzeOl2+Njp67hivHT0LACG1lNTqfaEeECT+FTkVW53NHn9jz18iZ0cqgECX7IEc3d19wTdBKSJIJ3YGsoU32fCfjyif/6lIKlBhDQjh8t/mHagJBa9jG/DYZKwO8B07Pc1TbwKK4AfckLIF0y6aMtalUw0e0S/chOxfEFxPuTcDa+mCb/Ihk6uO+wpfWKFw== 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=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u2LbfNCJukhAV4ENQzPNVSk0e1OZDuJxnP30T12t8XU=; b=xCe73kvx4yFmvp/k/f3e5eLnmn2P6tUHJydc9R6urIbhdVS9WgcFueAnuSSK4jF7/y5S3ssyBwNPIBJ6+UuycMcl9vP+NhGD1vTdFENSbh7tFbe0nxfWEtQoOPts0mpEEpgAGIpAFsF2DzCP0eW8S9kF+cL1qSoxKrNsr+UFyzg= 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 SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SN1PR12MB2365.namprd12.prod.outlook.com (2603:10b6:802:2e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Wed, 19 May 2021 18:20:08 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::9898:5b48:a062:db94]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::9898:5b48:a062:db94%6]) with mapi id 15.20.4129.032; Wed, 19 May 2021 18:20:08 +0000 From: "Brijesh Singh" To: devel@edk2.groups.io CC: Brijesh Singh , James Bottomley , Min Xu , Jiewen Yao , Tom Lendacky , Jordan Justen , Ard Biesheuvel , Laszlo Ersek , Erdem Aktas , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [PATCH v3 03/13] MdePkg/Register/Amd: define GHCB macros for hypervisor feature detection Date: Wed, 19 May 2021 13:19:39 -0500 Message-ID: <20210519181949.6574-4-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210519181949.6574-1-brijesh.singh@amd.com> References: <20210519181949.6574-1-brijesh.singh@amd.com> X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN7PR04CA0212.namprd04.prod.outlook.com (2603:10b6:806:127::7) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) Return-Path: brijesh.singh@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sbrijesh-desktop.amd.com (165.204.77.1) by SN7PR04CA0212.namprd04.prod.outlook.com (2603:10b6:806:127::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Wed, 19 May 2021 18:20:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2a8d80af-81c6-4e25-fbf9-08d91af2bb77 X-MS-TrafficTypeDiagnostic: SN1PR12MB2365: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uBVufeLU6MqFxsx4Z5Y5oYspSz/bkAXfsOrpayJMMTTKqSnzgUNIsdxY4cYaQhe2Hp+MQf6cm6tV2AabiJBnMj7Pb8I68vN/fHuUqmX4Huw0BmfZW0WxyML2k3yLeeuWJkZMlu4djP0kFQ7HaiXfM97hBOr/uSvoXw+lmOs7s1Ho8ZDq5BIJqxWoaiHCelfZ/5qqqsswj+RkR1LlR42SjlDX22/K9LhTz0Lqd/7QJYKn7+irdp7aDibovk0eFg8pm8Z2NlLdRemkhG/9k6vkgzvmS+XeqXwW9CjmiR4t5lhixWlv5eFrfsgxkJR9aD9PWFOmLJ82O0JfQd/2ayBLjARQQd5M7iLv8mipkPoLrElFHa25Bojekg3ZRTkwEzq+dwffJ6MJSgRE81OQvT658zNvcI7YI93nSnxxR4pmsb/+hJh6ErVfhuZLfpvo0hehDYo8AcB8ViU3cY9Q0ctyEm4P2ViEIu1BU8364pu4GonqkFzBdZAU76a/cGmgL2CpWYJokrSieTl3YuQ55BodVVt0x3q/EbyWY0ymuZL7LGC9yGFvGEFisA60LRri5g70CH5mokWC7b5jh8URJ15nml5u6ka7hV4CIfrQpKG4ZM2CnO9HJ3sfJb1NR0ubFkp8FeCsWi/jdiV8lu4GEb0lZGPAsZxLh3KceSNUqKIhopTjlfklyMvSN8Qq+shB1IWk6StUaOYRinEvfe83FsD7sd02pQg1jsyuoBjXHqtrXDI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2718.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(346002)(396003)(366004)(376002)(39840400004)(16526019)(4326008)(6916009)(956004)(2616005)(478600001)(1076003)(2906002)(5660300002)(6486002)(19627235002)(966005)(54906003)(66946007)(66476007)(316002)(7416002)(8676002)(66556008)(8936002)(83380400001)(36756003)(38100700002)(38350700002)(86362001)(26005)(7696005)(52116002)(186003)(44832011)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?rtEkCHSiV/qFkVasNFcGfxRylD7EIgkMG9VE1rU14Wb4osy2bMjVFNnZbIUA?= =?us-ascii?Q?SdD8JdstKDHGTnKE99G6aCxCZnRdwrwQJmhQC8DWuy1/AN/dSF1EZw1E+BUH?= =?us-ascii?Q?+L1hKpIQSKhskJPDc6iNYr96qoSz3mdkqzu5BKkmZ3VEGA+FGPzLuwoLE1YM?= =?us-ascii?Q?I52evIF8EAxqaV8kSKBtFktNPtTdauFU3wOCbvXtZrZ74tKFacv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ByiPI6nshozJqa6VFhSyTj3+XzpJPb2Qe+cQY/?= =?us-ascii?Q?7R0c/3B4z8rPrttDy0hhaME5VBSX/Lw9k/vb4Mn4oQHDYjOz/XyKDARU5eGv?= =?us-ascii?Q?9Uu7GJFYGRN0E9J4I03H6nukSIeI/zmh3ZxzjAPg28b3TsUmg9PA1uzC4vJZ?= =?us-ascii?Q?dH81aHAHIuMD8O4Guoa7g+477iRYSWv93eMxCYxQw519kCZPCf/HBPxxpb1g?= =?us-ascii?Q?nve2C9YHADgJwAhl/EEnus00?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a8d80af-81c6-4e25-fbf9-08d91af2bb77 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 18:20:08.3104 (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: Htm28BcJTAVlb0Jq5Wn8LyU9k9ajSP2IXKwybeGQ30T/ziAaZLcrSrrOMMWLkn6xKqCoJaORtGtkLjcm8a2NlA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2365 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3275 Version 2 of GHCB introduces advertisement of features that are supported by the hypervisor. See the GHCB spec section 2.2 for an additional details. Cc: James Bottomley Cc: Min Xu Cc: Jiewen Yao Cc: Tom Lendacky Cc: Jordan Justen Cc: Ard Biesheuvel Cc: Laszlo Ersek Cc: Erdem Aktas Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Reviewed-by: Laszlo Ersek Reviewed-by: Liming Gao Reviewed-by: Erdem Aktas Signed-off-by: Brijesh Singh --- MdePkg/Include/Register/Amd/Fam17Msr.h | 7 +++++++ MdePkg/Include/Register/Amd/Ghcb.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/MdePkg/Include/Register/Amd/Fam17Msr.h b/MdePkg/Include/Regist= er/Amd/Fam17Msr.h index 7368ce7af02a..cdb8f588ccf8 100644 --- a/MdePkg/Include/Register/Amd/Fam17Msr.h +++ b/MdePkg/Include/Register/Amd/Fam17Msr.h @@ -48,6 +48,11 @@ typedef union { UINT32 Reserved2:32; } GhcbTerminate; =20 + struct { + UINT64 Function:12; + UINT64 Features:52; + } GhcbHypervisorFeatures; + VOID *Ghcb; =20 UINT64 GhcbPhysicalAddress; @@ -57,6 +62,8 @@ typedef union { #define GHCB_INFO_SEV_INFO_GET 2 #define GHCB_INFO_CPUID_REQUEST 4 #define GHCB_INFO_CPUID_RESPONSE 5 +#define GHCB_HYPERVISOR_FEATURES_REQUEST 128 +#define GHCB_HYPERVISOR_FEATURES_RESPONSE 129 #define GHCB_INFO_TERMINATE_REQUEST 256 =20 #define GHCB_TERMINATE_GHCB 0 diff --git a/MdePkg/Include/Register/Amd/Ghcb.h b/MdePkg/Include/Register/A= md/Ghcb.h index 712dc8e769c0..ec232ebd3807 100644 --- a/MdePkg/Include/Register/Amd/Ghcb.h +++ b/MdePkg/Include/Register/Amd/Ghcb.h @@ -54,6 +54,7 @@ #define SVM_EXIT_NMI_COMPLETE 0x80000003ULL #define SVM_EXIT_AP_RESET_HOLD 0x80000004ULL #define SVM_EXIT_AP_JUMP_TABLE 0x80000005ULL +#define SVM_EXIT_HYPERVISOR_FEATURES 0x8000FFFDULL #define SVM_EXIT_UNSUPPORTED 0x8000FFFFULL =20 // @@ -154,4 +155,11 @@ typedef union { #define GHCB_EVENT_INJECTION_TYPE_EXCEPTION 3 #define GHCB_EVENT_INJECTION_TYPE_SOFT_INT 4 =20 +// +// Hypervisor features +// +#define GHCB_HV_FEATURES_SNP BIT0 +#define GHCB_HV_FEATURES_SNP_AP_CREATE (GHCB_HV_FEATURE= S_SNP | BIT1) +#define GHCB_HV_FEATURES_SNP_RESTRICTED_INJECTION (GHCB_HV_FEATURE= S_SNP_AP_CREATE | BIT2) +#define GHCB_HV_FEATURES_SNP_RESTRICTED_INJECTION_TIMER (GHCB_HV_FEATURE= S_SNP_RESTRICTED_INJECTION | BIT3) #endif --=20 2.17.1