From nobody Mon Feb 9 20:11:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=citrix.com); dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=2; a=rsa-sha256; t=1667495050; cv=pass; d=zohomail.com; s=zohoarc; b=fUF2a1gKMTgrT8bEzInplWfSCIvLnKJmoWWMLUXloesSFHg95M6f+nUUOfFiSmrjqyhyLU7M606Qc8nTNKqsyoaUVYBy2EMm1aeJhNdhvTm6yNQkIL6yF44XLttOAcv2jVctDJNyiSew6FrUNragNvSFdgpiJA7Fq6Vj2RZKx/Y= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667495050; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N41NuLnpI1Kxzwq/zU/F9XdrxfEQCxO44x4XXoUhJ0M=; b=Mw+p2vM1HUwfFvEi+dZEsb2k51sGmlybNZasQvItwOIA8U8k8lhOQ2t4+NnkvoFS2EOb5gzt5GKABO88ASKt7uxLdz6qadX6QELXAPwpbT6WasAyF4pwko5k+eWPpXv1Kbi5sfVoDJjt/xv1RUyoz2WltcVs2tKv2153wO4sY7w= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=citrix.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1667495050393154.0790936490812; Thu, 3 Nov 2022 10:04:10 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.436939.691200 (Exim 4.92) (envelope-from ) id 1oqdcl-0001Ag-5U; Thu, 03 Nov 2022 17:03:27 +0000 Received: by outflank-mailman (output) from mailman id 436939.691200; Thu, 03 Nov 2022 17:03:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oqdcl-0001AZ-2h; Thu, 03 Nov 2022 17:03:27 +0000 Received: by outflank-mailman (input) for mailman id 436939; Thu, 03 Nov 2022 17:03:26 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oqdck-00019m-Dg for xen-devel@lists.xenproject.org; Thu, 03 Nov 2022 17:03:26 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 6c6b910b-5b99-11ed-91b5-6bf2151ebd3b; Thu, 03 Nov 2022 18:03:24 +0100 (CET) Received: from mail-bn8nam12lp2176.outbound.protection.outlook.com (HELO NAM12-BN8-obe.outbound.protection.outlook.com) ([104.47.55.176]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 03 Nov 2022 13:03:10 -0400 Received: from SJ0PR03MB6360.namprd03.prod.outlook.com (2603:10b6:a03:395::11) by MN2PR03MB5312.namprd03.prod.outlook.com (2603:10b6:208:1e9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Thu, 3 Nov 2022 17:03:07 +0000 Received: from SJ0PR03MB6360.namprd03.prod.outlook.com ([fe80::d197:992c:4dca:3c4c]) by SJ0PR03MB6360.namprd03.prod.outlook.com ([fe80::d197:992c:4dca:3c4c%5]) with mapi id 15.20.5769.021; Thu, 3 Nov 2022 17:03:07 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 6c6b910b-5b99-11ed-91b5-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1667495004; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=Qtv7Cj22TjoQNgd8JyviLQaV2AH3o8KFjKIzwfUD6sU=; b=Pc/G3C09GUE5Itx0InR43597E0yS/2Pp153JnaQ2NjbGPqgHYMVD0XZb HVRdibriix/cTMmeITpFLRMN8TnbRcfWl/QvDYsVxUcqLLskW9K4owrk4 7tCd6VWcX2mOmIFth3LIxUm9vPjnCGvVwJSub42DXtkfTwUkyay5qW5jN w=; X-IronPort-RemoteIP: 104.47.55.176 X-IronPort-MID: 83721395 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED IronPort-Data: A9a23:XrTu5K5VjjaZiGc7+ZXN7gxRtOPGchMFZxGqfqrLsTDasY5as4F+v jNLCG3TPfiOY2v8KY9xO463800HsMDdm4I1GQdv/y5hHi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvynTraBYnoqLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9VU+4pwehBtC5gZkPKkT5weE/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq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dc7VcxLZvsX+9KK1wUh4S1bpXUd WHVKrnlbZrmBKhHjrkV1BUsZORti9ZJGbEfqAA0vbloQS+0koJjXfw//Zv7kvoxKhNNaWs2N 60Q5iA7Is+KPP+TZgNcNvpEvHHfVDlcFbrDF+4B2jBOeUuB0/twqSHk4ndotvaM6A18A== X-IronPort-AV: E=Sophos;i="5.96,134,1665460800"; d="scan'208";a="83721395" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YKR+D5q+wSrXQ/2MeJsnaC79F7hf5REi8lRrQxe0wSWHEYqabe61/kE/ycuGoRC8hpIorkiRuHR6hX0hIxXoWYgUcjLFYd31Akqb4W16oS/r+b85K9AKLwiPA/RWHK36MM6zs78HJDEnEly0MkgZkBi5QvC/Thn+J+bS1A8fGCDDvcSMi2eJVS5DEr8v/HvtTUCbkK2hleEE/zb0HZvUbmJlZVbsrFvoduz+HWirp/JAf1xKyjBwOoiklPAfZ1XIy8U+5zLmc+Hrv2MTzig/iNPrrYfN4ogsxcPudWdoe7GW7i+d6hphB+j+Uj1IdqkmyiA+Dyr6kMdgr9QL5Lg9Ag== 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=N41NuLnpI1Kxzwq/zU/F9XdrxfEQCxO44x4XXoUhJ0M=; b=ZfeL4lIY62sm5RW+b02jWr2uqi4V+8PR7+MUzfddX2Kpm51ngghTopSGyoDjVCvLZPF/ZlIfOHe9Zk7thNTeWOWD+QxF+f2c637uDtpDufXinCkkKuYng2MQhQmViBzdKBkxBGC0w444B8IYaSfu6CWCBSqg1V58redUw3R3gUZEwNP0eRfhzb8w8sOCt6qVnEVDbtbC/IBDsVUcTkmHvB5ksO4aF5KfUUhP9XZCamzpharg2cnm84bq1G4ZHKbpM84Hc/iSZompI5svTB6cVYfMw1PGy6JSLyuCPwqWf2nxbmq9KB/5OfVZs0F2wK/xWzbJEDrKT4DI1hbIkSfAsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N41NuLnpI1Kxzwq/zU/F9XdrxfEQCxO44x4XXoUhJ0M=; b=wskhWr6i1QScDxcmSGHohvsdM+EhUHRiWHg6nbesI1pqDumg4jHUTEvJ21wCQ/4SBGLIcp7g9vi758+SRDdjz9Pnq698gcQPsY9I28GXdLB1RUbA5RDmUCy4h/MrobjIK60iBKfTyYUybTcbQesAr4iNSXd4DcpDYjZ7KY7+jTU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Henry.Wang@arm.com, Roger Pau Monne , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH for-4.17 v3 1/2] amd/virt_ssbd: set SSBD at vCPU context switch Date: Thu, 3 Nov 2022 18:02:43 +0100 Message-Id: <20221103170244.29270-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221103170244.29270-1-roger.pau@citrix.com> References: <20221103170244.29270-1-roger.pau@citrix.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: LO4P123CA0517.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:272::20) To SJ0PR03MB6360.namprd03.prod.outlook.com (2603:10b6:a03:395::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR03MB6360:EE_|MN2PR03MB5312:EE_ X-MS-Office365-Filtering-Correlation-Id: a44c8acd-98bb-4566-752c-08dabdbd476c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uL5FVBOVAnNlZy3DswuFDofwp8RamILugc5Kpt1dMhoEkYPDFJYXXXcNlsrOL8yFlJd9HopLOP6kfWfVO64AW8OWFvgwSdh/Uc3rImbHSGJG+M4PtGEUK59FeBkmnufmQhjv0kTTKXeWRnNHxUls3qbL+/gLqeUC+zqKKA1OSN2PGhPLukxp92YtTzCK85m4Jgaujlz0CN1iPHpAqvFyDeJyUN6oe4qWlmWTNgFPXreS32LSC8tKB2aZA4INhYDOoryCgK4pWISxNZeUjODXQMBp8OuRlGTSuq6hNM/qqn4S5RCJlCBnDa1pn6s48jmFMShR/Zztvx5Ve2GbGOvV5itsfp+L7mT6URqNA+iIWxAbfKrAFIaC+4XOkD4YAyGkqNchxzxNn5InYRtLURQXywdbd0c+BubZIiCbPcxIPjUB3rh3qjxuI+vOFfz1e+Jx8xodpsYha7CUA5d53cRnb5DoGrOrF1a1JcxaQ3DV+REcX5QaVQScMu4gytHyxIfvDe9i/agvbYX/c5IguhAgmSGW4YT2AH3tXNtiDAFbVODeNbFZS2TNGKq1aiL2UO7K+vZkx9/sqEMgG60/Yz7Daxhqpkj9Sj9pgj/tJKWa3DdGKRylq2YP3nT8eES92QDmfXZ8TddGV1FSWdkwcuVTgmu6QLeQpu5GC8TUGFiSpJnIA2xfy6lGDVeZNcrg+JKdmS9z0Pc466P+mghN6FT2zQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR03MB6360.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(366004)(136003)(396003)(346002)(376002)(451199015)(36756003)(5660300002)(86362001)(4326008)(6916009)(82960400001)(38100700002)(316002)(54906003)(8676002)(186003)(1076003)(66946007)(8936002)(83380400001)(6512007)(2616005)(2906002)(478600001)(6666004)(41300700001)(6486002)(26005)(6506007)(66476007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZFRCckt2cW5ZWkJyQWpnRndLajhqWkNtNGZHNXdoMDNGUXpZV2xaaUNPMGow?= =?utf-8?B?cnlwUVdxR0IwSjhHdmUxQU5mK1F0TWh4azNRK0t2dEV0SlF4U3lwTGEyTmlQ?= =?utf-8?B?RFJLODJpbjBJREtSNlZGbUhiWm50VGRtQStuOS9JK3dZZS9XVEFKYVRKOVJB?= =?utf-8?B?Q2NkUHZ2MDNoTjdaanFia0pkdXAweWJGaWtjeGpVdzArV0FxQlVocWlPM3FH?= =?utf-8?B?NjRiMmpDUzNvek5sYTdlSFNxcUJkajhUV3FyNTNmdlovaVBmR3ZsT0ZTUW5B?= =?utf-8?B?Zmg5NjV0dmt4N0dnc1BCdWwzTXRYNUw5bG15dnhKM2FKbjZvU3pENDFhV1pn?= =?utf-8?B?ZVZsd3hLUitHSWZWcXh2eXZOZ1NvRWsraEhJTEkrbmJScnRBTGp1aytNWE83?= =?utf-8?B?YUJ1ZVB1TGM1Si9POEluN3UyL0p4V09hTFdFS2ViR0lVdGZXSzVIMnBka2lB?= =?utf-8?B?TnVoQm9mKzBVVjQxdXBXUzk2cW9QajExUGhQSmRDWURLTXNtZ0NJWHBsZDlR?= =?utf-8?B?aWJxU1RWU3luUDZGdWVDWDdvYjBXRFNHRFpKNTlNeDVlTDVVQVkwR1NXQTVs?= =?utf-8?B?S1E0ZzhZZm1ucnpmc0cyYk9IaTRXU3BGRkh2U1NKQ21oNUVkT1UrMmw5UTkr?= =?utf-8?B?ckFZZG9RdSswRGlWa2pESG1PUUZON0k2UGc0S0U3UVZPWGlEcDNseEd0SUdm?= =?utf-8?B?R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= =?utf-8?B?WFJma3NWcDR5ZGJWRXl3SVFxUkVEdmhXTTRzbzR0Nm9pVHM3cVMwN3J4RzZB?= =?utf-8?B?ZXorb0MvTUFiSFZFMnZzMWxxd0Y3VjFzTHpKS3EwZ3Zkb0ZkZW5kRHN6WktL?= =?utf-8?B?ZXJuMUNNUWV3ZnZ2R3IwNTVHMlc1ZWhHS3pjRTBrMC9YdjBmcFVrTFhrTDR2?= =?utf-8?B?eHE0cFh5WXpTQXpTdVF5YWlXa2N0SWhuY1BRTjFtczAxOGJ5dFN1dHV6ZHlp?= =?utf-8?B?UTRmNUJTYVJFaFVKUFRaSFBLWDNzUWROOW9RMmhzVGVXRVA0UTJ3SlJoWmsv?= =?utf-8?B?bmxMMXNBbnJtVEZxWTdKTG85OTJKODF0M2diQUsrWS83TTc4OVhISkxySkxi?= =?utf-8?B?VUprT2JEVGdaOTFISzJHY1M4VS9qZzRlcFNPd0lYNWZYN3crek5wSVJlRFVj?= =?utf-8?B?enMyZWdSbU50cjAzU2pwVTNibGpEckpUaXNGSU5lRC9CcXlJeVpCdkZBNnlH?= =?utf-8?Q?MbKDZjFfVcscu5IFKchDtV1gM?= X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: a44c8acd-98bb-4566-752c-08dabdbd476c X-MS-Exchange-CrossTenant-AuthSource: SJ0PR03MB6360.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2022 17:03:07.2979 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hL081M3TxKcbGwi1UZWwZO/iWCb8gS8eVmbnbPt70Np7Nizlmk+r8z95qBKG63/Xs+NjoSWIdUvC+uoFYn1P8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR03MB5312 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1667495051145100001 The current logic for AMD SSBD context switches it on every vm{entry,exit} if the Xen and guest selections don't match. This is expensive when not using SPEC_CTRL, and hence should be avoided as much as possible. When SSBD is not being set from SPEC_CTRL on AMD don't context switch at vm{entry,exit} and instead only context switch SSBD when switching vCPUs. This has the side effect of running Xen code with the guest selection of SSBD, the documentation is updated to note this behavior. Also note that then when `ssbd` is selected on the command line guest SSBD selection will not have an effect, and the hypervisor will run with SSBD unconditionally enabled when not using SPEC_CTRL itself. This fixes an issue with running C code in a GIF=3D0 region, that's problematic when using UBSAN or other instrumentation techniques. As a result of no longer running the code to set SSBD in a GIF=3D0 region the locking of amd_set_legacy_ssbd() can be done using normal spinlocks, and some more checks can be added to assure it works as intended. Finally it's also worth noticing that since the guest SSBD selection is no longer set on vmentry the VIRT_SPEC_MSR handling needs to propagate the value to the hardware as part of handling the wrmsr. Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Jan Beulich --- Changes since v2: - Fix calling set_reg unconditionally. - Fix comment. - Call amd_set_ssbd() from guest_wrmsr(). Changes since v1: - Just check virt_spec_ctrl value !=3D 0 on context switch. - Remove stray asm newline. - Use val in svm_set_reg(). - Fix style in amd.c. - Do not clear ssbd --- docs/misc/xen-command-line.pandoc | 10 +++--- xen/arch/x86/cpu/amd.c | 55 +++++++++++++++++-------------- xen/arch/x86/hvm/svm/entry.S | 6 ---- xen/arch/x86/hvm/svm/svm.c | 45 ++++++++++--------------- xen/arch/x86/include/asm/amd.h | 2 +- xen/arch/x86/msr.c | 9 +++++ 6 files changed, 63 insertions(+), 64 deletions(-) diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line= .pandoc index 0fbdcb574f..424b12cfb2 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -2372,10 +2372,12 @@ By default, Xen will use STIBP when IBRS is in use = (IBRS implies STIBP), and when hardware hints recommend using it as a blanket setting. =20 On hardware supporting SSBD (Speculative Store Bypass Disable), the `ssbd= =3D` -option can be used to force or prevent Xen using the feature itself. On A= MD -hardware, this is a global option applied at boot, and not virtualised for -guest use. On Intel hardware, the feature is virtualised for guests, -independently of Xen's choice of setting. +option can be used to force or prevent Xen using the feature itself. The +feature is virtualised for guests, independently of Xen's choice of settin= g. +On AMD hardware, disabling Xen SSBD usage on the command line (`ssbd=3D0` = which +is the default value) can lead to Xen running with the guest SSBD selection +depending on hardware support, on the same hardware setting `ssbd=3D1` will +result in SSBD always being enabled, regardless of guest choice. =20 On hardware supporting PSFD (Predictive Store Forwarding Disable), the `ps= fd=3D` option can be used to force or prevent Xen using the feature itself. By diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c index 98c52d0686..05d72c6501 100644 --- a/xen/arch/x86/cpu/amd.c +++ b/xen/arch/x86/cpu/amd.c @@ -742,7 +742,7 @@ void amd_init_ssbd(const struct cpuinfo_x86 *c) } =20 static struct ssbd_ls_cfg { - bool locked; + spinlock_t lock; unsigned int count; } __cacheline_aligned *ssbd_ls_cfg; static unsigned int __ro_after_init ssbd_max_cores; @@ -753,7 +753,7 @@ bool __init amd_setup_legacy_ssbd(void) unsigned int i; =20 if ((boot_cpu_data.x86 !=3D 0x17 && boot_cpu_data.x86 !=3D 0x18) || - boot_cpu_data.x86_num_siblings <=3D 1) + boot_cpu_data.x86_num_siblings <=3D 1 || opt_ssbd) return true; =20 /* @@ -776,46 +776,51 @@ bool __init amd_setup_legacy_ssbd(void) if (!ssbd_ls_cfg) return false; =20 - if (opt_ssbd) - for (i =3D 0; i < ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS; i++) - /* Set initial state, applies to any (hotplug) CPU. */ - ssbd_ls_cfg[i].count =3D boot_cpu_data.x86_num_siblings; + for (i =3D 0; i < ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS; i++) + spin_lock_init(&ssbd_ls_cfg[i].lock); =20 return true; } =20 -/* - * Executed from GIF=3D=3D0 context: avoid using BUG/ASSERT or other funct= ionality - * that relies on exceptions as those are not expected to run in GIF=3D=3D0 - * context. - */ -void amd_set_legacy_ssbd(bool enable) +static void core_set_legacy_ssbd(bool enable) { const struct cpuinfo_x86 *c =3D ¤t_cpu_data; struct ssbd_ls_cfg *status; + unsigned long flags; =20 if ((c->x86 !=3D 0x17 && c->x86 !=3D 0x18) || c->x86_num_siblings <=3D 1)= { - set_legacy_ssbd(c, enable); + BUG_ON(!set_legacy_ssbd(c, enable)); return; } =20 + BUG_ON(c->phys_proc_id >=3D AMD_FAM17H_MAX_SOCKETS); + BUG_ON(c->cpu_core_id >=3D ssbd_max_cores); status =3D &ssbd_ls_cfg[c->phys_proc_id * ssbd_max_cores + c->cpu_core_id]; =20 - /* - * Open code a very simple spinlock: this function is used with GIF=3D=3D0 - * and different IF values, so would trigger the checklock detector. - * Instead of trying to workaround the detector, use a very simple lock - * implementation: it's better to reduce the amount of code executed - * with GIF=3D=3D0. - */ - while (test_and_set_bool(status->locked)) - cpu_relax(); + spin_lock_irqsave(&status->lock, flags); status->count +=3D enable ? 1 : -1; + ASSERT(status->count <=3D c->x86_num_siblings); if (enable ? status->count =3D=3D 1 : !status->count) - set_legacy_ssbd(c, enable); - barrier(); - write_atomic(&status->locked, false); + BUG_ON(!set_legacy_ssbd(c, enable)); + spin_unlock_irqrestore(&status->lock, flags); +} + +void amd_set_ssbd(bool enable) +{ + if (opt_ssbd) + /* + * Ignore attempts to turn off SSBD, it's hardcoded on the + * command line. + */ + return; + + if (cpu_has_virt_ssbd) + wrmsr(MSR_VIRT_SPEC_CTRL, enable ? SPEC_CTRL_SSBD : 0, 0); + else if (amd_legacy_ssbd) + core_set_legacy_ssbd(enable); + else + ASSERT_UNREACHABLE(); } =20 /* diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S index a26589aa9a..981cd82e7c 100644 --- a/xen/arch/x86/hvm/svm/entry.S +++ b/xen/arch/x86/hvm/svm/entry.S @@ -59,9 +59,6 @@ __UNLIKELY_END(nsvm_hap) =20 clgi =20 - ALTERNATIVE "", STR(call vmentry_virt_spec_ctrl), \ - X86_FEATURE_VIRT_SC_MSR_HVM - /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */ /* SPEC_CTRL_EXIT_TO_SVM Req: b=3Dcurr %rsp=3Dregs/cpuinfo, = Clob: acd */ .macro svm_vmentry_spec_ctrl @@ -131,9 +128,6 @@ __UNLIKELY_END(nsvm_hap) ALTERNATIVE "", svm_vmexit_spec_ctrl, X86_FEATURE_SC_MSR_HVM /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */ =20 - ALTERNATIVE "", STR(call vmexit_virt_spec_ctrl), \ - X86_FEATURE_VIRT_SC_MSR_HVM - /* * STGI is executed unconditionally, and is sufficiently serialisi= ng * to safely resolve any Spectre-v1 concerns in the above logic. diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 1aeaabcb13..8b101d4f27 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -973,6 +973,16 @@ static void cf_check svm_ctxt_switch_from(struct vcpu = *v) =20 /* Resume use of ISTs now that the host TR is reinstated. */ enable_each_ist(idt_tables[cpu]); + + /* + * Clear previous guest selection of SSBD if set. Note that SPEC_CTRL= .SSBD + * is already cleared by svm_vmexit_spec_ctrl. + */ + if ( v->arch.msrs->virt_spec_ctrl.raw & SPEC_CTRL_SSBD ) + { + ASSERT(v->domain->arch.cpuid->extd.virt_ssbd); + amd_set_ssbd(false); + } } =20 static void cf_check svm_ctxt_switch_to(struct vcpu *v) @@ -1000,6 +1010,13 @@ static void cf_check svm_ctxt_switch_to(struct vcpu = *v) =20 if ( cpu_has_msr_tsc_aux ) wrmsr_tsc_aux(v->arch.msrs->tsc_aux); + + /* Load SSBD if set by the guest. */ + if ( v->arch.msrs->virt_spec_ctrl.raw & SPEC_CTRL_SSBD ) + { + ASSERT(v->domain->arch.cpuid->extd.virt_ssbd); + amd_set_ssbd(true); + } } =20 static void noreturn cf_check svm_do_resume(void) @@ -3116,34 +3133,6 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) vmcb_set_vintr(vmcb, intr); } =20 -/* Called with GIF=3D0. */ -void vmexit_virt_spec_ctrl(void) -{ - unsigned int val =3D opt_ssbd ? SPEC_CTRL_SSBD : 0; - - if ( val =3D=3D current->arch.msrs->virt_spec_ctrl.raw ) - return; - - if ( cpu_has_virt_ssbd ) - wrmsr(MSR_VIRT_SPEC_CTRL, val, 0); - else - amd_set_legacy_ssbd(val); -} - -/* Called with GIF=3D0. */ -void vmentry_virt_spec_ctrl(void) -{ - unsigned int val =3D current->arch.msrs->virt_spec_ctrl.raw; - - if ( val =3D=3D (opt_ssbd ? SPEC_CTRL_SSBD : 0) ) - return; - - if ( cpu_has_virt_ssbd ) - wrmsr(MSR_VIRT_SPEC_CTRL, val, 0); - else - amd_set_legacy_ssbd(val); -} - /* * Local variables: * mode: C diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h index 6a42f68542..81ed71710f 100644 --- a/xen/arch/x86/include/asm/amd.h +++ b/xen/arch/x86/include/asm/amd.h @@ -153,6 +153,6 @@ void amd_check_disable_c1e(unsigned int port, u8 value); =20 extern bool amd_legacy_ssbd; bool amd_setup_legacy_ssbd(void); -void amd_set_legacy_ssbd(bool enable); +void amd_set_ssbd(bool enable); =20 #endif /* __AMD_H__ */ diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c index 95416995a5..5609b71e99 100644 --- a/xen/arch/x86/msr.c +++ b/xen/arch/x86/msr.c @@ -24,6 +24,7 @@ #include #include =20 +#include #include #include #include @@ -697,7 +698,15 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t= val) msrs->spec_ctrl.raw &=3D ~SPEC_CTRL_SSBD; } else + { msrs->virt_spec_ctrl.raw =3D val & SPEC_CTRL_SSBD; + if ( v =3D=3D curr ) + /* + * Propagate the value to hardware, as it won't be set on = guest + * resume path. + */ + amd_set_ssbd(val & SPEC_CTRL_SSBD); + } break; =20 case MSR_AMD64_DE_CFG: --=20 2.37.3