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 15FDC358378; Fri, 4 Sep 2026 05:58:21 +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=1788501502; cv=none; b=mONlvqhhHFHEcJD6yhrfSOFDsyI/GS8F7bZ7Wmx+eqJJH7qlL45tBZTgNCFcuUR3DeTuXvvrjF/bJ0o8FArpUNISaPJ8xbwtp+qVfLxSTuay9bbMMVLvOF/AzNt0pPULt0KrAr+KfI058OvqT3ctRPfWL0TCnaI4+92u9aSTi1w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788501502; c=relaxed/simple; bh=q0exRCyEni8mjVw1R8x2oaoybvCqIQ/JNNBkVD6bUX0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rXkLUc29qjRw4/bSUaxIieF1En4YTdnenGYa6TrpxqJtrUqaXZ2aaoo9n86uZ2JP07GSVTH0DQaF6sVq8mr7+D+hNpC5/IOVI0VqsQVO30nElTgEn/clyYE3TH8BFRcsWfowfP5nip4kfZatJwtodn6vRUPZ6HZrccbxjLv8xoQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qdPqLcIv; 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="qdPqLcIv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DABB1F00A3D; Fri, 4 Sep 2026 05:58:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788501501; bh=IsHoTsqXHY12KZyjI1Coxw4FvltTL0GGLXrSz0OMfF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qdPqLcIvCq/UCaZitXfVcPrecfzbSfqhhH7Aw9PKQi+zZb8mxjrhH9dR2wIKNC5bt qBFniGXjTtR72PbEaWV/Yq6Yk9CVOJId/+ETum/7GpA7lAKrcmxucVoa4kTC1Yz4fY p/+c9QeBL6InV1MWUWsJcpodRtjCNMKj1pT/Y9F4= 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 6.18 431/552] platform/x86/amd/pmc: Restore msg_port on amd_stb_s2d_init() error paths Date: Fri, 4 Sep 2026 06:59:48 +0200 Message-ID: <20260904045800.365917998@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045747.813364717@linuxfoundation.org> References: <20260904045747.813364717@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.18-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; }