[PATCH v2 1/3] PCI: mediatek: Allocate MSI address with dmam_alloc_coherent()

Bjorn Helgaas helgaas at kernel.org
Tue Jun 11 10:21:47 PDT 2024


On Sun, Jun 09, 2024 at 01:32:38PM +0100, Marc Zyngier wrote:
> On Sat, 08 Jun 2024 10:01:52 +0100,
> Manivannan Sadhasivam <mani at kernel.org> wrote:
> > 
> > On Mon, Dec 11, 2023 at 04:52:54PM +0800, Jianjun Wang wrote:
> > > Use dmam_alloc_coherent() to allocate the MSI address, instead of using
> > > virt_to_phys().
> > 
> > What is the reason for this change? So now PCIE_MSI_VECTOR becomes unused?
> 
> More importantly, this is yet another example of the DW reference
> driver nonsense, where memory is allocated for *MSI*, while the whole
> point of MSIs is that it is a write that doesn't target memory, making
> any form of RAM allocation absolutely pointless.
> 
> This silly approach has been cargo-culted for years, and while I
> caught a few in my time, you can't beat copy-paste.
> 
> IMO, this patch is only making things worse instead of fixing things.

Probably partly my fault.  I think there are two pieces here:

  1) allocating the MSI address
  2) computing the PCI bus address

I don't know how to do 1), but I do encourage people not to use
virt_to_phys() for 2), since (in general) CPU physical addresses are
not the same as PCI bus addresses.



More information about the linux-arm-kernel mailing list