PCI: dwc: Fix MSI msi_msg DMA mapping
authorWill McVicker <willmcvicker@google.com>
Mon, 13 Jun 2022 22:26:11 +0000 (17:26 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 1 Aug 2022 20:15:32 +0000 (15:15 -0500)
commit35797e672ff0610224d80e3cc08393fef1032f9a
treeba6cd700d9cc9188a557c8f2fb252765f5fa6667
parentce06bf570390fb8b41d581e5d594727b51367179
PCI: dwc: Fix MSI msi_msg DMA mapping

As of 07940c369a6b ("PCI: dwc: Fix MSI page leakage in suspend/resume"),
the PCIe designware host driver has been using the driver data allocation
for the msi_msg DMA mapping which can result in a DMA_MAPPING_ERROR due to
the DMA overflow check in dma_direct_map_page() when the address is greater
than 32 bits (reported in [1]). The commit was trying to address a memory
leak on suspend/resume by moving the MSI mapping to dw_pcie_host_init(),
but subsequently dropped the page allocation thinking it wasn't needed.

To fix the DMA mapping issue as well as make msi_msg DMA'able, switch back
to allocating a 32-bit page for the msi_msg. To avoid the suspend/resume
leak, allocate the page in dw_pcie_host_init() since that shouldn't be
called during suspend/resume.

[1] https://lore.kernel.org/all/Yo0soniFborDl7+C@google.com/

Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rob Herring <robh@kernel.org>
drivers/pci/controller/dwc/pcie-designware-host.c
drivers/pci/controller/dwc/pcie-designware.h