On 2/17/26 4:42 PM, Jan Beulich wrote:
On 13.02.2026 17:28, Oleksii Kurochko wrote:
Introduce a function pointer for sbi_set_timer(), since different OpenSBI
versions may implement the TIME extension with different extension IDs
and/or function IDs.
If the TIME extension is not available, fall back to the legacy timer
mechanism. This is useful when Xen runs as a guest under another Xen,
because the TIME extension is not currently virtualised and therefore
will not appear as available.
Despite of the fact that sbi_set_timer_v01 is introduced and used as
fall back, SBI v0.1 still isn't fully supported (with the current SBI
calls usage, sbi_rfence_v01 should be introduced too), so panic()
in sbi_init() isn't removed.
The sbi_set_timer() pointer will be used by reprogram_timer() to program
Xen’s physical timer as without SSTC extension there is no any other
option except SBI call to do that as only M-timer is available for us.
Use dprintk() for all the cases to print that a speicifc SBI extension
is available as it isn't really necessary in case of release builds.
Signed-off-by: Oleksii Kurochko <[email protected]>
Acked-by: Jan Beulich <[email protected]>
---
Changes in v4:
- Add "stime_value is in absolute time" to the comment above declaration
of sbi_set_timer() function pointer.
Yet it still ...
@@ -134,6 +138,23 @@ int sbi_remote_hfence_gvma(const cpumask_t *cpu_mask,
vaddr_t start,
int sbi_remote_hfence_gvma_vmid(const cpumask_t *cpu_mask, vaddr_t start,
size_t size, unsigned long vmid);
+/*
+ * Programs the clock for next event after stime_value time. stime_value is in
+ * absolute time. This function must clear the pending timer interrupt bit as
+ * well.
... says "after" when, as per my understanding, it's "at or after". At which
point the final "time" in the sentence becomes bogus (says me as a non-
native speaker). Which in turn is what my v3 comment was triggered by, as
"after stime_value time" to me suggests something relative ("this amount of
time needs to pass"), when that's not what is meant, as the added sentence
now tries to clarify.
I will rephrase then the first sentence in the following way:
Programs the clock for next event at (or after) stime_value. ...
~ Oleksii