Skip to contentSkip to conversation

irq domain: drop IRQ_DOMAIN_HIERARCHY option, make it always on

PATCH In review Randy Dunlap 2 participants 3 messages Mar 13, 2023 – Mar 24, 2023

Subsystems (17)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 irq domain: drop IRQ_DOMAIN_HIERARCHY option, make it always on

In preparation for dropping the IRQ_DOMAIN Kconfig option (effectively making it always set/on), first drop IRQ_DOMAIN_HIERARCHY as an option, making its code always set/on.

This has been built successfully on all ARCHes except hexagon, both 32-bit and 64-bit where applicable.

---
v2: add stubs in include/linux/irqdomain.h for the config case of IRQ_DOMAIN is not set. If these are not added, there will be plenty of build errors (not so much for modern arches as for older ones). For functions that return a value, the return values should be reviewed. All of these stubs can be deleted when CONFIG_IRQ_DOMAIN is always on (i.e., in some subsequent patch).

 arch/mips/Kconfig                      |    4 
 arch/powerpc/sysdev/xics/xics-common.c |    4 
 arch/powerpc/sysdev/xive/common.c      |    4 
 arch/x86/Kconfig                       |    2 
 drivers/gpio/Kconfig                   |   20 +--
 drivers/gpio/gpiolib.c                 |   18 ---
 drivers/irqchip/Kconfig                |   45 +++----
 drivers/mfd/Kconfig                    |    2 
 drivers/pinctrl/qcom/Kconfig           |    6 -
 drivers/pinctrl/stm32/Kconfig          |    2 
 drivers/soc/tegra/Kconfig              |    2 
 drivers/spmi/Kconfig                   |    4 
 include/linux/gpio/driver.h            |    6 -
 include/linux/irq.h                    |    5 
 include/linux/irqdomain.h              |  136 +++++++++++++++++++----
 kernel/irq/Kconfig                     |    7 -
 kernel/irq/chip.c                      |    6 -
 kernel/irq/debugfs.c                   |    2 
 kernel/irq/internals.h                 |    6 -
 kernel/irq/irqdomain.c                 |   52 --------
 kernel/irq/manage.c                    |   18 ---
 kernel/irq/migration.c                 |    6 -
 kernel/irq/resend.c                    |    4 
 23 files changed, 164 insertions(+), 197 deletions(-)
kernel/irq/Kconfig +0 -7
diff -- a/kernel/irq/Kconfig b/kernel/irq/Kconfig
@@ -66,11 +66,6 @@ config IRQ_SIM
 	select IRQ_WORK
 	select IRQ_DOMAIN
 
-# Support for hierarchical irq domains
-config IRQ_DOMAIN_HIERARCHY
-	bool
-	select IRQ_DOMAIN
-
 # Support for obsolete non-mapping irq domains
 config IRQ_DOMAIN_NOMAP
 	bool
@@ -84,7 +79,6 @@ config IRQ_FASTEOI_HIERARCHY_HANDLERS
 config GENERIC_IRQ_IPI
 	bool
 	depends on SMP
-	select IRQ_DOMAIN_HIERARCHY
 
 # Generic IRQ IPI Mux support
 config GENERIC_IRQ_IPI_MUX
@@ -94,7 +88,6 @@ config GENERIC_IRQ_IPI_MUX
 # Generic MSI hierarchical interrupt domain support
 config GENERIC_MSI_IRQ
 	bool
-	select IRQ_DOMAIN_HIERARCHY
 
 config IRQ_MSI_IOMMU
 	bool
arch/mips/Kconfig +2 -2
diff -- a/arch/mips/Kconfig b/arch/mips/Kconfig
@@ -687,7 +687,7 @@ config SGI_IP27
 	select SYS_HAS_EARLY_PRINTK
 	select HAVE_PCI
 	select IRQ_MIPS_CPU
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	select NR_CPUS_DEFAULT_64
 	select PCI_DRIVERS_GENERIC
 	select PCI_XTALK_BRIDGE
@@ -752,7 +752,7 @@ config SGI_IP30
 	select ZONE_DMA32
 	select HAVE_PCI
 	select IRQ_MIPS_CPU
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	select PCI_DRIVERS_GENERIC
 	select PCI_XTALK_BRIDGE
 	select SYS_HAS_EARLY_PRINTK
arch/x86/Kconfig +1 -1
diff -- a/arch/x86/Kconfig b/arch/x86/Kconfig
@@ -1109,7 +1109,7 @@ config X86_UP_IOAPIC
 config X86_LOCAL_APIC
 	def_bool y
 	depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC || PCI_MSI
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 
 config X86_IO_APIC
 	def_bool y
drivers/spmi/Kconfig +2 -2
diff -- a/drivers/spmi/Kconfig b/drivers/spmi/Kconfig
@@ -13,7 +13,7 @@ if SPMI
 
 config SPMI_HISI3670
 	tristate "Hisilicon 3670 SPMI Controller"
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	depends on HAS_IOMEM
 	help
 	  If you say yes to this option, support will be included for the
@@ -22,7 +22,7 @@ config SPMI_HISI3670
 
 config SPMI_MSM_PMIC_ARB
 	tristate "Qualcomm MSM SPMI Controller (PMIC Arbiter)"
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	depends on ARCH_QCOM || COMPILE_TEST
 	depends on HAS_IOMEM
 	default ARCH_QCOM
drivers/irqchip/Kconfig +21 -24

189 lines not on this page · raw message

drivers/pinctrl/qcom/Kconfig +3 -3
diff -- a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig
@@ -9,7 +9,7 @@ config PINCTRL_MSM
 	select PINCONF
 	select GENERIC_PINCONF
 	select GPIOLIB_IRQCHIP
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	select IRQ_FASTEOI_HIERARCHY_HANDLERS
 
 config PINCTRL_APQ8064
@@ -236,7 +236,7 @@ config PINCTRL_QCOM_SPMI_PMIC
 	select GENERIC_PINCONF
   select GPIOLIB
 	select GPIOLIB_IRQCHIP
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	help
 	 This is the pinctrl, pinmux, pinconf and gpiolib driver for the
 	 Qualcomm GPIO and MPP blocks found in the Qualcomm PMIC's chips,
@@ -251,7 +251,7 @@ config PINCTRL_QCOM_SSBI_PMIC
 	select GENERIC_PINCONF
   select GPIOLIB
 	select GPIOLIB_IRQCHIP
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	help
 	 This is the pinctrl, pinmux, pinconf and gpiolib driver for the
 	 Qualcomm GPIO and MPP blocks found in the Qualcomm PMIC's chips,
drivers/pinctrl/stm32/Kconfig +1 -1
diff -- a/drivers/pinctrl/stm32/Kconfig b/drivers/pinctrl/stm32/Kconfig
@@ -7,7 +7,7 @@ config PINCTRL_STM32
 	select PINMUX
 	select GENERIC_PINCONF
 	select GPIOLIB
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	select MFD_SYSCON
 
 config PINCTRL_STM32F429
drivers/soc/tegra/Kconfig +1 -1
diff -- a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig
@@ -146,7 +146,7 @@ config SOC_TEGRA_FLOWCTRL
 config SOC_TEGRA_PMC
 	bool
 	select GENERIC_PINCONF
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	select PM_OPP
 	select PM_GENERIC_DOMAINS
 	select REGMAP
drivers/mfd/Kconfig +1 -1
diff -- a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
@@ -1066,7 +1066,7 @@ config PCF50633_GPIO
 config MFD_PM8XXX
 	tristate "Qualcomm PM8xxx PMIC chips driver"
 	depends on (ARM || HEXAGON || COMPILE_TEST)
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	select MFD_CORE
 	select REGMAP
 	help
drivers/gpio/Kconfig +10 -10
diff -- a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
@@ -361,7 +361,7 @@ config GPIO_IXP4XX
 	depends on OF
 	select GPIO_GENERIC
 	select GPIOLIB_IRQCHIP
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	help
 	  Say yes here to support the GPIO functionality of a number of Intel
 	  IXP4xx series of chips.
@@ -397,7 +397,7 @@ config GPIO_LPC18XX
 	tristate "NXP LPC18XX/43XX GPIO support"
 	default y if ARCH_LPC18XX
 	depends on OF_GPIO && (ARCH_LPC18XX || COMPILE_TEST)
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	help
 	  Select this option to enable GPIO driver for
 	  NXP LPC18XX/43XX devices.
@@ -566,7 +566,7 @@ config GPIO_SAMA5D2_PIOBU
 config GPIO_SIFIVE
 	bool "SiFive GPIO support"
 	depends on OF_GPIO
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	select GPIO_GENERIC
 	select GPIOLIB_IRQCHIP
 	select REGMAP_MMIO
@@ -646,7 +646,7 @@ config GPIO_TEGRA
 	depends on ARCH_TEGRA || COMPILE_TEST
 	depends on OF_GPIO
 	select GPIOLIB_IRQCHIP
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	help
 	  Say yes here to support GPIO pins on NVIDIA Tegra SoCs.
 
@@ -656,7 +656,7 @@ config GPIO_TEGRA186
 	depends on ARCH_TEGRA_186_SOC || ARCH_TEGRA_194_SOC || COMPILE_TEST
 	depends on OF_GPIO
 	select GPIOLIB_IRQCHIP
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	help
 	  Say yes here to support GPIO pins on NVIDIA Tegra186 SoCs.
 
@@ -673,7 +673,7 @@ config GPIO_THUNDERX
 	depends on ARCH_THUNDER || (64BIT && COMPILE_TEST)
 	depends on PCI_MSI
 	select GPIOLIB_IRQCHIP
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	select IRQ_FASTEOI_HIERARCHY_HANDLERS
 	help
 	  Say yes here to support the on-chip GPIO lines on the ThunderX
@@ -683,7 +683,7 @@ config GPIO_UNIPHIER
 	tristate "UniPhier GPIO support"
 	depends on ARCH_UNIPHIER || COMPILE_TEST
 	depends on OF_GPIO
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	help
 	  Say yes here to support UniPhier GPIOs.
 
@@ -700,7 +700,7 @@ config GPIO_VISCONTI
 	depends on OF_GPIO
 	select GPIOLIB_IRQCHIP
 	select GPIO_GENERIC
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	help
 	  Say yes here to support GPIO on Tohisba Visconti.
 
@@ -737,7 +737,7 @@ config GPIO_XGENE_SB
 	depends on (ARCH_XGENE || COMPILE_TEST)
 	select GPIO_GENERIC
 	select GPIOLIB_IRQCHIP
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	help
 	  This driver supports the GPIO block within the APM X-Gene
 	  Standby Domain. Say yes here to enable the GPIO functionality.
@@ -815,7 +815,7 @@ config GPIO_MSC313
 	depends on ARCH_MSTARV7
 	default ARCH_MSTARV7
 	select GPIOLIB_IRQCHIP
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN
 	help
 	  Say Y here to support the main GPIO block on MStar/SigmaStar
 	  ARMv7-based SoCs.
arch/powerpc/sysdev/xics/xics-common.c +0 -4
diff -- a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c
@@ -411,7 +411,6 @@ int xics_retrigger(struct irq_data *data
 	return 0;
 }
 
-#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
 static int xics_host_domain_translate(struct irq_domain *d, struct irq_fwspec *fwspec,
 				      unsigned long *hwirq, unsigned int *type)
 {
@@ -445,14 +444,11 @@ static void xics_host_domain_free(struct
 {
 	pr_debug("%s %d #%d\n", __func__, virq, nr_irqs);
 }
-#endif
 
 static const struct irq_domain_ops xics_host_ops = {
-#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
 	.alloc	= xics_host_domain_alloc,
 	.free	= xics_host_domain_free,
 	.translate = xics_host_domain_translate,
-#endif
 	.match = xics_host_match,
 	.map = xics_host_map,
 	.xlate = xics_host_xlate,
arch/powerpc/sysdev/xive/common.c +0 -4
diff -- a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
@@ -1388,7 +1388,6 @@ static void xive_irq_domain_debug_show(s
 }
 #endif
 
-#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
 static int xive_irq_domain_translate(struct irq_domain *d,
 				     struct irq_fwspec *fwspec,
 				     unsigned long *hwirq,
@@ -1445,14 +1444,11 @@ static void xive_irq_domain_free(struct
 	for (i = 0; i < nr_irqs; i++)
 		xive_irq_free_data(virq + i);
 }
-#endif
 
 static const struct irq_domain_ops xive_irq_domain_ops = {
-#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
 	.alloc	= xive_irq_domain_alloc,
 	.free	= xive_irq_domain_free,
 	.translate = xive_irq_domain_translate,
-#endif
 	.match = xive_irq_domain_match,
 	.map = xive_irq_domain_map,
 	.unmap = xive_irq_domain_unmap,
drivers/gpio/gpiolib.c +0 -18
diff -- a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
@@ -1098,8 +1098,6 @@ bool gpiochip_irqchip_irq_valid(const st
 }
 EXPORT_SYMBOL_GPL(gpiochip_irqchip_irq_valid);
 
-#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
-
 /**
  * gpiochip_set_hierarchical_irqchip() - connects a hierarchical irqchip
  * to a gpiochip
@@ -1362,20 +1360,6 @@ int gpiochip_populate_parent_fwspec_four
 }
 EXPORT_SYMBOL_GPL(gpiochip_populate_parent_fwspec_fourcell);
 
-#else
-
-static int gpiochip_hierarchy_add_domain(struct gpio_chip *gc)
-{
-	return -EINVAL;
-}
-
-static bool gpiochip_hierarchy_is_hierarchical(struct gpio_chip *gc)
-{
-	return false;
-}
-
-#endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */
-
 /**
  * gpiochip_irq_map() - maps an IRQ into a GPIO irqchip
  * @d: the irqdomain used by this irqchip
@@ -1503,7 +1487,6 @@ static int gpiochip_to_irq(struct gpio_c
 	if (!gpiochip_irqchip_irq_valid(gc, offset))
 		return -ENXIO;
 
-#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
 	if (irq_domain_is_hierarchy(domain)) {
 		struct irq_fwspec spec;
 
@@ -1514,7 +1497,6 @@ static int gpiochip_to_irq(struct gpio_c
 
 		return irq_create_fwspec_mapping(&spec);
 	}
-#endif
 
 	return irq_create_mapping(domain, offset);
 }
include/linux/gpio/driver.h +0 -6
diff -- a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
@@ -68,7 +68,6 @@ struct gpio_irq_chip {
 	 */
 	const struct irq_domain_ops *domain_ops;
 
-#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
 	/**
 	 * @fwnode:
 	 *
@@ -144,7 +143,6 @@ struct gpio_irq_chip {
 	 * supply their own translate function.
 	 */
 	struct irq_domain_ops child_irq_domain_ops;
-#endif
 
 	/**
 	 * @handler:
@@ -645,8 +643,6 @@ struct bgpio_pdata {
 	int ngpio;
 };
 
-#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
-
 int gpiochip_populate_parent_fwspec_twocell(struct gpio_chip *gc,
 					    union gpio_irq_fwspec *gfwspec,
 					    unsigned int parent_hwirq,
@@ -656,8 +652,6 @@ int gpiochip_populate_parent_fwspec_four
 					     unsigned int parent_hwirq,
 					     unsigned int parent_type);
 
-#endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */
-
 int bgpio_init(struct gpio_chip *gc, struct device *dev,
 	       unsigned long sz, void __iomem *dat, void __iomem *set,
 	       void __iomem *clr, void __iomem *dirout, void __iomem *dirin,
include/linux/irq.h +1 -4
diff -- a/include/linux/irq.h b/include/linux/irq.h
@@ -183,9 +183,7 @@ struct irq_data {
 	struct irq_common_data	*common;
 	struct irq_chip		*chip;
 	struct irq_domain	*domain;
-#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
 	struct irq_data		*parent_data;
-#endif
 	void			*chip_data;
 };
 
@@ -671,7 +669,7 @@ extern void handle_percpu_devid_fasteoi_
 extern int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg);
 extern int irq_chip_pm_get(struct irq_data *data);
 extern int irq_chip_pm_put(struct irq_data *data);
-#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
+
 extern void handle_fasteoi_ack_irq(struct irq_desc *desc);
 extern void handle_fasteoi_mask_irq(struct irq_desc *desc);
 extern int irq_chip_set_parent_state(struct irq_data *data,
@@ -697,7 +695,6 @@ extern int irq_chip_set_vcpu_affinity_pa
 extern int irq_chip_set_type_parent(struct irq_data *data, unsigned int type);
 extern int irq_chip_request_resources_parent(struct irq_data *data);
 extern void irq_chip_release_resources_parent(struct irq_data *data);
-#endif
 
 /* Handling of unhandled and spurious interrupts: */
 extern void note_interrupt(struct irq_desc *desc, irqreturn_t action_ret);
kernel/irq/chip.c +1 -5
diff -- a/kernel/irq/chip.c b/kernel/irq/chip.c
@@ -977,7 +977,7 @@ __irq_do_set_handler(struct irq_desc *de
 		handle = handle_bad_irq;
 	} else {
 		struct irq_data *irq_data = &desc->irq_data;
-#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
+
 		/*
 		 * With hierarchical domains we might run into a
 		 * situation where the outermost chip is not yet set
@@ -998,7 +998,6 @@ __irq_do_set_handler(struct irq_desc *de
 			/* Try the parent */
 			irq_data = irq_data->parent_data;
 		}
-#endif
 		if (WARN_ON(!irq_data || irq_data->chip == &no_irq_chip))
 			return;
 	}
@@ -1184,8 +1183,6 @@ void irq_cpu_offline(void)
 }
 #endif
 
-#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
-
 #ifdef CONFIG_IRQ_FASTEOI_HIERARCHY_HANDLERS
 /**
  *	handle_fasteoi_ack_irq - irq handler for edge hierarchy
@@ -1534,7 +1531,6 @@ void irq_chip_release_resources_parent(s
 		data->chip->irq_release_resources(data);
 }
 EXPORT_SYMBOL_GPL(irq_chip_release_resources_parent);
-#endif
 
 /**
  * irq_chip_compose_msi_msg - Compose msi message for a irq chip
kernel/irq/debugfs.c +0 -2
diff -- a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c
@@ -89,12 +89,10 @@ irq_debug_show_data(struct seq_file *m,
 	irq_debug_show_chip(m, data, ind + 1);
 	if (data->domain && data->domain->ops && data->domain->ops->debug_show)
 		data->domain->ops->debug_show(m, NULL, data, ind + 1);
-#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
 	if (!data->parent_data)
 		return;
 	seq_printf(m, "%*sparent:\n", ind + 1, "");
 	irq_debug_show_data(m, data->parent_data, ind + 4);
-#endif
 }
 
 static const struct irq_bit_descr irqdata_states[] = {
kernel/irq/internals.h +1 -5
diff -- a/kernel/irq/internals.h b/kernel/irq/internals.h
@@ -465,7 +465,7 @@ static inline bool handle_enforce_irqctx
 }
 #endif /* !CONFIG_GENERIC_PENDING_IRQ */
 
-#if !defined(CONFIG_IRQ_DOMAIN) || !defined(CONFIG_IRQ_DOMAIN_HIERARCHY)
+#if !defined(CONFIG_IRQ_DOMAIN)
 static inline int irq_domain_activate_irq(struct irq_data *data, bool reserve)
 {
 	irqd_set_activated(data);
@@ -479,11 +479,7 @@ static inline void irq_domain_deactivate
 
 static inline struct irq_data *irqd_get_parent_data(struct irq_data *irqd)
 {
-#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
 	return irqd->parent_data;
-#else
-	return NULL;
-#endif
 }
 
 #ifdef CONFIG_GENERIC_IRQ_DEBUGFS
kernel/irq/irqdomain.c +0 -52

82 lines not on this page · raw message

kernel/irq/manage.c +2 -16
diff -- a/kernel/irq/manage.c b/kernel/irq/manage.c
@@ -334,8 +334,7 @@ static bool irq_set_affinity_deactivated
 	 * driver has to make sure anyway that the interrupt is in a
 	 * usable state so startup works.
 	 */
-	if (!IS_ENABLED(CONFIG_IRQ_DOMAIN_HIERARCHY) ||
-	    irqd_is_activated(data) || !irqd_affinity_on_activate(data))
+	if (irqd_is_activated(data) || !irqd_affinity_on_activate(data))
 		return false;
 
 	cpumask_copy(desc->irq_common_data.affinity, mask);
@@ -663,11 +662,7 @@ int irq_set_vcpu_affinity(unsigned int i
 		chip = irq_data_get_irq_chip(data);
 		if (chip && chip->irq_set_vcpu_affinity)
 			break;
-#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
 		data = data->parent_data;
-#else
-		data = NULL;
-#endif
 	} while (data);
 
 	if (data)
@@ -1418,11 +1413,10 @@ static bool irq_supports_nmi(struct irq_
 {
 	struct irq_data *d = irq_desc_get_irq_data(desc);
 
-#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
 	/* Only IRQs directly managed by the root irqchip can be set as NMI */
 	if (d->parent_data)
 		return false;
-#endif
+
 	/* Don't support NMIs for chips behind a slow bus */
 	if (d->chip->irq_bus_lock || d->chip->irq_bus_sync_unlock)
 		return false;
@@ -2801,11 +2795,7 @@ int __irq_get_irqchip_state(struct irq_d
 			return -ENODEV;
 		if (chip->irq_get_irqchip_state)
 			break;
-#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
 		data = data->parent_data;
-#else
-		data = NULL;
-#endif
 	} while (data);
 
 	if (data)
@@ -2882,11 +2872,7 @@ int irq_set_irqchip_state(unsigned int i
 		}
 		if (chip->irq_set_irqchip_state)
 			break;
-#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
 		data = data->parent_data;
-#else
-		data = NULL;
-#endif
 	} while (data);
 
 	if (data)
kernel/irq/migration.c +1 -5
diff -- a/kernel/irq/migration.c b/kernel/irq/migration.c
@@ -95,11 +95,7 @@ void __irq_move_irq(struct irq_data *ida
 {
 	bool masked;
 
-	/*
-	 * Get top level irq_data when CONFIG_IRQ_DOMAIN_HIERARCHY is enabled,
-	 * and it should be optimized away when CONFIG_IRQ_DOMAIN_HIERARCHY is
-	 * disabled. So we avoid an "#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY" here.
-	 */
+	/* Get top level irq_data */
 	idata = irq_desc_get_irq_data(irq_data_to_desc(idata));
 
 	if (unlikely(irqd_irq_disabled(idata)))
kernel/irq/resend.c +0 -4
diff -- a/kernel/irq/resend.c b/kernel/irq/resend.c
@@ -91,11 +91,7 @@ static int try_retrigger(struct irq_desc
 	if (desc->irq_data.chip->irq_retrigger)
 		return desc->irq_data.chip->irq_retrigger(&desc->irq_data);
 
-#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
 	return irq_chip_retrigger_hierarchy(&desc->irq_data);
-#else
-	return 0;
-#endif
 }
 
 /*
include/linux/irqdomain.h +116 -20

197 lines not on this page · raw message

#1 lore raw
Quoted 6 lines · Randy Dunlap

In preparation for dropping the IRQ_DOMAIN Kconfig option (effectively making it always set/on), first drop IRQ_DOMAIN_HIERARCHY as an option, making its code always set/on.

This has been built successfully on all ARCHes except hexagon, both 32-bit and 64-bit where applicable.

I really like where this is going, but reviewing this is a pain. I tried to split it up into more digestable pieces:

https://tglx.de/~tglx/patches.tar

That's not completely equivalent to your patch as I did some of the changes below. It builds on various oddball architectures with IRQ_DOMAIN=n, but is otherwise completely untested.

It should be actually trivial after that to make IRQ_DOMAIN def_bool y and then gradually remove the IRQ_DOMAIN selects and ifdeffery.

Quoted 3 lines

v2: add stubs in include/linux/irqdomain.h for the config case of IRQ_DOMAIN is not set. If these are not added, there will be plenty of build errors (not so much for modern arches as for older ones).

I'm not really convinced that all of these stubs are required. Why would there suddenly be a requirement to expose stubs for functions which depend on CONFIG_IRQ_DOMAIN=y already today just by removing the hierarchy config?

Even exposing stubs for functions which have been only available via CONFIG_IRQ_DOMAIN_HIERARCHY is questionable simply because there cannot be any code which invokes them unconditionally if CONFIG_IRQ_DOMAIN_HIERARCHY=n today.

IOW, the sum of required stubs cannot be larger than number of stubs required today.

If there is code which has a #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY then this needs to be changed to CONFIG_IRQ_DOMAIN or the required functions have to be exposed unconditionally, right?

drivers/gpio/Kconfig config GPIO_IXP4XX · line 364

Quoted 9 lines

diff -- a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig

drivers/gpio/Kconfig +1 -1
@@ -361,7 +361,7 @@ config GPIO_IXP4XX
 	depends on OF
 	select GPIO_GENERIC
 	select GPIOLIB_IRQCHIP
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN

IRQ_DOMAIN is already selected by GPIOLIB_IRQCHIP, so this select is redundant for all GPIO configs which select GPIOLIB_IRQCHIP.

Thanks,

tglx

#2 lore raw

Hi Thomas,

Quoted 11 lines · Thomas Gleixner
Quoted 6 lines · Randy Dunlap

In preparation for dropping the IRQ_DOMAIN Kconfig option (effectively making it always set/on), first drop IRQ_DOMAIN_HIERARCHY as an option, making its code always set/on.

This has been built successfully on all ARCHes except hexagon, both 32-bit and 64-bit where applicable.

I really like where this is going, but reviewing this is a pain. I tried to split it up into more digestable pieces:

Quoted 8 lines

https://tglx.de/~tglx/patches.tar

That's not completely equivalent to your patch as I did some of the changes below. It builds on various oddball architectures with IRQ_DOMAIN=n, but is otherwise completely untested.

It should be actually trivial after that to make IRQ_DOMAIN def_bool y and then gradually remove the IRQ_DOMAIN selects and ifdeffery.

Yeah, that may be the best & simplest approach.

Or just use your patches.tar.

Quoted 8 lines
Quoted 3 lines

v2: add stubs in include/linux/irqdomain.h for the config case of IRQ_DOMAIN is not set. If these are not added, there will be plenty of build errors (not so much for modern arches as for older ones).

I'm not really convinced that all of these stubs are required. Why would there suddenly be a requirement to expose stubs for functions which depend on CONFIG_IRQ_DOMAIN=y already today just by removing the hierarchy config?

All of those stubs were added because I had configs/builds that were failing due to them. I didn't just add them for fun or "completeness."

I just checked and I didn't save all of those failing configs or output files that contain the errors.

Quoted 11 lines

Even exposing stubs for functions which have been only available via CONFIG_IRQ_DOMAIN_HIERARCHY is questionable simply because there cannot be any code which invokes them unconditionally if CONFIG_IRQ_DOMAIN_HIERARCHY=n today.

IOW, the sum of required stubs cannot be larger than number of stubs required today.

If there is code which has a #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY then this needs to be changed to CONFIG_IRQ_DOMAIN or the required functions have to be exposed unconditionally, right?

Yes, s/CONFIG_IRQ_DOMAIN_HIERARCHY/CONFIG_IRQ_DOMAIN/ in code.

Quoted 4 lines
Quoted 4 lines

diff -- a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig

drivers/gpio/Kconfig +0 -0
@@ -361,7 +361,7 @@ config GPIO_IXP4XX
Quoted 8 lines

drivers/gpio/Kconfig config GPIO_IXP4XX · line 364

Quoted 5 lines
drivers/gpio/Kconfig +1 -1
 	depends on OF
 	select GPIO_GENERIC
 	select GPIOLIB_IRQCHIP
-	select IRQ_DOMAIN_HIERARCHY
+	select IRQ_DOMAIN

IRQ_DOMAIN is already selected by GPIOLIB_IRQCHIP, so this select is redundant for all GPIO configs which select GPIOLIB_IRQCHIP.

Ack.

I'm perfectly happy to use either Marc's patch that he posted on 2023-FEB-14 (https://lore.kernel.org/all/[email protected]/)
or your patches. Both of you know your way around this better than I do.

Thanks for your review and feedback.

Signature · 1 line
~Randy