Message ID | 20240819131924.372366-10-steven.price@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: Support for running as a guest in Arm CCA | expand |
On Mon, Aug 19, 2024 at 02:19:14PM +0100, Steven Price wrote: > From: Suzuki K Poulose <suzuki.poulose@arm.com> > > 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@arm.com> > Signed-off-by: Steven Price <steven.price@arm.com> Will was keen (and I'd prefer it as well) to get rid of the early fixmap code, at least for the time being. Have you tried without these and the early RSI probing? Apart from the earlycon I recall you mentioned EFI early maps. These would be more problematic.
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__ */