[PATCH 1/2] riscv: efi: Map runtime MMIO with device attributes

Han Gao via B4 Relay devnull+gaohan.iscas.ac.cn at kernel.org
Sat Nov 21 02:38:07 PST 2026


From: Han Gao <gaohan at iscas.ac.cn>

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 at iscas.ac.cn>
---
 arch/riscv/kernel/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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





More information about the linux-riscv mailing list