On Wed, Sep 16, 2020 at 05:45:16PM +0100, Christoph Hellwig wrote: > Note that 0 is a valid DMA address. I think due the access bit this > works, but it is a little subtle.. It should be checked again carefully.. This looks a bit questionable if the flags are what makes it work: + dma_addr = dma & ODP_DMA_ADDR_MASK; + if (dma_addr) { > But more importantly except for (dma_addr_t)-1 (DMA_MAPPING_ERROR) > all dma_addr_t values are valid, so taking more than a single bit > from a dma_addr_t is not strictly speaking correct. This is the result of dma_map_page(). The HW requires that dma_map_page(page_size) returns a DMA address that is page_size aligned, even for huge pages. So at least the last 12 bits of the DMA address are always 0, they can be used for flags. This is also the HW representation in the page table. Last time you pointed at this code you agreed this alignment was met, is it still OK? Jason