From patchwork Sat Dec 30 16:19:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 184039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp3163393dyb; Sat, 30 Dec 2023 08:29:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZyoL4oQurP2QlgeKLHQYqqoTZ1B4B4ZdNEZlXW9VNM7SdD5XG6DFJ+dVOZRgoDQEdE/1o X-Received: by 2002:a05:6214:a86:b0:680:d8b:52ee with SMTP id ev6-20020a0562140a8600b006800d8b52eemr10663571qvb.125.1703953793249; Sat, 30 Dec 2023 08:29:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703953793; cv=pass; d=google.com; s=arc-20160816; b=CTg7tx26jq8SzyIfFtJlwm7EDi+eMHO6h+Nk+aga2nWWGTN7S5ED36wT/WRvivJwvL otA7XwWGlm/D3Br460riIjUIMi3UXl5u4oTB6W0T1DjvHg9ZjCQ5M87V2CSmRCmUOaMz vr/OgicwZTqpiZS1ni6r1+NGUZalvL226UhipnAvJXawgGhl1S5zn17ZV5NEIaj5b915 HcyUAIJ/12PQX5jLK6BvBKsYJstgALI4SCKtQ2SuGZdDdUqGUrBHrinPkDb1zCtfGXYh sUmIlpaGPsIM15oKawRFv3p/zda1rpZAGH0OH4QGVeeJ0LRjkKHnD+AamkLNEAjViG6M gYGA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=2kAUVL5Cnrne8lfXqEnlYpDIUVTDcWGqObX7dXNuHFA=; fh=whoFOj2Boh24h05sU5ktjSIpboTXjEyH6CemRvbunI8=; b=haj2fAdUDG/BmmH91E6yGQtOk97cWRqWv0rIRbfAXUK9ZMrMc/hgrvl4Q1bvQKyYZt 2aIzXjCy2X8k5uUh3VYC7lopWkvN8sc8f2l6j8iBVkp8DO9i11864co72dlK4tcbUMcP +Vnla8xtwviP/tjbtmcXHu8FwHZvPA5ZgB281X2rniWL4qcNS2wwFVfEJwpFlzUXCyIz aJiUIcH9Dwfvr/N5RdLFj2PHiiqitCVxHWPqXc0rPU31Kddpt03aaL1p2PjrWKdk2GnU qm8CK/9kdEbw8KO2ZbmZHIyuP4AII2oFNOH7ZOy58Pht+nS1C88KshCrMzlZhpnuW82b fAdw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=JoL2spqj; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-13497-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13497-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id k2-20020a0c9702000000b0067f235c2aa4si21292057qvd.69.2023.12.30.08.29.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 08:29:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13497-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=JoL2spqj; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-13497-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13497-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D893A1C213C4 for ; Sat, 30 Dec 2023 16:29:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B0DE0156C9; Sat, 30 Dec 2023 16:27:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="JoL2spqj" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2056.outbound.protection.outlook.com [40.107.223.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C28F814F7F; Sat, 30 Dec 2023 16:27:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=US/TTr9kFabWWorGOfEian9dQ5vwKsQtFCsKbqEQpCK+6TzhNvP50lCQMZznMhuVR/FaOX6aofFTGIj4k7dQOcQ81i2yilqhE/3UoXCouC/tW81j8WDsw9Vuviom+jtQNZ6r7M3BzolRDwxZ1dBDSXSAorP+6Qfpihugi5B6FEWnzzi2fQhJQ33cqd2YygsPVtuoZoqWV/ZJnksfv8kp08swzKDRI/ik1S+3NPtJnWAtnuUlStYcp+cUPNMhPanENoCcsZcmYET96pwAKTZeF5zov4iSadZjR2Gprqvv9+iBJdH+woenoM0SuVMTSaMPVKHF8+VJBieIQVXWnjMNww== 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=2kAUVL5Cnrne8lfXqEnlYpDIUVTDcWGqObX7dXNuHFA=; b=WfFOxOMOc/gl5dhKyOVjM9alV/Fn1mIzo57mZjyyneEVzeMAG3uh7LzvuXmWczcHjpc2MKDd/iGs2LjTGjxfnO8ZUU10iTNmc1FHQvZKiBf7bUwN2EwB020NReI4dGWi+Jx01PseZnr4qK3SZjyzNQBAvdIgOvjW8n54uqcJ/zM8hMLQtNwGZsv+fwnsDeT8I7RTtQ0VBud492VerVYyiPZuln7k66VcIk1scC+dHbML3J8dKvwXq9++jbyaDSr+ckc/tnB3h/Qa6VO7t8efS7Do9AIe88ozUKBUj56SxeYwOb/pZ3O69XD26cuCocyv5PvBctzJbKPyPAxR8DNVIA== 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 (0) 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=2kAUVL5Cnrne8lfXqEnlYpDIUVTDcWGqObX7dXNuHFA=; b=JoL2spqjNL+1Gaz9sJsEK5gKUOz6ATfxIvucuRJbRPvdTz7/S5cORLdf+lfZmhZUeDGTl5rSf4bsNtg08H5ahUXGalw/WkUV7dJ28MZuvtwa4z6sMUxH7haGJjmnC5O/Nf4KaP2/3FvKVxAIG8hBPr3ML2UDSFFZQXKv7sA7Ifk= Received: from DM6PR06CA0077.namprd06.prod.outlook.com (2603:10b6:5:336::10) by MW4PR12MB7481.namprd12.prod.outlook.com (2603:10b6:303:212::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.23; Sat, 30 Dec 2023 16:26:59 +0000 Received: from DS1PEPF00017098.namprd05.prod.outlook.com (2603:10b6:5:336:cafe::46) by DM6PR06CA0077.outlook.office365.com (2603:10b6:5:336::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.21 via Frontend Transport; Sat, 30 Dec 2023 16:26:58 +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 DS1PEPF00017098.mail.protection.outlook.com (10.167.18.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7159.9 via Frontend Transport; Sat, 30 Dec 2023 16:26:58 +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.2507.34; Sat, 30 Dec 2023 10:26:58 -0600 From: Michael Roth To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v1 23/26] x86/cpufeatures: Enable/unmask SEV-SNP CPU feature Date: Sat, 30 Dec 2023 10:19:51 -0600 Message-ID: <20231230161954.569267-24-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231230161954.569267-1-michael.roth@amd.com> References: <20231230161954.569267-1-michael.roth@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: DS1PEPF00017098:EE_|MW4PR12MB7481:EE_ X-MS-Office365-Filtering-Correlation-Id: 58f029b1-4130-45cf-1d1e-08dc0954255f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p1HhkywFCAEpqDjelHj2ZGxlEno6mQe0uEG0hAQsyGJ9eM3d6SGmYZ0HJWJp41eNu5/L5gZfsmO+StBGIX/2UiSeMVkd82E9kU7yDiGwK/o8zVbpqMypoF7Wl1REDz4kj0GrmrYoy+RCTkCJXVWBngPCt7M63Nbqj03Q2kem4tW2/0bnQq7V5KYZLLI9McDlMgUQaOfofnSGgxlqI1s1NjXNzUrdfpCHzeJpYI+6+MmnSDVBdFaFvuaPJperUlCaDCSM40FFrAnl4omRqaLOF1BG71zLbTqJaeoEMnbPgY+MrZ9ob41Z3njAwhdoTkaA334yXS1KHXvaCx8ro8ptpVqA10upkfXQ8Gs19SqBtpf1zPaMof74rnAnKN0enxnM2iAHrKc61cBSO1Op6icBk02Rq/Huu/DKGQjqnlaGS4m6M1h7AedmnCJ+7NRBXKQ2qrHM9H94EY28E7U77e77uI6lXjPb6gb1NJLSTNEQ32fu7bd4zFSmRujE3qw0LD801yLtNP/Ghn2EsJarlEaUQwN7oXJIxGUOxKe+vW0NV5Zhz2NI8ehQjnZMrCorXXR79aTto/nJKOmVhr70u/0WYrnbeiB2NRQbAAsS2cGn5cixuJlK3noqzQn2avIQsKrV4LOiaLGec76CrCyekksyQFxDMdi+6PMakiVPKJaG2MnI1126nRmOja6OYxUtnzx9usucUjHPOACDerHQtWFGH0entG0gM/BxXHTMGqZdC6+945cW3Rlg35a5d7atTlXIipU/STVkxttZ3rgfQJGqPwOmPgzMpDd4+vyi7neWL/pUWy6S7HErsOxkWJMesJr1 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:(13230031)(4636009)(376002)(396003)(136003)(39860400002)(346002)(230922051799003)(451199024)(1800799012)(82310400011)(186009)(64100799003)(36840700001)(46966006)(40470700004)(336012)(16526019)(26005)(1076003)(83380400001)(426003)(2616005)(6666004)(36860700001)(47076005)(7406005)(7416002)(5660300002)(4744005)(4326008)(44832011)(41300700001)(2906002)(478600001)(316002)(8676002)(8936002)(54906003)(70586007)(70206006)(6916009)(86362001)(36756003)(81166007)(356005)(82740400003)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2023 16:26:58.8035 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58f029b1-4130-45cf-1d1e-08dc0954255f 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: DS1PEPF00017098.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7481 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786725052874514487 X-GMAIL-MSGID: 1786725052874514487 With all the required host changes in place, it should now be possible to initialize SNP-related MSR bits, set up RMP table enforcement, and initialize SNP support in firmware while maintaining legacy support for running SEV/SEV-ES guests. Go ahead and enable the SNP feature now. Signed-off-by: Michael Roth --- arch/x86/include/asm/disabled-features.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/include/asm/disabled-features.h b/arch/x86/include/asm/disabled-features.h index a864a5b208fa..3332d2940020 100644 --- a/arch/x86/include/asm/disabled-features.h +++ b/arch/x86/include/asm/disabled-features.h @@ -117,7 +117,11 @@ #define DISABLE_IBT (1 << (X86_FEATURE_IBT & 31)) #endif +#ifdef CONFIG_KVM_AMD_SEV #define DISABLE_SEV_SNP 0 +#else +#define DISABLE_SEV_SNP (1 << (X86_FEATURE_SEV_SNP & 31)) +#endif /* * Make sure to add features to the correct mask