From nobody Tue Dec 16 23:58:43 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 580EAC3DA6F for ; Fri, 25 Aug 2023 10:21:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235960AbjHYKVC (ORCPT ); Fri, 25 Aug 2023 06:21:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244440AbjHYKUP (ORCPT ); Fri, 25 Aug 2023 06:20:15 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20C562132; Fri, 25 Aug 2023 03:20:09 -0700 (PDT) Date: Fri, 25 Aug 2023 10:19:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1692958775; h=from:from:sender:sender:reply-to: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; bh=M3V2CB2w7NtzfBHS2mgX/63jRQ3eyxiQmEiR9FpxIwY=; b=VoQxdVnNhFISrRIzNngzX2GHieYJMT6+/UCDAspcVhyBQdjSTZh7n4C/cbYbH8196yd5L6 aaPgoLfqTsxm29CVTvBi6lPubkCQNFIlawQ0sPNn0V1uHqGEj9ZNykyuNKJ1yeoscBL+tM G198TkefFsdIWJc0YSOYC6ubBRxQ0hFHjkRbBgIepDCg0qOoYbMxtlZH3appOk+lOhnv5d sX98dBZEoCOEnStLhyaFGsS3dgkq4eyJbcwotN+0SDBR5QtbINxdgiiu9zvhaaM5PeVdPo 3X+oR7DCSuQPRFGrx6iag/IuNM9JKRrilXef2h0WohyzYFpVLkitqZ6MC1O3Yg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1692958775; h=from:from:sender:sender:reply-to: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; bh=M3V2CB2w7NtzfBHS2mgX/63jRQ3eyxiQmEiR9FpxIwY=; b=JoTYVhbzS1BjmOFgFYmBdChbb6esnBL1ltVn+ebUzlkZj7MjhaE3nIgDNVROz6X72fJg5O N5DyaCRy3acRN7Dg== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/bugs] x86/srso: Don't probe microcode in a guest Cc: Andrew Cooper , Josh Poimboeuf , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <3e293282e96b9fe1835c8bd22d1aaac07d9628e7.1692919072.git.jpoimboe@kernel.org> References: <3e293282e96b9fe1835c8bd22d1aaac07d9628e7.1692919072.git.jpoimboe@kernel.org> MIME-Version: 1.0 Message-ID: <169295877472.27769.14355016220493450885.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/bugs branch of tip: Commit-ID: 3f267f825c98e3b3db0194645ac68ea154eac19d Gitweb: https://git.kernel.org/tip/3f267f825c98e3b3db0194645ac68ea15= 4eac19d Author: Josh Poimboeuf AuthorDate: Fri, 25 Aug 2023 00:01:34 -07:00 Committer: Ingo Molnar CommitterDate: Fri, 25 Aug 2023 11:21:58 +02:00 x86/srso: Don't probe microcode in a guest To support live migration, the hypervisor sets the "lowest common denominator" of features. Probing the microcode isn't allowed because any detected features might go away after a migration. As Andy Cooper states: "Linux must not probe microcode when virtualised.=C2=A0 What it may see instantaneously on boot (owing to MSR_PRED_CMD being fully passed through) is not accurate for the lifetime of the VM." Rely on the hypervisor to set the needed IBPB_BRTYPE and SBPB bits. Fixes: 1b5277c0ea0b ("x86/srso: Add SRSO_NO support") Suggested-by: Andrew Cooper Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Reviewed-by: Andrew Cooper Link: https://lore.kernel.org/r/3e293282e96b9fe1835c8bd22d1aaac07d9628e7.16= 92919072.git.jpoimboe@kernel.org --- arch/x86/kernel/cpu/amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index b08af92..28e77c5 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -767,7 +767,7 @@ static void early_init_amd(struct cpuinfo_x86 *c) if (cpu_has(c, X86_FEATURE_TOPOEXT)) smp_num_siblings =3D ((cpuid_ebx(0x8000001e) >> 8) & 0xff) + 1; =20 - if (!cpu_has(c, X86_FEATURE_IBPB_BRTYPE)) { + if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && !cpu_has(c, X86_FEATURE_IBPB_B= RTYPE)) { if (c->x86 =3D=3D 0x17 && boot_cpu_has(X86_FEATURE_AMD_IBPB)) setup_force_cpu_cap(X86_FEATURE_IBPB_BRTYPE); else if (c->x86 >=3D 0x19 && !wrmsrl_safe(MSR_IA32_PRED_CMD, PRED_CMD_SB= PB)) {