From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7761E19CC11; Mon, 23 Jun 2025 21:36:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750714590; cv=none; b=QFXObJhPVqjvcPuZFlra1TW4Zg12mBpcxWg4/d5qVgrRcz2r+8D0xgIqW8A9Q5XguLnO/dILH358mmqkbU1vTXQu6doJ/7vUwMUVkeiKE7YzC8FYjbQ9TDqsZrwG1JL/hzYyRVEZxF9WNnBkw7QYyAa2vl2xOGuks9w7bEjTzdo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750714590; c=relaxed/simple; bh=KphNYeSZebmpBUZn8zbdhwDaNTT/Gd1rZz4VmlMfpQc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EU8Bwn2cgJap4Mpou685IKBrW92uj+66f4WiJOy1XJodyAI3nO2r9BhxiwHX1tFOyaffG1uG9g8iKjsaxBiJb6PVfIpKBYzXniXjTwYLKJ5ihe5ZgRVWsHPUWgl4SuP6RSImLubXqcQ/NbFoe7QnYHNPYyZj5JoQQTTAjP6h6NM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xwrXqR8A; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xwrXqR8A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10A6BC4CEEA; Mon, 23 Jun 2025 21:36:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750714590; bh=KphNYeSZebmpBUZn8zbdhwDaNTT/Gd1rZz4VmlMfpQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xwrXqR8Al2VtIG2Mdoh3uisAMRmmSxWvfhjCRnntlu6RGGkOMv/ELnR+LMH9PVGjx Lh8izQqUNhCfN6OKHN5FCzL9YVENoq23NSoQXEVMkuVw2A9OXz6b6n7RcjXvmbd/Pi oCwMolBO67haESTWLAKmmSTfcu4Tr29kslkICHmc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Gautam Menghani , Venkat Rao Bagalkote , Vaibhav Jain , Madhavan Srinivasan Subject: [PATCH 5.15 197/411] powerpc/pseries/msi: Avoid reading PCI device registers in reduced power states Date: Mon, 23 Jun 2025 15:05:41 +0200 Message-ID: <20250623130638.636072951@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130632.993849527@linuxfoundation.org> References: <20250623130632.993849527@linuxfoundation.org> User-Agent: quilt/0.68 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-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gautam Menghani commit 9cc0eafd28c7faef300822992bb08d79cab2a36c upstream. When a system is being suspended to RAM, the PCI devices are also suspended and the PPC code ends up calling pseries_msi_compose_msg() and this triggers the BUG_ON() in __pci_read_msi_msg() because the device at this point is in reduced power state. In reduced power state, the memory mapped registers of the PCI device are not accessible. To replicate the bug: 1. Make sure deep sleep is selected # cat /sys/power/mem_sleep s2idle [deep] 2. Make sure console is not suspended (so that dmesg logs are visible) echo N > /sys/module/printk/parameters/console_suspend 3. Suspend the system echo mem > /sys/power/state To fix this behaviour, read the cached msi message of the device when the device is not in PCI_D0 power state instead of touching the hardware. Fixes: a5f3d2c17b07 ("powerpc/pseries/pci: Add MSI domains") Cc: stable@vger.kernel.org # v5.15+ Signed-off-by: Gautam Menghani Tested-by: Venkat Rao Bagalkote Reviewed-by: Vaibhav Jain Signed-off-by: Madhavan Srinivasan Link: https://patch.msgid.link/20250305090237.294633-1-gautam@linux.ibm.com Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/pseries/msi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c @@ -539,7 +539,12 @@ static struct msi_domain_info pseries_ms static void pseries_msi_compose_msg(struct irq_data *data, struct msi_msg *msg) { - __pci_read_msi_msg(irq_data_get_msi_desc(data), msg); + struct pci_dev *dev = msi_desc_to_pci_dev(irq_data_get_msi_desc(data)); + + if (dev->current_state == PCI_D0) + __pci_read_msi_msg(irq_data_get_msi_desc(data), msg); + else + get_cached_msi_msg(data->irq, msg); } static struct irq_chip pseries_msi_irq_chip = {