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

Bjorn Helgaas helgaas at kernel.org
Mon Sep 18 14:14:00 PDT 2023


On Sat, Sep 16, 2023 at 01:41:59PM +0300, Andy Shevchenko wrote:
> 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.

Sounds good, thanks!

Bjorn



More information about the linux-arm-kernel mailing list