From nobody Mon Apr 13 03:29:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1772814858; cv=none; d=zohomail.com; s=zohoarc; b=Sb4L2o8MWu8Oo8fwjc9ZbJLRBYPCFgZVkVG5cnJDL5RCsT/fVb0ztt7tCu5c+nMSaS8qFD/cqfx6Z1d9dJPStASCspn2AdDz/EQ5W30D9+xahaXGV6YtX3cmwYPGPUz3ufvghaPTZks0nxkbVE8jBWXkv/CW0gs1wYyKSuIQn+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772814858; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=e8+NHmV9aIJTBlEGWlUzdypWZU3A1Zs5nOLXPSleeHM=; b=nRvQYFS7ryRb3FHDpiKEcic5hqI3mZmo33iIvL4YHUO+E5g9057InY2YCXOgheIZPWLplFymaJnHe2eY3Ii+oFJo90WEztJVaXJNjgj7gbsyKWhyMU32LGC1QhVxzmConJLJpAefiH/NzelIv6bd04EaSZBF4vbTRS3vLSL5WOg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1772814858303673.1458438323278; Fri, 6 Mar 2026 08:34:18 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1247976.1546355 (Exim 4.92) (envelope-from ) id 1vyY7Z-00048h-Ni; Fri, 06 Mar 2026 16:33:49 +0000 Received: by outflank-mailman (output) from mailman id 1247976.1546355; Fri, 06 Mar 2026 16:33:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vyY7Z-00048W-IJ; Fri, 06 Mar 2026 16:33:49 +0000 Received: by outflank-mailman (input) for mailman id 1247976; Fri, 06 Mar 2026 16:33:47 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vyY7X-00030j-P4 for xen-devel@lists.xenproject.org; Fri, 06 Mar 2026 16:33:47 +0000 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [2a00:1450:4864:20::434]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3f8e7791-197a-11f1-b164-2bf370ae4941; Fri, 06 Mar 2026 17:33:47 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-439b2965d4bso5226444f8f.2 for ; Fri, 06 Mar 2026 08:33:46 -0800 (PST) Received: from fedora (user-109-243-67-101.play-internet.pl. [109.243.67.101]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439dae57c05sm4406550f8f.39.2026.03.06.08.33.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 08:33:45 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3f8e7791-197a-11f1-b164-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772814826; x=1773419626; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e8+NHmV9aIJTBlEGWlUzdypWZU3A1Zs5nOLXPSleeHM=; b=Qhw2PZU2IC64OpoScHVRrZSlZ6ttFMUGpheJjgUx/3f1BCboaFvG8E7t4isPSIWN8W 5vo/5H+trb1ekJqUP//y71RC9dWS3+2VWCUnARr74G6C2Xl2oh9cAdelZQdiBZSQvem7 EExQ28YBKMUVaMRzkA3k+6h00nbQhSv7eS259XGSZC810/k2SNk9Pj8OcQZpJ5EmWlzS LlXzO62MF+cv9MbwhM4AP1yAVLmWh64jK+LawYtKG/62EIMnegmfXhyJcjXCRnT4r5Od /CCrnFFx1llxOQPehEHVIKT+zFrqNpGZSV1Uwa55TNhx1t5mFo/pibthtkpw4wz+KmIc PJ7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772814826; x=1773419626; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=e8+NHmV9aIJTBlEGWlUzdypWZU3A1Zs5nOLXPSleeHM=; b=ZGt+fuHFR+Rfvg8E2bLCE/2vSv0/KEATl7k8rhbYhUrgLbbgOfayk/0ueLCUM+yOGn wgEoqNlhxXeHJ/oJhDC7hGQksZBtDQYLbHqbQFrKmQRLzWmICIjApfs8jjG38tB+M5za L9KhQ7KJCRJ+pRtfpRKvrz2SK42aq6i3OiekJrxJw8vr6gXejXCaHUdk50YEQpC/fOQ0 aBONUK6Tf0ptl5WqiaCFVgp15GGSBT7IRtLrnRYxi9d5d9gF53ncQH3XKdrdPhI1GYVm DcC+iRKIN/Aa/RyonJA5Gih3XwokBAPABQq1M6d7dnyKLQhhjFI6rDG+7K9PObq5J0My 6HZw== X-Gm-Message-State: AOJu0Yx4ZPYSn0T9tFlrY9EFWxxALaEC43DHi50Byv0nGsNCUUpdMhQu DFy1cdTp8CUQC6grIdC9b5udf3JU8q0KD+jVapRyZdUtOTcFhKUM+yoeLJ/A1g== X-Gm-Gg: ATEYQzyDsgB5HzUoLiK0HocmALJqndbGrQcUrZ7+mXrDI/7ZIt5g9GZTuyPWMgNxwX4 0h/yw8IwnQTIfmZDMRW4mlIcFk2sl75picsSS8cmnkBoQbRPD8s56kaWZIICrolu8pG3Uo7Dnf4 aa0LVebd+ASaZZgikXY83bCVWI05WgjDW8uApXwa2LAfgfvtkLpTAUuoxncRhU2T60oO3x2xaFl N2IYZdmT2G4eNRrGvby1biRLIvMn33iy0ukttB8pLIrLJfkU0liPWETMcALueSJbjlGmpA8rBp0 U14fcrwXIpY8iyUnJpHi+dza7kucoTe9XxYTWG2EagDiUOu1olhDX42Ot5mPZX0BJS9m+8sVM2y vMXkb2zOJL7SSbdYRQ+uDe2i7e+krNjOBQNDwoX2iu+5xwqOkyI0pcEfAec5GPZpfAo/MU3tq1Y 8CEMX0eqV3mIp5i1Q36eNiBX4rRiT5D8o6Ba4GiD2g8tETWdsCwSMZyi7JWPoclUH0AeYjqcS2M xTW X-Received: by 2002:a05:600c:46c3:b0:480:6bef:63a0 with SMTP id 5b1f17b1804b1-48526959433mr47154465e9.21.1772814826016; Fri, 06 Mar 2026 08:33:46 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Romain Caritey , Oleksii Kurochko , Alistair Francis , Connor Davis , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini Subject: [PATCH v7 06/14] xen/riscv: introduce vcpu_kick() implementation Date: Fri, 6 Mar 2026 17:33:23 +0100 Message-ID: <21e8e22cb62498236ebe094671d80676a46d8b76.1772814110.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1772814859571154100 Content-Type: text/plain; charset="utf-8" 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. Since vcpu_kick() calls perfc_incr(vcpu_kick), add perfcounter for vcpu_kick to handle the case when CONFIG_PERF_COUNTERS=3Dy. Although CONFIG_PERF_COUNTERS is not enabled by default, it can be enabled, for example, by randconfig what will lead to CI build issues. Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- Changes in v4-v7: - Nothing changed. Only rebase. --- Changes in v3: - Add asm/perfc_defn.h to provide vcpu_kick perfcoounter to cover the case when CONFIG_PERF_COUNTERS=3Dy. --- Changes in v2: - Add Acked-by: Jan Beulich . --- xen/arch/riscv/domain.c | 14 ++++++++++++++ xen/arch/riscv/include/asm/Makefile | 1 - xen/arch/riscv/include/asm/perfc_defn.h | 3 +++ xen/arch/riscv/stubs.c | 5 ----- 4 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 xen/arch/riscv/include/asm/perfc_defn.h diff --git a/xen/arch/riscv/domain.c b/xen/arch/riscv/domain.c index b59e026a9635..c8ce1efa884d 100644 --- a/xen/arch/riscv/domain.c +++ b/xen/arch/riscv/domain.c @@ -1,9 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0-only */ =20 +#include #include #include #include #include +#include #include =20 #include @@ -264,6 +266,18 @@ void vcpu_flush_interrupts(struct vcpu *curr) #endif } =20 +void vcpu_kick(struct vcpu *v) +{ + bool running =3D v->is_running; + + vcpu_unblock(v); + if ( running && v !=3D current ) + { + perfc_incr(vcpu_kick); + smp_send_event_check_mask(cpumask_of(v->processor)); + } +} + static void __init __maybe_unused build_assertions(void) { /* diff --git a/xen/arch/riscv/include/asm/Makefile b/xen/arch/riscv/include/a= sm/Makefile index 3824f31c395c..86c56251d5d7 100644 --- a/xen/arch/riscv/include/asm/Makefile +++ b/xen/arch/riscv/include/asm/Makefile @@ -7,7 +7,6 @@ generic-y +=3D hypercall.h generic-y +=3D iocap.h generic-y +=3D irq-dt.h generic-y +=3D percpu.h -generic-y +=3D perfc_defn.h generic-y +=3D random.h generic-y +=3D softirq.h generic-y +=3D vm_event.h diff --git a/xen/arch/riscv/include/asm/perfc_defn.h b/xen/arch/riscv/inclu= de/asm/perfc_defn.h new file mode 100644 index 000000000000..8a4b945df662 --- /dev/null +++ b/xen/arch/riscv/include/asm/perfc_defn.h @@ -0,0 +1,3 @@ +/* This file is intended to be included multiple times. */ + +PERFCOUNTER(vcpu_kick, "vcpu: notify other vcpu") diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c index daadff0138e4..eedf8bf9350a 100644 --- a/xen/arch/riscv/stubs.c +++ b/xen/arch/riscv/stubs.c @@ -203,11 +203,6 @@ void vcpu_block_unless_event_pending(struct vcpu *v) BUG_ON("unimplemented"); } =20 -void vcpu_kick(struct vcpu *v) -{ - BUG_ON("unimplemented"); -} - unsigned long hypercall_create_continuation(unsigned int op, const char *format, ...) { --=20 2.53.0