Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp128001lqs; Thu, 13 Jun 2024 06:04:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/0VOL/vaKY9P5YfgM8pqFgdxWAxI7DgkQeFLEutezQoZud2Ml0wLLfUB9Y6abvJqYV/TjdbbuY4YTuhbNilXYw1Z9ti8Tuf5gVGrUyA== X-Google-Smtp-Source: AGHT+IETJGYNFS/BryK143BgF7NXlvBUnhyKhm9643493tIxrHGR8krxJacp0o7pwutq334Rz0Bo X-Received: by 2002:a25:ae24:0:b0:dc7:497e:cddf with SMTP id 3f1490d57ef6-dfe6765b487mr4820555276.33.1718283866289; Thu, 13 Jun 2024 06:04:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718283866; cv=pass; d=google.com; s=arc-20160816; b=l2t8P65IcEEA98Zs/EYl35o9/3g48dGaTdAIhPB5EZN5WIbQWyASd2jpSNc9CPxQLS T3ZLcoZiWtCWjKC0DPBxVNhh6jAmzcEMbyVLRVLsJTyzXRr33sVXRgsBdnzYZxISH7hL QeLNrWKzHguO4zPhlLdA8sjZORJXk6uC4ysL6JDzhF6XM51PW7DBU1m77Xi4KZm2K8/g m+I9z3KA/2aMwO+CtfSVl3gwOFRZHy316ccHi+pzNratmPG6rwpuzUG+/fombBFmC7vl vLguZLLGzTYBcyZJ7S/Sgbn8FS08LP0Ukyeu0V7vvXwJtpuyOeV+4W2zvS5danB73jWJ mgEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=H/3iuphe/fIWOpdHUippxColCYX9TrQ9EQsd6uv0J2A=; fh=gy7Z1QtfIS3vd0RlCmBOaQUAcWaXMnk01qaaSts6W7o=; b=zqN0zOF5qbD0c8+aT610YUyXidn5I52ujSkgLfjsGb0CGBXgzh2I6iY2/NICa31vmF +laJsRKEEIu9MZIJDd4Nq4OVYJhmxUK55iY//hpyqo2+AtRh0gQR3iP+GufuLqT9RbRl OqscIeH3A5pJShQF5bWq2djAex0rB2zyfpy7MxHePVHR3QIalfHpJkuM6EZW9QXRYgTB x6vAcBECYau9cnPA5zRN3CkWeiit2bkKJOQTTHrgZFMNYm68w94wVOVup5VoX5KyUYqv E18DkjZxdZMafyg1Zej1xMTz0naVMf0rO2VrY0Ym5pOofb57LXDJ+JNkVh/G2Kt67pMw 3x4Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ytyL+Chq; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=kQ1oyxPn; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-213251-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213251-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 3f1490d57ef6-dff045e2c73si395179276.51.2024.06.13.06.04.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 06:04:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213251-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ytyL+Chq; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=kQ1oyxPn; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-213251-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213251-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 00A691C217ED for ; Thu, 13 Jun 2024 13:04:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D540143895; Thu, 13 Jun 2024 13:04:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ytyL+Chq"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kQ1oyxPn" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 033631EEE0; Thu, 13 Jun 2024 13:04:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718283860; cv=none; b=FZS5TLF9QMtr0m42oXvwnYT1rkhPcwDDJ28y6bt+w7ctqAcWDXOnht2rXhd63ve2p/JBjGnXKD45mzOldPbBSlES2K3p28ewoBRe4oSq6uWZxgNYs4voRPh6W+mIsggyFoGIWZz2mkXNOQGidAxRWd4ySCqmVzV4vV/3PAOvgvg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718283860; c=relaxed/simple; bh=mKAl+a9mmmclcosB7j5A0sAeDvfxEAyVo6VDqHuuXQ0=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=Is61WxHVt5U8AaVXfof7js+Kn39r92UFKc7CsX0agAWf2enIZLLMMgFBnJHgHGmKkuUITRTMYN5mgd18dkBqXSeD8GEE+yy6u4dyOGoXXYyZ50XbnBXJRsM6YIAKsAEbeHiwIyFEzhpp16DPT3zBbYhTyzsrk0VM4zyJZJzELkE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ytyL+Chq; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=kQ1oyxPn; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Thu, 13 Jun 2024 13:04:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718283856; 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=H/3iuphe/fIWOpdHUippxColCYX9TrQ9EQsd6uv0J2A=; b=ytyL+ChqQjidiIFqxK8MU9d8/+448qkLt6zmdtlx7DCkvugCVmSzZrJE/tkf/JYPGHoXuJ /bWKWSq0M0MncobM781xP9Bbfcn9MVA/pAXmRwWORjzsAQNlfBCrO4/TL8SpKhRV9ka34o t3Oumd0H8MywIFMRf+FjCI+WxdjxrUl8Pju5YwuZwZkWLRnQaFlGXFBZL/Tz2wlzaIvnWi XJsJdJZmQh8iU+g5km2qMRQZ8L1z+nTxQQnDtB8LErKL9Y6dX7JwAbu3dv4qRrqniJTETA T5N/JeeUsQA2XR99CbxcgpYR5651Y+BzD/jWTJTZLRcuoAaDiyD+Miva4q2x4A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718283856; 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=H/3iuphe/fIWOpdHUippxColCYX9TrQ9EQsd6uv0J2A=; b=kQ1oyxPnCrsTznNHpdSKLaiJDAw5tOKkaALaGA4Sj4ABZFgh/ATNlL93zdMEa2s1R+UNGB wU5oZSIPc2VmXjDQ== From: "tip-bot2 for Mateusz Guzik" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cpu] x86/CPU/AMD: Always inline amd_clear_divider() Cc: Mateusz Guzik , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240613082637.659133-1-mjguzik@gmail.com> References: <20240613082637.659133-1-mjguzik@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171828385610.10875.14518435557314345594.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/cpu branch of tip: Commit-ID: 501bd734f933f4eb5c080b87936e9d43f471d723 Gitweb: https://git.kernel.org/tip/501bd734f933f4eb5c080b87936e9d43f471d723 Author: Mateusz Guzik AuthorDate: Thu, 13 Jun 2024 10:26:37 +02:00 Committer: Borislav Petkov (AMD) CommitterDate: Thu, 13 Jun 2024 14:40:29 +02:00 x86/CPU/AMD: Always inline amd_clear_divider() The routine is used on syscall exit and on non-AMD CPUs is guaranteed to be empty. It probably does not need to be a function call even on CPUs which do need the mitigation. [ bp: Make sure it is always inlined so that noinstr marking works. ] Signed-off-by: Mateusz Guzik Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20240613082637.659133-1-mjguzik@gmail.com --- arch/x86/include/asm/processor.h | 12 +++++++++++- arch/x86/kernel/cpu/amd.c | 11 ----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index cb4f6c5..a75a07f 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -692,7 +692,17 @@ static inline u32 per_cpu_l2c_id(unsigned int cpu) #ifdef CONFIG_CPU_SUP_AMD extern u32 amd_get_highest_perf(void); -extern void amd_clear_divider(void); + +/* + * Issue a DIV 0/1 insn to clear any division data from previous DIV + * operations. + */ +static __always_inline void amd_clear_divider(void) +{ + asm volatile(ALTERNATIVE("", "div %2\n\t", X86_BUG_DIV0) + :: "a" (0), "d" (0), "r" (1)); +} + extern void amd_check_microcode(void); #else static inline u32 amd_get_highest_perf(void) { return 0; } diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 44df3f1..be5889b 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -1220,14 +1220,3 @@ void amd_check_microcode(void) on_each_cpu(zenbleed_check_cpu, NULL, 1); } - -/* - * Issue a DIV 0/1 insn to clear any division data from previous DIV - * operations. - */ -void noinstr amd_clear_divider(void) -{ - asm volatile(ALTERNATIVE("", "div %2\n\t", X86_BUG_DIV0) - :: "a" (0), "d" (0), "r" (1)); -} -EXPORT_SYMBOL_GPL(amd_clear_divider);