From patchwork Wed Dec 14 19:40:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 13073495 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 75955C4167B for ; Wed, 14 Dec 2022 20:05:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 12C6E8E0017; Wed, 14 Dec 2022 15:05:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B6308E0002; Wed, 14 Dec 2022 15:05:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E716E8E0017; Wed, 14 Dec 2022 15:05:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D7BA08E0002 for ; Wed, 14 Dec 2022 15:05:44 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id AA2DA1A0FA1 for ; Wed, 14 Dec 2022 20:05:44 +0000 (UTC) X-FDA: 80241992208.14.AB11944 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2069.outbound.protection.outlook.com [40.107.102.69]) by imf04.hostedemail.com (Postfix) with ESMTP id A28D940005 for ; Wed, 14 Dec 2022 20:05:41 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=Vh6XBIBi; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf04.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.102.69 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1671048341; a=rsa-sha256; cv=pass; b=K94i9JdHlGUeka+YzwvXe5n5UHjXDBdqcHD0pS0lhHWzJ+2lv4SZzU1g9W+RSwE5pbUzD1 ECJBX1XWR2/XQ//QjZ0IACLkw4Gm/kVEB2JwdpHr8aTxfOknA2QrujyZJsfvJNYtWN/HQu mT/clIiesHx/LHk2NtnyNlfugl8/hZU= ARC-Authentication-Results: i=2; imf04.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=Vh6XBIBi; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf04.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.102.69 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671048341; 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=sCFtQWTk77TMaIV8QgrLv1S9hcmAs7Blyn0qO9scZro=; b=0TMQ7CBLexQcn8bdfaUlQpQ6KakqwmQyHfUqc8hurW9QNfpepIBxMDORMWUfxx39MUSfQJ 8WCOK7Cx1DT4a1rz/QCii58s5EZs3oNPI02Jjz5FMDga4mdDh7W83q+N3Ah1DuRZJj5giC 1tMzt/ngQe1HDt/cy/NaXCtR6jXjjB4= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i2uAHIvBVxA8OmsGjOda3ZWI/9PbBSNEvl264Onf9fmgJGx0P85La7+8+zHcb1x6ywlpxre8uCeUrQ+frMm1hhnDQVmc/hziS52LWsq7s8UuanflXJ5E9NzTR10q55+EsjSneAoqjazuW4vqMR/v8oGeB/2kB5LMYXZs0NLawJbX4cafCKO2ZT8/hdIxJcjOgYmHyHR4g9hPf0b6qOtBWsZUW21k7a/cL/6z/PnRNzFoH6x8rd5sugdO79B4VEDIvREpCLtMnMaLrP7xlo+v7jHCK4UVCFeNS3OvKKat6O0GEL2xX8Uvnduqj1LSduuhjvSgHGC22JozyX0627kj/A== 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=sCFtQWTk77TMaIV8QgrLv1S9hcmAs7Blyn0qO9scZro=; b=nt1iODPWM/ZXWPA9nWgYU6V+xQc0/8ryQsdLye2Vtt4BIFjIJ7KZkddX6gx84f+M3nEkEffvD+cULh0VSLUBbYIyCyOQFf2aNEp4EWqx5ANjHSAn4sSMuciFi24m+Bv83CRIwihovyaZS9GIxCq2ggQdylIJI8IW5CWDhNVZOjAAzLZ589jYdR+ajab36kIqcIsJQZk7G557S8udfi0njBZvMyIalNebLT5unUqJzhmD9ixOAEpHmAOGxYduGGsxh6pUoBXUI7w2HQ5aDhPik1a5y+9JCdXblcyRscoBd9zuNMj4F0BsbSoBBIbtcHLJwfnfelKu5hMGDndciafy+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.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=sCFtQWTk77TMaIV8QgrLv1S9hcmAs7Blyn0qO9scZro=; b=Vh6XBIBiJ6WLuk5liJyjyeB/hw3+q56IpDEqldTzaUjLz2oXGN28gMOhDtrCtKBvV8de7Ne5ep6cEB3+OTuYLcKhhUoIpT4t2yzxOtS3wJYBUW+BYNTDsxdIfKVKGlZfQoIEvgppn8UR5XzDaI4z+nVUAa92FvK4/Lkat4glzQE= Received: from MW3PR05CA0008.namprd05.prod.outlook.com (2603:10b6:303:2b::13) by CY5PR12MB6178.namprd12.prod.outlook.com (2603:10b6:930:25::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19; Wed, 14 Dec 2022 20:05:39 +0000 Received: from CO1NAM11FT073.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2b:cafe::6e) by MW3PR05CA0008.outlook.office365.com (2603:10b6:303:2b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.5 via Frontend Transport; Wed, 14 Dec 2022 20:05:39 +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 CO1NAM11FT073.mail.protection.outlook.com (10.13.174.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5924.11 via Frontend Transport; Wed, 14 Dec 2022 20:05:39 +0000 Received: from localhost (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.34; Wed, 14 Dec 2022 14:05:37 -0600 From: Michael Roth To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Brijesh Singh Subject: [PATCH RFC v7 58/64] KVM: SVM: Add module parameter to enable the SEV-SNP Date: Wed, 14 Dec 2022 13:40:50 -0600 Message-ID: <20221214194056.161492-59-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221214194056.161492-1-michael.roth@amd.com> References: <20221214194056.161492-1-michael.roth@amd.com> 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-TrafficTypeDiagnostic: CO1NAM11FT073:EE_|CY5PR12MB6178:EE_ X-MS-Office365-Filtering-Correlation-Id: b94b5378-05a6-49e0-6f4e-08dade0e924e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9hK8S6WDAp46n+eq3J3LyrYc1/Fp1Fz/ZfDmq3axijXBMhoVnlYZ76WXY125XrLhAq6BN44sMr5VeAcFGoenGvWn6ZTAjukJYStjEKrHJzyQzrsC8w+j01Jv4Eh7E1hrEJiR6u0Ra+zy6ME4ikztINZCeiNcNQjsS9rLgOjyKrThltWYOHu1yMxkAGtfEytvapDQzHNx26TJlgf4NmiI7BOyqSggKS0upqwGBTOCwcjjk4EgHX2PDbeEsZiA5sugIdE8VlHjXc5u2qApYSAJcEqEydyRNVKU8QGWPN7MyD1ZpL0UPubfaG0tWZ485U9z6xaIoaPjK4fZWoG9TmccJk1GT17UnLKu+MeAyYgur1nb8HCz/YhDMGV/qKLH3OXL0+ioCODWDzGO59p2mPqPpCphcL9UOu6+P0Apu6iWqfsTee3R/Ocas//ILsaFf9A+70KTJqINX2wbehVBCUqL/uxTChTyEVnB15xORPIDqEekjWBF4YvQ1WpG/7ZvFCKozH2boHUtld2yDQgFIbkx+P9E6h5lnxtRzVcLVYxQGH+Mu3620keW7B1uY97fWMZgiosOXeaeuRKszbeLHgc84Y3hZzEumK5EgpH/hw8chVpl9ywXSJgXIlCLKReLlL86g6B0cW8/g/s8eUDFjMnAB48XouDvrfWo4BWwa2hr06Fmuw9cbh+A4Cq9vFYi2Y2Ufkh8Nu1ZLnsc3thCiMveL89LLdxHWD/9CHS7sQhmJHY= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:CA;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(396003)(376002)(39860400002)(136003)(346002)(451199015)(36840700001)(46966006)(40470700004)(83380400001)(356005)(26005)(36756003)(81166007)(478600001)(40460700003)(36860700001)(40480700001)(86362001)(82310400005)(1076003)(47076005)(336012)(186003)(82740400003)(2616005)(426003)(16526019)(44832011)(70206006)(7416002)(8676002)(6916009)(6666004)(5660300002)(7406005)(54906003)(70586007)(4326008)(2906002)(8936002)(316002)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2022 20:05:39.0150 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b94b5378-05a6-49e0-6f4e-08dade0e924e 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: CO1NAM11FT073.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6178 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: A28D940005 X-Stat-Signature: cfqo75t4qfk8iw6ci7okfs7rq7k8na8x X-HE-Tag: 1671048341-810475 X-HE-Meta: U2FsdGVkX1+vPrw2WnzHwjqs6c+uhCQWzJHvsipkOcGB0jehrSu8clTonLz7qcLE+K2N74eO5c4fatsFObRw6vc4dSarFpSqfygkoDHv+f3lmYb5ERlZEGQBaWFNR71R1mFZzfMw+gaDUoppbhEp2fg94HSEV/8uUPjJppWJg4Xw0WUifhs5KQ2EOPHC0Xczydeee43qgF9W/5a8qBOx5Vn+FUAHIAdNcJSzdrEsdVj5Zfy3aSrbMba5sHaa016pVaOjRmAx4YHNJ2n5JyHoAoB2ygHJ25DLCBV1fznn8ldIKUL4MWglJVe1RxkcV1Ts2A3BJiqJaDfwYzxee7Yoyka4SRdNgT5gOyzFdy18NgMHX91TW628A/s/CrSxTIZkvM1aNHeodUPyzmYkNhBuId7zL45JIwaSwo2kJM4D9DVW9AepHF+AcNh7L5P2lxeyE5M2WssVsvTlx+cZD7T+Wv1w4XHD7CuQBDtX3192CXGYV/jjgbZn4UFWaDIPSeGlJ/Ybpa0iujgt1jwROiIKjoLLv49TqKEHYf+GjMF7UlSXbw8ajSQGLY/1xp5G59rNJuQt7Z1IzItOsy6VD2G/aTQUGsNhUT4Kt7lsxHFHaXlDGOyLKSQFVHgujinRzS3y+8UZtNW8DuUlvRPFwrtxKg3+u8+MmLd6f5STsVfWE0giPyObrrM+7TVJSXZoATlisNtk7M85zPODVzA+9hPFXZYETZGUoiOc7BbjWp2AlgS0J0svuzpprWSnbAMh4QzpLJKNYc+gZ9cPQdqdr2cExchC/bX04ubob695zkFmW5mcK6pbzDIVeOmYYG/EWz3pBPXo/VnwfTORyjE9B9hP5P1ol3trsrG5RO/feNYkNsurjOgVT7fofcgYeRGHhps6J14Xn73/cUBRRVbkAtDwcZ/uZL1+ZAmfMuA93y/mcjYx5+0SM6K7p8oau0PickUpZhA2F0QdzIYhDyl3Vuh Sw32Vi/m STPai 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 Signed-off-by: Ashish Kalra Signed-off-by: Michael Roth --- 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 8783b64557e5..b0f25ced7bcf 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -54,14 +54,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 277f53c903c2..4692ada13f02 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -708,7 +708,7 @@ void avic_set_virtual_apic_mode(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;