From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD3C3D3EE96 for ; Thu, 22 Jan 2026 16:48:05 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1211350.1522936 (Exim 4.92) (envelope-from ) id 1vixqa-0000Nb-NZ; Thu, 22 Jan 2026 16:47:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1211350.1522936; Thu, 22 Jan 2026 16:47:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vixqa-0000NK-Ii; Thu, 22 Jan 2026 16:47:52 +0000 Received: by outflank-mailman (input) for mailman id 1211350; Thu, 22 Jan 2026 16:47:51 +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 1vixqY-0007Id-Vv for xen-devel@lists.xenproject.org; Thu, 22 Jan 2026 16:47:50 +0000 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [2a00:1450:4864:20::52e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 10f638db-f7b2-11f0-b15e-2bf370ae4941; Thu, 22 Jan 2026 17:47:41 +0100 (CET) Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-64b7318f1b0so1615058a12.2 for ; Thu, 22 Jan 2026 08:47:41 -0800 (PST) Received: from fedora (user-109-243-67-101.play-internet.pl. [109.243.67.101]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b879513e951sm1686014966b.7.2026.01.22.08.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 08:47:39 -0800 (PST) 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: 10f638db-f7b2-11f0-b15e-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769100460; x=1769705260; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XJbG6vfGmuAQ64APf6ZJ70lw3nhTcRe8DrgXDE4zMmo=; b=nC61hGXxEFUtEjIfBkkb3bAKR8b7y+hDQGUf8YCOiirkUAtlP0daT3ioGb4VglEBIP 9Myy1I3yEEnQvPqowDzbH8k9mDyTr/UMokFLbQMOdMJ10EvB7dwym7GEO1Jff4s0r6RU KT+DM0GbiG9SEEeUlWx3+Y76Hc2NOysx2lHqrlTKzWvEZpDnx3MKZtzGM6KSUoWeslZ8 1DK8hUVLxDO2ImksypOFWvZ730SizV/VW80lNgy0qyPHUIqcAQkkHsCJ3PhWXhNuRTUq i9oj7hxFV4L64d0IxSKICXKc80rPZc/yWzAkK4DIsE15zIYvThEXFaFRnz8a7pwTEk9p c7WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769100460; x=1769705260; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XJbG6vfGmuAQ64APf6ZJ70lw3nhTcRe8DrgXDE4zMmo=; b=VH46pEgOqQSxXFdSNwFUe7QFA0g7AW4PW6Fr2nCa7ao59qLIoma/RPTqt7CPT6UOMZ ++3hgypUsQpH+zkpsDKgV6jDV7PxB6vGu7bUc9Z39r6BCr0UiJdfOdWlTBH/JpjA+Hm+ Yin98Imzq7m6pTkX2+7nsqTTCZh+it6ZavJf1Nq+/94SukqY1cfqwnF8/NVsLc6y+G+8 78V3GB4VxJ3fKnGko93NiupEjs/jC+HPMHvGqM8yMrKMWNXWpfTh+zPXeuW8PmeiHPkJ X1g8GYTb1VjF21QdSuAkdmzkBo3lS39WjZ7HiCa4eqrE3pQZ1S5saH9YyOOleDI5Wv7Y JR6A== X-Gm-Message-State: AOJu0YwG230vEBOg+zXGeIBQcw0gxFdOWvtUTcUHaGadpCUAjhCg5DQC WFlv7DqG/BzhbckDx0bm7VAL6dk4wczl3Twi2Er02bjrNihYqn7fieSP9Xwu1A== X-Gm-Gg: AZuq6aKZFpWgz2sXUhlg6ZDHbbSTPMaVX12Qzdh1KMmGFjYbJ/iUrjUXiUnBLqBElEO qtZOVuWCmN/H4p+OMFVeTnu9KMErDINT9fA4BOj6RKq8BbFti9ddGvcVl3X4Hhrf7DtXVIKvOt/ kdAtUgny9lv8tVurfM1+evZm41Tkz+fYN626U03BOn3itXJ2WKXJK6HWqFMJxOGeEWxnBvAeO8D Sl11OyZCAj0urD0ytLiAx8PVz8o2/HnEavxyiLUPfKZlfcMdeBK2pW35CWK9fdbgwKrgJJlBz5V bLZowO+957hR9t+4eJiftpL4LXgP5rKabaQj4GEVWuSkRD7v9RcZKpYiz2EdFPhdZRFcBhQgaDr ElHCSU9nE8P6a4t0jNCLGSZ53GvGgnYny2zyVcNaeDXDoqSXy6VSxeDUN496qPRIqnazESLCq/Y iOdroHjXYQ4aOxY8An3lZ3NpdYyIup80bIrFQrPUsvN53JG9RnN0JKug== X-Received: by 2002:a17:907:c19:b0:b87:1741:a494 with SMTP id a640c23a62f3a-b87968f5a60mr1643494466b.17.1769100459978; Thu, 22 Jan 2026 08:47:39 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: 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 , Bertrand Marquis , Volodymyr Babchuk , Romain Caritey Subject: [PATCH v2 00/16] xen/riscv: introduce vtimer related things Date: Thu, 22 Jan 2026 17:47:15 +0100 Message-ID: X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch series introduces the components necessary to implement a virtual timer (vtimer). Since the SSTC extension is not supported by Xen, an emulated (SBI-based) timer is required. To address this, a virtual timer built on Xen’s timer infrastructure is introduced, with save/restore support and SBI-based programming. To provide full guest software–based timer support, the following components are also introduced: - arch_vcpu_{create,destroy}() to initialize the virtual timer and other vCPU-related state not directly tied to timer functionality. As part of this work, struct arch_vcpu is introduced to describe the internal state of a virtual CPU, along with vcpu_csr_init() to initialize the relevant CSR state. - Support functions required by the virtual timer, including: - vcpu_kick(), and a stub implementation of smp_send_event_check_mask() (since SMP is not yet supported in Xen), which is used by vcpu_kick(). - Support for guest timer programming via interception of the SBI legacy SET_TIMER call from guest. - Implement reprogram_timer() using introduced sbi_set_timer(). - Initial lockless tracking of pending vCPU interrupts using atomic bitmaps. - Handling of hypervisor timer interrupts and dispatch into Xen’s generic timer softirq. --- Changes in v2: - Add consumer part of tracking of pending vCPU interrupts. - Split patch "xen/riscv: init tasklet subsystem" to two. - Patches were acked: - xen/riscv: introduce vcpu_kick() implementation - xen/riscv: implement SBI legacy SET_TIMER support for guests - All other changes are patch-specific. Please check them. --- Oleksii Kurochko (16): xen/riscv: introduce struct arch_vcpu xen/riscv: implement arch_vcpu_{create,destroy}() xen/riscv: implement vcpu_csr_init() xen/riscv: introduce tracking of pending vCPU interrupts, part 1 xen/riscv: introduce tracking of pending vCPU interrupts, part 2 xen/time: move ticks<->ns helpers to common code xen/riscv: introduce basic vtimer infrastructure for guests xen/riscv: add temporary stub for smp_send_event_check_mask() xen/riscv: introduce vcpu_kick() implementation xen/riscv: add vtimer context switch helpers xen/riscv: implement SBI legacy SET_TIMER support for guests xen/riscv: introduce sbi_set_timer() xen/riscv: implement reprogram_timer() via SBI xen/riscv: handle hypervisor timer interrupts xen/riscv: init tasklet subsystem xen/riscv: implement sync_vcpu_execstate() xen/arch/arm/include/asm/time.h | 3 - xen/arch/arm/time.c | 11 - xen/arch/arm/vtimer.c | 2 +- xen/arch/riscv/Makefile | 2 + xen/arch/riscv/cpufeature.c | 1 + xen/arch/riscv/domain.c | 279 ++++++++++++++++++++ xen/arch/riscv/include/asm/config.h | 3 +- xen/arch/riscv/include/asm/cpufeature.h | 1 + xen/arch/riscv/include/asm/current.h | 8 + xen/arch/riscv/include/asm/domain.h | 84 +++++- xen/arch/riscv/include/asm/riscv_encoding.h | 2 + xen/arch/riscv/include/asm/sbi.h | 18 ++ xen/arch/riscv/include/asm/time.h | 5 - xen/arch/riscv/include/asm/vtimer.h | 23 ++ xen/arch/riscv/sbi.c | 40 +++ xen/arch/riscv/setup.c | 3 + xen/arch/riscv/smp.c | 7 + xen/arch/riscv/stubs.c | 35 --- xen/arch/riscv/time.c | 44 +++ xen/arch/riscv/traps.c | 14 + xen/arch/riscv/vsbi/legacy-extension.c | 6 + xen/arch/riscv/vtimer.c | 88 ++++++ xen/include/xen/time.h | 11 + 23 files changed, 632 insertions(+), 58 deletions(-) create mode 100644 xen/arch/riscv/domain.c create mode 100644 xen/arch/riscv/include/asm/vtimer.h create mode 100644 xen/arch/riscv/vtimer.c -- 2.52.0