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 []) by mx.groups.io with SMTP id smtpd.web11.16077.1620419951004614240 for ; Fri, 07 May 2021 13:39:11 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=MqlkQBSj; 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=g2f9eiA+dQ13sSYxR8FaiVVhfEarXl4mIYfTSSMhJTzUZXUvn3fAVhz3xF6gENTXPNyQn3ccHXIpt5BJpybK8zrqGnMd++ayiPF3psaxarHEi+NbeFSUalphpUC0Q49ZCoR9yyGxjd+IxkoxyDNEFytQMLxL1ihD7skltv7yjknWxh1zM9nSmDt+iPVUJUQXk0kA0/5hx9xa7n7SOWy7KoFDrYrZ46HgrK6AZP2kycD5N9zUzPmirBGGru75ATwbuyj17ZPt0vX/lemRfbroHufTLL4vernAJipMnlyImFVu8f8uyBXqAQjDaRcKm6zkpbFKlLcDokHKClMIzHDbAw== 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=J7yCjuLA3oO3sIGMjgfq6upfmEXVSiEPDbtreE1t3Jg=; b=ShS54UDB95eIge/TpKOBwjm9NEL9q0bmvU+Hdt+xQEQ6ywnd6H8cRmiZuc93/EeYIZEyKYTIUPGqSISdptV/wDxwHi+HtBurwsMLNVrsHIWEaFt4k/cBfDA/BvN2RtaqEmpnoqG3y92OYX2uVHlZV+v1CEEIrb4NQf9IlNgt//bin+M4ZQkTH1HUBfp6ZNNItRuto8HOSpZdKStDKCn2WocLznsu3wx4kSupuVTPIeZkgYi8fMaAnPxEdejGFnje4zgXanvE5xj9I2LQVAfnicKNnmMzFIws5R/dB07fDPHD6cRNkNz0x/AwQHV5b/qXlf1dvzH+2HP2sJCysNWrXw== 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=J7yCjuLA3oO3sIGMjgfq6upfmEXVSiEPDbtreE1t3Jg=; b=MqlkQBSjT+vcQUNaeOc31eqId9hcZDT94cYaV7nlJffR20IHIcWTBbNwMsYHMNt5cDcq/MLdjJPS1OLLu3u172Li+o+PVbGBIJ+/jlyh847lLRix6FbjVoRNjbmbZKG9/VvWvvNn34PFbOP9ZRAifavEAPI1q/8DKDzb2jEA+BM= 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 SA0PR12MB4415.namprd12.prod.outlook.com (2603:10b6:806:70::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Fri, 7 May 2021 20:39:10 +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.4108.029; Fri, 7 May 2021 20:39:09 +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 03/13] MdePkg/Register/Amd: define GHCB macros for hypervisor feature detection Date: Fri, 7 May 2021 15:38:28 -0500 Message-ID: <20210507203838.23706-4-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210507203838.23706-1-brijesh.singh@amd.com> References: <20210507203838.23706-1-brijesh.singh@amd.com> X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN7PR04CA0020.namprd04.prod.outlook.com (2603:10b6:806:f2::25) 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 SN7PR04CA0020.namprd04.prod.outlook.com (2603:10b6:806:f2::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 20:39:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1c4dfb9b-01fe-467f-3679-08d911982aa4 X-MS-TrafficTypeDiagnostic: SA0PR12MB4415: 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: R5j+j7//HagpfCAmg30PrAZ1Xp6d3WBp4K1C4wWE+V4TBx2zbX1/XxDBqmdIV5QkrYaEKD9GGjd7phdEuVIh61CPS3cs020j+Z8D+xFU9GHa8I0WBxMuElyKPIDLGGbzYzEXR9VirpNNsmznRLdn4JLrKDkePmfcS739sLA4L0Oe9zu+xbZMBXoX9/XsDfnlX5TXN0nRNSfUp8vh6A91E9CmKx6Me/OtaOObwFQiJCt7Mu1AtXaiC0PtLsWHbv+g8P2SUiDqa9wmFBJvcFCFb9EGujbdL441eLjTpE55b7Jj9QNP9wmMJGF7zqykD4b6VGFVHBfSbIVOVkQyL4kugy7RlScFYkaUnuEMPPUNByhkmc3hUGq+NX7pzqs/AqGNwaSTUDOPuQEIqt6F4LGMcONy9M8818h4PGsqB11Rm3R88cLcQCvowJxOp3w9d1Sp4GMKu+8jnQ/IFG0OWJEqV/8GIPbnb6HQ95/df7Qg5BOiq+ityiqrBTuQubryHuMEuxPkLwLmurhCtF6P3S6Yzxa40sqbcKtNnY+qAt0M5y8QxY39GRcLU+OmS4yR8LkEJ1hJfN9mQAVlxEf0oDWOyTt6bQBVIG6eWv0srnkOHZuZHl26SAZ3R3gA5/8XfZF83G2Z8ZGc0iM2gNKqWzGeUW11WrxyROHiER27h108HHHKE/Im/PC0uuucNVeLBRev9CJqQXumTsQOuaNNeNOgTR9TAsIrfO9Au/lyWznvh9A= 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)(396003)(376002)(136003)(39860400002)(366004)(346002)(66476007)(38100700002)(38350700002)(66556008)(6486002)(966005)(19627235002)(66946007)(7416002)(44832011)(83380400001)(1076003)(4326008)(5660300002)(6666004)(2906002)(26005)(36756003)(86362001)(2616005)(478600001)(52116002)(7696005)(8936002)(16526019)(186003)(316002)(8676002)(956004)(6916009)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?cUHnsirEmi5LXDwKVGLwWijwVbEqDHFwIMm5sI8eW5KJB+hFbamkIsuak7N0?= =?us-ascii?Q?XPEFgOzUc3uHeaaF7D2lF68yWyvzaIw9u1pywgyjt9IQI2eI1yVDD2rUsoL7?= =?us-ascii?Q?s+PvgwwWWyUX+BbX0ZQb0xTXm/nmQqqCOhW143o15n4qRBlcML4zjI+gp93N?= =?us-ascii?Q?A8z50V00jPbbZNWX1kupo924DP6OoBnmbt4yxJgdtGvWqTFmuhD+ltl7c7d2?= =?us-ascii?Q?/aOEom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kJ8mThzqZg5?= =?us-ascii?Q?ItXXalvOCtgP8IcfuPIYoobtnbzh7yEGJvNZsF7GSolm46i1glECqnArQIuw?= =?us-ascii?Q?2EQ6AfOYAGu1AqIcbegavECR8qr4yMeoffX2tM+TeUDjo9TWk7WuGXik5Y0j?= =?us-ascii?Q?DezT2y4F6YhtQM7/6NCg5ID0uBIUvogZqR3pR9uEsbvyGKYfXVQEaf2r3wXV?= =?us-ascii?Q?mrFAozrl1ML23xa0epPl+z2s?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c4dfb9b-01fe-467f-3679-08d911982aa4 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2021 20:39:09.8971 (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: 27YfhNxYTUWxNijOc4umuBoT15xY6sf6qfHi+/AW9p27nJYuGrbIHwRSITrb/TGFi78rXKPHZmV6R5zdxPNIEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4415 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 Reviewd-by: Laszlo Ersek 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..326b11479779 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 dections +// +#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