From nobody Fri Nov 29 04:45:28 2024 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=1651056501; cv=pass; d=zohomail.com; s=zohoarc; b=SppnaNoRIelN05tpKlS/hFy8zs9QfFa8b8LEztentF5xssYTdbb2mGBd3a+mM8KBQYuoue8YEdjshC8ty22DUkPUpK13TKC3kuKuYPk6GfE6R4TPS6mSADxPgiA4nR8e/ATduSnqb3qlOX4XBHIl5v18V2qSQE26lmphZATdKNo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651056501; 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=z12lg9DG0wvGLeF3XX3a2VomQuQ550jjqifJz8ePXvE=; b=jr0E20MHI9STKb3L4OfeU0llQX0YlCOPT/xN9H7qF9Go94ipgGywrCl13+fQhZsYd9wLOpZs9pMN3UHRhwAHIJ8yleFdPEs8NFrUxI9/wSoV5KCpXmjR4XcpTLrpvN0FbOrGmYqYeeuQ5ESOBXh/9XyBQx243ZhUPCv9eySWxuI= 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 1651056501657419.21200067152006; Wed, 27 Apr 2022 03:48:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.314860.533143 (Exim 4.92) (envelope-from ) id 1njfD9-0002y8-FI; Wed, 27 Apr 2022 10:47:55 +0000 Received: by outflank-mailman (output) from mailman id 314860.533143; Wed, 27 Apr 2022 10:47:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1njfD9-0002y0-Br; Wed, 27 Apr 2022 10:47:55 +0000 Received: by outflank-mailman (input) for mailman id 314860; Wed, 27 Apr 2022 10:47:54 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1njfD8-0002LY-Bc for xen-devel@lists.xenproject.org; Wed, 27 Apr 2022 10:47:54 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 7c427951-c617-11ec-8fc2-03012f2f19d4; Wed, 27 Apr 2022 12:47:52 +0200 (CEST) Received: from mail-bn7nam10lp2109.outbound.protection.outlook.com (HELO NAM10-BN7-obe.outbound.protection.outlook.com) ([104.47.70.109]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 27 Apr 2022 06:47:50 -0400 Received: from DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) by DM5PR03MB3403.namprd03.prod.outlook.com (2603:10b6:4:43::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.21; Wed, 27 Apr 2022 10:47:48 +0000 Received: from DS7PR03MB5608.namprd03.prod.outlook.com ([fe80::5df3:95ce:4dfd:134e]) by DS7PR03MB5608.namprd03.prod.outlook.com ([fe80::5df3:95ce:4dfd:134e%4]) with mapi id 15.20.5186.021; Wed, 27 Apr 2022 10:47:48 +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: 7c427951-c617-11ec-8fc2-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1651056472; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=BpP0m7aKbLABzlgc2LX2HlH4wa0142cM46ZjDoJX6eY=; b=htk4p4878Gp0Xzb52RijzVkziUAAxCBKEjTtC7aouZLEAVUV3cSbWppu 9G0Y563Xi/luvZ3LUKmHLkSuHu537MTqykIFAHUvxOdipH0XT2sK1ZL/Y p/KDWZeMkNr2aPZ/CG4ewE8eO0OvLG4v6EPzWot7p1XHzBZ57WymMS2xL Y=; X-IronPort-RemoteIP: 104.47.70.109 X-IronPort-MID: 72483422 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED IronPort-Data: A9a23:mECP9KMFyhjdZP/vrR3RlsFynXyQoLVcMsEvi/4bfWQNrUoj0zBTn DAYWzyGPf7cZDDwfNtwPNiw8ENU6pCAzYdjHgto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdleF+lH1dOKJQUBUjclkfJKlYAL/En03FFcMpBsJ00o5wbZl2NAw2rBVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu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TyaWDRKEopaFC6q gpFmko/1IPRw== X-IronPort-AV: E=Sophos;i="5.90,292,1643691600"; d="scan'208";a="72483422" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CwL18PuxYiUSYXw1mfZo4CE9EtW1nAdyiz3XuNCS5OVi5J4JGH/qVW2iN5ApP4EhO7gi9kdPJANq9G73Rk5KiibkqsmkABWTsX5Bet+iXJMmKZkMD5oVRWpz0K3/sdGmu/Syg2jSMfV9D6NqqJa99Mnv5oGaFKlZOd1+YNnVFXhtwLpAiwhT5KvzXC/6QXj2ZloEWXwy7WQW335vcmMo40lEAy4uPvxBM8+DICuh+2FAjg+n5yfY506ZhCb4niuWTWU0PVha7DMyiVauYLwU7vQFfZ881+4huJZfX9KAbLeCN8BrZHpGtxe1HmVkPdtw25tHUxabcYavdeneQEnQ3g== 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=z12lg9DG0wvGLeF3XX3a2VomQuQ550jjqifJz8ePXvE=; b=RtTXLaPO4GF1HsvCHr0+FINX809520fZj/k46blPLVnmhSp6oMjo3de++nYb93R+lzleBeSJy1Ju6RoXE9Ct/X/NJfJCsRvyHdQ+n0kGpmcE+GoFljdrpND1tnZb3Uxli5XfEhJfZU+YIGfjX3exw9bKSPphhj/CedYTVhh636RJiITW0gzbKScmru5a8QhEd/Npja4IDmx7mCHN5x9njqsjD33QmNU3MEFFzRHtdfPhCy9IMTKyeOgHMyV9uS2AJdQRUQY0outcctOMYBbhQLhId9Va2+onsHk1YKb911IJspHWc2oe0DMx9tKizC+h16GoPYl/jIW1pq3XK7SYrw== 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=z12lg9DG0wvGLeF3XX3a2VomQuQ550jjqifJz8ePXvE=; b=I7538quEMle03dYlt9D3+d/sCUZkioAkjlYB+X/y+t+uG5W7YWNunn/vZpWw5ynJyedkOW+cJp90wYI6nzYvw5noBkHi6Kzh0kiQILcZwaQHnSCTWARQfbGJtbR3bUoOEjvQ9fImAvKCNWsfwobb87otP4QbQu9lRZClEo9P94o= 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: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu Subject: [PATCH v4 3/3] amd/msr: implement VIRT_SPEC_CTRL for HVM guests using legacy SSBD Date: Wed, 27 Apr 2022 12:47:18 +0200 Message-Id: <20220427104718.81342-4-roger.pau@citrix.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220427104718.81342-1-roger.pau@citrix.com> References: <20220427104718.81342-1-roger.pau@citrix.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: LO2P265CA0304.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::28) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 04e68e45-9edc-42a3-f8cc-08da283b5e8f X-MS-TrafficTypeDiagnostic: DM5PR03MB3403:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +KX6jJb0kutyHhzD0I8J+waPvkHnUStq10QFwfq3DvlPGvwNrBQS+ORF0daBa8ucZucHHpnYWDGx34e+IpzS+mXMmfr8ARhPo8Fi3E0PGOZCk6iainldPrFXWhSTQTIAXd6dpmo1vNU2InTdztS4vtkbcZ4N0c3/L36Gz2eLW2J/Y3MvT4gSsM3WC2yUl9FI8OkiRrriJY8A4Ymrh84VOt3Cmd8if/LLImOcWP7v9xCGYGWx6Oygw7B6UFUbbXZUt/Iatmkv+iKTY59+cwHLKPW5npPXrWIIguGq24+j581SvYAfS6l/3eizaxHvYhcJG2mEqbbbjmcrCHt1y4rLfT3nwxIq8gtkTMOb8XcfciUS+gwBW3WIDYocyFAkGlu0PCMj4xFQDFXD4RZaIjGNz1lyzAu4TDfhEcujDzuX/oyYEpc1dPACB78696UWtbnsPEtbzCYFA7Eh7+j1dFDNaKZTGFtmvRyGdSWtU5XjiLslR8deduYCxj/UnHBqF5/OQRfXguA2QWBPZPN1dmcB/9fzXK6IhzI1NHHGSX5QWiP6DWIKfyGMK7vQFd6YFHyviG4VHh8wzetMbsmkaNQFE1IvxHiZrOnalNcokv2bgmeUrL+bYleCln+Z0tejd75qp2Fa0MVB18EqQDVP4RyWukjoYs1uKqDqADKwd8guLdo7zAKYgpvhGvIrpoK36M0nUMTJL/MXzygODz3b1PTlGEAXKwsSYnnpy6lEltmxadxnI1NPZzNwr/zk6SNuxG8hgs9wc2Bph903INSPXEdsiItYcaKqEi1TEZdEBKpxPqA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(508600001)(966005)(6486002)(6666004)(8676002)(66476007)(66946007)(86362001)(4326008)(66556008)(6916009)(54906003)(38100700002)(36756003)(82960400001)(6506007)(1076003)(6512007)(316002)(83380400001)(2906002)(26005)(186003)(5660300002)(8936002)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-Message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25SNktRZ1B2OE42c1VyTzJCU25sYTJNU284c2lZaXZsYXppSUx2VFF4cnNI?= =?utf-8?B?YW9VOVM4RnVyYi9EcWliNlZvRVR6Tjh6VytoOFdoWS9ZZlEwRkQ1L2ptQnpW?= =?utf-8?B?WjR3RlhQczNJa3VTT1ZLR3dyUitqd2ptaGVpYytuQ0RaUDBZVzdZUjdsRG5u?= =?utf-8?B?Nm5kVUhNQ0wveDl3STA0U3Y5MTd5b1RCRGxBNFJmbnl5eDZFbjJCaFFWZksy?= =?utf-8?B?Z3NFQ0FRazN5eWwvZUtid0I4Q3VBZExIWU8rbS9YZFdzWkRaMHVqSXd5S3BW?= =?utf-8?B?c1FRZjBCRHZobzhGMzUzTmx4VmU3b0lCdHBodzdaUTkvWC9QUFQzdDh4YWpv?= =?utf-8?B?U29udUY0RnhoTFRDRjVaTjFxWlhzZ2c5ZVZ0eTFpWmdBajlXNFErMHdJSldy?= =?utf-8?B?WGRVRDl4T1BwdzBoWXNqSTlJTk1jQ2tCbEFwVm13c1VGb2hLV1h1Y1hKT0VY?= =?utf-8?B?VnZRM2l2Z1c5OW1UaVcyK042Q0Y3UVdKK0MvV2hOVHE0NnB0RzdnVzMrcGc3?= =?utf-8?B?L1JMd1RDUncyVVVDUFE3WHEzM1ZhNDVEbVpxVlhLOElDeDB1dnpPOEcySXhC?= =?utf-8?Q?syxRIgWj0yGfpRJ8=3D?= X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04e68e45-9edc-42a3-f8cc-08da283b5e8f X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2022 10:47:48.2583 (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: gji5NHHtghA0t5WwpjUQspkvClDM+SVBFsO/I2asCS566eGvuV402ZeyforX/brpyZm9lu+J5qxoUzkOPJsOfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB3403 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1651056502931100003 Expose VIRT_SSBD to guests if the hardware supports setting SSBD in the LS_CFG MSR (a.k.a. non-architectural way). Different AMD CPU families use different bits in LS_CFG, so exposing VIRT_SPEC_CTRL.SSBD allows for an unified way of exposing SSBD support to guests on AMD hardware that's compatible migration wise, regardless of what underlying mechanism is used to set SSBD. Note that on AMD Family 17h and Hygon Family 18h processors the value of SSBD in LS_CFG is shared between threads on the same core, so there's extra logic in order to synchronize the value and have SSBD set as long as one of the threads in the core requires it to be set. Such logic also requires extra storage for each thread state, which is allocated at initialization time. Do the context switching of the SSBD selection in LS_CFG between hypervisor and guest in the same handler that's already used to switch the value of VIRT_SPEC_CTRL. Suggested-by: Andrew Cooper Signed-off-by: Roger Pau Monn=C3=A9 --- Changes since v3: - Align ssbd per-core struct to a cache line. - Open code a simple spinlock to avoid playing tricks with the lock detector. - s/ssbd_core/ssbd_ls_cfg/. - Fix log message wording. - Fix define name and remove comment. - Also handle Hygon processors (Fam18h). - Add changelog entry. Changes since v2: - Fix codding style issues. - Use AMD_ZEN1_MAX_SOCKETS to define the max number of possible sockets in Zen1 systems. Changes since v1: - Report legacy SSBD support using a global variable. - Use ro_after_init for ssbd_max_cores. - Handle boot_cpu_data.x86_num_siblings < 1. - Add comment regarding _irqsave usage in amd_set_legacy_ssbd. --- xen/arch/x86/cpu/amd.c | 119 ++++++++++++++++++++++++++++----- xen/arch/x86/cpuid.c | 10 +++ xen/arch/x86/hvm/svm/svm.c | 5 ++ xen/arch/x86/include/asm/amd.h | 4 ++ xen/arch/x86/spec_ctrl.c | 4 +- 5 files changed, 124 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c index 4999f8be2b..a911e2e50a 100644 --- a/xen/arch/x86/cpu/amd.c +++ b/xen/arch/x86/cpu/amd.c @@ -48,6 +48,7 @@ boolean_param("allow_unsafe", opt_allow_unsafe); =20 /* Signal whether the ACPI C1E quirk is required. */ bool __read_mostly amd_acpi_c1e_quirk; +bool __ro_after_init amd_legacy_ssbd; =20 static inline int rdmsr_amd_safe(unsigned int msr, unsigned int *lo, unsigned int *hi) @@ -685,23 +686,10 @@ void amd_init_lfence(struct cpuinfo_x86 *c) * Refer to the AMD Speculative Store Bypass whitepaper: * https://developer.amd.com/wp-content/resources/124441_AMD64_Speculative= StoreBypassDisable_Whitepaper_final.pdf */ -void amd_init_ssbd(const struct cpuinfo_x86 *c) +static bool set_legacy_ssbd(const struct cpuinfo_x86 *c, bool enable) { int bit =3D -1; =20 - if (cpu_has_ssb_no) - return; - - if (cpu_has_amd_ssbd) { - /* Handled by common MSR_SPEC_CTRL logic */ - return; - } - - if (cpu_has_virt_ssbd) { - wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0); - return; - } - switch (c->x86) { case 0x15: bit =3D 54; break; case 0x16: bit =3D 33; break; @@ -715,20 +703,117 @@ void amd_init_ssbd(const struct cpuinfo_x86 *c) if (rdmsr_safe(MSR_AMD64_LS_CFG, val) || ({ val &=3D ~mask; - if (opt_ssbd) + if (enable) val |=3D mask; false; }) || wrmsr_safe(MSR_AMD64_LS_CFG, val) || ({ rdmsrl(MSR_AMD64_LS_CFG, val); - (val & mask) !=3D (opt_ssbd * mask); + (val & mask) !=3D (enable * mask); })) bit =3D -1; } =20 - if (bit < 0) + return bit >=3D 0; +} + +void amd_init_ssbd(const struct cpuinfo_x86 *c) +{ + if (cpu_has_ssb_no) + return; + + if (cpu_has_amd_ssbd) { + /* Handled by common MSR_SPEC_CTRL logic */ + return; + } + + if (cpu_has_virt_ssbd) { + wrmsrl(MSR_VIRT_SPEC_CTRL, opt_ssbd ? SPEC_CTRL_SSBD : 0); + return; + } + + if (!set_legacy_ssbd(c, opt_ssbd)) { printk_once(XENLOG_ERR "No SSBD controls available\n"); + if (amd_legacy_ssbd) + panic("CPU feature mismatch: no legacy SSBD\n"); + } else if (c =3D=3D &boot_cpu_data) + amd_legacy_ssbd =3D true; +} + +static struct ssbd_ls_cfg { + bool locked; + unsigned int count; +} __cacheline_aligned *ssbd_ls_cfg; +static unsigned int __ro_after_init ssbd_max_cores; +#define AMD_FAM17H_MAX_SOCKETS 2 + +bool __init amd_setup_legacy_ssbd(void) +{ + unsigned int i; + + if ((boot_cpu_data.x86 !=3D 0x17 && boot_cpu_data.x86 !=3D 0x18) || + boot_cpu_data.x86_num_siblings <=3D 1) + return true; + + /* + * One could be forgiven for thinking that c->x86_max_cores is the + * correct value to use here. + * + * However, that value is derived from the current configuration, and + * c->cpu_core_id is sparse on all but the top end CPUs. Derive + * max_cpus from ApicIdCoreIdSize which will cover any sparseness. + */ + if (boot_cpu_data.extended_cpuid_level >=3D 0x80000008) { + ssbd_max_cores =3D 1u << MASK_EXTR(cpuid_ecx(0x80000008), 0xf000); + ssbd_max_cores /=3D boot_cpu_data.x86_num_siblings; + } + if (!ssbd_max_cores) + return false; + + ssbd_ls_cfg =3D xzalloc_array(struct ssbd_ls_cfg, + ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS); + if (!ssbd_ls_cfg) + return false; + + for (i =3D 0; i < ssbd_max_cores * AMD_FAM17H_MAX_SOCKETS; i++) + /* Record initial state, also applies to any hotplug CPU. */ + if (opt_ssbd) + ssbd_ls_cfg[i].count =3D boot_cpu_data.x86_num_siblings; + + return true; +} + +void amd_set_legacy_ssbd(bool enable) +{ + const struct cpuinfo_x86 *c =3D ¤t_cpu_data; + struct ssbd_ls_cfg *status; + + if (c->x86 !=3D 0x17 || c->x86_num_siblings <=3D 1) { + BUG_ON(!set_legacy_ssbd(c, enable)); + return; + } + + 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]; + + /* + * 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(); + status->count +=3D enable ? 1 : -1; + ASSERT(status->count <=3D c->x86_num_siblings); + if (enable ? status->count =3D=3D 1 : !status->count) + BUG_ON(!set_legacy_ssbd(c, enable)); + barrier(); + write_atomic(&status->locked, false); } =20 void __init detect_zen2_null_seg_behaviour(void) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c index 9a8c73f067..7607155875 100644 --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86/cpuid.c @@ -544,6 +544,16 @@ static void __init calculate_hvm_max_policy(void) if ( !boot_cpu_has(X86_FEATURE_VIRT_SC_MSR_HVM) ) /* Clear VIRT_SSBD if VIRT_SPEC_CTRL is not exposed to guests. */ __clear_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset); + else + /* + * Expose VIRT_SSBD if VIRT_SPEC_CTRL is supported, as that implie= s the + * underlying hardware is capable of setting SSBD using + * non-architectural way or VIRT_SSBD is available. + * + * Note that if the hardware supports VIRT_SSBD natively this sett= ing + * will just override an already set bit. + */ + __set_bit(X86_FEATURE_VIRT_SSBD, hvm_featureset); =20 /* * If Xen isn't virtualising MSR_SPEC_CTRL for HVM guests (functional diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index e15c9754d7..cee11bb244 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -3126,6 +3126,8 @@ void vmexit_virt_spec_ctrl(void) =20 if ( cpu_has_virt_ssbd ) wrmsr(MSR_VIRT_SPEC_CTRL, val, 0); + else + amd_set_legacy_ssbd(opt_ssbd); } =20 /* Called with GIF=3D0. */ @@ -3138,6 +3140,9 @@ void vmentry_virt_spec_ctrl(void) =20 if ( cpu_has_virt_ssbd ) wrmsr(MSR_VIRT_SPEC_CTRL, current->arch.msrs->virt_spec_ctrl.raw, = 0); + else + amd_set_legacy_ssbd(current->arch.msrs->virt_spec_ctrl.raw & + SPEC_CTRL_SSBD); } =20 /* diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h index a82382e6bf..6a42f68542 100644 --- a/xen/arch/x86/include/asm/amd.h +++ b/xen/arch/x86/include/asm/amd.h @@ -151,4 +151,8 @@ void check_enable_amd_mmconf_dmi(void); extern bool amd_acpi_c1e_quirk; 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); + #endif /* __AMD_H__ */ diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c index 0d5ec877d1..495e6f9405 100644 --- a/xen/arch/x86/spec_ctrl.c +++ b/xen/arch/x86/spec_ctrl.c @@ -22,6 +22,7 @@ #include #include =20 +#include #include #include #include @@ -1073,7 +1074,8 @@ void __init init_speculation_mitigations(void) } =20 /* Support VIRT_SPEC_CTRL.SSBD if AMD_SSBD is not available. */ - if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && cpu_has_virt_ssbd ) + if ( opt_msr_sc_hvm && !cpu_has_amd_ssbd && + (cpu_has_virt_ssbd || (amd_legacy_ssbd && amd_setup_legacy_ssbd()= )) ) setup_force_cpu_cap(X86_FEATURE_VIRT_SC_MSR_HVM); =20 /* If we have IBRS available, see whether we should use it. */ --=20 2.35.1