From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: Baptiste Le Duc <baptiste.le-duc@vates.tech>,
Hiago De Franco <hfranco@baylibre.com>
Cc: xen-devel@lists.xenproject.org,
"Alistair Francis" <alistair.francis@wdc.com>,
"Connor Davis" <connojdavis@gmail.com>,
"Ronaldo Nunez" <rnunez@baylibre.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Michal Orzel" <michal.orzel@amd.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Julien Grall" <julien@xen.org>,
"Roger Pau Monné" <roger@xenproject.org>,
"Stefano Stabellini" <sstabellini@kernel.org>
Subject: Re: [PATCH] xen/riscv: vsbi: add SBI TIME extension
Date: Fri, 20 Nov 2026 09:31:25 +0100 [thread overview]
Message-ID: <203974c4-e1ba-40ba-8329-e220fab53370@gmail.com> (raw)
In-Reply-To: <1795105976.8631fc262581453bbf619ec5b2062170.1a1f4a7711a000183d@vates.tech>
On 11/19/26 5:32 PM, Baptiste Le Duc wrote:
> The commit's name is kind of weird with this two `:` next to each other.
> Here is suggestion based on previous patches (xen/riscv: implement SBI legacy SET_TIMER support for guests (647542cdf1)...)
> ```
> xen/riscv: implement SBI TIME extension for guests
> ```
>
>> [ ... 8 lines skipped ... ]
>> Implement the TIME extension and handle SET_TIMER() by programming the
>> vCPU virtual timer through vtimer_set_timer(). With the extension
>> registered, SBI_EXT_BASE_PROBE_EXT reports TIME as available and Linux
>> selects the v0.2 path.
>>
>> Assisted-by: DeepSeek:v4.1-flash
> Uncommon to see DeepSeek model used :)
>> [ ... 46 lines skipped ... ]
>> +static int vsbi_time_ecall_handler(unsigned long eid, unsigned long fid,
>> + struct cpu_user_regs *regs)
>> +{
>> + ASSERT(eid == SBI_EXT_TIME);
>> +
>> + if ( fid != SBI_EXT_TIME_SET_TIMER )
>> + return SBI_ERR_NOT_SUPPORTED;
>> +
>> + vtimer_set_timer(¤t->arch.vtimer, regs->a0);
>>
> Nit: this assumes VSXLEN == 64, i.e. that stime_value fits in a0. The
> SBI spec (binary-encoding.adoc) says:
>
> Parameters that are 2×XLEN bits wide are passed in a pair of
> argument registers, with the low-order XLEN bits in the
> lower-numbered register and the high-order XLEN bits in the
> higher-numbered register.
>
> and sbi_set_timer() takes a uint64_t stime_value, so an RV32 guest
> passes it in a0 (low) and a1 (high).
>
> That's fine today, as both Xen and its guests are RV64 only, and the
> legacy SET_TIMER path makes the same assumption. But nothing in the
> tree enforces it for guests, so it might be worth stating it somewhere.
>
> Oleksii, any opinion on that point?
I thought about that too, but decided not to mention it since, as you
noted, only RV64 guests are possible at the moment. Another reason is
that it isn't specific to this handler: every vSBI handler takes guest
arguments as full-width registers, so other SBI extensions have the
same issue. To me, this should be addressed together with RV32 guest
support.
If we want the assumption stated explicitly until then, I think it
should be done once, in a separate patch, e.g. with a comment in
asm/vsbi.h or an ASSERT(is_64bit_domain(current->domain)) in
vsbi_handle_ecall(), rather than per extension.
~ Oleksii
prev parent reply other threads:[~2026-11-20 8:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 11:59 [PATCH] xen/riscv: vsbi: add SBI TIME extension Hiago De Franco
2026-11-19 13:52 ` Oleksii Kurochko
[not found] ` <bkmmgcqrbq47i7gxn3nt64xrypt2l2hrhlbip7rv7cfo7p6dqs@lssohgkujou5>
2026-11-20 8:42 ` Oleksii Kurochko
2026-11-19 16:32 ` Baptiste Le Duc
2026-11-19 21:38 ` Hiago De Franco
2026-11-20 8:31 ` Oleksii Kurochko [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=203974c4-e1ba-40ba-8329-e220fab53370@gmail.com \
--to=oleksii.kurochko@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=baptiste.le-duc@vates.tech \
--cc=connojdavis@gmail.com \
--cc=hfranco@baylibre.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=rnunez@baylibre.com \
--cc=roger@xenproject.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.