PCI: dwc: Fix MSI page leakage in suspend/resume
authorJisheng Zhang <Jisheng.Zhang@synaptics.com>
Fri, 9 Oct 2020 07:55:05 +0000 (15:55 +0800)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tue, 13 Oct 2020 08:52:49 +0000 (09:52 +0100)
commit07940c369a6bf940ec4a00eeb76bf51daa4f3973
tree350949e9217fdd3f8e3213ffdeeb7b5e8f0b1fdf
parent742833249198bfd07944158eca50f740faf823f3
PCI: dwc: Fix MSI page leakage in suspend/resume

Currently, dw_pcie_msi_init() allocates and maps page for msi, then
program the PCIE_MSI_ADDR_LO and PCIE_MSI_ADDR_HI. The Root Complex
may lose power during suspend-to-RAM, so when we resume, we want to
redo the latter but not the former. If designware based driver (for
example, pcie-tegra194.c) calls dw_pcie_msi_init() in resume path, the
msi page will be leaked.

As pointed out by Rob and Ard, there's no need to allocate a page for
the MSI address, we could use an address in the driver data.

To avoid map the MSI msg again during resume, we move the map MSI msg
from dw_pcie_msi_init() to dw_pcie_host_init().

Suggested-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20201009155505.5a580ef5@xhacker.debian
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
drivers/pci/controller/dwc/pci-dra7xx.c
drivers/pci/controller/dwc/pcie-designware-host.c
drivers/pci/controller/dwc/pcie-designware.h