From nobody Mon Apr 13 05:23:49 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=1771000196; cv=none; d=zohomail.com; s=zohoarc; b=KC01M+S8jlpMIAH8csTNgyw4ndNPKTt2F8MWa7+t7YIYg91eS40nyxfNYrZXc1OflzZDlizWzJY9o45p0fcuhiIV+A4ez/ULhwwEogEdN59yYz+WeZcOH5WpVes4YtDLG/gs2beB86lXW6ZGSW4zLyosfexMAJGleIxHCJlWAwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771000196; 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=W1EYQt5A3i5QUF1c7sbvdjSw7GZbau53/KdhZnxOwj0=; b=hr7Rz4lH+qlDJizL8wz+eFZkMFH6wvT7GeyFOKWuL4OYbaslpsMtl9vT3aPHaLzo+t6d0vYHA5zWLW6mBaa+5u5Rzcnvb5KeheCcWP/VTBUTBKPhmOIb1EBKdcyOWUIx/pKpVMrs3mtA0HmQKznViXN1izFUaKQe6vffWb/SGvA= 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 1771000196078789.8227472372573; Fri, 13 Feb 2026 08:29:56 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1231327.1536619 (Exim 4.92) (envelope-from ) id 1vqw2t-0000fI-Sd; Fri, 13 Feb 2026 16:29:31 +0000 Received: by outflank-mailman (output) from mailman id 1231327.1536619; Fri, 13 Feb 2026 16:29:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vqw2t-0000cR-0f; Fri, 13 Feb 2026 16:29:31 +0000 Received: by outflank-mailman (input) for mailman id 1231327; Fri, 13 Feb 2026 16:29:28 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vqw2q-0005Wn-Ij for xen-devel@lists.xenproject.org; Fri, 13 Feb 2026 16:29:28 +0000 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [2a00:1450:4864:20::32f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 29e3e8cd-08f9-11f1-9ccf-f158ae23cfc8; Fri, 13 Feb 2026 17:29:27 +0100 (CET) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-480706554beso10850105e9.1 for ; Fri, 13 Feb 2026 08:29:26 -0800 (PST) Received: from fedora (user-109-243-67-101.play-internet.pl. [109.243.67.101]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4834d5ebd1bsm303288185e9.6.2026.02.13.08.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 08:29:25 -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: 29e3e8cd-08f9-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771000166; x=1771604966; 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=W1EYQt5A3i5QUF1c7sbvdjSw7GZbau53/KdhZnxOwj0=; b=hRb/fOhgG76ubhtpx1WqzkkszCFuClqz5ihxcxWFXpQ6YMdiTqj98eplps22lk0bSA eqDIDjstkXddwPF1coVBPSdEsLvApiDiJDqVC8N5H3yFBxbgxE+r6zpzaQ/4UOi4FLUU QAj0LGxQ0KJ91fMZrMoYDzmN3jPbdaz0SMTm9DUDnGpfhVnw2WXQwhgui0l8eNXY3e+m ZlWZun7ElkcYhK/Zfb6AS8HqQGC+Lbhx6Ogi9R+AKQ/3PvrEP9CR3kBBEr1ISmDTbUDc ayfUauPr+gveuQFISwvHDzMM7cGtKtIx6c+zIxGYRh9PfELIGXHyNI8bPpH+iqgNIODM QRrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771000166; x=1771604966; 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=W1EYQt5A3i5QUF1c7sbvdjSw7GZbau53/KdhZnxOwj0=; b=X1ESuqDgQ3AsoGajapiSQ/cxy7jJHta0GYWw3iE9Yai2jQl72Mx2XMRV2fN+Wo9te+ zfYrr6QXbY4ZMcm1ozmrUqFiihvIuK5/IOPnd6V2qwVLKwOwzpSgtZ/JRq1E0xTQLOCF Pm8aIIvEN5or0e1Ie82Slv4dLLA3IPpTrTz9XcFIc4jTpGH/9b3Im8fw/z31Dib6+D9+ cKk+9K9mRpkuiplKomRhJV1yyqJcxP+zi3smi3kkvhBQtrZ72NYedbk2Br2rIjS3j/1O Fy1vDCjJW3NA+CYdk8gt+FLhEeSnf7AU93PveLBeUnwBxxn0qdxIsyLf76eq9o1pTHQ5 jwUw== X-Gm-Message-State: AOJu0YxAB8gwWSQEhqlDueLKNO1yIzf650CsFNcselHB7LMz960VDL+N cN8uqrB6UMLcbLOYaJy4zm4PyWlo5cVBrv6RFwg8VcqYqZfsjID5J+wIIGPoyMdD X-Gm-Gg: AZuq6aIGzWTQjUzPUkpP5OJdvW15xOC9oAV+Z4cG2HhF4+eQwqrO40Rhxr+Av7a7a5R OiAJL1Q9IwOzSDgO+Y8kKR0tX8puyuzMLd0lggPcl1HEww6tAAiht8pI/avKGoWVpaqrU3Mkwey z7tPV2uEwyDVNjXqWs0qbdree3hM0A/tt4JnICcN1HiUBbS9NYx0aOmx8mKZOubCWoDwoVztDXl AzA9gt/9ufhAWBPh2lzQd4dSP8411ZLb24Z3LrtuKFPFu6ZAS70ZpfL4E3xov0tzpCwFxdIBR2Y ph6HKFmqCmSYS+NO2oZG7plGzjjr/+1rE0EGzHV6QSYQjtxVUbqpQCuugOszuRR+OdrQU6E1Yox aFg/Hh9PPS4VqQlbB8MH47C8bID1efgAKpsjIja0nkYXvZlYCZtBdSZMgnWqOxZ3S/O1ovKjvLm wLRFzJ7x2sb8m9Wr4a92cA1ySl2YurXQ6oLpwC5QrrTEJjmXkqK7jOShV5gbfyuP4tUKiNLg== X-Received: by 2002:a05:600c:8486:b0:480:4a4f:c363 with SMTP id 5b1f17b1804b1-48373a1bbd0mr37656235e9.9.1771000165830; Fri, 13 Feb 2026 08:29:25 -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 v4 14/16] xen/riscv: handle hypervisor timer interrupts Date: Fri, 13 Feb 2026 17:29:00 +0100 Message-ID: <85118bb05a7a0635241ca15f80dcee8c01eada92.1770999383.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: 1771000198374158500 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 Acked-by: Jan Beulich --- Changes in v4: - Nothing changed. Only rebase. --- Changes in v3: - add Acked-by: Jan Beulich . --- 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 77738a01c8b5..ce8d346a14d2 100644 --- a/xen/arch/riscv/traps.c +++ b/xen/arch/riscv/traps.c @@ -10,6 +10,7 @@ #include #include #include +#include =20 #include #include @@ -178,6 +179,15 @@ static void check_for_pcpu_work(void) vcpu_flush_interrupts(c); } =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; @@ -219,6 +229,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: intr_handled =3D false; break; --=20 2.52.0