On Tue, Sep 10, 2024, at 12:28, Christophe Leroy wrote: > Le 08/09/2024 à 22:48, Arnd Bergmann a écrit : >> On Fri, Sep 6, 2024, at 18:40, Christophe Leroy wrote: > > uiomem->addr is a phys_addr_t > r->start is a ressource_size_t hence a phys_addr_t > > And phys_addr_t is defined as: > > #ifdef CONFIG_PHYS_ADDR_T_64BIT > typedef u64 phys_addr_t; > #else > typedef u32 phys_addr_t; > #endif > > On a 32 bits platform, UL is unsigned 32 bits, so the r->start & > PAGE_MASK will and r->start with 0x00000000fffff000 > > That is wrong. Right, I see. So out of the five 32-bit architectures with a 64-bit phys_addr_t, arc seems to ignore this problem, x86 has a separate PHYSICAL_PAGE_MASK for its internal uses and the other three have the definition you mention as > (~((1 << PAGE_SHIFT) - 1)) And this is only documented properly on powerpc. How about making the common definition this? #ifdef CONFIG_PHYS_ADDR_T_64BIT #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) #else #define PAGE_MASK (~(PAGE_SIZE-1)) #endif That keeps it unchanged for everything other than arc and x86-32, and hopefully fixes the currently behavior on those two. Arnd