All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Romain Caritey" <Romain.Caritey@microchip.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Connor Davis" <connojdavis@gmail.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Julien Grall" <julien@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 12/16] xen/riscv: introduce sbi_set_timer()
Date: Wed, 11 Feb 2026 16:37:44 +0100	[thread overview]
Message-ID: <c60a3908-660c-4fa2-af7b-2a24b6dc3e1a@gmail.com> (raw)
In-Reply-To: <4304e4a5-c820-4673-8ff7-bbfdea54edf6@suse.com>


On 2/11/26 4:03 PM, Jan Beulich wrote:
> On 09.02.2026 17:52, 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 <oleksii.kurochko@gmail.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>
> with one further request:
>
>> @@ -134,6 +138,20 @@ 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. This function also
>> + * clears the pending timer interrupt bit.
> "after stime_value time" reads as if this was a relative input, stime_value units
> of time need to pass until the event. Iirc values passed are absolute, though.
> Furthermore it was my understanding that the interrupt being raised is dependent
> upon clock >= value, not clock > value (where the latter is what "after" means
> when taken to apply to an absolute value).

Interesting that sbi_set_timer() has different description for OpenSBI v0.1 and v0.2.
What you see in the comment it is what v0.1 tells, but v0.2 tells that:
   
   "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."

"stime_value is in absolute time" has been added in v0.2. I'll update the comment for
a clarity.

Thanks.

~ Oleksii



  reply	other threads:[~2026-02-11 15:38 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-09 16:52 [PATCH v3 00/16] xen/riscv: introduce vtimer related things Oleksii Kurochko
2026-02-09 16:52 ` [PATCH v3 01/16] xen/riscv: implement arch_vcpu_{create,destroy}() Oleksii Kurochko
2026-02-10 16:24   ` Jan Beulich
2026-02-09 16:52 ` [PATCH v3 02/16] xen/riscv: avoid reading hstateen0 when Smstateen is not implemented Oleksii Kurochko
2026-02-11  7:22   ` Jan Beulich
2026-02-11  8:45     ` Oleksii Kurochko
2026-02-09 16:52 ` [PATCH v3 03/16] xen/riscv: detect and store supported hypervisor CSR bits at boot Oleksii Kurochko
2026-02-11  7:49   ` Jan Beulich
2026-02-11  9:47     ` Oleksii Kurochko
2026-02-11  9:50       ` Jan Beulich
2026-02-09 16:52 ` [PATCH v3 04/16] xen/riscv: implement vcpu_csr_init() Oleksii Kurochko
2026-02-11  9:44   ` Jan Beulich
2026-02-11  9:53     ` Oleksii Kurochko
2026-02-09 16:52 ` [PATCH v3 05/16] xen/riscv: introduce tracking of pending vCPU interrupts, part 1 Oleksii Kurochko
2026-02-11 14:16   ` Jan Beulich
2026-02-11 14:53     ` Jan Beulich
2026-02-12  9:37     ` Oleksii Kurochko
2026-02-12 10:24       ` Jan Beulich
2026-02-12 11:23         ` Oleksii Kurochko
2026-02-09 16:52 ` [PATCH v3 06/16] xen/riscv: introduce tracking of pending vCPU interrupts, part 2 Oleksii Kurochko
2026-02-11 14:26   ` Jan Beulich
2026-02-11 15:59     ` Oleksii Kurochko
2026-02-09 16:52 ` [PATCH v3 07/16] xen/time: move ticks<->ns helpers to common code Oleksii Kurochko
2026-02-09 16:52 ` [PATCH v3 08/16] xen/riscv: introduce basic vtimer infrastructure for guests Oleksii Kurochko
2026-02-11 14:51   ` Jan Beulich
2026-02-11 15:31     ` Oleksii Kurochko
2026-02-09 16:52 ` [PATCH v3 09/16] xen/riscv: introduce vcpu_kick() implementation Oleksii Kurochko
2026-02-09 16:52 ` [PATCH v3 10/16] xen/riscv: add vtimer context switch helpers Oleksii Kurochko
2026-02-09 16:52 ` [PATCH v3 11/16] xen/riscv: implement SBI legacy SET_TIMER support for guests Oleksii Kurochko
2026-02-09 16:52 ` [PATCH v3 12/16] xen/riscv: introduce sbi_set_timer() Oleksii Kurochko
2026-02-11 15:03   ` Jan Beulich
2026-02-11 15:37     ` Oleksii Kurochko [this message]
2026-02-09 16:52 ` [PATCH v3 13/16] xen/riscv: implement reprogram_timer() via SBI Oleksii Kurochko
2026-02-11 15:12   ` Jan Beulich
2026-02-11 15:14     ` Jan Beulich
2026-02-09 16:52 ` [PATCH v3 14/16] xen/riscv: handle hypervisor timer interrupts Oleksii Kurochko
2026-02-09 16:52 ` [PATCH v3 15/16] xen/riscv: init tasklet subsystem Oleksii Kurochko
2026-02-09 16:52 ` [PATCH v3 16/16] xen/riscv: implement sync_vcpu_execstate() Oleksii Kurochko
2026-02-11 15:16   ` Jan Beulich

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=c60a3908-660c-4fa2-af7b-2a24b6dc3e1a@gmail.com \
    --to=oleksii.kurochko@gmail.com \
    --cc=Romain.Caritey@microchip.com \
    --cc=alistair.francis@wdc.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=connojdavis@gmail.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --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.