On Sun, May 16, 2021 at 09:29:41AM -0700, Linus Torvalds wrote: > On Sun, May 16, 2021 at 5:19 AM Matthew Wilcox (Oracle) > <willy@xxxxxxxxxxxxx> wrote: > > > > 32-bit architectures which expect 8-byte alignment for 8-byte integers and > > need 64-bit DMA addresses (arm, mips, ppc) had their struct page > > inadvertently expanded in 2019. When the dma_addr_t was added, it forced > > the alignment of the union to 8 bytes, which inserted a 4 byte gap between > > 'flags' and the union. > > So I already have this in my tree, but this stable submission made me go "Hmm". > > Why do we actually want a full 64-bit DMA address on 32-bit architectures here? > > It strikes me that the address is page-aligned, and I suspect we could > just use a 32-bit "DMA page frame number" instead in 'struct page'? Nobody's been willing to guarantee that all 32-bit architectures keep the top 20 bits clear for their DMA addresses. I've certainly seen hardware (maybe PA-RISC? MIPS?) which uses the top few bits of the DMA address to indicate things like "coherent" or "bypasses IOMMU". Rather than trying to find out, I thought this was the safer option. It only affects 32-bit architectures with PAE, and I'd rather not introduce a shift on 64-bit architectures to work around a 32-bit PAE problem.