From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 0513A511E61; Wed, 30 Sep 2026 17:36:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790789813; cv=none; b=uRblJGa3DNMqEW0Mxa3jOyzJnZ6LRcZLy9Q6I/hEEwkGBHQX0JYVFIepmayod4ZY1A5Pb7aqEs6NbCspIcdgFceypZ25pEpKuslKdnvJYuIvNcx78EzbSTETNeCargFQ24i4VTdakhnSYntDqCqzORpykrbRhdB9OK+irv1todc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790789813; c=relaxed/simple; bh=sTIFjmiFGNBvJfV01e0Rt5MXUUkKHd1ZLXO+SgMw7A8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BUQpF7u8EQfXIuo5Gwvrrb33h7+BG7/DIQFosnSSp5/jvFEsVtqyJgCsUA6L68cUf9n4mRgWb6BWa8lim0KChZS4vmhMxxicFbQ2xLLBSm7nTpFUet6iTrfuWeMvWXSUzO+LbDdQ8+D6hVqQTtTgmYSRRBAE3qTa0ERIvT3CwAg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Thxu16oa; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Thxu16oa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D1431F000FF; Wed, 30 Sep 2026 17:36:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790789811; bh=rKvUJ0Wty7TN7Pb/R8kB5gZRSn+gJ84Jj5T4gdf+EX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Thxu16oaoDxgMnHjHA0c8+N5F6Ju5WGPIoY5azqX8WCp9JherN+ZqwY6sZPEcT8CZ 8XYz2tM9DCdkDya6wiC6GoXhc6kP7LCz1kAA+sA+BqE/hQCk1crcTI/20RT9KJpQe2 agBahCJuTIKPaP+p/C6KDYdav1CiBM779ensjzJI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mario Limonciello , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 6.12 592/877] platform/x86/amd/pmc: Restore msg_port on amd_stb_s2d_init() error paths Date: Wed, 30 Sep 2026 17:25:03 +0200 Message-ID: <20260930152427.425825915@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152414.738996857@linuxfoundation.org> References: <20260930152414.738996857@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mario Limonciello [ 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. Fixes: 3d7d407dfb05 ("platform/x86: amd-pmc: Add support for AMD Spill to DRAM STB feature") Cc: stable@vger.kernel.org Signed-off-by: Mario Limonciello Link: https://patch.msgid.link/20260721181756.143084-2-mario.limonciello@amd.com Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/amd/pmc/mp1_stb.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) --- a/drivers/platform/x86/amd/pmc/mp1_stb.c +++ b/drivers/platform/x86/amd/pmc/mp1_stb.c @@ -253,7 +253,7 @@ int amd_stb_s2d_init(struct amd_pmc_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; @@ -271,8 +271,10 @@ int amd_stb_s2d_init(struct amd_pmc_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); @@ -291,12 +293,16 @@ int amd_stb_s2d_init(struct amd_pmc_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; }