Re: [PATCH 09/24] serial: 8250: 8250_bcm7271: fix DMA address truncation to 32 bits
From: Andy Shevchenko
Date: Tue Oct 27 2026 - 13:14:48 EST
On Tue, Oct 27, 2026 at 09:41:17AM -0700, Florian Fainelli wrote:
> On 10/27/26 08:10, Andy Shevchenko wrote:
> > On Tue, Oct 27, 2026 at 12:06:35PM +0100, Greg Kroah-Hartman wrote:
> > >
> > > The local variable daddr is declared as u32 but assigned from dma_addr_t
> > > fields (priv->rx_addr and priv->tx_addr), which are 64-bit on ARM64.
> > > This silently truncates the upper 32 bits, causing upper_32_bits(daddr)
> > > to always produce zero when programming the UART DMA descriptor high
> > > address registers. Change the type to dma_addr_t to preserve the full
> > > DMA address.
> >
> > Since this value goes to HW, it should be u64. Even on 32-bit machines there
> > are possibilities to cover a bigger address space / DMA space.
>
> That is one way to go about it, but since the size of dma_addr_t follows
> ARCH_DMA_ADDR_T_64BIT, we could also take this patch, and also make the
> upper 32-bits programming conditional upon CONFIG_ARCH_DMA_ADDR_T_64BIT.
You never know this. The use of u64 is simple as that: it goes to HW as 64-bit
value no matter what. Note, in the past we used to have a problematic use of
dma_addr_t exactly due to its dependency on the data bus size when programming
HW, and hence, based on my experience, I hardly recommend not to use dma_addr_t
in this case, use plain fixed u64.
--
With Best Regards,
Andy Shevchenko