FAILED: patch "[PATCH] platform/x86/amd/pmc: Restore msg_port on amd_stb_s2d_init()" failed to apply to 6.1-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 9cef693bce96bb4c6952f48d855284cf7fa4f367
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090307-boss-eatable-41c7@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 9cef693bce96bb4c6952f48d855284cf7fa4f367 Mon Sep 17 00:00:00 2001
From: Mario Limonciello <[email protected]>
Date: Tue, 21 Jul 2026 13:17:51 -0500
Subject: [PATCH] platform/x86/amd/pmc: Restore msg_port on amd_stb_s2d_init()
error paths
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
dev->msg_port is switched to MSG_PORT_S2D before issuing the S2D SMU commands but is only restored to MSG_PORT_PMC on the success path. The early "return -EIO" and "return -ENOMEM" leave the port stuck on MSG_PORT_S2D, so all subsequent SMU communication - including the s2idle prepare/restore handlers - is directed at the wrong mailbox.
Consolidate the exit path through a single label so the message port is always restored.
drivers/platform/x86/amd/pmc/mp1_stb.c +15 -9
@@ -289,7 +289,7 @@ int amd_stb_s2d_init(struct amd_pmc_dev *dev)u32 phys_addr_low, phys_addr_hi;u64 stb_phys_addr;u32 size =0 ; -int ret; +int ret =0 ;if (!enable_stb)return 0 ;
@@ -307,8 +307,10 @@ int amd_stb_s2d_init(struct amd_pmc_dev *dev) dev->msg_port =MSG_PORT_S2D ;amd_pmc_send_cmd (dev,S2D_TELEMETRY_SIZE , &size, dev->stb_arg.s2d_msg_id, true); -if (size !=S2D_TELEMETRY_BYTES_MAX ) -return -EIO ; +if (size !=S2D_TELEMETRY_BYTES_MAX ) { + ret = -EIO ; + goto out; + }/* Get DRAM size */ ret =amd_pmc_send_cmd (dev,S2D_DRAM_SIZE , &dev->dram_size, dev->stb_arg.s2d_msg_id, true);
@@ -321,12 +323,16 @@ int amd_stb_s2d_init(struct amd_pmc_dev *dev) stb_phys_addr = ((u64 )phys_addr_hi <<32 | phys_addr_low); -/* Clear msg_port for other SMU operation */ - dev->msg_port =MSG_PORT_PMC ; - dev->stb_virt_addr =devm_ioremap (dev->dev, stb_phys_addr, dev->dram_size); -if (!dev->stb_virt_addr) -return -ENOMEM ; +if (!dev->stb_virt_addr) { + ret = -ENOMEM ; + goto out; + } -return 0 ; + ret =0 ; + +out: +/* Restore the default message port for subsequent SMU operations */ + dev->msg_port =MSG_PORT_PMC ; +return ret; }
Sasha Levin
maintainerPATCH 1/2 platform/x86/amd/pmc: Move STB functionality to a new file for better code organization
From: Shyam Sundar S K <[email protected]>
[ Upstream commit 0e914063ddd135407c0550b77a6f5bf779bf8384 ]
As the SoC evolves with each generation, the dynamics between the PMC and STB layers within the PMC driver are becoming increasingly complex, making it challenging to manage both in a single file and maintain code readability.
Additionally, during silicon bringup, the PMC functionality is often enabled first, with STB functionality added later. This can lead to missed updates in the driver, potentially causing issues.
To address these challenges, it's beneficial to move all STB-related changes to a separate file. This approach will better accommodate newer SoCs, provide improved flexibility for desktop variants, and facilitate the collection of additional debug information through STB mechanisms.
Also the additional checks for entering s2d_init have been moved from the PMC probe to amd_pmc_s2d_init(). This adjustment makes more sense following the transfer of code to the separate mp1_stb.c file.
Backport adaptation for Linux 6.1 (dependency of 9cef693bce96):
Move only the existing amd_pmc_s2d_init() into pmc/mp1_stb.c, where the target patch expects it. Keep the stable STB readers, writers, debugfs registration, CPU gating and driver layout. Link the new object from the existing AMD Makefile and share the device structure, enable_stb parameter and command interface through a minimal pmc/pmc.h. No functions are added. Omit the upstream subdirectory Makefile and newer MP2, quirks, custom STB and CPU-support dependencies that do not exist in this stable tree.
Provide the target's message-port enum, STB command field and DRAM-size query, with the existing 16 MiB fallback for unsupported firmware. Preserve the stable zero-address rejection and restore MSG_PORT_PMC on that extra error path, which is absent from the target's upstream context. Leave the target's telemetry-size and mapping error-path changes for the target.
[ sashal: Reduced backport -- upstream 0e914063ddd13 touches 4 file(s), this
backport carries 5. Not backported here:
drivers/platform/x86/amd/pmc/Makefile drivers/platform/x86/amd/pmc/pmc.c
This note is generated from the file lists only; see the resolution record for the reasoning. ]
Stable-dep-of: 9cef693bce96 ("platform/x86/amd/pmc: Restore msg_port on amd_stb_s2d_init() error paths")
--- MAINTAINERS | 1 + drivers/platform/x86/amd/Makefile | 2 +- drivers/platform/x86/amd/pmc.c | 69 ++---------------------- drivers/platform/x86/amd/pmc/mp1_stb.c | 73 ++++++++++++++++++++++++++ drivers/platform/x86/amd/pmc/pmc.h | 46 ++++++++++++++++ 5 files changed, 125 insertions(+), 66 deletions(-) create mode 100644 drivers/platform/x86/amd/pmc/mp1_stb.c create mode 100644 drivers/platform/x86/amd/pmc/pmc.h
MAINTAINERS +1 -0
@@ -1031,6 +1031,7 @@ M: Shyam Sundar S K <[email protected]> L: [email protected] S: Maintained F: drivers/platform/x86/amd/pmc.c +F: drivers/platform/x86/amd/pmc/ AMD PMF DRIVER M: Shyam Sundar S K <[email protected]>
drivers/platform/x86/amd/Makefile +1 -1
@@ -4,7 +4,7 @@ # AMD x86 Platform-Specific Drivers # -amd-pmc-y := pmc.o +amd-pmc-y := pmc.o pmc/mp1_stb.o obj-$(CONFIG_AMD_PMC) += amd-pmc.o amd_hsmp-y := hsmp.o obj-$(CONFIG_AMD_HSMP) += amd_hsmp.o
drivers/platform/x86/amd/pmc.c +4 -65
115 lines not on this page · raw message
drivers/platform/x86/amd/pmc/mp1_stb.c new file +73 -0
73 lines not on this page · raw message
drivers/platform/x86/amd/pmc/pmc.h new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 platform/x86/amd/pmc: Restore msg_port on amd_stb_s2d_init() error paths
From: Mario Limonciello <[email protected]>
[ Upstream commit 9cef693bce96bb4c6952f48d855284cf7fa4f367 ]
dev->msg_port is switched to MSG_PORT_S2D before issuing the S2D SMU commands but is only restored to MSG_PORT_PMC on the success path. The early "return -EIO" and "return -ENOMEM" leave the port stuck on MSG_PORT_S2D, so all subsequent SMU communication - including the s2idle prepare/restore handlers - is directed at the wrong mailbox.
Consolidate the exit path through a single label so the message port is always restored.
--- drivers/platform/x86/amd/pmc/mp1_stb.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/platform/x86/amd/pmc/mp1_stb.c +15 -9
@@ -31,7 +31,7 @@ int amd_pmc_s2d_init(struct amd_pmc_dev *dev)u32 phys_addr_low, phys_addr_hi;u64 stb_phys_addr;u32 size =0 ; -int ret; +int ret =0 ;if (!enable_stb)return 0 ;
@@ -42,8 +42,10 @@ int amd_pmc_s2d_init(struct amd_pmc_dev *dev) dev->msg_port =MSG_PORT_S2D ;amd_pmc_send_cmd (dev,S2D_TELEMETRY_SIZE , &size, dev->stb_arg.s2d_msg_id, true); -if (size !=S2D_TELEMETRY_BYTES_MAX ) -return -EIO ; +if (size !=S2D_TELEMETRY_BYTES_MAX ) { + ret = -EIO ; + goto out; + }/* Get DRAM size */ ret =amd_pmc_send_cmd (dev,S2D_DRAM_SIZE , &dev->dram_size, dev->stb_arg.s2d_msg_id, true);
@@ -62,12 +64,16 @@ int amd_pmc_s2d_init(struct amd_pmc_dev *dev) stb_phys_addr = ((u64 )phys_addr_hi <<32 | phys_addr_low); -/* Clear msg_port for other SMU operation */ - dev->msg_port =MSG_PORT_PMC ; - dev->stb_virt_addr =devm_ioremap (dev->dev, stb_phys_addr, dev->dram_size); -if (!dev->stb_virt_addr) -return -ENOMEM ; +if (!dev->stb_virt_addr) { + ret = -ENOMEM ; + goto out; + } + + ret =0 ; -return 0 ; +out: +/* Restore the default message port for subsequent SMU operations */ + dev->msg_port =MSG_PORT_PMC ; +return ret; }
Signature · 1 line
2.53.0