RE: [PATCH v2 1/5] PCI: dwc: Call dma_unmap_page() before freeing the msi page
From: Gustavo Pimentel
Date: Thu Sep 24 2020 - 07:56:33 EST
On Thu, Sep 24, 2020 at 12:5:57, Jisheng Zhang
<Jisheng.Zhang@xxxxxxxxxxxxx> wrote:
> In dw_pcie_free_msi(), call dma_unmap_page() before freeing.
>
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@xxxxxxxxxxxxx>
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index 9dafecba347f..0a19de946351 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -288,8 +288,12 @@ void dw_pcie_free_msi(struct pcie_port *pp)
> irq_domain_remove(pp->msi_domain);
> irq_domain_remove(pp->irq_domain);
>
> - if (pp->msi_page)
> + if (pp->msi_page) {
> + struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> + struct device *dev = pci->dev;
> + dma_unmap_page(dev, pp->msi_data, PAGE_SIZE, DMA_FROM_DEVICE);
> __free_page(pp->msi_page);
> + }
> }
>
> void dw_pcie_msi_init(struct pcie_port *pp)
> --
> 2.28.0
Acked-by: Gustavo Pimentel <gustavo.pimentel@xxxxxxxxxxxx>