From mboxrd@z Thu Jan 1 00:00:00 1970 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 8463847DD4F; Thu, 2 Jul 2026 10:16:03 +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=1782987364; cv=none; b=OBGTVhzq4fGBQV6LpNPPv+FxotAm/a8qqzbZG0FpgK31CuFJiLyIMsNVt/CRP5VkNjQYLuokaEHoOMKoNY/WkKWqM3JvhfxRyM0ed2Gj/3c6jDCZmz6gBMjeoqkdNLKG6/7anSHSuzjbv9CforJ5/S70VJX4YtPvynPePfuGUwU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782987364; c=relaxed/simple; bh=MQb9+kS1ylNyaMShC78Xvg9mxioDyGJasvxvSJf0X9E=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=F1UO4m6J/H3vS9ck5GEpfVPPJoZYZ35zln/Cg0YYA1buslmaSFbjJQcNLa4qEFbHTN3r/EKA8hYRhGUDyxBRgtqF36B+I9TuRGkIsZX7EgAAO79J91vx3i41EUGbr+1eWuAqx4XmnGxqyRiLe2AOdVDxndxb9GqdKVPuftCOtto= 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=I/8HjQZA; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=faE6XqAV; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="I/8HjQZA"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="faE6XqAV" Date: Thu, 02 Jul 2026 10:16:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1782987362; 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=XqKORoXCkSTydKTPHG07F7t6txpbAeULrnWSFwJ1nJU=; b=I/8HjQZAGIKMRlp6jONM7AOBlCsnT4hsebfHLI2Vle+Wr858k2QyUfzduSrjE+fr4sr5kT Y+rPrk5k6ehCYi2O4OBD/ysJl9FsuvOGwyYJI4e0btlzIaoSUKswdhp8vuIzhtMyHTaaOX FQpvw/7dnC7ha4LeOD///6DLDMez1KcbJIeU4+YH2OJXJMNKiEl5su6MCUbySYG7tTa7wG S/elEjIi0+z/3OXFxD8ZVSVElQJAYNmKoqj1WVV4d78gSk+L7RTeYteKXpIFh3iz1IoEdO 34MvfTX/dBuSIb4O+0cdHRsK12Lb6ZSqTr5N1F0BlHmj3IuhqtmoHSP3pZ3uQA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1782987362; 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=XqKORoXCkSTydKTPHG07F7t6txpbAeULrnWSFwJ1nJU=; b=faE6XqAVEdJXL56dKB2sVblulrlBv8Ne+6aPwcyz8Jlf70f7t9xy1/gGoPKso+ySDgy2Zv CT4ZU+qfS/wzheDQ== From: "tip-bot2 for Juergen Gross" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/msr] x86/amd: Stop using 32-bit MSR interfaces Cc: Juergen Gross , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260629060526.3638272-13-jgross@suse.com> References: <20260629060526.3638272-13-jgross@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178298736037.3843924.3726541404604741012.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: quoted-printable The following commit has been merged into the x86/msr branch of tip: Commit-ID: 9c6be5e789818f6577507ce42fc4b70f0fd44303 Gitweb: https://git.kernel.org/tip/9c6be5e789818f6577507ce42fc4b70f0fd= 44303 Author: Juergen Gross AuthorDate: Mon, 29 Jun 2026 08:05:03 +02:00 Committer: Ingo Molnar CommitterDate: Thu, 02 Jul 2026 11:54:52 +02:00 x86/amd: Stop using 32-bit MSR interfaces The 32-bit MSR interfaces rdmsr(), wrmsr() and rdmsr_safe() are planned to be removed. Use the related 64-bit variants instead. Signed-off-by: Juergen Gross Signed-off-by: Ingo Molnar Link: https://patch.msgid.link/20260629060526.3638272-13-jgross@suse.com --- arch/x86/kernel/cpu/amd.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 487ac14..169e373 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -113,7 +113,7 @@ static void init_amd_k5(struct cpuinfo_x86 *c) static void init_amd_k6(struct cpuinfo_x86 *c) { #ifdef CONFIG_X86_32 - u32 l, h; + struct msr val; int mbytes =3D get_num_physpages() >> (20-PAGE_SHIFT); =20 if (c->x86_model < 6) { @@ -160,13 +160,13 @@ static void init_amd_k6(struct cpuinfo_x86 *c) if (mbytes > 508) mbytes =3D 508; =20 - rdmsr(MSR_K6_WHCR, l, h); - if ((l&0x0000FFFF) =3D=3D 0) { + rdmsrq(MSR_K6_WHCR, val.q); + if ((val.l & 0x0000FFFF) =3D=3D 0) { unsigned long flags; - l =3D (1<<0)|((mbytes/4)<<1); + val.l =3D (1 << 0) | ((mbytes / 4) << 1); local_irq_save(flags); wbinvd(); - wrmsr(MSR_K6_WHCR, l, h); + wrmsrq(MSR_K6_WHCR, val.q); local_irq_restore(flags); pr_info("Enabling old style K6 write allocation for %d Mb\n", mbytes); @@ -181,13 +181,13 @@ static void init_amd_k6(struct cpuinfo_x86 *c) if (mbytes > 4092) mbytes =3D 4092; =20 - rdmsr(MSR_K6_WHCR, l, h); - if ((l&0xFFFF0000) =3D=3D 0) { + rdmsrq(MSR_K6_WHCR, val.q); + if ((val.l & 0xFFFF0000) =3D=3D 0) { unsigned long flags; - l =3D ((mbytes>>2)<<22)|(1<<16); + val.l =3D ((mbytes >> 2) << 22) | (1 << 16); local_irq_save(flags); wbinvd(); - wrmsr(MSR_K6_WHCR, l, h); + wrmsrq(MSR_K6_WHCR, val.q); local_irq_restore(flags); pr_info("Enabling new style K6 write allocation for %d Mb\n", mbytes); @@ -207,7 +207,7 @@ static void init_amd_k6(struct cpuinfo_x86 *c) static void init_amd_k7(struct cpuinfo_x86 *c) { #ifdef CONFIG_X86_32 - u32 l, h; + struct msr val; =20 /* * Bit 15 of Athlon specific MSR 15, needs to be 0 @@ -228,11 +228,12 @@ static void init_amd_k7(struct cpuinfo_x86 *c) * As per AMD technical note 27212 0.2 */ if ((c->x86_model =3D=3D 8 && c->x86_stepping >=3D 1) || (c->x86_model > 8)= ) { - rdmsr(MSR_K7_CLK_CTL, l, h); - if ((l & 0xfff00000) !=3D 0x20000000) { + rdmsrq(MSR_K7_CLK_CTL, val.q); + if ((val.l & 0xfff00000) !=3D 0x20000000) { pr_info("CPU: CLK_CTL MSR was %x. Reprogramming to %x\n", - l, ((l & 0x000fffff)|0x20000000)); - wrmsr(MSR_K7_CLK_CTL, (l & 0x000fffff)|0x20000000, h); + val.l, ((val.l & 0x000fffff) | 0x20000000)); + val.l =3D (val.l & 0x000fffff) | 0x20000000; + wrmsrq(MSR_K7_CLK_CTL, val.q); } } =20 @@ -614,12 +615,13 @@ clear_sev: =20 static void early_init_amd(struct cpuinfo_x86 *c) { - u32 dummy; + u64 val; =20 if (c->x86 >=3D 0xf) set_cpu_cap(c, X86_FEATURE_K8); =20 - rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy); + rdmsrq_safe(MSR_AMD64_PATCH_LEVEL, &val); + c->microcode =3D (u32)val; =20 /* * c->x86_power is 8000_0007 edx. Bit 8 is TSC runs at constant rate