From patchwork Fri Aug 20 15:59:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 12449853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6786CC432BE for ; Fri, 20 Aug 2021 16:02:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1BA1861221 for ; Fri, 20 Aug 2021 16:02:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1BA1861221 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 61D9B8D0028; Fri, 20 Aug 2021 12:01:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5CCC58D0007; Fri, 20 Aug 2021 12:01:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 41F448D0028; Fri, 20 Aug 2021 12:01:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0077.hostedemail.com [216.40.44.77]) by kanga.kvack.org (Postfix) with ESMTP id 2349B8D0007 for ; Fri, 20 Aug 2021 12:01:15 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id C98D41BCA8 for ; Fri, 20 Aug 2021 16:01:14 +0000 (UTC) X-FDA: 78495923268.17.7D1FBA6 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2051.outbound.protection.outlook.com [40.107.237.51]) by imf10.hostedemail.com (Postfix) with ESMTP id 6C8596001981 for ; Fri, 20 Aug 2021 16:01:14 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hwXKuvmY58bwTogxvAxV8YSvQGnrXdInFQ1g1xodGPB3xkMW724t0rlciyxP+VOR0WYTX8dVK/23DN9tuW4ntARFeSn7HyqtWoygD4pnayKr/8Yi4RehiTvz+eJo56YkOQD7rajIfyk6VL2MQxFCmEq7WfNddAGwOdeL34qH973tVr9aoVr1F/H7K4U8tRynxPpkuvRWK8L7zMttJcK8rvw10iLkasOW2ZgZ78DigF9g2kNLVcne8txooiaCmeLnyLkbh7KBKehww3wqnbiZTslmEw/Cxn3mbEFWlVo/DrrdSJfIhfDbOHjjcCp79s0EeXxC2ErGYqifyxats4/xGw== 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=pNxh+iPFc7gj7fjVPpyPybIIus+xmeFB09nTxgEXS4M=; b=Y3+oSAtDGOlwSPb00L7YHiJ4B6OWPbw+aeLmqepqEBqedS7Aebsxd3khgcvyxDZWtXRKcSBQwzbh0gh/IBcscHPrtdBg55ROiYgXJ5tj/X+rkPGCJ4XrYlQgApymFs3DSBqe+rYwUU1qlF+7iycwmr0+n8Ud6rCVKVIx+Mqhv69WdG1k+VLxgfizV8RK2BCbMpzHPVG9I5LFV+kA/6FTDz923zSnGlD/XfJbPmIDzGLaQpMz4iTGrSr2xLKifXEb9chqOIqy2EX11vIpQI8wCXBQJTZ7psIp34ZqfpjFjqpeo+vj+d/rzb5/UxRfhzhyBQtWPD5Y+AIdE3AfhIDo2A== 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=pNxh+iPFc7gj7fjVPpyPybIIus+xmeFB09nTxgEXS4M=; b=pMtrgCBlDIh7WeOiDqcuO17PlFCi5eQb0z/ffQuV60agO1QlAkVek1gNkCCBxGjKrHBD1EjhU3mOkyuUiNmw5XTndCbyLRfBtncQJ+cF5Z6c8eUbBuYwcNKGE8/DyA/Udj4ew5NuxiN4gY+vqNXz7C5eAiCIAgtiF/Pzcx7uwoI= Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SA0PR12MB4509.namprd12.prod.outlook.com (2603:10b6:806:9e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Fri, 20 Aug 2021 16:01:11 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::78b7:7336:d363:9be3]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::78b7:7336:d363:9be3%6]) with mapi id 15.20.4436.019; Fri, 20 Aug 2021 16:01:11 +0000 From: Brijesh Singh 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: Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Borislav Petkov , Michael Roth , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, Brijesh Singh Subject: [PATCH Part2 v5 45/45] KVM: SVM: Add module parameter to enable the SEV-SNP Date: Fri, 20 Aug 2021 10:59:18 -0500 Message-Id: <20210820155918.7518-46-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210820155918.7518-1-brijesh.singh@amd.com> References: <20210820155918.7518-1-brijesh.singh@amd.com> X-ClientProxiedBy: SN7P222CA0013.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:124::11) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sbrijesh-desktop.amd.com (165.204.77.1) by SN7P222CA0013.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:124::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.18 via Frontend Transport; Fri, 20 Aug 2021 16:00:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a6b9b0f6-6fac-40ad-672b-08d963f3ae99 X-MS-TrafficTypeDiagnostic: SA0PR12MB4509: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2V5HZHsADss/CtDzuwParXtu4Njee156SYo3atFQcEuIllRtvF27AOLXlduRr6Kp7a+itH61EF8b2NvlXSlrgKzmEwgq4sdPuJ7lBBzTHOYRqCeQvJGGykkBkeVS3pdz4EJc6MIB663Jqh6SXSfC/d/mZVhAWZe3o3AcgocL1KoZ70AXQQkyEBsTmFlJ9ZxXVh5Tr4cOVMBsBLSfnff5KqUWFvngJ4QvuM2w4z/YG2kLC1ghC9ynN5HZNcKll1QVCZ7Xl1K3jLezvseSNSeZ09Wv/0Q08gUQqQdKqLc6gMuzhtJy5Ar95R4dqYmokHBWZUrjMrY4qcapvWnpszg6PKZWz1XoSALGGdc0N8XwzQjRNrMqa4L0+NUdNL+n9dtEvBXdYtarsdXxM6Dd1JJTzqsJZm1lF7tyougqDgkdAS3ecl2NKT7xzM5CNRKAmhteA4igmNT58mhSSMooGimoZCBvnbJKoTvlz9zrjbfpQk2Abu9pr3HXfUqm5zI8X2B6SCichJmHovs5tQSBogY0Itjq8dOQhKF2DKOsWOUNjdxfyfTmv6hqitUN5osqrfr6qJq+Z0YrqaeXuvrDzZ4Wj4VssfVTf3k0PUkieWDsvzWMlJq19Ommg5aEkQgRPBzgFW4de1pzA+DneXAocf1S1ozZ+Cbx3ewchtIFv5wN+niPz8nkJ117tFQQcTBI/PlwKmdEfxQvHgNncIBbh1eKXw== 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)(366004)(508600001)(4326008)(36756003)(7416002)(44832011)(54906003)(316002)(66946007)(66556008)(66476007)(86362001)(7406005)(956004)(6486002)(2616005)(2906002)(83380400001)(38350700002)(38100700002)(186003)(5660300002)(8936002)(52116002)(1076003)(7696005)(8676002)(26005)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tVGClb7fi0ufWF6CVKpJ/q7AaishPnuj+lu8Tuwhuz5h8UTOBLl9PBDdNOnW+h5jhHXjqUmF9W4WYvHe3eqSXGz0wB2eJpCPle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V4ScvSHCyxMgEikZ7vdeUXYp3+CEsNkj8zxUiOVe6R3xNZKC4jYWEXRLYpSh6wCngshTDatuiR+v1A+eIroyM3zZ1AhKsRRw0qp5OsJ7sRy7+/cdcrqSgQ4qbLbEGKpNfd+uFGYSycuzLHWUf1ZSTa X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6b9b0f6-6fac-40ad-672b-08d963f3ae99 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2021 16:00:50.8956 (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: ISmLP5CVBlVwdJssJYG77YIYuAI0jrytQsWay2HGyE8Fiy5HLU8bbk44onWX+5LWbjhUKD3XmoC/THCMh1nWxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4509 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=pMtrgCBl; dmarc=pass (policy=quarantine) header.from=amd.com; spf=pass (imf10.hostedemail.com: domain of brijesh.singh@amd.com designates 40.107.237.51 as permitted sender) smtp.mailfrom=brijesh.singh@amd.com X-Stat-Signature: 3atpei56qr8nifmj6ut6wtqzi4hc6b9e X-Rspamd-Queue-Id: 6C8596001981 X-Rspamd-Server: rspam05 X-HE-Tag: 1629475274-799861 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: 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 151747ec0809..0c834df3f63c 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -59,14 +59,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 59044b3a7c7a..9d6c51e92a79 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -608,7 +608,7 @@ void svm_vcpu_unblocking(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;