Re: [PATCH v2 1/1] PCI: mediatek: Correct type for virt_to_phys()

From: Andy Shevchenko
Date: Sat Sep 16 2023 - 06:43:14 EST


On Thu, Sep 14, 2023 at 03:31:46PM -0500, Bjorn Helgaas wrote:
> On Thu, Sep 14, 2023 at 10:23:24PM +0300, Andy Shevchenko wrote:

...

> > - addr = virt_to_phys(port->base + PCIE_MSI_VECTOR);
> > + addr = virt_to_phys((__force void *)port->base + PCIE_MSI_VECTOR);
>
> Lots of these drivers use either virt_to_phys() or
> platform_get_resource_byname() to get a physical address that they
> then use as the MSI target.
>
> But I don't think that's quite right -- the MSI is a DMA transaction
> on PCI, and in general there's no guarantee that bus addresses are
> identical to CPU physical addresses, so shouldn't we use a dma_addr_t
> obtained from the DMA API?
>
> dw_pcie_msi_host_init() has a complicated version of this that uses
> dmam_alloc_coherent().

Fair enough. I leave it to you then to get it fixed properly.
Consider this as just a heads up for the old report.

--
With Best Regards,
Andy Shevchenko