PCI: MSI: Remove unsafe and unnecessary hardware access
authorBen Hutchings <bhutchings@solarflare.com>
Thu, 17 Jun 2010 19:16:36 +0000 (20:16 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Sep 2010 20:17:44 +0000 (13:17 -0700)
commited6fd21943f0e2bbab458755fe44c71c47660c4d
tree073ba2a07a5bc97ce00c1b879a5e98fec8611b0f
parent9d550e4071d7734f3dc4ec8a10971091782f281e
PCI: MSI: Remove unsafe and unnecessary hardware access

commit fcd097f31a6ee207cc0c3da9cccd2a86d4334785 upstream.

During suspend on an SMP system, {read,write}_msi_msg_desc() may be
called to mask and unmask interrupts on a device that is already in a
reduced power state.  At this point memory-mapped registers including
MSI-X tables are not accessible, and config space may not be fully
functional either.

While a device is in a reduced power state its interrupts are
effectively masked and its MSI(-X) state will be restored when it is
brought back to D0.  Therefore these functions can simply read and
write msi_desc::msg for devices not in D0.

Further, read_msi_msg_desc() should only ever be used to update a
previously written message, so it can always read msi_desc::msg
and never needs to touch the hardware.

Tested-by: "Michael Chan" <mchan@broadcom.com>
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/msi.c