From nobody Mon Jan 26 09:21:38 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; 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=1769100508; cv=none; d=zohomail.com; s=zohoarc; b=XB79FHyctm8n7dxPaLOHoFpZQiCu4xnJdmE+LNQ8w3ieJv10ngi6izaRLr3rSdtm5B1uUMmY0DEblHNR8eySk8LQw+MKUI8NNnGpgpDXZzRlTIAjt2/Tt4nqKY3jlkHtKQI1tWphE4BUBTcdRVDXCaajEQvISh0XfKpVHzeSlsw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769100508; 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=TbDTiLjWuEzC7c6gqH8qnfrVym3BHTcxish5wSxW7l4=; b=ibuTImXTymW1u8f3zTYPPmwBQQ2NVNHQGAoYJ8sgwqo6c6vAiOfVMhWA39kfbZlrzpbp/WY5AIrri4N8u+QV/lmhq1bfi5S1F5cr1YyntDSTU6Zwl5Op97pLlARdAcIjJfaA9B/ebiEji6Ry4nJsIGPVCmVTbMt8kmVQVWJRy0A= 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 1769100508746781.2937995030857; Thu, 22 Jan 2026 08:48:28 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1211363.1523002 (Exim 4.92) (envelope-from ) id 1vixqj-0002PV-AZ; Thu, 22 Jan 2026 16:48:01 +0000 Received: by outflank-mailman (output) from mailman id 1211363.1523002; Thu, 22 Jan 2026 16:48:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vixqj-0002Mo-4B; Thu, 22 Jan 2026 16:48:01 +0000 Received: by outflank-mailman (input) for mailman id 1211363; Thu, 22 Jan 2026 16:47:58 +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 1vixqg-0007Id-Mo for xen-devel@lists.xenproject.org; Thu, 22 Jan 2026 16:47:58 +0000 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [2a00:1450:4864:20::62d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 1a95e4e3-f7b2-11f0-b15e-2bf370ae4941; Thu, 22 Jan 2026 17:47:57 +0100 (CET) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-b872cf905d3so179241566b.2 for ; Thu, 22 Jan 2026 08:47:57 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 08:47:55 -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: 1a95e4e3-f7b2-11f0-b15e-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769100476; x=1769705276; 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=TbDTiLjWuEzC7c6gqH8qnfrVym3BHTcxish5wSxW7l4=; b=CWdIITF/ZXYEDHdxzK1vj5zcXRYOy2bi/7+MRf0NuKpED8XisHUwoela6pvnuCjcpg uXUrpvZwUSzGoa2ibDfHRkfkftdDRhg4htBZl7t8uMznGeMqmDt0YTRx/6b/3RkcPWXr 6fz15NaeICVHYAHVsF8lXkPS2GdLFGpQMKZxdM/tT7x//UhziauLyCf0FwZLr4Xz7jsf svXJ2qtKdJ6KqWPY362vGJn+Hg8ZrfFPA9FAiZTqBuALTqRPqT69hsyC9QwD1D03p42z MNNllLPrmnkSY2fYzXrPNlQfH6FpS0fG8YkPnRLXzfoh+UmV0HTPMXQogA2pghfCQAh9 qsXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769100476; x=1769705276; 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=TbDTiLjWuEzC7c6gqH8qnfrVym3BHTcxish5wSxW7l4=; b=CKyHW2rXrnTRUJeoeBDI27XYMCqsZdftKEglnZjZDfEjgllbqi1jYy8AmmmeCaL7Ik 3/XUANT9to0+HjGGm8sQ02cqQAP0qFkZKGSTAQvvu1WNq/R5jfU+lGIvuNK4xOgbqwsG hndLJgrLdRkYkviJLwkId06sJaCxB4kIf0lsVMcEwPcrQZsHA9TKIiBfRBc/UIq2GmXy oRaKatEuQSG+dBVrRHWQNpXp9xBSjFdYGtnJIpCCszNhM7A+uwhbcN8fbVoU7ejkaKtc /iRMyx6W3BV34O/0BHAzIhhfQlIBaKs7dMwtj4PlNXOVJwJ9NiizuaE0MXnfVbsofOyU Aqfg== X-Gm-Message-State: AOJu0YxYDi5qMkBQqt2Q5E6P03J1HAxyw/0KND0kJH9gwM+Gd9ofPJen cETb2n6wWd1KGYAkq3DCqGGwJ/gEyg+PENY8HGfe9JmpC0cXRy4sM+9ul1B9ig== X-Gm-Gg: AZuq6aIW9w+6Pc67hjhF/GHnNqgOJSJp643acRmfEH8GPd3f/GUiLFViBkALcaKcwk/ MPF1eONdBBu/6E+uqyz4nRk16ozXMwnRReHZ4VK9RExbgnqo33Cx/eXStn/pAGE0n9bO0P5rVAZ xjdsWkFGATHxCLL+Y9kUIhomYbYn9tEXWpMY812U/P9CFQ3TmZKoTIBA3f38wRi26k9DxBGHWsZ XgAiBxM7/8vAFDRyCVIcVHUVQ3krZ9ec33ySR89jZeMPSaFskyWtkHDoNKLfvLnaeQEsz5Mf7sn PuRuR4tA84ZxGZHb3sZqlDM7TSt7wgGQZHl4b3brLLW1BOnyTbO7az4WakceugQpeGIOHqxhOA8 To7sXXZyUZBvnIjLv13xPjdZ9yRB4S8+/apcJ17TnQmRH4Zeh6Lysm9/9KIYWUoRwNGt3bTmJQe UfjPXR+VYXH5ngLEPf4WHZq0ByC6mR7ydyjNqxIWdyMsfaZh1f/VxBY3RnVpQBFytj X-Received: by 2002:a17:906:6a14:b0:b87:173f:631 with SMTP id a640c23a62f3a-b87968e76e5mr1734061466b.25.1769100476195; Thu, 22 Jan 2026 08:47:56 -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 , Romain Caritey Subject: [PATCH v2 14/16] xen/riscv: handle hypervisor timer interrupts Date: Thu, 22 Jan 2026 17:47:29 +0100 Message-ID: <5028577821754b86f633bedb0c32f5490ab6452c.1769099885.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1769100510454158500 Content-Type: text/plain; charset="utf-8" Introduce timer_interrupt() to process IRQ_S_TIMER interrupts. The handler disables further timer interrupts by clearing SIE.STIE and raises TIMER_SOFTIRQ so the generic timer subsystem can perform its processing. Update do_trap() to dispatch IRQ_S_TIMER to this new handler. Signed-off-by: Oleksii Kurochko --- Changes in v2: - Drop cause argument of timer_interrupt() as it isn't used inside the function and anyway it is pretty clear what is the cause inside timer_interrupt(). --- xen/arch/riscv/traps.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c index e9c967786312..53f96f143823 100644 --- a/xen/arch/riscv/traps.c +++ b/xen/arch/riscv/traps.c @@ -10,6 +10,7 @@ #include #include #include +#include =20 #include #include @@ -108,6 +109,15 @@ static void do_unexpected_trap(const struct cpu_user_r= egs *regs) die(); } =20 +static void timer_interrupt(void) +{ + /* Disable the timer to avoid more interrupts */ + csr_clear(CSR_SIE, BIT(IRQ_S_TIMER, UL)); + + /* Signal the generic timer code to do its work */ + raise_softirq(TIMER_SOFTIRQ); +} + void do_trap(struct cpu_user_regs *cpu_regs) { register_t pc =3D cpu_regs->sepc; @@ -148,6 +158,10 @@ void do_trap(struct cpu_user_regs *cpu_regs) intc_handle_external_irqs(cpu_regs); break; =20 + case IRQ_S_TIMER: + timer_interrupt(); + break; + default: break; } --=20 2.52.0