]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
irqchip/mvebu-gicp: Switch to MSI parent
authorThomas Gleixner <tglx@linutronix.de>
Sun, 23 Jun 2024 15:18:58 +0000 (17:18 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 18 Jul 2024 18:31:20 +0000 (20:31 +0200)
All platform MSI users and the PCI/MSI code handle per device MSI domains
when the irqdomain associated to the device provides MSI parent
functionality.

Remove the "global" platform domain related code and provide the MSI parent
functionality by filling in msi_parent_ops.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Shivamurthy Shastri <shivamurthy.shastri@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240623142235.699780279@linutronix.de
drivers/irqchip/Kconfig
drivers/irqchip/irq-mvebu-gicp.c

index e7a57b3dc4b115e9e8adca173c8839b53cf3bab1..a0fa59928913aa4f2b6553dc56077ec55a820c04 100644 (file)
@@ -371,6 +371,7 @@ config MSCC_OCELOT_IRQ
        select GENERIC_IRQ_CHIP
 
 config MVEBU_GICP
+       select IRQ_MSI_LIB
        bool
 
 config MVEBU_ICU
index c43a345061d535b4afc94d6e11059177c33391a8..2b6183919ea48bb2ba97ae1614b050256857a969 100644 (file)
@@ -17,6 +17,8 @@
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
 
+#include "irq-msi-lib.h"
+
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
 #define GICP_SETSPI_NSR_OFFSET 0x0
@@ -145,32 +147,32 @@ static void gicp_irq_domain_free(struct irq_domain *domain,
 }
 
 static const struct irq_domain_ops gicp_domain_ops = {
+       .select = msi_lib_irq_domain_select,
        .alloc  = gicp_irq_domain_alloc,
        .free   = gicp_irq_domain_free,
 };
 
-static struct irq_chip gicp_msi_irq_chip = {
-       .name           = "GICP",
-       .irq_set_type   = irq_chip_set_type_parent,
-       .flags          = IRQCHIP_SUPPORTS_LEVEL_MSI,
-};
+#define GICP_MSI_FLAGS_REQUIRED  (MSI_FLAG_USE_DEF_DOM_OPS |   \
+                                 MSI_FLAG_USE_DEF_CHIP_OPS)
 
-static struct msi_domain_ops gicp_msi_ops = {
-};
+#define GICP_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK |     \
+                                 MSI_FLAG_LEVEL_CAPABLE)
 
-static struct msi_domain_info gicp_msi_domain_info = {
-       .flags  = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-                  MSI_FLAG_LEVEL_CAPABLE),
-       .ops    = &gicp_msi_ops,
-       .chip   = &gicp_msi_irq_chip,
+static const struct msi_parent_ops gicp_msi_parent_ops = {
+       .supported_flags        = GICP_MSI_FLAGS_SUPPORTED,
+       .required_flags         = GICP_MSI_FLAGS_REQUIRED,
+       .bus_select_token       = DOMAIN_BUS_GENERIC_MSI,
+       .bus_select_mask        = MATCH_PLATFORM_MSI,
+       .prefix                 = "GICP-",
+       .init_dev_msi_info      = msi_lib_init_dev_msi_info,
 };
 
 static int mvebu_gicp_probe(struct platform_device *pdev)
 {
-       struct mvebu_gicp *gicp;
-       struct irq_domain *inner_domain, *plat_domain, *parent_domain;
+       struct irq_domain *inner_domain, *parent_domain;
        struct device_node *node = pdev->dev.of_node;
        struct device_node *irq_parent_dn;
+       struct mvebu_gicp *gicp;
        int ret, i;
 
        gicp = devm_kzalloc(&pdev->dev, sizeof(*gicp), GFP_KERNEL);
@@ -234,17 +236,9 @@ static int mvebu_gicp_probe(struct platform_device *pdev)
        if (!inner_domain)
                return -ENOMEM;
 
-
-       plat_domain = platform_msi_create_irq_domain(of_node_to_fwnode(node),
-                                                    &gicp_msi_domain_info,
-                                                    inner_domain);
-       if (!plat_domain) {
-               irq_domain_remove(inner_domain);
-               return -ENOMEM;
-       }
-
-       platform_set_drvdata(pdev, gicp);
-
+       irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_GENERIC_MSI);
+       inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
+       inner_domain->msi_parent_ops = &gicp_msi_parent_ops;
        return 0;
 }