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

From: Atish Patra

Date: Sat Aug 08 2026 - 03:33:13 EST



On 8/7/26 6:04 PM, Paul Walmsley wrote:
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 <atishp@xxxxxxxxxxxx>

The indirect CSR requires multiple instructions to read/write CSR.
Add a few helper functions for ease of usage.

Signed-off-by: Atish Patra <atishp@xxxxxxxxxxxx>
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.
Oops. Ha ha. LLM agent was parsing the lore and preparing a draft response.
It produced so much garbage that I replied manually. I have no idea what prompted
it to send it after I sent the response! Sorry for the spam.

- Paul