From: "Radim Krčmář" <rkrcmar@ventanamicro.com>
To: "David Laight" <david.laight.linux@gmail.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>
Cc: <linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
<aou@eecs.berkeley.edu>, "Alexandre Ghiti" <alex@ghiti.fr>,
"Atish Patra" <atishp@rivosinc.com>, <ajones@ventanamicro.com>,
<cleger@rivosinc.com>, <apatel@ventanamicro.com>,
<thomas.weissschuh@linutronix.de>
Subject: Re: [PATCH v2 0/2] RISC-V: turn sbi_ecall into a variadic macro
Date: Tue, 24 Jun 2025 14:40:37 +0200 [thread overview]
Message-ID: <DAURR8R4IVN1.3U4UFSWQD6JZL@ventanamicro.com> (raw)
In-Reply-To: <20250624090923.5521a0f2@pumpkin>
2025-06-24T09:09:23+01:00, David Laight <david.laight.linux@gmail.com>:
> On Mon, 23 Jun 2025 15:53:58 -0700 (PDT)
> Palmer Dabbelt <palmer@dabbelt.com> wrote:
>> On Thu, 19 Jun 2025 12:03:12 PDT (-0700), rkrcmar@ventanamicro.com wrote:
>> > v2 has a completely rewritten [1/2], and fixes some missed trailing
>> > zeroes in [2/2]. The fixes in [2/2] are important for v2, because
>> > sbi_ecall doesn't fill the registers with zeroes anymore.
>>
>> The SBI spec says "Registers that are not defined in the SBI function
>> call are not reserved." and I'm not really sure what to make of that.
At the beginning, SBI says that only a0-a5 can contain ecall arguments,
and then each function indirectly says which registers actually contain
arguments. a0-a5 that don't contain arguments are not reserved, just
like all the other unspecified registers.
>> Specifically: does that mean implementations are allowed to ascribe
>> custom meaning to those parameters and might start doing stuff if
>> they're not set to zero?
SBI explicitly reserves registers if they are intended to be used in the
future. The result of the ecall must be exactly the same regardless of
the value in unspecified (not reserved) registers.
We can't really tell what an SBI implementation will do with unspecified
registers, but the most sane thing would be to ignore them.
> Or does it mean they aren't guaranteed to be preserved?
No, they are preserved:
"All registers except a0 & a1 must be preserved across an SBI call by
the callee."
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
prev parent reply other threads:[~2025-06-24 12:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 19:03 [PATCH v2 0/2] RISC-V: turn sbi_ecall into a variadic macro Radim Krčmář
2025-06-19 19:03 ` [PATCH v2 1/2] RISC-V: sbi: turn sbi_ecall into " Radim Krčmář
2025-06-19 19:03 ` [PATCH v2 2/2] RISC-V: make use of variadic sbi_ecall Radim Krčmář
2025-06-19 19:03 ` [PATCH v2 3/2] RISC-V: sbi: remove sbi_ecall tracepoints Radim Krčmář
2025-06-23 22:54 ` Palmer Dabbelt
2025-06-24 13:09 ` Radim Krčmář
2025-06-25 7:51 ` Radim Krčmář
2025-06-25 8:34 ` David Laight
2025-06-26 8:10 ` Radim Krčmář
2025-06-23 22:53 ` [PATCH v2 0/2] RISC-V: turn sbi_ecall into a variadic macro Palmer Dabbelt
2025-06-24 8:09 ` David Laight
2025-06-24 12:40 ` Radim Krčmář [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=DAURR8R4IVN1.3U4UFSWQD6JZL@ventanamicro.com \
--to=rkrcmar@ventanamicro.com \
--cc=ajones@ventanamicro.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=apatel@ventanamicro.com \
--cc=atishp@rivosinc.com \
--cc=cleger@rivosinc.com \
--cc=david.laight.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=thomas.weissschuh@linutronix.de \
/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