From patchwork Mon Jun 20 23:14:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12888546 Return-Path: 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 80B83C433EF for ; Mon, 20 Jun 2022 23:14:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1DE2E8E0005; Mon, 20 Jun 2022 19:14:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 18E908E0003; Mon, 20 Jun 2022 19:14:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 031238E0005; Mon, 20 Jun 2022 19:14:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E7E0D8E0003 for ; Mon, 20 Jun 2022 19:14:41 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id C0C46120D64 for ; Mon, 20 Jun 2022 23:14:41 +0000 (UTC) X-FDA: 79600170762.20.9FA84A9 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2060.outbound.protection.outlook.com [40.107.96.60]) by imf28.hostedemail.com (Postfix) with ESMTP id 527D2C0019 for ; Mon, 20 Jun 2022 23:14:41 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VTHcJL/UvBqxDnrZss6HcpkteX+XKTLRCWn/SCf5i7t02b9WIJWx90CekzVuKdV8OKGloyPKy2YX20nKZffoOKH5Hf749vnctSNtPKfZKry8mayoE1aHXtjQr9D1dW7HUyG7U0d3ih/F3STCp9pY5tJfMwhT7rT4QKaJXXVI7ujYCjOxAT/pEXDrM1fZjwlE4dgAbr0d4u2getl/gBWuOO4LBTDmoE6HlD81mdbbcIJ0aT4irqccQtpCPQssbFCj2d6sdsZs4yQdds3yihI7mwVGnrrPxYEv/igWmwYTMjk7eVXCIsX52ppgm7tDc+U4fubjQ5kusJ2FGR4+nl3Eeg== 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=VrTmDG8FFhLZCqqlrVRTue53NXpuwUEgHlgWlrLtd5E=; b=Jh7jowCLVlM4qoQZP9K++uuXSjqWQGkmf4UZv0utfJnlR3HRLLK64u+cpmXPBCbL+r4He0HYnxfYigq50v8rgTv06WQt1Sps1g4zhdlvboOC4q4BY7Pp3msmya1IFZW86an3Z98l33tH2cKIsDaLMGwcQ73icxFgWlWvI9fFWvAtKG1eLRstK4PfKoM7yh+CI6DOOVbpi+pgR3q7I6+zNB/SkqcFju/CT5VCe47+HRLhFbQ2PRE88ZsQPs5TKbQwWCX4nyXA9YbmYvePXlley6L80wsuY5SNYUL1LizLRM2aIUcOEnVwB9dsd5u6N/+YHCUR/qM2dgAEj1CMq9R4Vg== 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=VrTmDG8FFhLZCqqlrVRTue53NXpuwUEgHlgWlrLtd5E=; b=eiCrCiNsOVKQYKgiGO/E1wPg/w6QCY1mxG3D89Ct+1XvqobhxpZYXKKP2etdCaPvIpN/CA34tlm7sONlEcoD6sSytrJJO8uwFukH+WgX5UZQGuGq/COO7M0U+TAW6/MlQOv3iimGz2w+C+EHf8UFodMcB9xVO28lmiCKZNCBN1A= Received: from DM6PR01CA0010.prod.exchangelabs.com (2603:10b6:5:296::15) by PH0PR12MB5678.namprd12.prod.outlook.com (2603:10b6:510:14e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14; Mon, 20 Jun 2022 23:14:38 +0000 Received: from DM6NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:5:296:cafe::7e) by DM6PR01CA0010.outlook.office365.com (2603:10b6:5:296::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.20 via Frontend Transport; Mon, 20 Jun 2022 23:14:38 +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 DM6NAM11FT015.mail.protection.outlook.com (10.13.172.133) 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:14:38 +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:14:36 -0500 From: Ashish Kalra To: , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH Part2 v6 45/49] KVM: SVM: Add module parameter to enable the SEV-SNP Date: Mon, 20 Jun 2022 23:14:28 +0000 Message-ID: <83f8b60ce5cfee305fe44ec70bc5d4329d08b6e1.1655761627.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 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: bf3241d9-0f7e-4d38-3bf5-08da5312a61b X-MS-TrafficTypeDiagnostic: PH0PR12MB5678:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XtQyPRZ3yQu+BfEucujqIrzvBmJgT7fi0oUxUjxhNBnqt13hsgirqwD3OCtYV5IjeigcIVdjR8S8XsCkg9hOC5bl+Aq6IIXEHfhBODnG9/DLadnxcOaXvEGileMNtpiFYxn7AnDKLG1iS/3F9lPP8Ghx+o34iS+xV7VMhwmp5eF0NxJt6D9j+z4wir07FroahSBc2sxMCDOKZqSdmNpwTavnt3YJsQDFUcIvnlbgTINu+w7HmafB+XzuJ/5Ntxcb4WyxiEQpgfxsbswBneHRZWfVapo973Ps5PUtctt5XkF7JVxE5wc9hyrBexA5uEiEDsUlF9HCv/ODi5oQKnjO5na5L7i/yA2ggGrZTy8CrvSmdn+F48ykVCU9pQLDSejYb03danUz2AAYY6GZHIA7JBLUOU/2H1+zL+2FbUgivJ4vM5ZW2FJ5SIdumWCdeEI/OtGR5toKhkDBIlp8WxVLprmyejphZePOW03T/9l13X53DXlv8TxeVSwU0647D+aQK4GYDQC37fJ54m3EGVhSPtMjvV0PmaFWh9u9L5M+SfDmNfEYmHHFn9EVabSnDB7XPXQ9ONi5XPRSaFnRtTgJgQMJdvZA/Xrw7MyJf6I/DXzdREKJvMRu9cLoIG6y0uKpeCv6ukz5d5QVGvYI5A8AqWEn9jBmgJXJ2lv7OBDvqMocbZQYZubHRk6Os0HMF3QXuHmxo8brsT06TjvFgR6gmT7iqlvqe0IXafUqJXniezysrxzNFVkAzpD+b1NyVjehdRoCzludJ9ZJjqfwWYED+w== 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)(136003)(376002)(346002)(39860400002)(46966006)(40470700004)(36840700001)(83380400001)(478600001)(336012)(5660300002)(8676002)(40460700003)(356005)(2616005)(36756003)(26005)(7416002)(7696005)(6666004)(41300700001)(110136005)(16526019)(426003)(316002)(54906003)(186003)(70206006)(2906002)(70586007)(8936002)(7406005)(4326008)(82310400005)(40480700001)(86362001)(81166007)(47076005)(36860700001)(82740400003)(2101003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2022 23:14:38.6728 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf3241d9-0f7e-4d38-3bf5-08da5312a61b 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: DM6NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5678 ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1655766881; a=rsa-sha256; cv=pass; b=mcy/FLvhJEWjXj4vdUbgF3X20CbDLid1G2Z6dWYzi7XG46NKuYsQ/KusfqJYMcwDJz3HHp RKi4yBwAtnN/V1b72eXgu59CEPDaSYpCNSzCTM6J01AGPhQd1Po5zz59Mtt4+lp9BDzcj4 JVMNn4SwN9oZlA6sUlnGi/tLMGU8mj0= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=eiCrCiNs; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf28.hostedemail.com: domain of Ashish.Kalra@amd.com designates 40.107.96.60 as permitted sender) smtp.mailfrom=Ashish.Kalra@amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655766881; 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=VrTmDG8FFhLZCqqlrVRTue53NXpuwUEgHlgWlrLtd5E=; b=ub0TKdM+Z3CReB64FLuN1oWN/PkFrhntvRggkFl/poO/b05e5d+fgImHbnVbw/qCReQzjU g6q+X4qX9v4lrGKsMBmdW6zPdIw77EybWn6OXcox6Bk0sKRxETegFjcmrF44fme8STgJ3X VNE3FJdH956K78c5QupAHuGOCwJKffQ= Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=eiCrCiNs; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf28.hostedemail.com: domain of Ashish.Kalra@amd.com designates 40.107.96.60 as permitted sender) smtp.mailfrom=Ashish.Kalra@amd.com X-Rspam-User: X-Stat-Signature: muu8gdmde7bs8qtxnfxgi7x3uobeairw X-Rspamd-Queue-Id: 527D2C0019 X-Rspamd-Server: rspam08 X-HE-Tag: 1655766881-471918 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: From: Brijesh Singh Add a module parameter than can be used to enable or disable the SEV-SNP feature. Now that KVM contains the support for the SNP set the GHCB hypervisor feature flag to indicate that SNP is supported. Signed-off-by: Brijesh Singh --- arch/x86/kvm/svm/sev.c | 7 ++++--- arch/x86/kvm/svm/svm.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index bb7d4547df81..2c88215a111f 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -57,14 +57,15 @@ module_param_named(sev, sev_enabled, bool, 0444); /* enable/disable SEV-ES support */ static bool sev_es_enabled = true; module_param_named(sev_es, sev_es_enabled, bool, 0444); + +/* enable/disable SEV-SNP support */ +static bool sev_snp_enabled = true; +module_param_named(sev_snp, sev_snp_enabled, bool, 0444); #else #define sev_enabled false #define sev_es_enabled false #endif /* CONFIG_KVM_AMD_SEV */ -/* enable/disable SEV-SNP support */ -static bool sev_snp_enabled; - #define AP_RESET_HOLD_NONE 0 #define AP_RESET_HOLD_NAE_EVENT 1 #define AP_RESET_HOLD_MSR_PROTO 2 diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h index 971ff4e949fd..7b14b5ef1f8c 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -688,7 +688,7 @@ unsigned long avic_vcpu_get_apicv_inhibit_reasons(struct kvm_vcpu *vcpu); #define GHCB_VERSION_MAX 2ULL #define GHCB_VERSION_MIN 1ULL -#define GHCB_HV_FT_SUPPORTED 0 +#define GHCB_HV_FT_SUPPORTED (GHCB_HV_FT_SNP | GHCB_HV_FT_SNP_AP_CREATION) extern unsigned int max_sev_asid;