From nobody Wed Dec 17 03:46:18 2025 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=1747843470; cv=none; d=zohomail.com; s=zohoarc; b=ZLx2uNhHLWwEW+94MIGL176zESBXDNQUukFUkLS4ySATSjhdrKb8B89BS7KLZEokU2EO5JRgwx6O2vDVyHLPrBib373AX2PwhFmydl+gEkQUOIkBAhrrMQx28QJmd5eZDP73sD+TiCBrSieNOW7ocMeX+tTcn4l08D9Mde8hJxU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747843470; 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=pXa7CGMEIFOZ1vN2aNUNz1YqzXIyy5P1kJ1VTA9ahL8=; b=bpEBPBj+hjg1IQ0b7rLcSNUtcwW50nNuvUN6s2q0b/nKyzeSxjITZSYbmy4g9Le0fegXMux44n06GPtkonEX4E3CG387I8uoUhwQxt+dOxWYKPypfOgCLqIirbEiq5p3RULDNmDLwSvtsYw6XWSCYeDblAFPTTXtThbUcqcyAFk= 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 1747843470794159.08646599735812; Wed, 21 May 2025 09:04:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.992143.1375977 (Exim 4.92) (envelope-from ) id 1uHlvN-00062S-Lz; Wed, 21 May 2025 16:04:09 +0000 Received: by outflank-mailman (output) from mailman id 992143.1375977; Wed, 21 May 2025 16:04:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uHlvN-00061w-HL; Wed, 21 May 2025 16:04:09 +0000 Received: by outflank-mailman (input) for mailman id 992143; Wed, 21 May 2025 16:04:07 +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 1uHlvL-0004XB-BE for xen-devel@lists.xenproject.org; Wed, 21 May 2025 16:04:07 +0000 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [2a00:1450:4864:20::534]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3945bd89-365d-11f0-a2fa-13f23c93f187; Wed, 21 May 2025 18:04:07 +0200 (CEST) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-60119cd50b6so8915099a12.0 for ; Wed, 21 May 2025 09:04:06 -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-6004d502736sm9152513a12.25.2025.05.21.09.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 May 2025 09:04:05 -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: 3945bd89-365d-11f0-a2fa-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747843446; x=1748448246; 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=pXa7CGMEIFOZ1vN2aNUNz1YqzXIyy5P1kJ1VTA9ahL8=; b=Ql/U+Y2gv8TuEyJvD55drooo0n+lpbzEJgvHP1dXnRe7W6f3TE6qa1GYFwtqAKn2j9 jTqyF7te+xrKt0O1hi60DwUb8H9SCFBSeM+wAH4SRnMMwnPNvcH71MH3ZNh4RjQ8PXzu ctNI5hmNHIY/esNB+a9Us1xPhRtI9PUqF1cm6ec3IG6KE2wohykGzw4MM9dL/wD0hh2X k6gL0RXfM2Z55lCkjH0yGSFL9oboV10OeCVnVWvP+ac+xfdfWXJ8vmTj3QvbaZgVlzyR g/x8J+FK/Y+qfxYQKvIJOvkT1n+8OBtGOd9q8t0zUGIt7SkIRyqXPdB4exPdcWnyNSX1 8Kbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747843446; x=1748448246; 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=pXa7CGMEIFOZ1vN2aNUNz1YqzXIyy5P1kJ1VTA9ahL8=; b=Wt6VUCXLEvDfRB9YhoE5WyP08+PHF8E4+Zrhpb9AeqMASvEfy2f1vUsOU8ir4q2OwA vUaPOeSTze47fEk+zq2v4WsKW8b71HL055aUF5VNA2/IIGTHBuwIjiCVkr/H5O0IvQXv 2F0sbnIJ1RIlnq5QgRsDsWi9co3wnwIBItStZUrVVu3CKEPNq6+KoyF8xrY3xDajLvH1 z9phmflz5dz70FzbDxiZbaNg+vRRADQyHHpdAIso8mW83oRHMK2OkeDZkJfQji1221eH SzJ+IdBBQE46SRMkPf0GLpatVig2jFNu7ramTZZUWvSbSRmDos3+umkJHCpL2Uz2WFiV GWpg== X-Gm-Message-State: AOJu0YzEaZW8bdPkK9GS7yWrTMaw9ly1vSItyJOO5J3LppIIdOdTC/0H 5JEnDYCGP6iY67S+/UqLMOOGOlwuOrcR+xzqCClpQwZ5JUIRnBSk1gpiQNKPsQ== X-Gm-Gg: ASbGnctxi2rLFD2OGlHwg7jigooZ9GAUycl1oz/CvEstCextyW73ncbt7DcKve2YvQQ fqol9xnaRljRJeg/iy5A9bCz6PqbqqDetyPwhlKbEJFn3nJs3sXyEnozJEeohOrYlN3NzoPzeHM aN1X07IiNV2FJAwjGdGg/AHnFFqfZsn31LuN6a1JxNIizxWQ6oASBtO7TOAK69J1i1mgfscSidS UNOzzxQv3ParXcVuZ5xdHahJ/yBugmx+8sL9vKTxpMFYrcCFPyfc7tSuSxqDhpjuvCISt+L9Cfn m9yP4CJgfT41BaXikVxXvIub2t8AL0L+SoH03IB5BUsiUJx5nClP5D9UdsafZOwYbxndkvGY/Di yxTkl10se+tem/gplBw== X-Google-Smtp-Source: AGHT+IHS5fYBVXgwvUEWYYYGn4MRpmHoyuk/dgn1+GBR9YqJki3D+U4gCHeomjidZ5cP60SAXnS+tA== X-Received: by 2002:a05:6402:35c3:b0:601:ff94:4a41 with SMTP id 4fb4d7f45d1cf-601ff944b43mr7172006a12.29.1747843446075; Wed, 21 May 2025 09:04:06 -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 v3 07/14] xen/riscv: introduce register_intc_ops() and intc_hw_ops. Date: Wed, 21 May 2025 18:03:47 +0200 Message-ID: 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: 1747843473349116600 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 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 52ba196d87..860737f965 100644 --- a/xen/arch/riscv/include/asm/intc.h +++ b/xen/arch/riscv/include/asm/intc.h @@ -12,11 +12,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