Re: [PATCH v8 05/22] RISC-V: Define indirect CSR access helpers

Paul Walmsley <[email protected]>
Newsgroups org.kernel.vger.linux-perf-users,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-riscv,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed, 5 Aug 2026, Atish Patra wrote:

> On 8/4/26 5:39 PM, Paul Walmsley wrote:
> > On Wed, 1 Jul 2026, Atish Patra wrote:
> > 
> > > From: Atish Patra <[email protected]>
> > > 
> > > The indirect CSR requires multiple instructions to read/write CSR.
> > > Add a few helper functions for ease of usage.
> > > 
> > > Signed-off-by: Atish Patra <[email protected]>
> > 
> > Thanks.  These macros seem better implemented as static inline functions.
> > That also nicely aligns the code with what you write in the patch
> > description.
> 
> I don't think inlining these macros in the following way will work because of
> the following reason. It won't build once anything calls it.
> 
> csr_read()/csr_write() stringify the CSR argument straight into the inline asm
> template:

Yes, you're right; I should have caught that.  Too bad, there are multiple 
keyhole CSR index registers in use, otherwise it would have been a 
reasonable thing to do.

What's up with the subsequent followup message?  Looks like a 
cut-and-paste from an LLM.


- Paul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.