Skip to contentSkip to conversation

irqchip: Hybrid probing

PATCH In review Marc Zyngier 6 participants 23 messages Sep 12, 2020 – Sep 16, 2020

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

cover irqchip: Hybrid probing

A recent attempt at converting a couple of interrupt controllers from early probing to standard platform drivers have badly failed, as it became evident that although an interrupt controller can easily probe late, device drivers for the endpoints connected to it are rarely equipped to deal with probe deferral. Changes were swiftly reverted.

However, there is some value in *optionally* enabling this, if only for development purposes, as there is otherwise a "chicken and egg" problem, and a few people (cc'd) are working on a potential solution.

This short series enables the infrastructure for modular building whilst retaining the usual early probing for monolithic build, and introduces it to the three drivers that were previously made to probe as platform drivers.

As I don't have any of the HW, this series is fully untested and I'd welcome some feedback on it.

Thanks,

	M.

Marc Zyngier (6):
of: Add basic infrastructure to create early probe arrays
irqchip: Make IRQCHIP_MATCH() type safe
irqchip: Introduce IRQCHIP_HYBRID_DRIVER_{BEGIN,END} macros irqchip/mtk-cirq: Allow modular build irqchip/mtk-sysirq: Allow modular build irqchip/qcom-pdc: Allow modular build

 drivers/irqchip/irq-mtk-cirq.c   |  4 +++-
 drivers/irqchip/irq-mtk-sysirq.c |  4 +++-
 drivers/irqchip/qcom-pdc.c       |  4 +++-
 include/linux/irqchip.h          | 14 +++++++++++++-
 include/linux/of.h               | 15 +++++++++++++++
 5 files changed, 37 insertions(+), 4 deletions(-)
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/6 of: Add basic infrastructure to create early probe arrays

We currently probe interrupt controller and timers that need to be available very early using an infratstructure that creates struct of_device_id instances in a special section. These are individual structures that are ultimately collated by the linker.

In order to facilitate further use of this infrastructure for drivers that can either be built modular or as an early driver, let's add a couple of helpers that will make it look like a "normal" device_id array, like this:

_OF_DECLARE_ARRAY_START(table, name)
_OF_DECLARE_ELMT("compat-1", probe, type)
_OF_DECLARE_ELMT("compat-2", probe, type)
_OF_DECLARE_ELMT("compat-3", other_probe, type)
_OF_DECLARE_ARRAY_END

---
 include/linux/of.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
include/linux/of.h +15 -0
index 5cf7ae0465d1..08f78da95378 100644
@@ -1291,20 +1291,35 @@ static inline int of_get_available_child_count(const struct device_node *np)
 	return num;
 }
 
+#define __OF_DECLARE_ARRAY_START(name, section)				\
+	static const struct of_device_id __of_table_##name[]		\
+		__used __section(section) = {
+
 #if defined(CONFIG_OF) && !defined(MODULE)
 #define _OF_DECLARE(table, name, compat, fn, fn_type)			\
 	static const struct of_device_id __of_table_##name		\
 		__used __section(__##table##_of_table)			\
 		 = { .compatible = compat,				\
 		     .data = (fn == (fn_type)NULL) ? fn : fn  }
+#define _OF_DECLARE_ARRAY_START(table, name)				\
+	__OF_DECLARE_ARRAY_START(name, __##table##_of_table)
 #else
 #define _OF_DECLARE(table, name, compat, fn, fn_type)			\
 	static const struct of_device_id __of_table_##name		\
 		__attribute__((unused))					\
 		 = { .compatible = compat,				\
 		     .data = (fn == (fn_type)NULL) ? fn : fn }
+#define _OF_DECLARE_ARRAY_START(table, name)				\
+	__OF_DECLARE_ARRAY_START(name, unused)
 #endif
 
+#define _OF_DECLARE_ARRAY_END	}
+#define _OF_DECLARE_ELMT(compat, fn, fn_type)				\
+	{								\
+		.compatible = compat,					\
+		.data = (fn == (fn_type)NULL) ? fn : fn,		\
+	},
+
 typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
 typedef int (*of_init_fn_1_ret)(struct device_node *);
 typedef void (*of_init_fn_1)(struct device_node *);
Signature · 1 line
2.28.0
Reviewed-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] of: Add basic infrastructure to create early probe arrays

Quoted 10 lines · Marc Zyngier

We currently probe interrupt controller and timers that need to be available very early using an infratstructure that creates struct of_device_id instances in a special section. These are individual structures that are ultimately collated by the linker.

In order to facilitate further use of this infrastructure for drivers that can either be built modular or as an early driver, let's add a couple of helpers that will make it look like a "normal" device_id array, like this:

Quoted 6 lines

_OF_DECLARE_ARRAY_START(table, name)
_OF_DECLARE_ELMT("compat-1", probe, type)
_OF_DECLARE_ELMT("compat-2", probe, type)
_OF_DECLARE_ELMT("compat-3", other_probe, type)
_OF_DECLARE_ARRAY_END

Regards,
Bjorn

Quoted 48 lines
---
 include/linux/of.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
include/linux/of.h +15 -0
index 5cf7ae0465d1..08f78da95378 100644
@@ -1291,20 +1291,35 @@ static inline int of_get_available_child_count(const struct device_node *np)
 	return num;
 }
 
+#define __OF_DECLARE_ARRAY_START(name, section)				\
+	static const struct of_device_id __of_table_##name[]		\
+		__used __section(section) = {
+
 #if defined(CONFIG_OF) && !defined(MODULE)
 #define _OF_DECLARE(table, name, compat, fn, fn_type)			\
 	static const struct of_device_id __of_table_##name		\
 		__used __section(__##table##_of_table)			\
 		 = { .compatible = compat,				\
 		     .data = (fn == (fn_type)NULL) ? fn : fn  }
+#define _OF_DECLARE_ARRAY_START(table, name)				\
+	__OF_DECLARE_ARRAY_START(name, __##table##_of_table)
 #else
 #define _OF_DECLARE(table, name, compat, fn, fn_type)			\
 	static const struct of_device_id __of_table_##name		\
 		__attribute__((unused))					\
 		 = { .compatible = compat,				\
 		     .data = (fn == (fn_type)NULL) ? fn : fn }
+#define _OF_DECLARE_ARRAY_START(table, name)				\
+	__OF_DECLARE_ARRAY_START(name, unused)
 #endif
 
+#define _OF_DECLARE_ARRAY_END	}
+#define _OF_DECLARE_ELMT(compat, fn, fn_type)				\
+	{								\
+		.compatible = compat,					\
+		.data = (fn == (fn_type)NULL) ? fn : fn,		\
+	},
+
 typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
 typedef int (*of_init_fn_1_ret)(struct device_node *);
 typedef void (*of_init_fn_1)(struct device_node *);
Signature · 1 line
2.28.0
#3 lore raw

Re: [PATCH 1/6] of: Add basic infrastructure to create early probe arrays

In reply to Marc Zyngier
Quoted 2 lines · Marc Zyngier

We currently probe interrupt controller and timers that need to be available very early using an infratstructure that creates

s/infratstructure/infrastructure/

Quoted 62 lines

struct of_device_id instances in a special section. These are individual structures that are ultimately collated by the linker.

In order to facilitate further use of this infrastructure for drivers that can either be built modular or as an early driver, let's add a couple of helpers that will make it look like a "normal" device_id array, like this:

_OF_DECLARE_ARRAY_START(table, name)
_OF_DECLARE_ELMT("compat-1", probe, type)
_OF_DECLARE_ELMT("compat-2", probe, type)
_OF_DECLARE_ELMT("compat-3", other_probe, type)
_OF_DECLARE_ARRAY_END

---
 include/linux/of.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
include/linux/of.h +15 -0
index 5cf7ae0465d1..08f78da95378 100644
@@ -1291,20 +1291,35 @@ static inline int of_get_available_child_count(const struct device_node *np)
 	return num;
 }
 
+#define __OF_DECLARE_ARRAY_START(name, section)				\
+	static const struct of_device_id __of_table_##name[]		\
+		__used __section(section) = {
+
 #if defined(CONFIG_OF) && !defined(MODULE)
 #define _OF_DECLARE(table, name, compat, fn, fn_type)			\
 	static const struct of_device_id __of_table_##name		\
 		__used __section(__##table##_of_table)			\
 		 = { .compatible = compat,				\
 		     .data = (fn == (fn_type)NULL) ? fn : fn  }
+#define _OF_DECLARE_ARRAY_START(table, name)				\
+	__OF_DECLARE_ARRAY_START(name, __##table##_of_table)
 #else
 #define _OF_DECLARE(table, name, compat, fn, fn_type)			\
 	static const struct of_device_id __of_table_##name		\
 		__attribute__((unused))					\
 		 = { .compatible = compat,				\
 		     .data = (fn == (fn_type)NULL) ? fn : fn }
+#define _OF_DECLARE_ARRAY_START(table, name)				\
+	__OF_DECLARE_ARRAY_START(name, unused)
 #endif
 
+#define _OF_DECLARE_ARRAY_END	}
+#define _OF_DECLARE_ELMT(compat, fn, fn_type)				\
+	{								\
+		.compatible = compat,					\
+		.data = (fn == (fn_type)NULL) ? fn : fn,		\
+	},
+
 typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
 typedef int (*of_init_fn_1_ret)(struct device_node *);
 typedef void (*of_init_fn_1)(struct device_node *);
Signature · 1 line
2.28.0
#4 lore raw

PATCH 2/6 irqchip: Make IRQCHIP_MATCH() type safe

In reply to Marc Zyngier

IRQCHIP_DECLARE() is backed by macros that perform some elementary type checking on the probe function. Unfortunately, IRQCHIP_MATCH() doesn't, risking difficult debugging sessions...

Rewrite IRQCHIP_MATCH() in terms of _OF_DECLARE_ELMT() restore the missing type safety.

---
 include/linux/irqchip.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/irqchip.h +1 -1
index 67351aac65ef..f8f25e9f8200 100644
@@ -33,7 +33,7 @@ extern int platform_irqchip_probe(struct platform_device *pdev);
 #define IRQCHIP_PLATFORM_DRIVER_BEGIN(drv_name) \
 static const struct of_device_id drv_name##_irqchip_match_table[] = {
 
-#define IRQCHIP_MATCH(compat, fn) { .compatible = compat, .data = fn },
+#define IRQCHIP_MATCH(compat, fn) _OF_DECLARE_ELMT(compat, fn, of_init_fn_2)
 
 #define IRQCHIP_PLATFORM_DRIVER_END(drv_name)				\
 	{},								\
Signature · 1 line
2.28.0
Reviewed-by on v1 2/6
#5 lore raw

Re: [PATCH 2/6] irqchip: Make IRQCHIP_MATCH() type safe

Quoted 7 lines · Marc Zyngier

IRQCHIP_DECLARE() is backed by macros that perform some elementary type checking on the probe function. Unfortunately, IRQCHIP_MATCH() doesn't, risking difficult debugging sessions...

Rewrite IRQCHIP_MATCH() in terms of _OF_DECLARE_ELMT() restore the missing type safety.

Quoted 21 lines
---
 include/linux/irqchip.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/irqchip.h +1 -1
index 67351aac65ef..f8f25e9f8200 100644
@@ -33,7 +33,7 @@ extern int platform_irqchip_probe(struct platform_device *pdev);
 #define IRQCHIP_PLATFORM_DRIVER_BEGIN(drv_name) \
 static const struct of_device_id drv_name##_irqchip_match_table[] = {
 
-#define IRQCHIP_MATCH(compat, fn) { .compatible = compat, .data = fn },
+#define IRQCHIP_MATCH(compat, fn) _OF_DECLARE_ELMT(compat, fn, of_init_fn_2)
 
 #define IRQCHIP_PLATFORM_DRIVER_END(drv_name)				\
 	{},								\
Signature · 1 line
2.28.0
#6 lore raw

PATCH 3/6 irqchip: Introduce IRQCHIP_HYBRID_DRIVER_{BEGIN,END} macros

In reply to Marc Zyngier

Although we are trying to move to a world where a large number of irqchip drivers can safely be built as platform drivers the reality is that most endpoint drivers are not ready for that, and will fail to probe as they expect their interrupt controller to be up and running.

A halfway house solution is to let the driver indicate that if it is built-in (i.e. not a module), then it must use the earily probe mechanism, IRQCHIP_DECLARE() style. Otherwise, it is a normal module implemenenting a platform driver, and we can fallback to the existing code.

Hopefully we'll one day be able to drop this code altogether, but that's not for tomorrow.

---
 include/linux/irqchip.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
include/linux/irqchip.h +12 -0
index f8f25e9f8200..31fc9d00101f 100644
@@ -50,6 +50,18 @@ static struct platform_driver drv_name##_driver = {		\
 };									\
 builtin_platform_driver(drv_name##_driver)
 
+#ifdef MODULE
+#define IRQCHIP_HYBRID_DRIVER_BEGIN(drv)	\
+	IRQCHIP_PLATFORM_DRIVER_BEGIN(drv)
+#define IRQCHIP_HYBRID_DRIVER_END(drv)		\
+	IRQCHIP_PLATFORM_DRIVER_END(drv)
+#else
+#define IRQCHIP_HYBRID_DRIVER_BEGIN(drv)	\
+	_OF_DECLARE_ARRAY_START(irqchip, drv)
+#define IRQCHIP_HYBRID_DRIVER_END(drv)		\
+	_OF_DECLARE_ARRAY_END;
+#endif
+
 /*
  * This macro must be used by the different irqchip drivers to declare
  * the association between their version and their initialization function.
Signature · 1 line
2.28.0
Reviewed-by on v1 3/6
#7 lore raw

Re: [PATCH 3/6] irqchip: Introduce IRQCHIP_HYBRID_DRIVER_{BEGIN,END} macros

Quoted 6 lines · Marc Zyngier

Although we are trying to move to a world where a large number of irqchip drivers can safely be built as platform drivers the reality is that most endpoint drivers are not ready for that, and will fail to probe as they expect their interrupt controller to be up and running.

Quoted 9 lines

A halfway house solution is to let the driver indicate that if it is built-in (i.e. not a module), then it must use the earily probe mechanism, IRQCHIP_DECLARE() style. Otherwise, it is a normal module implemenenting a platform driver, and we can fallback to the existing code.

Hopefully we'll one day be able to drop this code altogether, but that's not for tomorrow.

Quoted 31 lines
---
 include/linux/irqchip.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
include/linux/irqchip.h +12 -0
index f8f25e9f8200..31fc9d00101f 100644
@@ -50,6 +50,18 @@ static struct platform_driver drv_name##_driver = {		\
 };									\
 builtin_platform_driver(drv_name##_driver)
 
+#ifdef MODULE
+#define IRQCHIP_HYBRID_DRIVER_BEGIN(drv)	\
+	IRQCHIP_PLATFORM_DRIVER_BEGIN(drv)
+#define IRQCHIP_HYBRID_DRIVER_END(drv)		\
+	IRQCHIP_PLATFORM_DRIVER_END(drv)
+#else
+#define IRQCHIP_HYBRID_DRIVER_BEGIN(drv)	\
+	_OF_DECLARE_ARRAY_START(irqchip, drv)
+#define IRQCHIP_HYBRID_DRIVER_END(drv)		\
+	_OF_DECLARE_ARRAY_END;
+#endif
+
 /*
  * This macro must be used by the different irqchip drivers to declare
  * the association between their version and their initialization function.
Signature · 1 line
2.28.0
#8 lore raw

PATCH 4/6 irqchip/mtk-cirq: Allow modular build

In reply to Marc Zyngier

Switch the driver to a "hybrid probe" model which preserves the built-in behaviour while allowing the driver to be optionnally built as a module for development purposes.

---
 drivers/irqchip/irq-mtk-cirq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mtk-cirq.c +3 -1
index 69ba8ce3c178..43e880b63ed2 100644
@@ -295,4 +295,6 @@ static int __init mtk_cirq_of_init(struct device_node *node,
 	return ret;
 }
 
-IRQCHIP_DECLARE(mtk_cirq, "mediatek,mtk-cirq", mtk_cirq_of_init);
+IRQCHIP_HYBRID_DRIVER_BEGIN(mtk_cirq)
+IRQCHIP_MATCH("mediatek,mtk-cirq", mtk_cirq_of_init)
+IRQCHIP_HYBRID_DRIVER_END(mtk_cirq)
Signature · 1 line
2.28.0
Reviewed-by on v1 4/6
#9 lore raw

Re: [PATCH 4/6] irqchip/mtk-cirq: Allow modular build

Quoted 4 lines · Marc Zyngier

Switch the driver to a "hybrid probe" model which preserves the built-in behaviour while allowing the driver to be optionnally built as a module for development purposes.

Quoted 20 lines
---
 drivers/irqchip/irq-mtk-cirq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mtk-cirq.c +3 -1
index 69ba8ce3c178..43e880b63ed2 100644
@@ -295,4 +295,6 @@ static int __init mtk_cirq_of_init(struct device_node *node,
 	return ret;
 }
 
-IRQCHIP_DECLARE(mtk_cirq, "mediatek,mtk-cirq", mtk_cirq_of_init);
+IRQCHIP_HYBRID_DRIVER_BEGIN(mtk_cirq)
+IRQCHIP_MATCH("mediatek,mtk-cirq", mtk_cirq_of_init)
+IRQCHIP_HYBRID_DRIVER_END(mtk_cirq)
Signature · 1 line
2.28.0
Tested-by Enric Balletbo i Serra
#10 lore raw

Re: [PATCH 4/6] irqchip/mtk-cirq: Allow modular build

Missatge de Bjorn Andersson <[email protected]> del dia dg., 13 de set. 2020 a les 1:26:

Quoted 11 lines · Marc Zyngier
Quoted 5 lines

Switch the driver to a "hybrid probe" model which preserves the built-in behaviour while allowing the driver to be optionnally built as a module for development purposes.

Quoted 1 line

I've tested this on mt8173 and mt8183, and this time, the patches didn't break booting on these platforms. For MediaTek, right now, only makes sense the driver to be built-in as other drivers that use it are not ready for deferring their probe. So,

Thanks
Enric

Quoted 19 lines
Quoted 19 lines
---
 drivers/irqchip/irq-mtk-cirq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mtk-cirq.c +3 -2
index 69ba8ce3c178..43e880b63ed2 100644
@@ -295,4 +295,6 @@ static int __init mtk_cirq_of_init(struct device_node *node,
      return ret;
 }
 
-IRQCHIP_DECLARE(mtk_cirq, "mediatek,mtk-cirq", mtk_cirq_of_init);
+IRQCHIP_HYBRID_DRIVER_BEGIN(mtk_cirq)
+IRQCHIP_MATCH("mediatek,mtk-cirq", mtk_cirq_of_init)
+IRQCHIP_HYBRID_DRIVER_END(mtk_cirq)
--

2.28.0

#11 lore raw

PATCH 5/6 irqchip/mtk-sysirq: Allow modular build

In reply to Marc Zyngier

Switch the driver to a "hybrid probe" model which preserves the built-in behaviour while allowing the driver to be optionnally built as a module for development purposes.

---
 drivers/irqchip/irq-mtk-sysirq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mtk-sysirq.c +3 -1
index 6ff98b87e5c0..ee45d8f71ec3 100644
@@ -231,4 +231,6 @@ static int __init mtk_sysirq_of_init(struct device_node *node,
 	kfree(chip_data);
 	return ret;
 }
-IRQCHIP_DECLARE(mtk_sysirq, "mediatek,mt6577-sysirq", mtk_sysirq_of_init);
+IRQCHIP_HYBRID_DRIVER_BEGIN(mtk_sysirq)
+IRQCHIP_MATCH("mediatek,mt6577-sysirq", mtk_sysirq_of_init)
+IRQCHIP_HYBRID_DRIVER_END(mtk_sysirq)
Signature · 1 line
2.28.0
Reviewed-by on v1 5/6
#12 lore raw

Re: [PATCH 5/6] irqchip/mtk-sysirq: Allow modular build

Quoted 4 lines · Marc Zyngier

Switch the driver to a "hybrid probe" model which preserves the built-in behaviour while allowing the driver to be optionnally built as a module for development purposes.

Quoted 20 lines
---
 drivers/irqchip/irq-mtk-sysirq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mtk-sysirq.c +3 -1
index 6ff98b87e5c0..ee45d8f71ec3 100644
@@ -231,4 +231,6 @@ static int __init mtk_sysirq_of_init(struct device_node *node,
 	kfree(chip_data);
 	return ret;
 }
-IRQCHIP_DECLARE(mtk_sysirq, "mediatek,mt6577-sysirq", mtk_sysirq_of_init);
+IRQCHIP_HYBRID_DRIVER_BEGIN(mtk_sysirq)
+IRQCHIP_MATCH("mediatek,mt6577-sysirq", mtk_sysirq_of_init)
+IRQCHIP_HYBRID_DRIVER_END(mtk_sysirq)
Signature · 1 line
2.28.0
Tested-by Enric Balletbo i Serra
#13 lore raw

Re: [PATCH 5/6] irqchip/mtk-sysirq: Allow modular build

Missatge de Bjorn Andersson <[email protected]> del dia dg., 13 de set. 2020 a les 1:25:

Quoted 11 lines · Marc Zyngier
Quoted 5 lines

Switch the driver to a "hybrid probe" model which preserves the built-in behaviour while allowing the driver to be optionnally built as a module for development purposes.

Quoted 1 line

I've tested this on mt8173 and mt8183, and this time, the patches didn't break booting on these platforms. For MediaTek, right now, only makes sense the driver to be built-in as other drivers that use it are not ready for deferring their probe. So,

Thanks
Enric

Quoted 19 lines
Quoted 19 lines
---
 drivers/irqchip/irq-mtk-sysirq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mtk-sysirq.c +3 -2
index 6ff98b87e5c0..ee45d8f71ec3 100644
@@ -231,4 +231,6 @@ static int __init mtk_sysirq_of_init(struct device_node *node,
      kfree(chip_data);
      return ret;
 }
-IRQCHIP_DECLARE(mtk_sysirq, "mediatek,mt6577-sysirq", mtk_sysirq_of_init);
+IRQCHIP_HYBRID_DRIVER_BEGIN(mtk_sysirq)
+IRQCHIP_MATCH("mediatek,mt6577-sysirq", mtk_sysirq_of_init)
+IRQCHIP_HYBRID_DRIVER_END(mtk_sysirq)
--

2.28.0

#14 lore raw

PATCH 6/6 irqchip/qcom-pdc: Allow modular build

In reply to Marc Zyngier

Switch the driver to a "hybrid probe" model which preserves the built-in behaviour while allowing the driver to be optionnally built as a module for development purposes.

---
 drivers/irqchip/qcom-pdc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/qcom-pdc.c +3 -1
index 6ae9e1f0819d..8543fa23da10 100644
@@ -430,4 +430,6 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
 	return ret;
 }
 
-IRQCHIP_DECLARE(qcom_pdc, "qcom,pdc", qcom_pdc_init);
+IRQCHIP_HYBRID_DRIVER_BEGIN(qcom_pdc)
+IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init)
+IRQCHIP_HYBRID_DRIVER_END(qcom_pdc)
Signature · 1 line
2.28.0
Reviewed-by on v1 6/6
#15 lore raw

Re: [PATCH 6/6] irqchip/qcom-pdc: Allow modular build

Quoted 4 lines · Marc Zyngier

Switch the driver to a "hybrid probe" model which preserves the built-in behaviour while allowing the driver to be optionnally built as a module for development purposes.

Quoted 20 lines
---
 drivers/irqchip/qcom-pdc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/qcom-pdc.c +3 -1
index 6ae9e1f0819d..8543fa23da10 100644
@@ -430,4 +430,6 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
 	return ret;
 }
 
-IRQCHIP_DECLARE(qcom_pdc, "qcom,pdc", qcom_pdc_init);
+IRQCHIP_HYBRID_DRIVER_BEGIN(qcom_pdc)
+IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init)
+IRQCHIP_HYBRID_DRIVER_END(qcom_pdc)
Signature · 1 line
2.28.0
#16 lore raw

PATCH 1/1 irqchip/qcom-pdc: Allow QCOM_PDC to be loadable as a permanent module

In reply to Marc Zyngier

Allows qcom-pdc driver to be loaded as a permanent module.

An earlier version of this patch was merged in a larger patchset but was reverted entirely when issues were found with other drivers, so now that Marc has provided a better solution in his Hybrid probing patch set, I wanted to re-submit this change.

Cc Andy Gross <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Maulik Shah <[email protected]>
Cc Lina Iyer <[email protected]>
Cc Saravana Kannan <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/irqchip/Kconfig    | 2 +-
 drivers/irqchip/qcom-pdc.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/Kconfig +1 -1
index bfc9719dbcdc..bb70b7177f94 100644
@@ -425,7 +425,7 @@ config GOLDFISH_PIC
          for Goldfish based virtual platforms.
 
 config QCOM_PDC
-	bool "QCOM PDC"
+	tristate "QCOM PDC"
 	depends on ARCH_QCOM
 	select IRQ_DOMAIN_HIERARCHY
 	help
drivers/irqchip/qcom-pdc.c +2 -0
index 8543fa23da10..59eb3c8473b0 100644
@@ -433,3 +433,5 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
 IRQCHIP_HYBRID_DRIVER_BEGIN(qcom_pdc)
 IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init)
 IRQCHIP_HYBRID_DRIVER_END(qcom_pdc)
+MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");
+MODULE_LICENSE("GPL v2");
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#17 lore raw

Re: [PATCH] irqchip/qcom-pdc: Allow QCOM_PDC to be loadable as a permanent module

Quoted 23 lines · John Stultz

Allows qcom-pdc driver to be loaded as a permanent module.

An earlier version of this patch was merged in a larger patchset but was reverted entirely when issues were found with other drivers, so now that Marc has provided a better solution in his Hybrid probing patch set, I wanted to re-submit this change.

Cc Andy Gross <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Maulik Shah <[email protected]>
Cc Lina Iyer <[email protected]>
Cc Saravana Kannan <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 1 line

---

Reviewed-by on v1 1/1
#18 lore raw

Re: [PATCH] irqchip/qcom-pdc: Allow QCOM_PDC to be loadable as a permanent module

In reply to John Stultz
Quoted 7 lines · John Stultz

Allows qcom-pdc driver to be loaded as a permanent module.

An earlier version of this patch was merged in a larger patchset but was reverted entirely when issues were found with other drivers, so now that Marc has provided a better solution in his Hybrid probing patch set, I wanted to re-submit this change.

Quoted 47 lines
Cc Andy Gross <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Maulik Shah <[email protected]>
Cc Lina Iyer <[email protected]>
Cc Saravana Kannan <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/irqchip/Kconfig    | 2 +-
 drivers/irqchip/qcom-pdc.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/Kconfig +1 -1
index bfc9719dbcdc..bb70b7177f94 100644
@@ -425,7 +425,7 @@ config GOLDFISH_PIC
          for Goldfish based virtual platforms.
 
 config QCOM_PDC
-	bool "QCOM PDC"
+	tristate "QCOM PDC"
 	depends on ARCH_QCOM
 	select IRQ_DOMAIN_HIERARCHY
 	help
drivers/irqchip/qcom-pdc.c +2 -0
index 8543fa23da10..59eb3c8473b0 100644
@@ -433,3 +433,5 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
 IRQCHIP_HYBRID_DRIVER_BEGIN(qcom_pdc)
 IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init)
 IRQCHIP_HYBRID_DRIVER_END(qcom_pdc)
+MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");
+MODULE_LICENSE("GPL v2");
Signature · 1 line
2.17.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Tested-by on the v1 series
#19 lore raw
In reply to Marc Zyngier
Quoted 11 lines · Marc Zyngier

A recent attempt at converting a couple of interrupt controllers from early probing to standard platform drivers have badly failed, as it became evident that although an interrupt controller can easily probe late, device drivers for the endpoints connected to it are rarely equipped to deal with probe deferral. Changes were swiftly reverted.

However, there is some value in *optionally* enabling this, if only for development purposes, as there is otherwise a "chicken and egg" problem, and a few people (cc'd) are working on a potential solution.

Quoted 7 lines

This short series enables the infrastructure for modular building whilst retaining the usual early probing for monolithic build, and introduces it to the three drivers that were previously made to probe as platform drivers.

As I don't have any of the HW, this series is fully untested and I'd welcome some feedback on it.

I've tested this on db845c along with a small follow-on patch I'll send to you which sets the qcom-pdc as a tristate in the Kconfig, both as a module and as a built-in.

thanks
-john

maintainer
#20 lore raw
In reply to Marc Zyngier
Quoted 6 lines · Marc Zyngier

A recent attempt at converting a couple of interrupt controllers from early probing to standard platform drivers have badly failed, as it became evident that although an interrupt controller can easily probe late, device drivers for the endpoints connected to it are rarely equipped to deal with probe deferral. Changes were swiftly reverted.

Quoted 8 lines

However, there is some value in *optionally* enabling this, if only for development purposes, as there is otherwise a "chicken and egg" problem, and a few people (cc'd) are working on a potential solution.

This short series enables the infrastructure for modular building whilst retaining the usual early probing for monolithic build, and introduces it to the three drivers that were previously made to probe as platform drivers.

I hardly expected more OF_DECLARE macros when I opened this up. Given desires to get rid of them, I don't think adding to it is the way forward. That wrapping a platform driver around OF_DECLARE looks pretty horrible IMO.

I browsed some of the discussion around this. It didn't seem like it's a large number of drivers that have to be fixed to defer probe correctly. Am I missing something?

I'd rather keep the pressure on getting fw_devlink on by default.

Rob

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#21 lore raw
Quoted 16 lines · Rob Herring
Quoted 6 lines · Marc Zyngier

A recent attempt at converting a couple of interrupt controllers from early probing to standard platform drivers have badly failed, as it became evident that although an interrupt controller can easily probe late, device drivers for the endpoints connected to it are rarely equipped to deal with probe deferral. Changes were swiftly reverted.

Quoted 8 lines

However, there is some value in *optionally* enabling this, if only for development purposes, as there is otherwise a "chicken and egg" problem, and a few people (cc'd) are working on a potential solution.

This short series enables the infrastructure for modular building whilst retaining the usual early probing for monolithic build, and introduces it to the three drivers that were previously made to probe as platform drivers.

Quoted 4 lines

I hardly expected more OF_DECLARE macros when I opened this up. Given desires to get rid of them, I don't think adding to it is the way forward. That wrapping a platform driver around OF_DECLARE looks pretty horrible IMO.

Nobody said it was cute. It's a band aid that allows us to move from the status-quo that exists today. How would you propose we allow people to go and start "fixing" drivers if you don't give them the opportunity to even start trying?

Quoted 3 lines

I browsed some of the discussion around this. It didn't seem like it's a large number of drivers that have to be fixed to defer probe correctly. Am I missing something?

Well, that was enough drivers for the two platforms that had it enabled to break horribly, without a way to go back to a working state. Do you find that acceptable? I don't.

Quoted 1 line

I'd rather keep the pressure on getting fw_devlink on by default.

So far, fw_devlink breaks everything under the sun, even without modular irqchips. Most of my systems fail to boot if I enable it. So yes, it really needs some work. And this series allows this work to happen.

        M.
Signature · 1 line
Jazz is not dead. It just smells funny...
maintainer
#22 lore raw
Quoted 23 lines · Marc Zyngier
Quoted 16 lines · Rob Herring
Quoted 6 lines · Marc Zyngier

A recent attempt at converting a couple of interrupt controllers from early probing to standard platform drivers have badly failed, as it became evident that although an interrupt controller can easily probe late, device drivers for the endpoints connected to it are rarely equipped to deal with probe deferral. Changes were swiftly reverted.

Quoted 8 lines

However, there is some value in *optionally* enabling this, if only for development purposes, as there is otherwise a "chicken and egg" problem, and a few people (cc'd) are working on a potential solution.

This short series enables the infrastructure for modular building whilst retaining the usual early probing for monolithic build, and introduces it to the three drivers that were previously made to probe as platform drivers.

Quoted 4 lines

I hardly expected more OF_DECLARE macros when I opened this up. Given desires to get rid of them, I don't think adding to it is the way forward. That wrapping a platform driver around OF_DECLARE looks pretty horrible IMO.

Quoted 4 lines

Nobody said it was cute. It's a band aid that allows us to move from the status-quo that exists today. How would you propose we allow people to go and start "fixing" drivers if you don't give them the opportunity to even start trying?

Apply the reverted patches and start fixing the drivers.

Quoted 7 lines
Quoted 3 lines

I browsed some of the discussion around this. It didn't seem like it's a large number of drivers that have to be fixed to defer probe correctly. Am I missing something?

Well, that was enough drivers for the two platforms that had it enabled to break horribly, without a way to go back to a working state. Do you find that acceptable? I don't.

I understand reverting for v5.9, that was the right choice. But Mediatek had 3 drivers broken. Is there more to it than getting EPROBE_DEFER handled correctly in those drivers?

Quoted 5 lines
Quoted 1 line

I'd rather keep the pressure on getting fw_devlink on by default.

So far, fw_devlink breaks everything under the sun, even without modular irqchips. Most of my systems fail to boot if I enable it. So yes, it really needs some work. And this series allows this work to happen.

I think we can do something more simple here. We just need to instantiate the irqchip devices earlier to get them to probe first and not cause deferrals. That's just a matter of calling of_platform_device_create() in an earlier initcall (<= arch_initcall_sync ('=' because of link order)). Then once dependent drivers are all fixed, all that has to be done is rip out that initcall and the default of_platform_populate call will create the device instead.

Rob

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel