From: Suzuki K Poulose <suzuki.poulose@xxxxxxx> For early I/O mapping using fixmap, we mask the address by PAGE_MASK base and then map it to the FIXMAP slot. However, with confidential computing, the granularity at which "protections" (encrypted vs decrypted) are applied may be finer than the PAGE_SIZE. e.g., for Arm CCA it is 4K while an arm64 kernel could be using 64K pagesize. However we need to know the exact address being mapped in. Thus in-order to calculate the accurate protection, pass down the exact phys address to the helpers. This would be later used by arm64 to detect if the MMIO address is shared vs protected. The users of such drivers already cope with running the same code with "4K" page size, thus mapping a PAGE_SIZE covering the address range is considered acceptable. Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx> Signed-off-by: Steven Price <steven.price@xxxxxxx> --- New patch for v5 --- drivers/tty/serial/earlycon.c | 2 +- include/asm-generic/fixmap.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index a5fbb6ed38ae..c8414b648d47 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c @@ -40,7 +40,7 @@ static void __iomem * __init earlycon_map(resource_size_t paddr, size_t size) { void __iomem *base; #ifdef CONFIG_FIX_EARLYCON_MEM - set_fixmap_io(FIX_EARLYCON_MEM_BASE, paddr & PAGE_MASK); + set_fixmap_io(FIX_EARLYCON_MEM_BASE, paddr); base = (void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE); base += paddr & ~PAGE_MASK; #else diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h index 9b75fe2bd8fd..8d2222035ed2 100644 --- a/include/asm-generic/fixmap.h +++ b/include/asm-generic/fixmap.h @@ -96,7 +96,7 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr) */ #ifndef set_fixmap_io #define set_fixmap_io(idx, phys) \ - __set_fixmap(idx, phys, FIXMAP_PAGE_IO) + __set_fixmap(idx, phys & PAGE_MASK, FIXMAP_PAGE_IO) #endif #endif /* __ASSEMBLY__ */ -- 2.34.1