From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2918927FD4F for ; Wed, 12 Aug 2026 07:42:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786520555; cv=none; b=auF2MGovPRh5RedlPISG7i2u0ZBg52KGYO/HcsbDeWcUsgm0wLaMKHAxyV96PwOtzDcvMviWLZSkGdyKKxne6YXgzbIi6cD7LBP6BrV+Ww50MpFyfRpTFv7NhjIfa4m+AIRBmsiAOOQqQ/QwpHgxzEa10MIf0vcaIQixUh0wGHc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786520555; c=relaxed/simple; bh=4QEvNJOcg2DH22aJEJgIoY5WejDiWG2sqe6WEyhW54A=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GyUwH5zUtRTvRQn31q8lKAv0/9KM3uXsWnXiKvT9KI7RJYQYv7qwq/7HUHz/+gkQzuJ7ceRNOGok+wb5RLEd6zZiSM8h6C9uWDG43RoTYnOiBgiLX10fSrwAEWzQt9JzUU5nQK6vN+Be/f7vimCdYdvJnui8RgorC8gwqQ6mAO0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MivWXtoo; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MivWXtoo" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-47f7027ca11so359456f8f.3 for ; Wed, 12 Aug 2026 00:42:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786520550; x=1787125350; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=xDlUymzYH5qGZ8x4wOLV+ZUwGNw/karbkHQKYgOmugk=; b=MivWXtoohr79J6tO2lq0u09MyogjAkKyMGzYaVMhesnEsgq1M3ZYjJubbdrf7vcCN5 4uLwuqyw9Snlta5WdX/pJzVj2vUM+yLXbifjHc9fow+nbKyK7mip5m6l6FFUL9Pef2DO 9fAizJwjnkvdFr5sTOBNqp3EmuiJwUq53XghfaAq40zGRpyphwhvAx4D+fdAM8LU8sKb 0biZpkDjCYB7gLpkmZtv+VB6AHc4mz7vAZXaywG28ng/Y1VVkbIVwTtQ9OTYdChCGKjA xmVCeInFLhFLye0Gu6+47MTgKBGmqEl1vURW1ZrffIeTMJmBpWolnH6wrpS61b+oGBmN QvOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786520550; x=1787125350; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=xDlUymzYH5qGZ8x4wOLV+ZUwGNw/karbkHQKYgOmugk=; b=T1xyY9BhhGsSeQl/SP1Nq4vgBjbdU0gWLcU1TG5nvZM0vQ9AkqzdxsueXUAhtvuhm5 n+llzUsjbny+MuAqiBQNqo01JlAn8F6tLsltAbjn+/bdDp3NJwFZqWPQn1NSbASJTTsr NUzldHcy6Le4MOVc3BK5WbSwECXdpjrSKJYx9kiSPz7fNnnEuCDN1e3BuaQ5eLyEuwBq Q//MZozD4i7IlJhHoVOqf7F4y2LRQbM2j/thxDT/x41VBcjo6ojOi9tQhTef2IsH20iE SoY3A0/q3jlv5aVCuvVNTuQyXaDH0CzONlEVwwJyX56kmVBWMDoPGcpzD8688l6xPGix zhnQ== X-Forwarded-Encrypted: i=1; AHgh+RoBBwcmnDHGxIFtho6xJ3cl7KtfCALmLaxpCE9lnoTW6LZVQDWDpMit0NdeqjLuDvhL+cuQ65W6Q/OSAlI=@vger.kernel.org X-Gm-Message-State: AOJu0YyGMu+rc2m5TEwMJ/GO/yUq+oss/pj8ZOgk9tUNezzEFUQIkziC GjE3aMW+jMQysTLf/zOKHoV4XHSuZdYRBIDJGHA+MNHrHWQ90pyF9I47 X-Gm-Gg: AR+sD134MtNR441LPcbh4z2tAi7OKmYaPQeNDTJJ3Qx+jcxHYn6YWTuUdCEpfe0v68g TYi5FW/P+1l4J9Y4j6rrgWa0IAQO8ym1z2nnkJT4IcO9aokzhk7LKSlvLlysWRyZXng1Zy+b2rg RCDSOdGTYTiYuOXYkO3+9Dz6do6zb17VCVxbUF0NsWg8TRaf/JiBaHFzJp7DPrcMP1NxlWvQCUS bqCfD0RgBETF1MDIrHpi12vZHA9KVVg8BSOa4p4jTeiulf63wzrDC/XV/I97RXlMWYQfb/Lf8N5 97Ttfs4HBDG7MRmLm3NwzRWfzJnZ16KkfbAT4+8scomfXAW4T9CVvoj2tj/o6K//1Z8TnuwrCzs xQvFiTASw1aPAL2MQirmnAfB3TA+3H9vCEYk2gF1rf0bYnd2Ja/+jLTjg+ujyMq9AZC5oDWXSF2 7Ki+hjpu/wChqf0KW5aotvVqMawRFjfOfck35eFNbAJdLhvppH/Q5+tUC7NJiu+TSbOJc7vsurI K9+4V91pGZ2nor7e3N8V+DnUJA= X-Received: by 2002:a5d:5f04:0:b0:481:4697:8808 with SMTP id ffacd0b85a97d-48152cbb647mr3790254f8f.22.1786520550537; Wed, 12 Aug 2026 00:42:30 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48150c06b73sm5092600f8f.12.2026.08.12.00.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2026 00:42:30 -0700 (PDT) Date: Wed, 12 Aug 2026 08:42:28 +0100 From: David Laight To: Borislav Petkov Cc: Sean Rhodes , Mario Limonciello , x86@kernel.org, "Rafael J. Wysocki" , Pavel Machek , Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/pm: Save AMD CPUID leaf 7 across S3 Message-ID: <20260812084228.66e7a3dd@pumpkin> In-Reply-To: <20260804184920.GBanI0MCMbnglz7Ncc@fat_crate.local> References: <4430d02d34617dd2d3cb506202fe44d5e45c053b.1785838418.git.sean@starlabs.systems> <20260804184920.GBanI0MCMbnglz7Ncc@fat_crate.local> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 4 Aug 2026 11:49:20 -0700 Borislav Petkov wrote: > + Mario. > > On Tue, Aug 04, 2026 at 11:13:41AM +0100, Sean Rhodes wrote: > > Some AMD systems return from S3 with the boot CPU CPUID leaf 7 > > override MSR reset. On Byte/Cezanne, CPUID leaf 7 EBX becomes > > 0x219c9fb9 on CPU0 after S3 even though XTEST still raises #UD. > > Userspace can then select RTM-optimised glibc paths and fault after > > resume. > > Do you have the latest BIOS on that machine? > > > The x86 suspend code already has a small MSR save/restore list for > > firmware-modified MSRs and restores it after resume microcode has been > > loaded. Add MSR_AMD64_CPUID_FN_7 for the AMD families that can modify > > this MSR during CPU init so the pre-suspend CPUID mask is restored > > before tasks are thawed. > > > > This covers family 17h, 19h, and 1Ah: > > Why? > > > family 17h has the Cyan Skillfish > > RDSEED leaf-7 quirk, family 19h covers the observed Cezanne issue, and > > family 1Ah has the Zen5 RDSEED leaf-7 quirk. > > Those RDSEED quirks need more details as to why they need to be applied here. > > > Tested on StarBook Mk V (Byte/Cezanne, 26.07 firmware): > > - without this restore, dmesg showed "ACPI: PM: Low-level resume complete" > > and "PM: suspend exit"; the post-S3 CPUID probe showed CPU0 leaf 7 EBX > > 0x219c9fb9 with hle=1 rtm=1 while XTEST still raised #UD. > > - a temporary PM resume hook clearing the same MSR logged > > "CPU0 MSR_AMD64_CPUID_FN_7 0x219c9fb9 -> 0x219c97a9"; the post-S3 probe > > showed hle=0 rtm=0 on all CPUs. > > - this patch booted on Byte and registered the MSR save path; dmesg showed > > "x86/pm: AMD family 0x19 CPU detected"; pm_test freezer/devices/platform/ > > processors/core passed with the same boot ID. > > For future patches: testing goes... > > > > > Tested-by: Sean Rhodes > > Signed-off-by: Sean Rhodes > > --- > > <-- here, under that line. > > > arch/x86/power/cpu.c | 15 +++++++++++++++ > > 1 file changed, 15 insertions(+) > > > > diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c > > index 702f30eaf9c4..b85061f4cee4 100644 > > --- a/arch/x86/power/cpu.c > > +++ b/arch/x86/power/cpu.c > > @@ -467,9 +467,24 @@ static int msr_save_cpuid_features(const struct x86_cpu_id *c) > > return msr_build_context(cpuid_msr_id, ARRAY_SIZE(cpuid_msr_id)); > > } > > > > +static int msr_save_amd_leaf7_cpuid_features(const struct x86_cpu_id *c) > > +{ > > + u32 cpuid_msr_id[] = { > > + MSR_AMD64_CPUID_FN_7, > > + }; > > + > > + pr_info("x86/pm: AMD family %#x CPU detected, saving CPUID leaf 7 MSR across suspend.\n", > > I guess pr_info_once() is fine here. Would be more informative in the restore path if the value is wrong. David > > Thx. >