mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: gaohan@iscas.ac.cn,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Paul Walmsley" <pjw@kernel.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Atish Patra" <atish.patra@linux.dev>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Brian Masney" <bmasney+clk@redhat.com>,
	"Jerome Brunet" <jbrunet+clk@baylibre.com>,
	"Chen Wang" <chen.wang@linux.dev>,
	"Inochi Amaoto" <inochiama@gmail.com>
Cc: "Han Gao" <rabenda.cn@gmail.com>,
	linux-efi@vger.kernel.org, linux-riscv@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
	sophgo@lists.linux.dev
Subject: Re: [PATCH 1/2] riscv: efi: Map runtime MMIO with device attributes
Date: Sat, 21 Nov 2026 13:42:20 +0100	[thread overview]
Message-ID: <bb39f961-0589-4a3e-b649-888cf5edd3a1@app.fastmail.com> (raw)
In-Reply-To: <20261121-b4-sg2042-efi-rtc-v1-1-19898b8ad497@iscas.ac.cn>



On Sat, 21 Nov 2026, at 11:38, Han Gao via B4 Relay wrote:
> From: Han Gao <gaohan@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@iscas.ac.cn>
> ---
>  arch/riscv/kernel/efi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

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

  reply	other threads:[~2026-11-21 12:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21 10:38 [PATCH 0/2] riscv/clk: sophgo: Fix EFI RTC on Milk-V Pioneer Han Gao via B4 Relay
2026-11-21 10:38 ` [PATCH 1/2] riscv: efi: Map runtime MMIO with device attributes Han Gao via B4 Relay
2026-11-21 12:42   ` Ard Biesheuvel [this message]
2026-11-21 14:48     ` Han Gao
2026-11-21 10:38 ` [PATCH 2/2] clk: sophgo: sg2042-clkgen: Keep gates of reserved devices enabled Han Gao via B4 Relay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bb39f961-0589-4a3e-b649-888cf5edd3a1@app.fastmail.com \
    --to=ardb@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=atish.patra@linux.dev \
    --cc=bmasney+clk@redhat.com \
    --cc=chen.wang@linux.dev \
    --cc=gaohan@iscas.ac.cn \
    --cc=ilias.apalodimas@linaro.org \
    --cc=inochiama@gmail.com \
    --cc=jbrunet+clk@baylibre.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=rabenda.cn@gmail.com \
    --cc=sboyd@kernel.org \
    --cc=sophgo@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®