From patchwork Wed May 24 15:53:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Allen X-Patchwork-Id: 98597 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp30940vqr; Wed, 24 May 2023 09:26:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ov6W17YcbhL2DM+vgW0rj2IKwkSx/Dp/uK8n7RC6JKqGTKdvD7SVuATbPpGp7iRBKfMpX X-Received: by 2002:a17:902:b093:b0:1ac:8062:4f31 with SMTP id p19-20020a170902b09300b001ac80624f31mr16973853plr.37.1684945564308; Wed, 24 May 2023 09:26:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684945564; cv=pass; d=google.com; s=arc-20160816; b=bRs6+kapA6xUQKEeoIlJ5xDZer9VnVdJ5oNWjQmv77ZVqygnHgpudY26BZKD/2Y0oR oJWOua4tKRctkpr91fV82pt4PnJ1hI43CJZuO2FG5hXA4OBa2TV2cSq/5hqnjog2GYzY ZPkBXj1d/TQUYB5MbSRf4sPvazmvROLS7vsmDBgYx44a54umWvWzu+8kZaG3IEz4Kf5i 3rIrlI3CSwvErBc2yPhqU47c8+/FFNECZW7M2OoO9YTLz592hslMZpf0a11dSAM8EZi/ R6XmI9+C5YpINIiX9inDHFGqNqx2gQAxbNZFeS2uLUEAGyaDM5hF/+mWCcJl2WO+aQiu uJXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2gFVMMouh7V1LSfGRT5ZG7L0BoHklaeBS0PswjOAMqg=; b=oPEsMChh22it4BmXAXGFZNzENvWSeEzCJGAygl4SglJoeo2Q1Hzl1bM9DsAN3UnptH M+EopF2ADX5jkZzKINP9WTyMgSoXOoQEqgXnmIB8Eul09ikpUh18hNbxTwCNxvYbdG3/ dEzR9N+tKpG+1/HD68lvEwpKzMptFlIxXHd8NQZFx7NhpyDYKqaNLPN34z4fkAZX/z6T LDLlPK0vChhDyhgcEz6ZgtmqICjfCtT0dzbA2Jb5nnS98c1IJNgUUbVsQfxd4XYf26sm j9QrXJ4mJFnxzFV6vq6SyCH2ScbbQs2cIH4afNUKzX2WszndJNVhNmZkbL4jq4/eYQZD +EeQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=EIboHQvp; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a170902f68300b001ae488bbbd0si1617909plg.494.2023.05.24.09.25.51; Wed, 24 May 2023 09:26:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=EIboHQvp; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237673AbjEXPzP (ORCPT + 99 others); Wed, 24 May 2023 11:55:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237571AbjEXPyp (ORCPT ); Wed, 24 May 2023 11:54:45 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCE0697; Wed, 24 May 2023 08:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e0+eRCyNRbwSxw0IF1sL7ubSzgTPTZqgMj1du0IaGLIWsoiv4CM/v7zIjcUJR6nprmZFTHnhQAhiKoPZJsJ+i5z3mQ1OtRRJCQviI9eFOJa/lX3tOlxUFo0+MJS5skZBou5vJruhk3FTv8g9CyuaCTvwQ5nMuQL3NrJhaxLw4c9k7auKVKoUu0x9yedFSF0ws4vAuWnoASd5vDPsGrzVYfuShPW8N9ak10lp4fXK4lisZQ97SgcFBo22xNIUk+zAaD0FKIb+Kf4BgmTXX2SOcw6/v5+ZvVJRsgW8Ly+UjMrnrhx6ipfi67cBhUoyVRNYzh3YAGj/cnOc7DhnBVmsiQ== 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=2gFVMMouh7V1LSfGRT5ZG7L0BoHklaeBS0PswjOAMqg=; b=CqoFUCoJV9I+db/JXM1t5Vz5EBE6QWSbIA3JWi2Y+US3w3apzVokgR6/M3naR08XlBR//2qyERAOhuwC/xbLzdSQ/cR4CeQx6hl/Q5JN0qGWdDTJdbTaC71SVa4sidjhdjpkbU7PwWTRQIyO/9F5dEqErGJcgVbtQx6FPhpVPVKW/KLoMVZPQDI92E/v6JYh0PU9++n3osRcfCpdDZ1lBhYkQdXEGWro5EQrqZmqaqJ7sq4j4M6jYHC7KTKyU/Lu02KbAYtwkT3RvCJXntJTjzF2acFeNlW36kfVLrPvd6k4SlbxhuvVs2k9M0+k1yzOdsJzrLub2tLDj/Co5qPAWg== 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=2gFVMMouh7V1LSfGRT5ZG7L0BoHklaeBS0PswjOAMqg=; b=EIboHQvp0H0pbgX1JfTQ07dH1UAOAESx/K1Ufw4Gqtv9/oonubpvz5FfDMUz6oe0FYfmbd+inEsakUjP6gKktIvCdnK6oi2lojLg/bwc0SgPM1NJd8wtlNa2hi6zweBm5ze+Dad8AzMneF7rG1HTOrHF6A/MCaSo8o71uxMg3xQ= Received: from BN9PR03CA0691.namprd03.prod.outlook.com (2603:10b6:408:ef::6) by BL1PR12MB5779.namprd12.prod.outlook.com (2603:10b6:208:392::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.14; Wed, 24 May 2023 15:54:41 +0000 Received: from BN8NAM11FT049.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ef:cafe::5e) by BN9PR03CA0691.outlook.office365.com (2603:10b6:408:ef::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29 via Frontend Transport; Wed, 24 May 2023 15:54:41 +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 BN8NAM11FT049.mail.protection.outlook.com (10.13.177.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6433.16 via Frontend Transport; Wed, 24 May 2023 15:54:41 +0000 Received: from jallen-jump-host.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.34; Wed, 24 May 2023 10:54:40 -0500 From: John Allen To: CC: , , , , , , , , John Allen Subject: [RFC PATCH v2 6/6] KVM: SVM: Add CET features to supported_xss Date: Wed, 24 May 2023 15:53:39 +0000 Message-ID: <20230524155339.415820-7-john.allen@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230524155339.415820-1-john.allen@amd.com> References: <20230524155339.415820-1-john.allen@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT049:EE_|BL1PR12MB5779:EE_ X-MS-Office365-Filtering-Correlation-Id: b2d65cc9-d563-4dbc-9f49-08db5c6f2fb5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cdl/5UxarJDRwxbcO675vcS5HxFwh3Iawz7mX4Y16Hgt4j+Lfq4SQ8Nqw0+wmgQN5McviVPixkzxWjtqxgdMbIg0TZiG7r9EFyCXpyGi51pVm0youw/Vp+5Psl8UGVO4XCj/PL9qIGhWNQxF+M8HT4ZnKF0sQD9d8S4bEn7kWabxE5hErm9B01GovL2IZyB7AfxDp/QDz4K3olwMduHLggbw+7q1PkG0k9yVsZmlp6RIsRchANEGSP1L9n8DpTqDMu6dVcyq7PUh/OYPJNSSIZb7BlrdZY89gIt/NDI7WBUnQtSIpyooe+YbR4JxlSUa1pZev9I0Ym++U2ER0TjGdXOtGTxFrZfy9690uw1BjK8Hi9FCr3srp145Ca7hlk82z4ubzD7lMg/RWhJgSdIuCG1z8DJnuaaHRnenZsFTLbo3rgG1J6S6tgzgxlz5sFfl8s8K743eqPMCzLk4CYXalWEm2jMQcsonVrf0wcGtMDrFPG5gaACBvTkMEiKrn2HFIs0jljDRFtMlWA73zqoWYFagB8uJy0ZR6tag8qIebiR9gOty6aXV82YnEeEKoO2XAfsA7sW/gkcRgIJHWsYvH5CzoApbhOvvAQ00PNO25wk5syWhi4vZrqaUgVewS8aL3MbAtikt36TQWuU2Qh1Gz5kDXrAQAiUzmqaQNSxWY6z7W/qOyuv2xNM1csa+LMaErVGspo1J5hTL0HDXhh8CDhnQIbr4rN52gzisVVbBu+v+w9TexPulM/8gaGnAfdPemT4CtnF9WEejqhnRI7hOgA== 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:(13230028)(4636009)(39860400002)(346002)(396003)(376002)(136003)(451199021)(36840700001)(40470700004)(46966006)(8936002)(8676002)(47076005)(44832011)(5660300002)(36860700001)(82310400005)(336012)(426003)(186003)(16526019)(1076003)(26005)(81166007)(86362001)(2616005)(82740400003)(356005)(40460700003)(41300700001)(7696005)(70586007)(6916009)(70206006)(4326008)(316002)(40480700001)(36756003)(478600001)(54906003)(4744005)(2906002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 15:54:41.4145 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b2d65cc9-d563-4dbc-9f49-08db5c6f2fb5 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: BN8NAM11FT049.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5779 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766793479957488011?= X-GMAIL-MSGID: =?utf-8?q?1766793479957488011?= If the CPU supports CET, add CET XSAVES feature bits to the supported_xss mask. Signed-off-by: John Allen --- v2: - Remove curly braces around if statement --- arch/x86/kvm/svm/svm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 6afd2c44fdb6..cee496bee0a9 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -5070,6 +5070,10 @@ static __init void svm_set_cpu_caps(void) boot_cpu_has(X86_FEATURE_AMD_SSBD)) kvm_cpu_cap_set(X86_FEATURE_VIRT_SSBD); + if (kvm_cpu_cap_has(X86_FEATURE_SHSTK)) + kvm_caps.supported_xss |= XFEATURE_MASK_CET_USER | + XFEATURE_MASK_CET_KERNEL; + /* AMD PMU PERFCTR_CORE CPUID */ if (enable_pmu && boot_cpu_has(X86_FEATURE_PERFCTR_CORE)) kvm_cpu_cap_set(X86_FEATURE_PERFCTR_CORE);