[PATCH v1 06/15] xen/riscv: introduce vcpu_kick() implementation

Oleksii Kurochko posted 15 patches 2 weeks ago
[PATCH v1 06/15] xen/riscv: introduce vcpu_kick() implementation
Posted by Oleksii Kurochko 2 weeks ago
Add a RISC-V implementation of vcpu_kick(), which unblocks the target
vCPU and sends an event check IPI if the vCPU was running on another
processor. This mirrors the behavior of Arm and enables proper vCPU
wakeup handling on RISC-V.

Remove the stub implementation from stubs.c, as it is now provided by
arch/riscv/domain.c.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/riscv/domain.c | 14 ++++++++++++++
 xen/arch/riscv/stubs.c  |  5 -----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c
index dd3c237d163d..164ab14a5209 100644
--- a/xen/arch/riscv/domain.c
+++ b/xen/arch/riscv/domain.c
@@ -1,7 +1,9 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/cpumask.h>
 #include <xen/mm.h>
 #include <xen/sched.h>
+#include <xen/smp.h>
 
 #include <asm/cpufeature.h>
 #include <asm/csr.h>
@@ -121,3 +123,15 @@ void arch_vcpu_destroy(struct vcpu *v)
 {
     free_xenheap_pages(v->arch.stack, STACK_ORDER);
 }
+
+void vcpu_kick(struct vcpu *v)
+{
+    bool running = v->is_running;
+
+    vcpu_unblock(v);
+    if ( running && v != current )
+    {
+        perfc_incr(vcpu_kick);
+        smp_send_event_check_mask(cpumask_of(v->processor));
+    }
+}
diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index 6ebb5139de69..68ee859ca1a8 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -213,11 +213,6 @@ void vcpu_block_unless_event_pending(struct vcpu *v)
     BUG_ON("unimplemented");
 }
 
-void vcpu_kick(struct vcpu *v)
-{
-    BUG_ON("unimplemented");
-}
-
 struct vcpu *alloc_vcpu_struct(const struct domain *d)
 {
     BUG_ON("unimplemented");
-- 
2.52.0
Re: [PATCH v1 06/15] xen/riscv: introduce vcpu_kick() implementation
Posted by Jan Beulich 20 hours ago
On 24.12.2025 18:03, Oleksii Kurochko wrote:
> Add a RISC-V implementation of vcpu_kick(), which unblocks the target
> vCPU and sends an event check IPI if the vCPU was running on another
> processor. This mirrors the behavior of Arm and enables proper vCPU
> wakeup handling on RISC-V.
> 
> Remove the stub implementation from stubs.c, as it is now provided by
> arch/riscv/domain.c.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Acked-by: Jan Beulich <jbeulich@suse.com>