From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web08.6092.1620863207579547074 for ; Wed, 12 May 2021 16:46:48 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=oQst4ZNa; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: , mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZMx3es/i8ro0cBO6fQYeQKnh52FbNvgtCMa06DT5aBdXe9UAcoeFLfVmFsnNGMXVDCa5w6RHdKCxF4kjOAhjhwqAjHKMzV0gTAHz8ytSIUTXmB3FrVKwbp90MVAJMfWp5P/UcDt3Gu2+r8DHnlb6lHFg5fCArkloIXk+EafLb9IEbEo4qtT6l3AnynmQiJXwvGgEaJNIZbDFtK4R4t2V2k43z57DZ/RqrbJeSddFrEGSRHnrfVzoW4r0vrH0n9ZWlyrP88cnd4cbcg6SyCdu1g/FNKqrRXRpAPDJuoO6PzX2pBhn14cr50OIitrqqDZ9M9+l7kg+A8ACUCqy2mOj8g== 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=cLtYHQsHIaDsFRMxqxNJFyqiGfLdvpAIY+3+821HXY4=; b=bXS1SNNWtKYQoeX0+4TviAtGvwahJB5gBDfvILPP2P/UoGmiBrA0JfdpK08HTkU+KsGBaxzmbw0p42JioIyOLMGkIKLxIrurhJSuuHPhiIoL9urxomIA07+ps1LTpBqAXdQMMGSqvVLeDAoStYyozx4U77znjuCkQkkExSrqGhahVYp2FpW8jFQXsiUsYjb1NOMzoVuELUuIa0iZAFdjVYCg/GDtjPl3iNaY1NGK95fJam2JuMcmSYuRqs8uY+ZOgub4RgcgbSXbCKFKci2dNm7h8Zru5k9O8DqynWqj9EIyQLZmQ38renj5nS3KqDwDL1MoHFah7i9ik2LzqPaf6A== 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=cLtYHQsHIaDsFRMxqxNJFyqiGfLdvpAIY+3+821HXY4=; b=oQst4ZNaEoB5CGQmAhUdc3zNqWmsE32kqCZSld77sh3WSbxQfb2ekzGh/w1U3Ua5P8FVGdJ0uzNUAMKVf82qlPR2/4TtdZf2KaZ1ZEgMspekxS6aKpfMCKbzDdgczk9/6deFKQubt3RakQQk5N3g0lih/BvpUc8wnJ7ZczBl0f8= 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 SN6PR12MB2781.namprd12.prod.outlook.com (2603:10b6:805:67::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Wed, 12 May 2021 23:46:41 +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.025; Wed, 12 May 2021 23:46:41 +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 v2 03/13] MdePkg/Register/Amd: define GHCB macros for hypervisor feature detection Date: Wed, 12 May 2021 18:46:05 -0500 Message-ID: <20210512234615.1726-4-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210512234615.1726-1-brijesh.singh@amd.com> References: <20210512234615.1726-1-brijesh.singh@amd.com> X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SA0PR13CA0003.namprd13.prod.outlook.com (2603:10b6:806:130::8) 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 SA0PR13CA0003.namprd13.prod.outlook.com (2603:10b6:806:130::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.11 via Frontend Transport; Wed, 12 May 2021 23:46:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4ada6730-0245-4099-2de8-08d915a03134 X-MS-TrafficTypeDiagnostic: SN6PR12MB2781: 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: PeJ8uXH9JjtpQMoCJZIw9y4gGEkpe6o6/DnI7D8UnVuqy+lOP+LziyyN90cGf2Jbu74H2gwjsuwoIoTXVGRa8rt3arlmIvgWBihZEUepF96q9a9TflAEwcMsr1pukXpccS6idkdvWGk/KaVWj6SEdfHSiGzIq456PoVT9QaGFUKB066lkCfxi+SlBQrC4m0Q/LL26///IDyk9CoZu1ETwgyn1U9G96kL0cwti7HN9YE1sQfSgAb/Xo7ohs9Tfh392mVrza6aveSfy9gTT0efVF1Fe/jy2pAavbbTMu1BZgk6rrX/5cFIPB/xNt4Ox7GcLuCk9YwWMR+odz4/F2RV/IMzhq02kQ6b3kFBBn2Zn4ktJQS2denErk2vyKu4upG9AQxxliAKDs8zD5tvjfA8HgJw+S1eYFIBOn8EwSCx+MlXKYR04AhYl1dAZ+F3Je4AODU3cTN1ywOeHtESOTwSp8rFCPMLROefa5t9XurwjjZvsxBpPi+7j1mDIEfdbyLfvLJJKaiJTm4qtd8bPmTVvKZ6z2tlP5ByhcBcvjOGMsIeKQxH3wqZgv0ReTjF7puDEFQ0LLtkRHateLRQo2s/cz5KueUEKeCk07j/CLxxBDHWcUGwiRrRqqkT+nCiPSvmgH0E4GTUeZxtjiWFC7iA0WurDfQ22QxOpLzQvvlb506NoqWUZPhEupcuPdbJTw7C+fIf8351QtULI+eD4uLWqTGDZbjyzkGCPlqzd+0xeVg= 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)(39850400004)(366004)(376002)(396003)(346002)(66946007)(36756003)(19627235002)(7416002)(66556008)(8676002)(956004)(8936002)(6486002)(6916009)(44832011)(7696005)(316002)(5660300002)(1076003)(52116002)(66476007)(6666004)(38350700002)(38100700002)(4326008)(2906002)(186003)(16526019)(26005)(83380400001)(478600001)(966005)(2616005)(86362001)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?i5jL4fEWPNqavHYOHTBJIzTyY9X0jf7IV+mSSKO7NXCgR0L0X+iIfyHxm0Md?= =?us-ascii?Q?j+XWrp6owXHSjFB4LyN4BvNXsQFQrhy1Dwloi7Ahc6tahabbDHc4GnCrY+4a?= =?us-ascii?Q?YKyYzvacqZ1/qehF3WlB1S8dtQ/UXOZOB/2z6kB2p009in2BFbA5RP+Yo4Kn?= =?us-ascii?Q?12cm0ustnbFFdpSb3ZDHQqBqh5W37IzN/TYxqDafklOVUrjp2klzSAGuzzev?= =?us-ascii?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wVlF5xeF5pG+l6+Z85tidOiGh?= =?us-ascii?Q?WVzao52tWnlHL19ufgYvtThoSn6LOj4owoSgIeDlbyPGqcTl2gWyYUHY6C4O?= =?us-ascii?Q?xyqwt1C2KMS1R8liARB7kgoQa7xU7htvYUz+T16RCKx9O/VMrREnBEFGCCFQ?= =?us-ascii?Q?iunjkuBBGHZqc9HGirLsx7b0ArAfKzympERa4M5Yf2JbyVvvUNLrk4kk602D?= =?us-ascii?Q?W70PgVHP0XYM81jcptVogG7u?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ada6730-0245-4099-2de8-08d915a03134 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 23:46:41.5928 (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: fYqhyGy31KD0h46y/RjeP/ADxhE0EgNMYCmWydZ1+Ukcu2tRlS/mipDf37Ru30KKy8Of/aNqotYtcDra2deWLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2781 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 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