Skip to content

Commit 22cd5ed

Browse files
committed
arm64: Use simpler arithmetics for the linear map macros
Because of the tagged addresses, the __is_lm_address() and __lm_to_phys() macros grew to some harder to understand bitwise operations using PAGE_OFFSET. Since these macros only accept untagged addresses, use a simple subtract operation. Signed-off-by: Catalin Marinas <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Cc: Will Deacon <[email protected]> Cc: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 91cb2c8 commit 22cd5ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/include/asm/memory.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ static inline const void *__tag_set(const void *addr, u8 tag)
251251
* lives in the [PAGE_OFFSET, PAGE_END) interval at the bottom of the
252252
* kernel's TTBR1 address range.
253253
*/
254-
#define __is_lm_address(addr) (((u64)(addr) ^ PAGE_OFFSET) < (PAGE_END - PAGE_OFFSET))
254+
#define __is_lm_address(addr) (((u64)(addr) - PAGE_OFFSET) < (PAGE_END - PAGE_OFFSET))
255255

256-
#define __lm_to_phys(addr) (((addr) & ~PAGE_OFFSET) + PHYS_OFFSET)
256+
#define __lm_to_phys(addr) (((addr) - PAGE_OFFSET) + PHYS_OFFSET)
257257
#define __kimg_to_phys(addr) ((addr) - kimage_voffset)
258258

259259
#define __virt_to_phys_nodebug(x) ({ \

0 commit comments

Comments
 (0)