Message ID | 2aae6a4456858af4cd45bf2d8a2843f114b8e200.1655761627.git.ashish.kalra@amd.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE0BAC433EF for <linux-mm@archiver.kernel.org>; Mon, 20 Jun 2022 23:06:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 907E66B007B; Mon, 20 Jun 2022 19:06:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 891166B007D; Mon, 20 Jun 2022 19:06:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 730598E0001; Mon, 20 Jun 2022 19:06:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 655BA6B007B for <linux-mm@kvack.org>; Mon, 20 Jun 2022 19:06:55 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4619A340E4 for <linux-mm@kvack.org>; Mon, 20 Jun 2022 23:06:55 +0000 (UTC) X-FDA: 79600151190.04.51CB6A1 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2080.outbound.protection.outlook.com [40.107.94.80]) by imf13.hostedemail.com (Postfix) with ESMTP id 6708F200C3 for <linux-mm@kvack.org>; Mon, 20 Jun 2022 23:06:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YVhZV3r2fgl0gRYGDQNHRb2iYEJfWD/vWhzaLIkeI0huz1dXhX2fcsHAXUXZw9uo8nE7Ab47ICt9MSRF8fqbJe6gb3FUhxzW0icJN8cd50NjFdOqfiCD81HQaxQhPWCszdFj/pGtb2TmKuAF/OirzdmY4MQ81SQlCX2NXW4GzGQndx/ig03XwoaPUSs6XuxfPLwdl6fjMUAae1YPiCKp8XZBbN2/atWB1GW+BwZzDA/mpE2JAGdkEIzpb4EWponJ1Dm1t2sFscGq/k/GnQyf4KEZpVbk1WYwFtY2c1NLgDZW54zmHB5QGV9BE5lUW+YIEDzlvfeKovTUXBGRidH6/Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gRNldrZ62q/dbiU8EB7pwK/9hQjFTKYoEkcuqsV4KLA=; b=RsBsJpv9pNLwkKPT3tRGgMhhWwGuC1nOWWhFu+qQ5Rb5xuZvYVlK43jczfgyLP+Opq/tuVKBPl4w86TrkijHd1vjoACS97JWcezWm+yF/cZal4AIBZo47tEOKYIknwvD7RpP4TPUd2fC9X9JmClSB6+8dIxJX9H89PGMet9kZoIIA75Lws7G2qUsBur6Ox2Zf+3jazGkpaeY+Cx67a6lqO27IYxs7Os+7ZvkZXAYxj5Mv+z2UCWG8yCwMyZAOtNCR7G+6lVAslepkU9o9323wzv5xuHXWOVHREszGtUICC6MZfqw63vce7MPt9KT+wHwLYqvSIv9Z2DZTOfn6q9yDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=gRNldrZ62q/dbiU8EB7pwK/9hQjFTKYoEkcuqsV4KLA=; b=CtDB7DjlHuHzgpsm+Bfp+hka23DWGcUYeFD33HEq+UuDRpL+e+M2hULZNUrA+d3RtYcgGpWZXgWbQb8ch7Bvi+K4QYK7aNvadhUIqpoXGbYnnMcqX6W9Il7pRa3/b9ruvgDAcfqku9OtmrBFnbpIgr4JJBPRN0WJoTww0eCTYc0= Received: from BY3PR10CA0008.namprd10.prod.outlook.com (2603:10b6:a03:255::13) by DM6PR12MB3881.namprd12.prod.outlook.com (2603:10b6:5:148::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Mon, 20 Jun 2022 23:06:48 +0000 Received: from DM6NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:255:cafe::ca) by BY3PR10CA0008.outlook.office365.com (2603:10b6:a03:255::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.19 via Frontend Transport; Mon, 20 Jun 2022 23:06:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT014.mail.protection.outlook.com (10.13.173.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5353.14 via Frontend Transport; Mon, 20 Jun 2022 23:06:47 +0000 Received: from ashkalraubuntuserver.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 20 Jun 2022 18:06:45 -0500 From: Ashish Kalra <Ashish.Kalra@amd.com> To: <x86@kernel.org>, <linux-kernel@vger.kernel.org>, <kvm@vger.kernel.org>, <linux-coco@lists.linux.dev>, <linux-mm@kvack.org>, <linux-crypto@vger.kernel.org> CC: <tglx@linutronix.de>, <mingo@redhat.com>, <jroedel@suse.de>, <thomas.lendacky@amd.com>, <hpa@zytor.com>, <ardb@kernel.org>, <pbonzini@redhat.com>, <seanjc@google.com>, <vkuznets@redhat.com>, <jmattson@google.com>, <luto@kernel.org>, <dave.hansen@linux.intel.com>, <slp@redhat.com>, <pgonda@google.com>, <peterz@infradead.org>, <srinivas.pandruvada@linux.intel.com>, <rientjes@google.com>, <dovmurik@linux.ibm.com>, <tobin@ibm.com>, <bp@alien8.de>, <michael.roth@amd.com>, <vbabka@suse.cz>, <kirill@shutemov.name>, <ak@linux.intel.com>, <tony.luck@intel.com>, <marcorr@google.com>, <sathyanarayanan.kuppuswamy@linux.intel.com>, <alpergun@google.com>, <dgilbert@redhat.com>, <jarkko@kernel.org> Subject: [PATCH Part2 v6 20/49] KVM: SVM: Provide the Hypervisor Feature support VMGEXIT Date: Mon, 20 Jun 2022 23:06:37 +0000 Message-ID: <2aae6a4456858af4cd45bf2d8a2843f114b8e200.1655761627.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <cover.1655761627.git.ashish.kalra@amd.com> References: <cover.1655761627.git.ashish.kalra@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 760845bf-f7cc-4ad6-f4db-08da53118d8c X-MS-TrafficTypeDiagnostic: DM6PR12MB3881:EE_ X-Microsoft-Antispam-PRVS: <DM6PR12MB3881D1A3F1E483F638C70E498EB09@DM6PR12MB3881.namprd12.prod.outlook.com> X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Su2e99hT9FSuskmNU5JDtrXyAAbMbGzBHuPBh6ITrmtE9MWkgw7Fb6K0Y/O88sL16fUHbM4A9yGrMiXEML2Oc7ImTs0BHN+C6KeIPDr5Pp+fvI0IupiztKNaXi/gAOin/qVZWJ4/sHLqhGq07YEPCJlcTtptj7VqJsElhuqd6NO7JmG8c1dwvMqDt4nK99ffs86lm9WhkS03beRC0pPZ/eW2TKm59LW4aYzk6X+qVGU69861VreYOnHUV79YypYsMm34zTclYfvJzbR2hXmrflcE+ftJv6f/Vz8UoyPFrOXTwhvnIYNBbu6XDZbtKukSml0M8osAK6ofjOYTLfOwDRTgB2EwQudJA6RRxcJiLQTsMTxf/88wvDtkcPE7e6UyXl7wu087QCw7KNOQPGWp+7RQRwC8BJrP6kdG6RRveZppBTOjiVl1XXXgEiCr+okuDCDkyQQRZ/7L2igHexsWcsTeiXi5XI+33dPi22Atb3kaBoXIAqaNEOecKDIxqCqykeLS0uNJkWLtYc/VUhJpewwVkZXLqEBGZFbMB6Mc8ythhAaQ2SoJaQ+zaWVfYvmIFFiecuKxdbUqNkwB7wlH+rarmyFia5DJ/cpBDSGbsbbb85Qe5wIbV9GWG0Lfq1WWNFqC0eSXisuZxsLmjKdGGe5reCkS5NgncHLHa2sAyWw90EpSNkCA9CYnfTYmR/pD8Kol+ul6tR6cAf+6G9wYVKUQOPRYiBIvJVpJ07IGICU4E2yEG17EWqfg539u5r/2vocoGQ46NhxkdlzKxcSNYQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(4636009)(396003)(346002)(39860400002)(376002)(136003)(36840700001)(40470700004)(46966006)(26005)(7696005)(2906002)(356005)(82740400003)(86362001)(316002)(70586007)(6666004)(110136005)(82310400005)(54906003)(70206006)(8676002)(4326008)(7406005)(36756003)(478600001)(5660300002)(40480700001)(81166007)(7416002)(47076005)(16526019)(186003)(426003)(336012)(40460700003)(41300700001)(2616005)(8936002)(83380400001)(36860700001)(2101003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2022 23:06:47.9627 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 760845bf-f7cc-4ad6-f4db-08da53118d8c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3881 ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1655766413; a=rsa-sha256; cv=pass; b=xX++NHJOhPiwZQhkJZ/Kltg/tGJ5ZBmxeO3b7Q9+jg8J5HJjkkcr3jrPqMO+3+LHnKwaDu ugdWBuq6+t6ZOPV8Fzh0c0ucGcx1ZVnjktxrmsWlA2MkikA9JpGR+kCYh5d1eH47u9Qq6r lVrWeZL7nCLLCKKuc7DaSanRryBeOn0= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=CtDB7Djl; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf13.hostedemail.com: domain of Ashish.Kalra@amd.com designates 40.107.94.80 as permitted sender) smtp.mailfrom=Ashish.Kalra@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655766413; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gRNldrZ62q/dbiU8EB7pwK/9hQjFTKYoEkcuqsV4KLA=; b=69tBtUpcogTS/C2tPtVERA4J1AMuSWzsO6AAYN1BgezPVmil7EuvsApT3PBwfBRt0acqpe lOOw3VkzL7PJneG6hDUDZbcuk0WfFgV9CMPmpMoCfDquPEVXcdFtJzqiKQO8G1faubq0eP GXt69NGLeKv5Ap9TT/W9+levs2PIToY= X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 6708F200C3 X-Stat-Signature: h9w1xn3yozs4t6dy8p9oijja8yp7drx6 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=CtDB7Djl; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf13.hostedemail.com: domain of Ashish.Kalra@amd.com designates 40.107.94.80 as permitted sender) smtp.mailfrom=Ashish.Kalra@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-HE-Tag: 1655766413-391017 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
Add AMD Secure Nested Paging (SEV-SNP)
|
expand
|
diff --git a/arch/x86/include/asm/sev-common.h b/arch/x86/include/asm/sev-common.h index e15548d88f2a..539de6b93420 100644 --- a/arch/x86/include/asm/sev-common.h +++ b/arch/x86/include/asm/sev-common.h @@ -101,6 +101,8 @@ enum psc_op { /* GHCB Hypervisor Feature Request/Response */ #define GHCB_MSR_HV_FT_REQ 0x080 #define GHCB_MSR_HV_FT_RESP 0x081 +#define GHCB_MSR_HV_FT_POS 12 +#define GHCB_MSR_HV_FT_MASK GENMASK_ULL(51, 0) #define GHCB_MSR_HV_FT_RESP_VAL(v) \ /* GHCBData[63:12] */ \ (((u64)(v) & GENMASK_ULL(63, 12)) >> 12) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index a1318236acd2..b49c370d5ae9 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -2480,6 +2480,7 @@ static int sev_es_validate_vmgexit(struct vcpu_svm *svm) case SVM_VMGEXIT_AP_HLT_LOOP: case SVM_VMGEXIT_AP_JUMP_TABLE: case SVM_VMGEXIT_UNSUPPORTED_EVENT: + case SVM_VMGEXIT_HV_FEATURES: break; default: reason = GHCB_ERR_INVALID_EVENT; @@ -2746,6 +2747,13 @@ static int sev_handle_vmgexit_msr_protocol(struct vcpu_svm *svm) GHCB_MSR_INFO_MASK, GHCB_MSR_INFO_POS); break; + case GHCB_MSR_HV_FT_REQ: { + set_ghcb_msr_bits(svm, GHCB_HV_FT_SUPPORTED, + GHCB_MSR_HV_FT_MASK, GHCB_MSR_HV_FT_POS); + set_ghcb_msr_bits(svm, GHCB_MSR_HV_FT_RESP, + GHCB_MSR_INFO_MASK, GHCB_MSR_INFO_POS); + break; + } case GHCB_MSR_TERM_REQ: { u64 reason_set, reason_code; @@ -2871,6 +2879,12 @@ int sev_handle_vmgexit(struct kvm_vcpu *vcpu) ret = 1; break; } + case SVM_VMGEXIT_HV_FEATURES: { + ghcb_set_sw_exit_info_2(ghcb, GHCB_HV_FT_SUPPORTED); + + ret = 1; + break; + } case SVM_VMGEXIT_UNSUPPORTED_EVENT: vcpu_unimpl(vcpu, "vmgexit: unsupported event - exit_info_1=%#llx, exit_info_2=%#llx\n", diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h index 9f7eb1f18893..1f4a8bd09c9e 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -629,9 +629,10 @@ unsigned long avic_vcpu_get_apicv_inhibit_reasons(struct kvm_vcpu *vcpu); /* sev.c */ -#define GHCB_VERSION_MAX 1ULL +#define GHCB_VERSION_MAX 2ULL #define GHCB_VERSION_MIN 1ULL +#define GHCB_HV_FT_SUPPORTED 0 extern unsigned int max_sev_asid;