Re: [PATCH 1/2] riscv: efi: Map runtime MMIO with device attributes
From: Ard Biesheuvel
Date: Sat Nov 21 2026 - 07:42:50 EST
On Sat, 21 Nov 2026, at 11:38, Han Gao via B4 Relay wrote:
> From: Han Gao <gaohan@xxxxxxxxxxx>
>
> EFI_MEMORY_MAPPED_IO regions are mapped with PAGE_KERNEL, so device
> registers end up mapped as normal memory.
>
> On Milk-V Pioneer, GetTime() reads the clock controller registers and
> faults:
>
> Oops - load access fault [#1]
> Workqueue: efi_runtime efi_call_rts
> status: 0000000200000120 badaddr: 0000007030012000 cause: 0000000000000005
>
> Use PAGE_KERNEL_IO for these regions.
>
> Fixes: b91540d52a08 ("RISC-V: Add EFI runtime services")
> Signed-off-by: Han Gao <gaohan@xxxxxxxxxxx>
> ---
> arch/riscv/kernel/efi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Acked-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
I can take this as a fix via the EFI tree if you like.
> diff --git a/arch/riscv/kernel/efi.c b/arch/riscv/kernel/efi.c
> index 2d3cc57b4535..11e85d0ebc91 100644
> --- a/arch/riscv/kernel/efi.c
> +++ b/arch/riscv/kernel/efi.c
> @@ -22,7 +22,7 @@ static __init pgprot_t
> efimem_to_pgprot_map(efi_memory_desc_t *md)
> u32 type = md->type;
>
> if (type == EFI_MEMORY_MAPPED_IO)
> - return PAGE_KERNEL;
> + return PAGE_KERNEL_IO;
>
> /* R-- */
> if ((attr & (EFI_MEMORY_XP | EFI_MEMORY_RO)) ==
>
> --
> 2.55.0