From patchwork Mon Feb 20 18:38:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 13146978 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 E7E2FC6379F for ; Mon, 20 Feb 2023 18:59:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 886E86B0080; Mon, 20 Feb 2023 13:59:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 80F3B6B0081; Mon, 20 Feb 2023 13:59:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 688D36B0082; Mon, 20 Feb 2023 13:59:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 568616B0080 for ; Mon, 20 Feb 2023 13:59:50 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 26B32120704 for ; Mon, 20 Feb 2023 18:59:50 +0000 (UTC) X-FDA: 80488584540.10.214F0FF Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2089.outbound.protection.outlook.com [40.107.243.89]) by imf13.hostedemail.com (Postfix) with ESMTP id 2DBC520014 for ; Mon, 20 Feb 2023 18:59:46 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=3CBYj510; spf=pass (imf13.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.243.89 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); 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=1676919587; 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=AnmyPryN/heSuGOFY8VRmqMvbLRbxeGy7ersAZFqHrs=; b=YAk5COwUF+fhDCiZn2exAb9sU4jFcViindA9Y6CZiuMR31YiCXOqFqoEc8VKyCZSCc8xcF VD8/151EK1nZFnItx1zq5zs1Sw2Axbr1uQtQDLIIortQ+iMsXbDvDJbOqWwyamzKv+JMJS sMMuUsgOEBPpiNjKs/Z+er55EEz/xRg= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b=3CBYj510; spf=pass (imf13.hostedemail.com: domain of Michael.Roth@amd.com designates 40.107.243.89 as permitted sender) smtp.mailfrom=Michael.Roth@amd.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=amd.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1676919587; a=rsa-sha256; cv=pass; b=4FEvQo9N7O9LARGgO491wmzXcKWXY34Y6yFRF5++45SL+ALOMAHwY+pRuWJmMl0ZfuC7a/ 06VfCR4KmVd0xYve0qneLd3lqbe899E2LfFyibFUQBQUJfUhUJs2YN/thLQP7sWENSWDZN 18g2hL66hU2hP3OvLH7e3KQcW13dPo4= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W2aenU3s6cZD5hVCPjgOAoPTP2W6rpwaGeyZr83O6oQmUVFM4kuTcJt6HKSjhWX19hO2dOBfdpmMSgPqyTn1t9RLJfARFZkvE0tUH0IgceK6WT8/8FSNFBTDM4zf/0vSqxfTZPxzRjBT2vD7VbgpMhddkYyojjzbKs/v02IDznlB/U0zvsHWvdjuIsg18WXdDlMuFE+a87dYKnwvSGToljI8gdvNPXYaaE35T/eOdMlxsh+DioN0OvoR3H0l0wspm8veTfneXVA+L5N0Yldz8MLjTNkAfdA/i7IJ9kna610n9upu7pSsuTebYMNf7X+Dzev8Zi7jYu8lLZ3X8EaNdw== 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=AnmyPryN/heSuGOFY8VRmqMvbLRbxeGy7ersAZFqHrs=; b=cyK72mdA3W40+GoElJkksYkV12Nto+lYHLiMJ/ICUDyoEJ3KVjyZg/NuIXRcNbHoaUuYSxNC3+mBGGy8D1gC7glvcPb765MhP4FyhqAlJR9daQ37SRiCFf2iRrkO8gwuhtWypydJZDHimaFDeTwAG4VwAXG7w0oc8Z7C7A0TpA9T03/AvGIxpmqHqA5J5k92Zbtm16uGEtIMccecPPbKsWjD/jUUeK5mQqbGtxfC/jC5u0HdBGdjrfF79MVf5SlE0w1UwbiSA4qaOrUZEUS74Vr1o0hEaP3dmKtR8Xq979/6OjULjQ+j1q15EstqVgmHLviXERNvZeGS7hN8615DUg== 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=AnmyPryN/heSuGOFY8VRmqMvbLRbxeGy7ersAZFqHrs=; b=3CBYj510JB/Xi9kZ6Rl3hpwED5tzOJQUeTWTpyiRgMGVC9uF5d1tQ9FoovDjnYQG9HiisJNLUy1rFsklT2loKSWjAYNcQOh7pWeh/EL6jWbxpvvI70zyxICUQbEl4tuv6/k+MZrf4Rr5YyL+RTa9h2Udlzd/jh8F5zwGLo6Br4Q= Received: from BL0PR01CA0014.prod.exchangelabs.com (2603:10b6:208:71::27) by SJ2PR12MB8112.namprd12.prod.outlook.com (2603:10b6:a03:4f8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.19; Mon, 20 Feb 2023 18:59:44 +0000 Received: from BL02EPF000108EA.namprd05.prod.outlook.com (2603:10b6:208:71:cafe::65) by BL0PR01CA0014.outlook.office365.com (2603:10b6:208:71::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.20 via Frontend Transport; Mon, 20 Feb 2023 18:59:44 +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 BL02EPF000108EA.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6134.14 via Frontend Transport; Mon, 20 Feb 2023 18:59:40 +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; Mon, 20 Feb 2023 12:59:37 -0600 From: Michael Roth To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Brijesh Singh Subject: [PATCH RFC v8 51/56] KVM: SVM: Add module parameter to enable the SEV-SNP Date: Mon, 20 Feb 2023 12:38:42 -0600 Message-ID: <20230220183847.59159-52-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230220183847.59159-1-michael.roth@amd.com> References: <20230220183847.59159-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: BL02EPF000108EA:EE_|SJ2PR12MB8112:EE_ X-MS-Office365-Filtering-Correlation-Id: 52d75de6-2d76-454e-aea0-08db1374a0ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sTe4xAMoq5qs8YNKgQysFoV6mcA4pIKYsNbhB2cFfiIcPw1x9RKRny+Z0hBatdIf5FTLLRcg5W3wDysgVBdYh1lfTi7F6Fs1nIN+tNkGEI7oppP90DgN0+cbjwYXpGkHSyL2IuypupiJIqHW/vn4uTd26PcIBsW1dW/BIeuj47sIAeDxq7r07GE39CrjJY5dE4KA6u6gSpX3EISmF4BJj1OlZIzsOH+J7dEAKgy0Rz2QpDHH8BLdg1EkuWLVuQ5YkyYqzo0TH8tjs7Hq1/STP0quYMEHxvXJMe4eGnympgGX4dsIbHhDzgR0PtjQAhYsBwRKzqmEj+tqYYF8OrxmXgVM4Fav1RC5OGt1CvMVveBnmonxPe7lo3p9idQx/jjiuDONs9bFaoEEI9SB1hDsXG1u0eCT3sqz32timjJHqipHfV2AH1w5sUaxhmBut+pCCtWe+Sb7JnSRSKg8NxD6qhjL3lRuT5CVA+/bRTPJn6JKzXK6ZpU//6c4rMCnaOZ/dPRmhojKEBc89kR01n8Wa4OD3vFk7PAYmkIyTqiGzfeJBbxg40YN7aasn8Kt1rMk/rAvpv0ta39uKFqPKcBmCVAoJTMbbJbo0mnyvKq6cV1JsdQ/L1X8r/GuzwRZHSsWESr13zeqafFB42q2Pnn2cjiDsCg12Rew/TRfpSqA3D9/3Ta4Cl7EMw5FbbmtXTnw3QhjPKqJH7tiEBJPmNXrqOeain0aINXfviAd7s6VDFo= 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:(13230025)(4636009)(39860400002)(136003)(396003)(376002)(346002)(451199018)(36840700001)(40470700004)(46966006)(40460700003)(41300700001)(83380400001)(54906003)(70586007)(316002)(2616005)(6916009)(4326008)(8936002)(6666004)(1076003)(8676002)(70206006)(426003)(47076005)(26005)(336012)(186003)(16526019)(478600001)(36756003)(40480700001)(2906002)(82310400005)(82740400003)(356005)(7406005)(44832011)(5660300002)(36860700001)(7416002)(81166007)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2023 18:59:40.8781 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 52d75de6-2d76-454e-aea0-08db1374a0ee 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: BL02EPF000108EA.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8112 X-Rspamd-Queue-Id: 2DBC520014 X-Stat-Signature: qwtzpw5jut3m7upqoupr6qkyiaw9f1b9 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1676919586-849618 X-HE-Meta: U2FsdGVkX19EgV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Ij7I43Ndjf+YHaRd6mKbtlmmPIDkV/Yva9ezAj45I0BRDmfhU3i1S5+8q4yI8YIcMh00yZkAJw5d8IlK7YhFAw2y48AMpUzpuZLPZqJfsd15la1NlCUEU38F9DxVB05UlXMoS08oIIysY2Uu5EaWc2sKivCxa/ZIzfSulU5df9KobmjxrsNHtHJnXR9BwW4WgQIbzaSbG8kjz0i3rS/9c2W0fumnm41CD9zzhMvjk27bBbcfs7XEbWsgqQX4/d5ptivfygmFSZk= 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 bedec90d034f..70d5650d8d95 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -55,14 +55,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 857b674e68f0..221b38d3c845 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -694,7 +694,7 @@ void avic_refresh_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;