From nobody Mon Feb 9 15:29: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=1749139174; cv=none; d=zohomail.com; s=zohoarc; b=HkZYtwp7Y4wDmxVongKoK22Ev8YAes6xElC7KCVYqq2sRPEgZ79kqBmrNtKVWeyp7Pbv8I5duyfMsS4fc614HQd+LWWJx4z0slVkzjdUBT3v2XVIURbxAiRIvEcd0HfK/duzUopt1daD/cKlqjZeYbvqOHTV6sGYYH0l79oR6Ls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749139174; 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=8rMgsLeE3IPvDrOvyCQ5hw/i+mcvXBtOgOiBpyo7Ow8=; b=X6jswzQbHiCU/oSo1B1JV8FRVH+3JTX2mwc0QRtnH+0kPTpD3lodbUHyfD9Rf75BCmiNzUBsfmVUEjnFcsZ73JTk4TV5CNFpRNkJYvIlFOIHjfMODkcXIA5wFD1Y5Vn0MmjRhR/kwYPxzZJTzwcTS9UHdkB+FkSrA2WF9DANvV0= 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 174913917495760.839552146625465; Thu, 5 Jun 2025 08:59:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1007084.1386372 (Exim 4.92) (envelope-from ) id 1uNCzw-0007UL-MC; Thu, 05 Jun 2025 15:59:20 +0000 Received: by outflank-mailman (output) from mailman id 1007084.1386372; Thu, 05 Jun 2025 15:59:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uNCzw-0007UC-JL; Thu, 05 Jun 2025 15:59:20 +0000 Received: by outflank-mailman (input) for mailman id 1007084; Thu, 05 Jun 2025 15:59:19 +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 1uNCzv-00071f-8U for xen-devel@lists.xenproject.org; Thu, 05 Jun 2025 15:59:19 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 08e2e749-4226-11f0-b894-0df219b8e170; Thu, 05 Jun 2025 17:59:17 +0200 (CEST) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-601f278369bso2304251a12.1 for ; Thu, 05 Jun 2025 08:59:17 -0700 (PDT) Received: from fedora.. (user-109-243-64-38.play-internet.pl. [109.243.64.38]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-60566c2aba9sm10443034a12.2.2025.06.05.08.59.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jun 2025 08:59:14 -0700 (PDT) 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: 08e2e749-4226-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749139157; x=1749743957; 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=8rMgsLeE3IPvDrOvyCQ5hw/i+mcvXBtOgOiBpyo7Ow8=; b=nlwo5ZQMM98ycaJvDWaUGm8O+EeByck7QUksUcCme9qAkd7sMpWnS5M+ZXLUuUFn5p DUKXV+87z53gfIFq8yE/erXsSZBNAS7mQfnBSuSwP4b2RzQ7qKm1e6zQD5oXqQ6kZtIP Zog2W0FMGL77GtmhPEI7f2zqAunFmfOh3X7q6jnb7NeQTbUUo67U2fLjtCA+/BEisiNH 46+KpZtWAIZpMKepOFslvVeFktw5skcqj/4qmb1pVS1opSSiweEgPcysBTN4n4Qw4I+o iXOlHMwpB5sPKZ2sxyg5DTeWwScOZZbYlo14WvTV+S1mhCZulNaTxDjnkSJAV5QMq0ON xz3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749139157; x=1749743957; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8rMgsLeE3IPvDrOvyCQ5hw/i+mcvXBtOgOiBpyo7Ow8=; b=qNM7khYiLHf5ePyRL27oCeBpsXzmaYse4woOcbZ5a5u5HeTKCHQjUu3anXu4Bd5IEL WA+MNztoyXnNEd1U9YoaHCnIdRb5F+Q8dneFhWzgltmYpmFdFt6Km7BDZmsOmj18d6+g VM52hk0t8ISS1JskkrfBE/RiKx3KPTKXPi9U8/rt44aniNfBR5hMSm5CvuLZnQIwZISS rXxyMsV7WyRSwg5iCtujeesCWn9bCsAo9fQ5Mr0eXVVqzGZWNq8mlNd1QNTdBF2OwFS0 sdlQ02ImgVdknl43XJqMG7QUYq3nWV2KQojFHBmy94KOaTvigMpNaP6/JiWnGPUHJ1Bn MITQ== X-Gm-Message-State: AOJu0YwIn8NPuS4vVjQQY1VtBq/JT0CGf07HlIEyKElmUzrLfd0JAVs3 AU0GPhceYcrn7HrNNidP0JzUv1nnzDrG6dpV2+5IOFSTq/VXXmwyksVLZDtpxQ== X-Gm-Gg: ASbGncs2cC5FtrIxdvEmI65HdjisXQG9WtjEa6JFNpj3R82ndTRv6Avs7tdo62tBDND rGkoRzgv/Dq8M0qjiCGbOYvfYotGMWPuXLsdiZtiXqpPIpQXLxd76fF2yb7Pb8WgXHLoIff5Rh/ yyJxhPRtYnLCIIHqtiom3bO+8nJP5FIkzSxhwMwUK63JcQb1lvgl5mHdF9T54MxzaXOB86vFzS+ xJU1TsSpxE2ocPUHevpIJb0uOkEsbsiSaSfHC2wAUD1PcD/VawPnFgubuX/2a+O4Cf+KDDTejta 4crVoHk8vpnLJ04R6Sn2QfeDRZ2ZWSD0L300/v+7254CsXZFlDEAZnSHf9E41rO9dRT+YyUPJsU rgPZK5oN2g75A825WXw== X-Google-Smtp-Source: AGHT+IH7rXiZOc4pWZsuxKU/tb4/N3pcyfMMbckG8T5MjO0JeKXo7aXBlXFcqF9yolConDtACq6QAA== X-Received: by 2002:a05:6402:3591:b0:607:27bb:7bf with SMTP id 4fb4d7f45d1cf-60727bb09f7mr3105825a12.32.1749139154603; Thu, 05 Jun 2025 08:59:14 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , 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 v4 2/9] xen/riscv: introduce register_intc_ops() and intc_hw_ops. Date: Thu, 5 Jun 2025 17:58:58 +0200 Message-ID: <100c1377b3ac06a2603d5740ad4606cb84bff168.1749121437.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1749139177123116600 Content-Type: text/plain; charset="utf-8" Introduce the intc_hw_operations structure to encapsulate interrupt controller-specific data and operations. This structure includes: - A pointer to interrupt controller information (`intc_info`) - Callbacks to initialize the controller and set IRQ type/priority - A reference to an interupt controller descriptor (`host_irq_type`) - number of interrupt controller irqs. Add function register_intc_ops() to mentioned above structure. Co-developed-by: Romain Caritey Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- Changes in V4: - Add Acked-by: Jan Beulich . --- Changes in V3: - Drop inclusion of xen/irq.h in asm/intc.h as forward declaration is enogh for types used in asm/intc.h. - Drop forward declaration for dt_device_node and hw_irq_controller. - Declare intc_hw_ops as: const struct intc_hw_operations * __ro_after_init intc_hw_ops; --- Changes in V2: - Declare host_irq_type member of intc_hw_operations as pointer-to-const. - Moved up forward declaration of irq_desc. - Use attribute __init for register_intc_ops(). - Use attribute __ro_after_init for intc_hw_ops variable. - Update prototype of register_intc_ops() because of what mention in the previous point. --- xen/arch/riscv/include/asm/intc.h | 19 +++++++++++++++++++ xen/arch/riscv/intc.c | 9 +++++++++ 2 files changed, 28 insertions(+) diff --git a/xen/arch/riscv/include/asm/intc.h b/xen/arch/riscv/include/asm= /intc.h index 81f74736ba..434c9d0781 100644 --- a/xen/arch/riscv/include/asm/intc.h +++ b/xen/arch/riscv/include/asm/intc.h @@ -14,11 +14,30 @@ enum intc_version { INTC_APLIC, }; =20 +struct irq_desc; + struct intc_info { enum intc_version hw_version; const struct dt_device_node *node; }; =20 +struct intc_hw_operations { + /* Hold intc hw information */ + const struct intc_info *info; + /* Initialize the intc and the boot CPU */ + int (*init)(void); + + /* hw_irq_controller to enable/disable/eoi host irq */ + const struct hw_interrupt_type *host_irq_type; + + /* Set IRQ type */ + void (*set_irq_type)(struct irq_desc *desc, unsigned int type); + /* Set IRQ priority */ + void (*set_irq_priority)(struct irq_desc *desc, unsigned int priority); +}; + void intc_preinit(void); =20 +void register_intc_ops(const struct intc_hw_operations *ops); + #endif /* ASM__RISCV__INTERRUPT_CONTOLLER_H */ diff --git a/xen/arch/riscv/intc.c b/xen/arch/riscv/intc.c index 4061a3c457..1ecd651bf3 100644 --- a/xen/arch/riscv/intc.c +++ b/xen/arch/riscv/intc.c @@ -5,6 +5,15 @@ #include #include =20 +#include + +static const struct intc_hw_operations *__ro_after_init intc_hw_ops; + +void __init register_intc_ops(const struct intc_hw_operations *ops) +{ + intc_hw_ops =3D ops; +} + void __init intc_preinit(void) { if ( acpi_disabled ) --=20 2.49.0