[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DAURR8R4IVN1.3U4UFSWQD6JZL@ventanamicro.com>
Date: Tue, 24 Jun 2025 14:40:37 +0200
From: Radim Krčmář <rkrcmar@...tanamicro.com>
To: "David Laight" <david.laight.linux@...il.com>, "Palmer Dabbelt"
<palmer@...belt.com>
Cc: <linux-riscv@...ts.infradead.org>, <linux-kernel@...r.kernel.org>, "Paul
Walmsley" <paul.walmsley@...ive.com>, <aou@...s.berkeley.edu>, "Alexandre
Ghiti" <alex@...ti.fr>, "Atish Patra" <atishp@...osinc.com>,
<ajones@...tanamicro.com>, <cleger@...osinc.com>,
<apatel@...tanamicro.com>, <thomas.weissschuh@...utronix.de>
Subject: Re: [PATCH v2 0/2] RISC-V: turn sbi_ecall into a variadic macro
2025-06-24T09:09:23+01:00, David Laight <david.laight.linux@...il.com>:
> On Mon, 23 Jun 2025 15:53:58 -0700 (PDT)
> Palmer Dabbelt <palmer@...belt.com> wrote:
>> On Thu, 19 Jun 2025 12:03:12 PDT (-0700), rkrcmar@...tanamicro.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."
Powered by blists - more mailing lists