From: "Arnd Bergmann" <arnd@arndb.de>
To: "Qingfang Deng" <qingfang.deng@linux.dev>,
"Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
"Thomas Gleixner" <tglx@kernel.org>,
"Nam Cao" <namcao@linutronix.de>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] riscv: use generic relaxed MMIO accessors
Date: Thu, 24 Sep 2026 16:51:42 +0200 [thread overview]
Message-ID: <c0ab08f9-2258-41da-8fc5-0b95ae62ed1b@app.fastmail.com> (raw)
In-Reply-To: <20260923013913.357710-1-qingfang.deng@linux.dev>
On Wed, Sep 23, 2026, at 03:39, Qingfang Deng wrote:
> The relaxed MMIO accessors duplicate the generic implementation, as noted
> by their FIXME comment. Remove those definitions and their empty barrier
> hooks so asm-generic/io.h supplies them through the existing asm/io.h
> include path.
This seems fine.
> The M-mode timer uses the lightweight asm/mmio.h header before the
> generic relaxed accessors are available. Use readl_cpu() and readq_cpu()
> there, which perform the same accesses and endian conversion as the
> existing relaxed accessors.
>
> @@ -17,18 +17,18 @@ typedef unsigned long cycles_t;
> #ifdef CONFIG_64BIT
> static inline cycles_t get_cycles(void)
> {
> - return readq_relaxed(clint_time_val);
> + return readq_cpu(clint_time_val);
> }
> #else /* !CONFIG_64BIT */
> static inline u32 get_cycles(void)
> {
> - return readl_relaxed(((u32 __iomem *)clint_time_val));
> + return readl_cpu(((u32 __iomem *)clint_time_val));
> }
> #define get_cycles get_cycles
I don't understand this bit: Why should these not keep using the
portable accessors? As far as I can tell, the readl_cpu() helpers
are just an implementation detail in riscv and could be removed
along with the custom readl_relaxed() variant, but with your
patch that becomes harder.
Arnd
prev parent reply other threads:[~2026-09-24 14:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 1:39 Qingfang Deng
2026-09-24 14:51 ` Arnd Bergmann [this message]
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=c0ab08f9-2258-41da-8fc5-0b95ae62ed1b@app.fastmail.com \
--to=arnd@arndb.de \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=namcao@linutronix.de \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=qingfang.deng@linux.dev \
--cc=tglx@kernel.org \
/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®