Skip to content

Commit 9cc0eaf

Browse files
Gautam Menghanimaddy-kerneldev
authored andcommitted
powerpc/pseries/msi: Avoid reading PCI device registers in reduced power states
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: a5f3d2c ("powerpc/pseries/pci: Add MSI domains") Cc: [email protected] # v5.15+ Signed-off-by: Gautam Menghani <[email protected]> Tested-by: Venkat Rao Bagalkote <[email protected]> Reviewed-by: Vaibhav Jain <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 59ba025 commit 9cc0eaf

File tree

1 file changed

+6
-1
lines changed
  • arch/powerpc/platforms/pseries

1 file changed

+6
-1
lines changed

arch/powerpc/platforms/pseries/msi.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,12 @@ static struct msi_domain_info pseries_msi_domain_info = {
525525

526526
static void pseries_msi_compose_msg(struct irq_data *data, struct msi_msg *msg)
527527
{
528-
__pci_read_msi_msg(irq_data_get_msi_desc(data), msg);
528+
struct pci_dev *dev = msi_desc_to_pci_dev(irq_data_get_msi_desc(data));
529+
530+
if (dev->current_state == PCI_D0)
531+
__pci_read_msi_msg(irq_data_get_msi_desc(data), msg);
532+
else
533+
get_cached_msi_msg(data->irq, msg);
529534
}
530535

531536
static struct irq_chip pseries_msi_irq_chip = {

0 commit comments

Comments
 (0)