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 510E626AC3; Fri, 4 Sep 2026 05:31:19 +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=1788499880; cv=none; b=ALSbR5YoBlHFmuEnShqkETpe+ccZmlTcVobrHGpe4dYbwqvJuGjRnrkqSnMtQkkENr201g0UnFb83lPwW45JApQ3JzoWjA9flZbMRDHOaTIrPAZ1/0S5CUlNzWna//z2uj9O3Mq2Rd6Qi00eX94CupOaIkukyETKbtwxvnyyRV8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788499880; c=relaxed/simple; bh=jTNamzVXhnMqnHO54ut3E8jLu/0+4B0wlZGLaEzYEtA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WVjKeR2nXo2sRKA/mK+LTxg8ooFnZVJiDee6H1sZ4QEukQkJSp7rSJ5jU+Ucd1eDLo9ZCVgAn4Fjyy0/DndT7VZef12OvLsiTd31pOdqEJ9/s2qKDlFpDVLrnnGGuBpljl12050gIPbSIW37Aq4E1mB31GKQkRDmKGzEj6ZicOw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oUfbHB0r; 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="oUfbHB0r" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAF341F00A3D; Fri, 4 Sep 2026 05:31:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788499879; bh=rmOXn6I07OQmN97aZYLsrt5XquT9gtuxeG9bLjuuZMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oUfbHB0rd3wWU/Z6xdRiVawqDPeWBfR70HXMO431A9yov327WwP8s8eZ83vYeHYHp V5LAQ0mGLMCLtbFVXqS5tQD6ZNDJnUq0vRWMMYI/Ida+9Q1AJJIIB3cPCShvzPYDPI wHzicEW1UF5Jy2a5efqu6mOK/Ja+23VodsGR+kt8= 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?= Subject: [PATCH 7.2 572/713] platform/x86/amd/pmc: Restore msg_port on amd_stb_s2d_init() error paths Date: Fri, 4 Sep 2026 06:59:00 +0200 Message-ID: <20260904045816.643482956@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045803.810145556@linuxfoundation.org> References: <20260904045803.810145556@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 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mario Limonciello commit 9cef693bce96bb4c6952f48d855284cf7fa4f367 upstream. 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: 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 @@ -289,7 +289,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; @@ -307,8 +307,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); @@ -321,12 +323,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; }