From nobody Mon Oct 6 01:28:19 2025 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB35726AAA3 for ; Mon, 28 Jul 2025 09:44:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753695875; cv=none; b=MAvHDivek4NJzlO/nCfnE7NbJUA9DQs1XiscV+gv7yWAmrWwRK2vvzy7pzbqBJug1BoKeed7hyHBrJKKnlCzdYKjM6NmIba9XRxlhWSb9VHSghSrYJ5wKyIYkrUl1oIggbd6NUdZNN6LQfqEQSdnGPEBO1/1yuiPaFZ2pTKXFdU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753695875; c=relaxed/simple; bh=FX/B5nGrbSl3HmerIxToYr+lslD0mN8D8gnQDTQi4h8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B2XS7XSVXv8x66t47DtI9dd5wRs2/eawbNwy25SNX/j6OjlE0CIeMP1OwKS/dklwSqB40aFWVz08x3r0B4zmv8VJFgT0pqx8a17/Fw6+h3crdwSP8WYgpL8vY0/ywDxnOxpknAOEZ3+SyePT6MzQrNu5vuv70dzQN3Y3QoR6Jhg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=YdiXo6J7; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="YdiXo6J7" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-879d2e419b9so2868080a12.2 for ; Mon, 28 Jul 2025 02:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1753695873; x=1754300673; darn=vger.kernel.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=KlYXC9F0O8zbv2hE1LP7h6LlplF1lF+tvzzZDmIs1fc=; b=YdiXo6J7s1cx4vdf3I8PluAt3l/hrCbaMla7K39qKJmUAJ0B3L/wioZA7soIgPtp+B E1XxwGKmJD9sBVJQjROxFFX3TMAtlFmapR1HE3NbxMVJ/uHNvN0+RWdvnAk+kJ9qdN1o ZjQhPD8mfo/H31vBRUcDVYIT56a5T0M+irEY0BdtXtmgcAB2rpSTf536EHbo9q7XaBa/ JhEWJsRZp/QpgXgMhouQ/UDg2gISebfkLuPOAIiEKhHqcRAxNkiYrUSWQ32LY/6CXrkf s7Lcmh6eEvvKpeCaazP63uPakm1PtTmOAaUMxjeJ/OXegIi90oHpv9W8j0GUKQgOzF4a 6fkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753695873; x=1754300673; 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=KlYXC9F0O8zbv2hE1LP7h6LlplF1lF+tvzzZDmIs1fc=; b=O0PUDfQFgQEnd5lGkLbIWEGk6Faa3DcgeaPLYTDeF0kLT/OmRYY1PBBaZxhHSjDyv8 b28+A4GLPSCONb+8ESB2bS153knNWhL2o/N4d2xuWu1zWjZKR1z/Csan1D6T5fDmyNKf sXGjOItNKhEoLxLX4yGu8W1mXtZF5RBwVQPn5wBTTplOVY4tDwtvRnYeWT7bBVlRhf3V 0g5LTdHAU51i3ppFa+mohO8ip8jD5N+7SqInIUPRzZz5Eiu5ySSqHWH4w/yyoZon04B5 fujtMYcXKNJlnO4Zln7KBR+q/EbAcf2lK3YH1jL8K/WqqHjrUA51RnvE7dsoHxVKUpxG /CUA== X-Forwarded-Encrypted: i=1; AJvYcCV/2PAXEMTPpAPYXEimY4+0PX5VcNjspsyRerzc5CaJ8cF6AgJP56MSWR1jBKipvy6FafeEZMiIUpLxOLY=@vger.kernel.org X-Gm-Message-State: AOJu0YzaoGPIxTPAq/VUxPaEC1vhYorwIvhfN6ls40GCdlSTz8ZFNpgQ zECZV80Y6AfdikElyanl8W0XbgDfx9nhesCZFPHhluUnQ7UuOgoknyzrN6DndCAAg24= X-Gm-Gg: ASbGncuLmSEXFy7sGZMbV3aO2HX0xKZYgy4/3aNN/kl9J1cot8PvbWyMCb5nN5/FPqM H40uuIVgKYagF6bIbP4nq7JoG1luCkrqlqdzgkRTSYmHNlO9uM5ipd9iy0cyTz7SW+hHaI3HLsO 3JP/EzU8HbtLzuRKyN7z9qzKjCqhOH/Vg8ahTdfOS//dfDm31OzFODVlrA77h/nkPHv4fvtnjQq 6Cu2QZoKhf9GLQyr/9NGW6mpp8PBFAud7xLL4PreMmXO0r5KNfhoIJljCa+igczjAMdDn4SylCi eb3FEIV0ebpcXALLfDRB7tygjslCwYuvt2MJSdey77jnUSMwfZsq73R1OP88FsOrIT7W7SZ02BY JE0y995058eUzdb4QDbWMiIRTmawBjMDVmrme9okFwSY7S7PmxmV3UYNYEcxpPoUlerjf2lo= X-Google-Smtp-Source: AGHT+IGAwJvkdUw2Iit6cp8KQcw8fgP3DTpOBB5lX+b717WF4c4kBlnVYgF0+VaAcfTFETTz20JkcA== X-Received: by 2002:a17:90b:3b4c:b0:315:b07a:ac12 with SMTP id 98e67ed59e1d1-31e77882e8emr16716236a91.14.1753695872826; Mon, 28 Jul 2025 02:44:32 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([122.171.19.28]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-31e832fbf99sm5396230a91.1.2025.07.28.02.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Jul 2025 02:44:32 -0700 (PDT) From: Anup Patel To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jassi Brar , Thomas Gleixner , "Rafael J . Wysocki" , Mika Westerberg , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Cc: Palmer Dabbelt , Paul Walmsley , Alexandre Ghiti , Len Brown , Sunil V L , Rahul Pathak , Leyfoon Tan , Atish Patra , Andrew Jones , Samuel Holland , Anup Patel , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH v9 22/24] irqchip/riscv-rpmi-sysmsi: Add ACPI support Date: Mon, 28 Jul 2025 15:10:30 +0530 Message-ID: <20250728094032.63545-23-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250728094032.63545-1-apatel@ventanamicro.com> References: <20250728094032.63545-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sunil V L Add ACPI support for the RISC-V RPMI system MSI based irqchip driver. Reviewed-by: Thomas Gleixner Signed-off-by: Sunil V L Signed-off-by: Anup Patel --- drivers/irqchip/Kconfig | 2 +- drivers/irqchip/irq-riscv-rpmi-sysmsi.c | 47 +++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index b10e36db2c63..25bac6a21a88 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -620,7 +620,7 @@ config RISCV_IMSIC =20 config RISCV_RPMI_SYSMSI bool - depends on MAILBOX + depends on RISCV && MAILBOX select IRQ_DOMAIN_HIERARCHY select GENERIC_MSI_IRQ default RISCV diff --git a/drivers/irqchip/irq-riscv-rpmi-sysmsi.c b/drivers/irqchip/irq-= riscv-rpmi-sysmsi.c index 92e8847dfccc..5c74c561ce31 100644 --- a/drivers/irqchip/irq-riscv-rpmi-sysmsi.c +++ b/drivers/irqchip/irq-riscv-rpmi-sysmsi.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2025 Ventana Micro Systems Inc. */ =20 +#include #include #include #include @@ -9,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -209,6 +211,8 @@ static int rpmi_sysmsi_probe(struct platform_device *pd= ev) { struct device *dev =3D &pdev->dev; struct rpmi_sysmsi_priv *priv; + struct fwnode_handle *fwnode; + u32 id; int rc; =20 priv =3D devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); @@ -239,6 +243,22 @@ static int rpmi_sysmsi_probe(struct platform_device *p= dev) } priv->nr_irqs =3D rc; =20 + fwnode =3D dev_fwnode(dev); + if (is_acpi_node(fwnode)) { + u32 nr_irqs; + + rc =3D riscv_acpi_get_gsi_info(fwnode, &priv->gsi_base, &id, + &nr_irqs, NULL); + if (rc) { + dev_err(dev, "failed to find GSI mapping\n"); + return rc; + } + + /* Update with actual GSI range */ + if (nr_irqs !=3D priv->nr_irqs) + riscv_acpi_update_gsi_range(priv->gsi_base, priv->nr_irqs); + } + /* * The device MSI domain for platform devices on RISC-V architecture * is only available after the MSI controller driver is probed so, @@ -252,8 +272,15 @@ static int rpmi_sysmsi_probe(struct platform_device *p= dev) * then we need to set it explicitly before using any platform * MSI functions. */ - if (dev_of_node(dev)) + if (is_of_node(fwnode)) { of_msi_configure(dev, dev_of_node(dev)); + } else if (is_acpi_device_node(fwnode)) { + struct irq_domain *msi_domain; + + msi_domain =3D irq_find_matching_fwnode(imsic_acpi_get_fwnode(dev), + DOMAIN_BUS_PLATFORM_MSI); + dev_set_msi_domain(dev, msi_domain); + } =20 if (!dev_get_msi_domain(dev)) { mbox_free_channel(priv->chan); @@ -268,6 +295,13 @@ static int rpmi_sysmsi_probe(struct platform_device *p= dev) return dev_err_probe(dev, -ENOMEM, "failed to create MSI irq domain\n"); } =20 +#ifdef CONFIG_ACPI + struct acpi_device *adev =3D ACPI_COMPANION(dev); + + if (adev) + acpi_dev_clear_dependencies(adev); +#endif + dev_info(dev, "%u system MSIs registered\n", priv->nr_irqs); return 0; } @@ -277,10 +311,17 @@ static const struct of_device_id rpmi_sysmsi_match[] = =3D { {} }; =20 +static const struct acpi_device_id acpi_rpmi_sysmsi_match[] =3D { + { "RSCV0006" }, + {} +}; +MODULE_DEVICE_TABLE(acpi, acpi_rpmi_sysmsi_match); + static struct platform_driver rpmi_sysmsi_driver =3D { .driver =3D { - .name =3D "rpmi-sysmsi", - .of_match_table =3D rpmi_sysmsi_match, + .name =3D "rpmi-sysmsi", + .of_match_table =3D rpmi_sysmsi_match, + .acpi_match_table =3D acpi_rpmi_sysmsi_match, }, .probe =3D rpmi_sysmsi_probe, }; --=20 2.43.0