irqchip: Add IRQCHIP_PLATFORM_DRIVER helper macros
Subsystems (4)
v3 cover irqchip: Add IRQCHIP_PLATFORM_DRIVER helper macros
Made a series out of the previous v2 patch + some example uses of the macros.
Not sure if the MTK changes work (just compile tested), but saw that Hanks was trying to make those drivers into tristate. So I assume they'll work as platform drivers. Please wait for MTK Ack before picking up patches 3 and 4.
v1-v2:
- Instead of redifining IRQCHIP_DECLARE, created new macros.
- Added more checks in the probe helper function to ensure topological probe ordering when fw_devlink is not "on".
v2->v3:
- Added comments
- Changed IRQCHIP_PLATFORM_DRIVER_BEGIN macro parameters
Saravana Kannan (4):
irqchip: Add IRQCHIP_PLATFORM_DRIVER_BEGIN/END and IRQCHIP_MATCH
helper macros
irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper
macros
irqchip/mtk-sysirq: Convert to a platform driver irqchip/mtk-cirq: Convert to a platform driver
drivers/irqchip/irq-mtk-cirq.c | 4 +++- drivers/irqchip/irq-mtk-sysirq.c | 4 +++- drivers/irqchip/irqchip.c | 29 +++++++++++++++++++++++++++++ drivers/irqchip/qcom-pdc.c | 26 +++----------------------- include/linux/irqchip.h | 23 +++++++++++++++++++++++ 5 files changed, 61 insertions(+), 25 deletions(-)
Signature · 1 line
2.28.0.rc0.105.gf9edc3c819-goog
PATCH v3 1/4 irqchip: Add IRQCHIP_PLATFORM_DRIVER_BEGIN/END and IRQCHIP_MATCH helper macros
Compiling an irqchip driver as a platform driver needs to bunch of things to be done right:
- Making sure the parent domain is initialized first
- Making sure the device can't be unbound from sysfs
- Disallowing module unload if it's built as a module
- Finding the parent node
- Etc.
Instead of trying to make sure all future irqchip platform drivers get this right, provide boilerplate macros that take care of all of this.
An example use would look something like this. Where acme_foo_init and acme_bar_init are similar to what would be passed to IRQCHIP_DECLARE.
IRQCHIP_PLATFORM_DRIVER_BEGIN(acme_irq)IRQCHIP_MATCH("acme,foo", acme_foo_init)IRQCHIP_MATCH("acme,bar", acme_bar_init)IRQCHIP_PLATFORM_DRIVER_END(acme_irq)
--- drivers/irqchip/irqchip.c | 29 +++++++++++++++++++++++++++++ include/linux/irqchip.h | 23 +++++++++++++++++++++++ 2 files changed, 52 insertions(+)
drivers/irqchip/irqchip.c +29 -0
@@ -10,8 +10,10 @@#include <linux/acpi.h> #include <linux/init.h> +#include <linux/of_device.h> #include <linux/of_irq.h> #include <linux/irqchip.h> +#include <linux/platform_device.h> /* * This special of_device_id is the sentinel at the end of the
@@ -29,3 +31,30 @@ void __init irqchip_init(void)of_irq_init (__irqchip_of_table);acpi_probe_device_table (irqchip); } + +int platform_irqchip_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +struct device_node *par_np =of_irq_find_parent (np); +of_irq_init_cb_t irq_init_cb =of_device_get_match_data (&pdev->dev); + +if (!irq_init_cb) +return -EINVAL ; + +if (par_np == np) + par_np =NULL ; + +/* +* If there's a parent interrupt controller and none of the parent irq +* domains have been registered, that means the parent interrupt +* controller has not been initialized yet. it's not time for this +* interrupt controller to initialize. So, defer probe of this +* interrupt controller. The actual initialization callback of this +* interrupt controller can check for specific domains as necessary. +*/ +if (par_np && !irq_find_matching_host (np,DOMAIN_BUS_ANY )) +return -EPROBE_DEFER ; + +return irq_init_cb (np, par_np); +} +EXPORT_SYMBOL_GPL (platform_irqchip_probe);
include/linux/irqchip.h +23 -0
@@ -13,6 +13,7 @@#include <linux/acpi.h> #include <linux/of.h> +#include <linux/platform_device.h> /* * This macro must be used by the different irqchip drivers to declare
@@ -26,6 +27,28 @@*/ #define IRQCHIP_DECLARE (name, compat, fn) OF_DECLARE_2(irqchip, name, compat, fn) +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_PLATFORM_DRIVER_END (drv_name) \ + {}, \ +}; \ +MODULE_DEVICE_TABLE(of, drv_name##_irqchip_match_table); \ +static struct platform_driver drv_name##_driver = { \ + .probe = platform_irqchip_probe, \ + .driver = { \ + .name = #drv_name, \ + .owner = THIS_MODULE, \ + .of_match_table = drv_name##_irqchip_match_table, \ + .suppress_bind_attrs = true, \ + }, \ +}; \ +builtin_platform_driver(drv_name##_driver) +/* * 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.rc0.105.gf9edc3c819-goog
PATCH v3 2/4 irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
In reply to Saravana KannanSwitch the driver to use the helper macros. In addition to reducing the number of lines, this also adds module unload protection (if the driver is compiled as a module) by switching from module_platform_driver to builtin_platform_driver.
--- drivers/irqchip/qcom-pdc.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)
drivers/irqchip/qcom-pdc.c +3 -23
@@ -432,28 +432,8 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)return ret; } -static int qcom_pdc_probe (struct platform_device *pdev) -{ -struct device_node *np = pdev->dev.of_node; -struct device_node *parent =of_irq_find_parent (np); - -return qcom_pdc_init (np, parent); -} - -static const struct of_device_id qcom_pdc_match_table[] = { - { .compatible ="qcom,pdc" }, - {} -}; -MODULE_DEVICE_TABLE (of, qcom_pdc_match_table); - -static struct platform_driver qcom_pdc_driver = { - .probe = qcom_pdc_probe, - .driver = { - .name ="qcom-pdc" , - .of_match_table = qcom_pdc_match_table, - .suppress_bind_attrs = true, - }, -}; -module_platform_driver (qcom_pdc_driver); +IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc) +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init) +IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.28.0.rc0.105.gf9edc3c819-goog
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 37 lines · Saravana Kannan
Switch the driver to use the helper macros. In addition to reducing the number of lines, this also adds module unload protection (if the driver is compiled as a module) by switching from
module_platform_drivertobuiltin_platform_driver.Signed-off-by Saravana Kannan <[email protected]>--- drivers/irqchip/qcom-pdc.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)drivers/irqchip/qcom-pdc.c +0
-18@@ -432,28 +432,8 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)return ret; } -static int qcom_pdc_probe (struct platform_device *pdev) -{ -struct device_node *np = pdev->dev.of_node; -struct device_node *parent =of_irq_find_parent (np); - -return qcom_pdc_init (np, parent); -} - -static const struct of_device_id qcom_pdc_match_table[] = { - { .compatible ="qcom,pdc" }, - {} -}; -MODULE_DEVICE_TABLE (of, qcom_pdc_match_table); - -static struct platform_driver qcom_pdc_driver = { - .probe = qcom_pdc_probe, - .driver = { - .name ="qcom-pdc" ,
drivers/irqchip/qcom-pdc.c static int qcom_pdc_init(struct device_node *node, struct device_node *parent) · line 439
Quoted 10 lines
drivers/irqchip/qcom-pdc.c +3
-5- .of_match_table = qcom_pdc_match_table, - .suppress_bind_attrs = true, - }, -}; -module_platform_driver (qcom_pdc_driver); +IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc) +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init) +IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");MODULE_LICENSE ("GPL v2" );
<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
I managed to bisect it down to this patch, and reverting it avoids the issue. I don't see what is wrong right off, but I really need to get to bed, so I'll dig further tomorrow.
Saravana: Apologies for not getting around to testing this beforehand!
thanks
-john
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 55 lines · John Stultz
Quoted 37 lines · Saravana Kannan
Switch the driver to use the helper macros. In addition to reducing the number of lines, this also adds module unload protection (if the driver is compiled as a module) by switching from
module_platform_drivertobuiltin_platform_driver.Signed-off-by Saravana Kannan <[email protected]>--- drivers/irqchip/qcom-pdc.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)drivers/irqchip/qcom-pdc.c +0
-18@@ -432,28 +432,8 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)return ret; } -static int qcom_pdc_probe (struct platform_device *pdev) -{ -struct device_node *np = pdev->dev.of_node; -struct device_node *parent =of_irq_find_parent (np); - -return qcom_pdc_init (np, parent); -} - -static const struct of_device_id qcom_pdc_match_table[] = { - { .compatible ="qcom,pdc" }, - {} -}; -MODULE_DEVICE_TABLE (of, qcom_pdc_match_table); - -static struct platform_driver qcom_pdc_driver = { - .probe = qcom_pdc_probe, - .driver = { - .name ="qcom-pdc" ,drivers/irqchip/qcom-pdc.c static int qcom_pdc_init(struct device_node *node, struct device_node *parent) · line 439
Quoted 10 lines
drivers/irqchip/qcom-pdc.c +3
-5- .of_match_table = qcom_pdc_match_table, - .suppress_bind_attrs = true, - }, -}; -module_platform_driver (qcom_pdc_driver); +IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc) +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init) +IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");MODULE_LICENSE ("GPL v2" );<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
The only significant change from what your probe function is doing is this snippet. But it'd be surprising if this only affects the builtin case.
+ if (par_np == np)
+ par_np = NULL;
+
+ /*
+ * If there's a parent interrupt controller and none of the parent irq
+ * domains have been registered, that means the parent interrupt
+ * controller has not been initialized yet. it's not time for this
+ * interrupt controller to initialize. So, defer probe of this
+ * interrupt controller. The actual initialization callback of this
+ * interrupt controller can check for specific domains as necessary.
+ */
+ if (par_np && !irq_find_matching_host(np, DOMAIN_BUS_ANY))
+ return -EPROBE_DEFER;
Quoted 5 lines
I managed to bisect it down to this patch, and reverting it avoids the issue. I don't see what is wrong right off, but I really need to get to bed, so I'll dig further tomorrow.
Saravana: Apologies for not getting around to testing this beforehand!
No worries. Apologies for breaking it accidentally.
-Saravana
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 6 lines · Saravana Kannan
Quoted 5 lines · John Stultz
<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.
Quoted 7 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
For what it's worth, I saw this too on the Lenovo C630 (started on -next around 20200727, but I didn't track it down as, well, there's less way to get debug output on the C630.
In my testing, module or built-in doesn't matter, but reverting does allow me to boot again.
Quoted 26 lines
The only significant change from what your probe function is doing is this snippet. But it'd be surprising if this only affects the builtin case.
+ if (
par_np== np)(quoted diff) +12
-0+ par_np = NULL; + + /* + * If there's a parent interrupt controller and none of the parent irq + * domains have been registered, that means the parent interrupt + * controller has not been initialized yet. it's not time for this + * interrupt controller to initialize. So, defer probe of this + * interrupt controller. The actual initialization callback of this + * interrupt controller can check for specific domains as necessary. + */ + if (par_np && !irq_find_matching_host(np, DOMAIN_BUS_ANY)) + return -EPROBE_DEFER;Quoted 6 lines
I managed to bisect it down to this patch, and reverting it avoids the issue. I don't see what is wrong right off, but I really need to get to bed, so I'll dig further tomorrow.
Saravana: Apologies for not getting around to testing this beforehand!
No worries. Apologies for breaking it accidentally.
-Saravana
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 14 lines · Steev Klimaszewski
Quoted 6 lines · Saravana Kannan
Quoted 5 lines · John Stultz
<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.Quoted 7 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
Quoted 7 lines
For what it's worth, I saw this too on the Lenovo C630 (started on -next around 20200727, but I didn't track it down as, well, there's less way to get debug output on the C630.
In my testing, module or built-in doesn't matter, but reverting does allow me to boot again.
Actually - I spoke too soon - QCOM_PDC built-in with the commit reverted boots, however, module (on the c630 at least) doesn't boot whether it's a module or built-in.
Quoted 26 lines
Quoted 26 lines
The only significant change from what your probe function is doing is this snippet. But it'd be surprising if this only affects the builtin case.
+ if (
par_np== np)(quoted diff) +12
-0+ par_np = NULL; + + /* + * If there's a parent interrupt controller and none of the parent irq + * domains have been registered, that means the parent interrupt + * controller has not been initialized yet. it's not time for this + * interrupt controller to initialize. So, defer probe of this + * interrupt controller. The actual initialization callback of this + * interrupt controller can check for specific domains as necessary. + */ + if (par_np && !irq_find_matching_host(np, DOMAIN_BUS_ANY)) + return -EPROBE_DEFER;Quoted 6 lines
I managed to bisect it down to this patch, and reverting it avoids the issue. I don't see what is wrong right off, but I really need to get to bed, so I'll dig further tomorrow.
Saravana: Apologies for not getting around to testing this beforehand!
No worries. Apologies for breaking it accidentally.
-Saravana
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 21 lines · Steev Klimaszewski
Quoted 18 lines · Steev Klimaszewski
Quoted 6 lines · Saravana Kannan
Quoted 5 lines · John Stultz
<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.Quoted 7 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
For what it's worth, I saw this too on the Lenovo C630 (started on -next around 20200727, but I didn't track it down as, well, there's less way to get debug output on the C630.
Quoted 6 lines
Quoted 3 lines
In my testing, module or built-in doesn't matter, but reverting does allow me to boot again.
Actually - I spoke too soon -
QCOM_PDCbuilt-in with the commit reverted boots, however, module (on the c630 at least) doesn't boot whether it's a module or built-in.
You may need to set deferred_probe_timeout=30 to give things a bit more grace time to load.
(I've mostly recently used qcom-pdc as a module with the android tree, so the fw_devlink bits help there, but I need to re-check the state of that upstream.)
I'll dbl check this and dig more on the issue with the patch in question once I can get back in my office later today.
thanks
-john
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 25 lines · John Stultz
Quoted 24 lines · Steev Klimaszewski
Quoted 21 lines · Steev Klimaszewski
Quoted 6 lines · Saravana Kannan
Quoted 5 lines · John Stultz
<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.Quoted 7 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
For what it's worth, I saw this too on the Lenovo C630 (started on -next around 20200727, but I didn't track it down as, well, there's less way to get debug output on the C630.
In my testing, module or built-in doesn't matter, but reverting does allow me to boot again.
Quoted 6 lines
Quoted 3 lines
Actually - I spoke too soon -
QCOM_PDCbuilt-in with the commit reverted boots, however, module (on the c630 at least) doesn't boot whether it's a module or built-in.You may need to set deferred_probe_timeout=30 to give things a bit more grace time to load.
With the risk of me reading more into this than what you're saying, please don't upstream anything that depend this parameter to be increased.
Compiling any of these drivers as module should not require the user to pass additional kernel command line parameters in order to get their device to boot.
Regards,
Bjorn
Quoted 9 lines
(I've mostly recently used qcom-pdc as a module with the android tree, so the
fw_devlinkbits help there, but I need to re-check the state of that upstream.)I'll dbl check this and dig more on the issue with the patch in question once I can get back in my office later today.
thanks
-john
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 31 lines · Bjorn Andersson
Quoted 23 lines · John Stultz
Quoted 22 lines · Steev Klimaszewski
Quoted 21 lines · Steev Klimaszewski
Quoted 6 lines · Saravana Kannan
Quoted 5 lines · John Stultz
<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.Quoted 7 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
For what it's worth, I saw this too on the Lenovo C630 (started on -next around 20200727, but I didn't track it down as, well, there's less way to get debug output on the C630.
In my testing, module or built-in doesn't matter, but reverting does allow me to boot again.
Quoted 6 lines
Quoted 3 lines
Actually - I spoke too soon -
QCOM_PDCbuilt-in with the commit reverted boots, however, module (on the c630 at least) doesn't boot whether it's a module or built-in.You may need to set deferred_probe_timeout=30 to give things a bit more grace time to load.
Quoted 7 lines
With the risk of me reading more into this than what you're saying, please don't upstream anything that depend this parameter to be increased.
Compiling any of these drivers as module should not require the user to pass additional kernel command line parameters in order to get their device to boot.
So, ideally I agree, and Saravana's fw_devlink work should allow us to avoid it. But the reality is that it is already required (at least in configurations heavily using modules) to give more time for modules loaded to resolve missing dependencies after init begins (due to changes in the driver core to fail loading after init so that optional dt links aren't eternally looked for). This was seen when trying to enable the qualcom clk drivers to modules.
It doesn't seem necessary in this case, but I suggested it here as I've got it enabled by default in my AOSP builds so that the module-heavy configs for GKI boot properly (even if Saravana's fw_devlink work is disabled).
thanks
-john
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 41 lines · John Stultz
Quoted 31 lines · Bjorn Andersson
Quoted 23 lines · John Stultz
Quoted 22 lines · Steev Klimaszewski
Quoted 21 lines · Steev Klimaszewski
Quoted 6 lines · Saravana Kannan
Quoted 5 lines · John Stultz
<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.Quoted 7 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
For what it's worth, I saw this too on the Lenovo C630 (started on -next around 20200727, but I didn't track it down as, well, there's less way to get debug output on the C630.
In my testing, module or built-in doesn't matter, but reverting does allow me to boot again.
Quoted 6 lines
Quoted 3 lines
Actually - I spoke too soon -
QCOM_PDCbuilt-in with the commit reverted boots, however, module (on the c630 at least) doesn't boot whether it's a module or built-in.You may need to set deferred_probe_timeout=30 to give things a bit more grace time to load.
Quoted 7 lines
With the risk of me reading more into this than what you're saying, please don't upstream anything that depend this parameter to be increased.
Compiling any of these drivers as module should not require the user to pass additional kernel command line parameters in order to get their device to boot.
Quoted 8 lines
So, ideally I agree, and Saravana's
fw_devlinkwork should allow us to avoid it. But the reality is that it is already required (at least in configurations heavily using modules) to give more time for modules loaded to resolve missing dependencies after init begins (due to changes in the driver core to fail loading after init so that optional dt links aren't eternally looked for). This was seen when trying to enable the qualcom clk drivers to modules.
So to clarify what you're saying, any system that boots successfully with the default options is a sign of pure luck - regardless of being builtin or modules.
And there you have my exact argument against the deferred timeout magic going on in the driver core. But as you know people insist that it's more important to be able to boot some defunct system from NFS than a properly configured one reliably.
Quoted 5 lines
It doesn't seem necessary in this case, but I suggested it here as I've got it enabled by default in my AOSP builds so that the module-heavy configs for GKI boot properly (even if Saravana's
fw_devlinkwork is disabled).
With all due respect, that's your downstream kernel, the upstream kernel should not rely on luck, out-of-tree patches or kernel parameters.
Regards,
Bjorn
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 56 lines · Bjorn Andersson
Quoted 41 lines · John Stultz
Quoted 31 lines · Bjorn Andersson
Quoted 23 lines · John Stultz
Quoted 22 lines · Steev Klimaszewski
Quoted 21 lines · Steev Klimaszewski
Quoted 6 lines · Saravana Kannan
Quoted 5 lines · John Stultz
<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.Quoted 7 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
For what it's worth, I saw this too on the Lenovo C630 (started on -next around 20200727, but I didn't track it down as, well, there's less way to get debug output on the C630.
In my testing, module or built-in doesn't matter, but reverting does allow me to boot again.
Quoted 6 lines
Quoted 3 lines
Actually - I spoke too soon -
QCOM_PDCbuilt-in with the commit reverted boots, however, module (on the c630 at least) doesn't boot whether it's a module or built-in.You may need to set deferred_probe_timeout=30 to give things a bit more grace time to load.
Quoted 7 lines
With the risk of me reading more into this than what you're saying, please don't upstream anything that depend this parameter to be increased.
Compiling any of these drivers as module should not require the user to pass additional kernel command line parameters in order to get their device to boot.
Quoted 8 lines
So, ideally I agree, and Saravana's
fw_devlinkwork should allow us to avoid it. But the reality is that it is already required (at least in configurations heavily using modules) to give more time for modules loaded to resolve missing dependencies after init begins (due to changes in the driver core to fail loading after init so that optional dt links aren't eternally looked for). This was seen when trying to enable the qualcom clk drivers to modules.So to clarify what you're saying, any system that boots successfully with the default options is a sign of pure luck - regardless of being builtin or modules.
Quoted 4 lines
And there you have my exact argument against the deferred timeout magic going on in the driver core. But as you know people insist that it's more important to be able to boot some defunct system from NFS than a properly configured one reliably.
I'd agree, but the NFS case was in use before, and when the original deferred timeout/optional link handling stuff landed no one complained they were broken by it (at least at the point where it landed). Only later when we started enabling more lower-level core drivers as modules did the shortened dependency resolution time start to bite folks. My attempt to set the default to be 30 seconds helped there, but caused trouble and delays for the NFS case, and "don't break existing users" seemed to rule, so I set the default timeout back to 0.
Quoted 8 lines
Quoted 5 lines
It doesn't seem necessary in this case, but I suggested it here as I've got it enabled by default in my AOSP builds so that the module-heavy configs for GKI boot properly (even if Saravana's
fw_devlinkwork is disabled).With all due respect, that's your downstream kernel, the upstream kernel should not rely on luck, out-of-tree patches or kernel parameters.
I agree that would be preferred. But kernel parameters are often there for these sorts of cases where we can't always do the right thing. As for out-of-tree patches, broken things don't get fixed until out-of-tree patches are developed and upstreamed, and I know Saravana is doing exactly that, and I hope his fw_devlink work helps fix it so the module loading is not just a matter of luck.
Also I think Thierry's comments in the other thread today are also good ideas for ways to better handle the optional dt link handling (rather than using a timeout).
thanks
-john
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 83 lines · John Stultz
Quoted 56 lines · Bjorn Andersson
Quoted 41 lines · John Stultz
Quoted 31 lines · Bjorn Andersson
Quoted 23 lines · John Stultz
Quoted 22 lines · Steev Klimaszewski
Quoted 21 lines · Steev Klimaszewski
Quoted 6 lines · Saravana Kannan
Quoted 5 lines · John Stultz
<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.Quoted 7 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
For what it's worth, I saw this too on the Lenovo C630 (started on -next around 20200727, but I didn't track it down as, well, there's less way to get debug output on the C630.
In my testing, module or built-in doesn't matter, but reverting does allow me to boot again.
Quoted 6 lines
Quoted 3 lines
Actually - I spoke too soon -
QCOM_PDCbuilt-in with the commit reverted boots, however, module (on the c630 at least) doesn't boot whether it's a module or built-in.You may need to set deferred_probe_timeout=30 to give things a bit more grace time to load.
Quoted 7 lines
With the risk of me reading more into this than what you're saying, please don't upstream anything that depend this parameter to be increased.
Compiling any of these drivers as module should not require the user to pass additional kernel command line parameters in order to get their device to boot.
Quoted 8 lines
So, ideally I agree, and Saravana's
fw_devlinkwork should allow us to avoid it. But the reality is that it is already required (at least in configurations heavily using modules) to give more time for modules loaded to resolve missing dependencies after init begins (due to changes in the driver core to fail loading after init so that optional dt links aren't eternally looked for). This was seen when trying to enable the qualcom clk drivers to modules.So to clarify what you're saying, any system that boots successfully with the default options is a sign of pure luck - regardless of being builtin or modules.
Quoted 4 lines
And there you have my exact argument against the deferred timeout magic going on in the driver core. But as you know people insist that it's more important to be able to boot some defunct system from NFS than a properly configured one reliably.
I'd agree, but the NFS case was in use before, and when the original deferred timeout/optional link handling stuff landed no one complained they were broken by it (at least at the point where it landed). Only later when we started enabling more lower-level core drivers as modules did the shortened dependency resolution time start to bite folks. My attempt to set the default to be 30 seconds helped there, but caused trouble and delays for the NFS case, and "don't break existing users" seemed to rule, so I set the default timeout back to 0.
Quoted 8 lines
Quoted 5 lines
It doesn't seem necessary in this case, but I suggested it here as I've got it enabled by default in my AOSP builds so that the module-heavy configs for GKI boot properly (even if Saravana's
fw_devlinkwork is disabled).With all due respect, that's your downstream kernel, the upstream kernel should not rely on luck, out-of-tree patches or kernel parameters.
Quoted 6 lines
I agree that would be preferred. But kernel parameters are often there for these sorts of cases where we can't always do the right thing. As for out-of-tree patches, broken things don't get fixed until out-of-tree patches are developed and upstreamed, and I know Saravana is doing exactly that, and I hope his
fw_devlinkwork helps fix it so the module loading is not just a matter of luck.
Btw, the only downstream fw_devlink change is setting itto =on (vs =permissive in upstream).
Quoted 3 lines
Also I think Thierry's comments in the other thread today are also good ideas for ways to better handle the optional dt link handling (rather than using a timeout).
Could you please give me a lore link to this thread? Just curious.
-Saravana
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 13 lines · Saravana Kannan
Quoted 11 lines · John Stultz
Quoted 2 lines · Bjorn Andersson
With all due respect, that's your downstream kernel, the upstream kernel should not rely on luck, out-of-tree patches or kernel parameters.
I agree that would be preferred. But kernel parameters are often there for these sorts of cases where we can't always do the right thing. As for out-of-tree patches, broken things don't get fixed until out-of-tree patches are developed and upstreamed, and I know Saravana is doing exactly that, and I hope his
fw_devlinkwork helps fix it so the module loading is not just a matter of luck.
Quoted 2 lines
Btw, the only downstream
fw_devlinkchange is setting itto =on (vs =permissive in upstream).
I thought there was the clk_sync_state stuff as well?
Quoted 5 lines
Quoted 3 lines
Also I think Thierry's comments in the other thread today are also good ideas for ways to better handle the optional dt link handling (rather than using a timeout).
Could you please give me a lore link to this thread? Just curious.
Sure: https://lore.kernel.org/lkml/20200806135251.GB3351349@ulmo/
thanks
-john
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 15 lines · John Stultz
Quoted 13 lines · Saravana Kannan
Quoted 11 lines · John Stultz
Quoted 2 lines · Bjorn Andersson
With all due respect, that's your downstream kernel, the upstream kernel should not rely on luck, out-of-tree patches or kernel parameters.
I agree that would be preferred. But kernel parameters are often there for these sorts of cases where we can't always do the right thing. As for out-of-tree patches, broken things don't get fixed until out-of-tree patches are developed and upstreamed, and I know Saravana is doing exactly that, and I hope his
fw_devlinkwork helps fix it so the module loading is not just a matter of luck.
Quoted 4 lines
Quoted 2 lines
Btw, the only downstream
fw_devlinkchange is setting itto =on (vs =permissive in upstream).I thought there was the
clk_sync_statestuff as well?
That's not needed to solve the module load ordering issues and deferred probe issues. That's only needed to keep clocks on till some of the modules are loaded and it depends on fw_devlink, but not really a part of fw_devlink IMHO. And yes, that's on my list of things to upstream.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Also I think Thierry's comments in the other thread today are also good ideas for ways to better handle the optional dt link handling (rather than using a timeout).
Could you please give me a lore link to this thread? Just curious.
Sure: https://lore.kernel.org/lkml/20200806135251.GB3351349@ulmo/
Thanks.
-Saravana
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
In reply to John StultzQuoted 58 lines · John Stultz
Quoted 56 lines · Bjorn Andersson
Quoted 41 lines · John Stultz
Quoted 31 lines · Bjorn Andersson
Quoted 23 lines · John Stultz
Quoted 22 lines · Steev Klimaszewski
Quoted 21 lines · Steev Klimaszewski
Quoted 6 lines · Saravana Kannan
Quoted 5 lines · John Stultz
<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.Quoted 7 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
For what it's worth, I saw this too on the Lenovo C630 (started on -next around 20200727, but I didn't track it down as, well, there's less way to get debug output on the C630.
In my testing, module or built-in doesn't matter, but reverting does allow me to boot again.
Quoted 6 lines
Quoted 3 lines
Actually - I spoke too soon -
QCOM_PDCbuilt-in with the commit reverted boots, however, module (on the c630 at least) doesn't boot whether it's a module or built-in.You may need to set deferred_probe_timeout=30 to give things a bit more grace time to load.
Quoted 7 lines
With the risk of me reading more into this than what you're saying, please don't upstream anything that depend this parameter to be increased.
Compiling any of these drivers as module should not require the user to pass additional kernel command line parameters in order to get their device to boot.
Quoted 8 lines
So, ideally I agree, and Saravana's
fw_devlinkwork should allow us to avoid it. But the reality is that it is already required (at least in configurations heavily using modules) to give more time for modules loaded to resolve missing dependencies after init begins (due to changes in the driver core to fail loading after init so that optional dt links aren't eternally looked for). This was seen when trying to enable the qualcom clk drivers to modules.So to clarify what you're saying, any system that boots successfully with the default options is a sign of pure luck - regardless of being builtin or modules.
Quoted 8 lines
Quoted 4 lines
And there you have my exact argument against the deferred timeout magic going on in the driver core. But as you know people insist that it's more important to be able to boot some defunct system from NFS than a properly configured one reliably.
I'd agree, but the NFS case was in use before, and when the original deferred timeout/optional link handling stuff landed no one complained they were broken by it (at least at the point where it landed).
I did object when this was proposed and I've objected for the last two years, because we keep adding more and more subsystems to follow this broken behavior.
Quoted 7 lines
Only later when we started enabling more lower-level core drivers as modules did the shortened dependency resolution time start to bite folks. My attempt to set the default to be 30 seconds helped there, but caused trouble and delays for the NFS case, and "don't break existing users" seemed to rule, so I set the default timeout back to 0.
I can't argue with that and I'm at loss on how to turn this around.
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines
It doesn't seem necessary in this case, but I suggested it here as I've got it enabled by default in my AOSP builds so that the module-heavy configs for GKI boot properly (even if Saravana's
fw_devlinkwork is disabled).With all due respect, that's your downstream kernel, the upstream kernel should not rely on luck, out-of-tree patches or kernel parameters.
Quoted 7 lines
I agree that would be preferred. But kernel parameters are often there for these sorts of cases where we can't always do the right thing. As for out-of-tree patches, broken things don't get fixed until out-of-tree patches are developed and upstreamed, and I know Saravana is doing exactly that, and I hope his
fw_devlinkwork helps fix it so the module loading is not just a matter of luck.
I don't agree with this, upstream should be functional in its default configuration. Out-of-tree patches might be necessary to enable features or get the most out of the hardware, but what we have upstream should work. And no, this is not always the case, but we should at least aim for this.
Quoted 4 lines
Also I think Thierry's comments in the other thread today are also good ideas for ways to better handle the optional dt link handling (rather than using a timeout).
I'll take a look at that, but to repeat what I've said many times before, for Qualcomm platforms there's pretty much no such thing as optional links.
Regards,
Bjorn
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 107 lines · Bjorn Andersson
Quoted 58 lines · John Stultz
Quoted 56 lines · Bjorn Andersson
Quoted 41 lines · John Stultz
Quoted 31 lines · Bjorn Andersson
Quoted 23 lines · John Stultz
Quoted 22 lines · Steev Klimaszewski
Quoted 21 lines · Steev Klimaszewski
Quoted 6 lines · Saravana Kannan
Quoted 5 lines · John Stultz
<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.Quoted 7 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
For what it's worth, I saw this too on the Lenovo C630 (started on -next around 20200727, but I didn't track it down as, well, there's less way to get debug output on the C630.
In my testing, module or built-in doesn't matter, but reverting does allow me to boot again.
Quoted 6 lines
Quoted 3 lines
Actually - I spoke too soon -
QCOM_PDCbuilt-in with the commit reverted boots, however, module (on the c630 at least) doesn't boot whether it's a module or built-in.You may need to set deferred_probe_timeout=30 to give things a bit more grace time to load.
Quoted 7 lines
With the risk of me reading more into this than what you're saying, please don't upstream anything that depend this parameter to be increased.
Compiling any of these drivers as module should not require the user to pass additional kernel command line parameters in order to get their device to boot.
Quoted 8 lines
So, ideally I agree, and Saravana's
fw_devlinkwork should allow us to avoid it. But the reality is that it is already required (at least in configurations heavily using modules) to give more time for modules loaded to resolve missing dependencies after init begins (due to changes in the driver core to fail loading after init so that optional dt links aren't eternally looked for). This was seen when trying to enable the qualcom clk drivers to modules.So to clarify what you're saying, any system that boots successfully with the default options is a sign of pure luck - regardless of being builtin or modules.
Quoted 8 lines
Quoted 4 lines
And there you have my exact argument against the deferred timeout magic going on in the driver core. But as you know people insist that it's more important to be able to boot some defunct system from NFS than a properly configured one reliably.
I'd agree, but the NFS case was in use before, and when the original deferred timeout/optional link handling stuff landed no one complained they were broken by it (at least at the point where it landed).
I did object when this was proposed and I've objected for the last two years, because we keep adding more and more subsystems to follow this broken behavior.
Quoted 7 lines
Only later when we started enabling more lower-level core drivers as modules did the shortened dependency resolution time start to bite folks. My attempt to set the default to be 30 seconds helped there, but caused trouble and delays for the NFS case, and "don't break existing users" seemed to rule, so I set the default timeout back to 0.
I can't argue with that and I'm at loss on how to turn this around.
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines
It doesn't seem necessary in this case, but I suggested it here as I've got it enabled by default in my AOSP builds so that the module-heavy configs for GKI boot properly (even if Saravana's
fw_devlinkwork is disabled).With all due respect, that's your downstream kernel, the upstream kernel should not rely on luck, out-of-tree patches or kernel parameters.
Quoted 7 lines
I agree that would be preferred. But kernel parameters are often there for these sorts of cases where we can't always do the right thing. As for out-of-tree patches, broken things don't get fixed until out-of-tree patches are developed and upstreamed, and I know Saravana is doing exactly that, and I hope his
fw_devlinkwork helps fix it so the module loading is not just a matter of luck.I don't agree with this, upstream should be functional in its default configuration. Out-of-tree patches might be necessary to enable features or get the most out of the hardware, but what we have upstream should work. And no, this is not always the case, but we should at least aim for this.
Quoted 8 lines
Quoted 4 lines
Also I think Thierry's comments in the other thread today are also good ideas for ways to better handle the optional dt link handling (rather than using a timeout).
I'll take a look at that, but to repeat what I've said many times before, for Qualcomm platforms there's pretty much no such thing as optional links.
Nicolas had suggested earlier that we could have a way to enable fw_devlink=on in DT under the "chosen" node. I liked that idea, but wasn't sure how easy it would be to convince DT maintainers to allow it. If that happens, we could just set that and not have to worry about these timeouts for QC platforms.
Not sure how easy it is to update DT in a DB 845c though. But for cases where DT can't be updated, we'd still have the crappy timeout to plaster over the issue.
Something like this or whatever sensible name that suggests that the dependencies in DT are reliable enough to use for probe ordering, deferred probe, etc. Then once that's there, we can turn on fw_devlink=on and that'd completely skip this timeout code path (and has a bunch of other benefits).
chosen {
linux,reliable-dt-dependencies;
}Just some food for thought.
Also, Thierry's idea would work, but it'll need changes to multiple drivers. Also, I don't think it'll work for drivers that'll need to ignore vs not ignore dependencies based on what board they are used in. It's still better than the blind timeout though.
-Saravana
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
In reply to Saravana KannanQuoted 55 lines · Saravana Kannan
Quoted 54 lines · John Stultz
Quoted 37 lines · Saravana Kannan
Switch the driver to use the helper macros. In addition to reducing the number of lines, this also adds module unload protection (if the driver is compiled as a module) by switching from
module_platform_drivertobuiltin_platform_driver.Signed-off-by Saravana Kannan <[email protected]>--- drivers/irqchip/qcom-pdc.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)drivers/irqchip/qcom-pdc.c +0
-18@@ -432,28 +432,8 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)return ret; } -static int qcom_pdc_probe (struct platform_device *pdev) -{ -struct device_node *np = pdev->dev.of_node; -struct device_node *parent =of_irq_find_parent (np); - -return qcom_pdc_init (np, parent); -} - -static const struct of_device_id qcom_pdc_match_table[] = { - { .compatible ="qcom,pdc" }, - {} -}; -MODULE_DEVICE_TABLE (of, qcom_pdc_match_table); - -static struct platform_driver qcom_pdc_driver = { - .probe = qcom_pdc_probe, - .driver = { - .name ="qcom-pdc" ,drivers/irqchip/qcom-pdc.c static int qcom_pdc_init(struct device_node *node, struct device_node *parent) · line 439
Quoted 10 lines
drivers/irqchip/qcom-pdc.c +3
-5- .of_match_table = qcom_pdc_match_table, - .suppress_bind_attrs = true, - }, -}; -module_platform_driver (qcom_pdc_driver); +IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc) +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init) +IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");MODULE_LICENSE ("GPL v2" );<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.
Quoted 8 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
I've not yet tested with modules with your patch.
Quoted 7 lines
The only significant change from what your probe function is doing is this snippet. But it'd be surprising if this only affects the builtin case.
+ if (
par_np== np)(quoted diff) +2
-0+ par_np = NULL; +
Review
Quoted 10 lines
(quoted diff) +10
-0+ /* + * If there's a parent interrupt controller and none of the parent irq + * domains have been registered, that means the parent interrupt + * controller has not been initialized yet. it's not time for this + * interrupt controller to initialize. So, defer probe of this + * interrupt controller. The actual initialization callback of this + * interrupt controller can check for specific domains as necessary. + */ + if (par_np && !irq_find_matching_host(np, DOMAIN_BUS_ANY)) + return -EPROBE_DEFER;
Yep. We're getting caught on the irq_find_matching_host() check. I'm a little lost as when I look at the qcom,pdc node in the dtsi its not under a parent controller (instead the soc node).
Not sure if that's an issue in the dtsi or if par_np check needs to ignore the soc node and pass null?
thanks
-john
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 86 lines · John Stultz
Quoted 55 lines · Saravana Kannan
Quoted 54 lines · John Stultz
Quoted 37 lines · Saravana Kannan
Switch the driver to use the helper macros. In addition to reducing the number of lines, this also adds module unload protection (if the driver is compiled as a module) by switching from
module_platform_drivertobuiltin_platform_driver.Signed-off-by Saravana Kannan <[email protected]>--- drivers/irqchip/qcom-pdc.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)drivers/irqchip/qcom-pdc.c +0
-18@@ -432,28 +432,8 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)return ret; } -static int qcom_pdc_probe (struct platform_device *pdev) -{ -struct device_node *np = pdev->dev.of_node; -struct device_node *parent =of_irq_find_parent (np); - -return qcom_pdc_init (np, parent); -} - -static const struct of_device_id qcom_pdc_match_table[] = { - { .compatible ="qcom,pdc" }, - {} -}; -MODULE_DEVICE_TABLE (of, qcom_pdc_match_table); - -static struct platform_driver qcom_pdc_driver = { - .probe = qcom_pdc_probe, - .driver = { - .name ="qcom-pdc" ,drivers/irqchip/qcom-pdc.c static int qcom_pdc_init(struct device_node *node, struct device_node *parent) · line 439
Quoted 10 lines
drivers/irqchip/qcom-pdc.c +3
-5- .of_match_table = qcom_pdc_match_table, - .suppress_bind_attrs = true, - }, -}; -module_platform_driver (qcom_pdc_driver); +IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc) +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init) +IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");MODULE_LICENSE ("GPL v2" );<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.Quoted 8 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
I've not yet tested with modules with your patch.
Quoted 10 lines
The only significant change from what your probe function is doing is this snippet. But it'd be surprising if this only affects the builtin case.
+ if (
par_np== np)(quoted diff) +4
-0+ par_np = NULL; + + /* + * If there's a parent interrupt controller and none of the parentirq
Quoted 8 lines
+ * domains have been registered, that means the parent interrupt
+ * controller has not been initialized yet. it's not time for this
+ * interrupt controller to initialize. So, defer probe of this
+ * interrupt controller. The actual initialization callback of this
+ * interrupt controller can check for specific domains as necessary.
+ */
+ if (par_np&& !irq_find_matching_host(np,DOMAIN_BUS_ANY))
+ return -EPROBE_DEFER;
Quoted 5 lines
Yep. We're getting caught on the
irq_find_matching_host()check. I'm a little lost as when I look at the qcom,pdc node in the dtsi its not under a parent controller (instead the soc node).
Not sure if that's an issue in the dtsi or ifpar_npcheck needs to ignore the soc node and pass null?
I think you have nailed it. This checks for a domain attached to the driver we are about to probe, and this domain cannot possibly exist. Instead, it is the *parent* this should check for, as we depend on it for successful probing.
Can you please give this a go?
Thanks,
M.
drivers/irqchip/irqchip.c +1 -1
@@ -52,7 +52,7 @@ int platform_irqchip_probe(struct platform_device *pdev)* interrupt controller. The actual initialization callback of this * interrupt controller can check for specific domains as necessary. */ -if (par_np && !irq_find_matching_host (np,DOMAIN_BUS_ANY )) +if (par_np && !irq_find_matching_host (par_np,DOMAIN_BUS_ANY ))return -EPROBE_DEFER ;return irq_init_cb (np, par_np);
Signature · 6 lines
Jazz is not dead. It just smells funny... _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 96 lines · Marc Zyngier
Quoted 88 lines · John Stultz
Quoted 56 lines · Saravana Kannan
Quoted 54 lines · John Stultz
Quoted 37 lines · Saravana Kannan
Switch the driver to use the helper macros. In addition to reducing the number of lines, this also adds module unload protection (if the driver is compiled as a module) by switching from
module_platform_drivertobuiltin_platform_driver.Signed-off-by Saravana Kannan <[email protected]>--- drivers/irqchip/qcom-pdc.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)drivers/irqchip/qcom-pdc.c +0
-18@@ -432,28 +432,8 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)return ret; } -static int qcom_pdc_probe (struct platform_device *pdev) -{ -struct device_node *np = pdev->dev.of_node; -struct device_node *parent =of_irq_find_parent (np); - -return qcom_pdc_init (np, parent); -} - -static const struct of_device_id qcom_pdc_match_table[] = { - { .compatible ="qcom,pdc" }, - {} -}; -MODULE_DEVICE_TABLE (of, qcom_pdc_match_table); - -static struct platform_driver qcom_pdc_driver = { - .probe = qcom_pdc_probe, - .driver = { - .name ="qcom-pdc" ,drivers/irqchip/qcom-pdc.c static int qcom_pdc_init(struct device_node *node, struct device_node *parent) · line 439
Quoted 10 lines
drivers/irqchip/qcom-pdc.c +3
-5- .of_match_table = qcom_pdc_match_table, - .suppress_bind_attrs = true, - }, -}; -module_platform_driver (qcom_pdc_driver); +IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc) +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init) +IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc) MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");MODULE_LICENSE ("GPL v2" );<sigh>
So this is where I bashfully admit I didn't get a chance to try this patch series out, as I had success with a much older version of Saravana's macro magic.Quoted 8 lines
Quoted 3 lines
But unfortunately, now that this has landed in mainline, I'm seeing boot regressions on db845c. :( This is in the non-modular case, building the driver in.
Does that mean the modular version is working? Or you haven't tried that yet? I'll wait for your reply before I try to fix it. I don't have the hardware, but it should be easy to guess this issue looking at the code delta.
I've not yet tested with modules with your patch.
Quoted 10 lines
The only significant change from what your probe function is doing is this snippet. But it'd be surprising if this only affects the builtin case.
+ if (
par_np== np)(quoted diff) +4
-0+ par_np = NULL; + + /* + * If there's a parent interrupt controller and none of the parentirq
Quoted 8 lines
+ * domains have been registered, that means the parent interrupt
+ * controller has not been initialized yet. it's not time for this
+ * interrupt controller to initialize. So, defer probe of this
+ * interrupt controller. The actual initialization callback of this
+ * interrupt controller can check for specific domains as necessary.
+ */
+ if (par_np&& !irq_find_matching_host(np,DOMAIN_BUS_ANY))
+ return -EPROBE_DEFER;Quoted 5 lines
Yep. We're getting caught on the
irq_find_matching_host()check. I'm a little lost as when I look at the qcom,pdc node in the dtsi its not under a parent controller (instead the soc node).
Not sure if that's an issue in the dtsi or ifpar_npcheck needs to ignore the soc node and pass null?
Quoted 4 lines
I think you have nailed it. This checks for a domain attached to the driver we are about to probe, and this domain cannot possibly exist. Instead, it is the *parent* this should check for, as we depend on it for successful probing.
Duh! Looks like I made a copy-paste/typo error. The comment clearly says I'm trying to check the parent and then I end up checking the node getting registered. I'm sure this will fix it.
Actually Nial sent an email a few hours after your and he had found the same issue. He even tested the fix with an irqchip driver and it fixed the probe issue.
I'm assuming you'll put up the patch yourself. Please let me know if you need me to send one.
Thanks,
Saravana
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 3 lines · Saravana Kannan
Quoted 2 lines · Marc Zyngier
On 2020-08-06 02:24, John Stultz wrote:
[...]
Quoted 26 lines
Quoted 21 lines
Quoted 15 lines
Quoted 6 lines
+ if (
par_np== np)(quoted diff) +4
-0+ par_np = NULL; + + /* + * If there's a parent interrupt controller and none of the parentirq
Quoted 8 lines
+ * domains have been registered, that means the parent interrupt
+ * controller has not been initialized yet. it's not time for this
+ * interrupt controller to initialize. So, defer probe of this
+ * interrupt controller. The actual initialization callback of this
+ * interrupt controller can check for specific domains as necessary.
+ */
+ if (par_np&& !irq_find_matching_host(np,DOMAIN_BUS_ANY))
+ return -EPROBE_DEFER;Quoted 5 lines
Yep. We're getting caught on the
irq_find_matching_host()check. I'm a little lost as when I look at the qcom,pdc node in the dtsi its not under a parent controller (instead the soc node).
Not sure if that's an issue in the dtsi or ifpar_npcheck needs to ignore the soc node and pass null?Quoted 4 lines
I think you have nailed it. This checks for a domain attached to the driver we are about to probe, and this domain cannot possibly exist. Instead, it is the *parent* this should check for, as we depend on it for successful probing.
Quoted 7 lines
Duh! Looks like I made a copy-paste/typo error. The comment clearly says I'm trying to check the parent and then I end up checking the node getting registered. I'm sure this will fix it.
Actually Nial sent an email a few hours after your and he had found the same issue. He even tested the fix with an irqchip driver and it fixed the probe issue.
OK, thanks for confirming. It would have been good if these patches had seen a bit more testing.
Quoted 3 lines
I'm assuming you'll put up the patch yourself. Please let me know if you need me to send one.
I have queued this [1] in -next.
It'd be good if someone (John?) could give a Tested-by.
Thanks,
M.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?h=irq/irqchip-next
Signature · 1 line
Jazz is not dead. It just smells funny...
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 2 lines · Marc Zyngier
OK, thanks for confirming. It would have been good if these patches had seen a bit more testing.
Yes, again, my apologies for that!
Quoted 6 lines
Quoted 2 lines
I'm assuming you'll put up the patch yourself. Please let me know if you need me to send one.
I have queued this [1] in -next.
It'd be good if someone (John?) could give a Tested-by.
Just validated. Tested-by: John Stultz <[email protected]>
Thanks so much for the quick fix!
-john
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 5 lines · John Stultz
Quoted 2 lines · Marc Zyngier
OK, thanks for confirming. It would have been good if these patches had seen a bit more testing.
Yes, again, my apologies for that!
I would say this should be the job of the patch author, before anyone else. Yes, silly bugs happen. In this occurrence, it could have been avoided by just boot-testing it, though.
Oh well. At least it was caught early.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I'm assuming you'll put up the patch yourself. Please let me know if you need me to send one.
I have queued this [1] in -next.
It'd be good if someone (John?) could give a Tested-by.
Just validated. Tested-by: John Stultz <[email protected]>
Thanks for your patience, the reporting and testing.
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
Quoted 11 lines · Marc Zyngier
Quoted 5 lines · John Stultz
Quoted 2 lines · Marc Zyngier
OK, thanks for confirming. It would have been good if these patches had seen a bit more testing.
Yes, again, my apologies for that!
I would say this should be the job of the patch author, before anyone else. Yes, silly bugs happen. In this occurrence, it could have been avoided by just boot-testing it, though.
Sorry about this. I don't have a DB 845c to test this one. I generally work with John or try and backport changes to devices I have that are running older 4.xx kernels. This one seemed harmless/simple enough that I didn't think I needed to go through all that. But obviously the few times you don't test is when things fail :-(
-Saravana
PATCH v3 3/4 irqchip/mtk-sysirq: Convert to a platform driver
In reply to Saravana KannanThis driver can work as a platform driver. So covert it to a platform driver.
--- drivers/irqchip/irq-mtk-sysirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mtk-sysirq.c +3 -1
@@ -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_PLATFORM_DRIVER_BEGIN(mtk_sysirq) +IRQCHIP_MATCH("mediatek,mt6577-sysirq", mtk_sysirq_of_init) +IRQCHIP_PLATFORM_DRIVER_END (mtk_sysirq)
Signature · 1 line
2.28.0.rc0.105.gf9edc3c819-goog
Re: [PATCH v3 3/4] irqchip/mtk-sysirq: Convert to a platform driver
Quoted 13 lines · Saravana Kannan
This driver can work as a platform driver. So covert it to a platform driver.
Signed-off-by Saravana Kannan <[email protected]>--- drivers/irqchip/irq-mtk-sysirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/irqchip/irq-mtk-sysirq.c +0
-0
drivers/irqchip/irq-mtk-sysirq.c static int __init mtk_sysirq_of_init(struct device_node *node, · line 236
Quoted 7 lines
drivers/irqchip/irq-mtk-sysirq.c +3
-1@@ -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_PLATFORM_DRIVER_BEGIN(mtk_sysirq) +IRQCHIP_MATCH("mediatek,mt6577-sysirq", mtk_sysirq_of_init) +IRQCHIP_PLATFORM_DRIVER_END (mtk_sysirq)
Hi Saravana,
Looks good for me to convert it to a platform.
Thank you for your patch.
Hanks Chen
PATCH v3 4/4 irqchip/mtk-cirq: Convert to a platform driver
In reply to Saravana KannanThis driver can work as a platform driver. So covert it to a platform driver.
--- drivers/irqchip/irq-mtk-cirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mtk-cirq.c +3 -1
@@ -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_PLATFORM_DRIVER_BEGIN(mtk_cirq) +IRQCHIP_MATCH("mediatek,mtk-cirq", mtk_cirq_of_init) +IRQCHIP_PLATFORM_DRIVER_END (mtk_cirq)
Signature · 1 line
2.28.0.rc0.105.gf9edc3c819-goog
Re: [PATCH v3 4/4] irqchip/mtk-cirq: Convert to a platform driver
Quoted 13 lines · Saravana Kannan
This driver can work as a platform driver. So covert it to a platform driver.
Signed-off-by Saravana Kannan <[email protected]>--- drivers/irqchip/irq-mtk-cirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/irqchip/irq-mtk-cirq.c +0
-0
drivers/irqchip/irq-mtk-cirq.c static int __init mtk_cirq_of_init(struct device_node *node, · line 300
Quoted 7 lines
drivers/irqchip/irq-mtk-cirq.c +3
-1@@ -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_PLATFORM_DRIVER_BEGIN(mtk_cirq) +IRQCHIP_MATCH("mediatek,mtk-cirq", mtk_cirq_of_init) +IRQCHIP_PLATFORM_DRIVER_END (mtk_cirq)
Hi Saravana,
Looks good for me to convert cirq to a platform.
Thank you for your patch.
Hanks Chen
Re: [PATCH v3 4/4] irqchip/mtk-cirq: Convert to a platform driver
Quoted 25 lines · Hanks Chen
Quoted 13 lines · Saravana Kannan
This driver can work as a platform driver. So covert it to a platform driver.
Signed-off-by Saravana Kannan <[email protected]>--- drivers/irqchip/irq-mtk-cirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/irqchip/irq-mtk-cirq.c +0
-0drivers/irqchip/irq-mtk-cirq.c static int __init mtk_cirq_of_init(struct device_node *node, · line 300
Quoted 7 lines
drivers/irqchip/irq-mtk-cirq.c +3
-1@@ -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_PLATFORM_DRIVER_BEGIN(mtk_cirq) +IRQCHIP_MATCH("mediatek,mtk-cirq", mtk_cirq_of_init) +IRQCHIP_PLATFORM_DRIVER_END (mtk_cirq)Hi Saravana,
Quoted 4 lines
Looks good for me to convert cirq to a platform.
Thank you for your patch.Reviewed-by Hanks Chen <[email protected]>
Hi Hanks,
Thanks for the Reviewed-by on both patches.
-Saravana
Marc Zyngier
AppliedQuoted 9 lines · Saravana Kannan
Made a series out of the previous v2 patch + some example uses of the macros.
Not sure if the MTK changes work (just compile tested), but saw that Hanks was trying to make those drivers into tristate. So I assume they'll work as platform drivers. Please wait for MTK Ack before picking up patches 3 and 4.
[...]
Applied to irq/irqchip-5.9, thanks!
[1/4] irqchip: Add IRQCHIP_PLATFORM_DRIVER_BEGIN/END and IRQCHIP_MATCH helper macros
commit: f3b5e608ed6d17bdf04dacbf2374f10d51fe9b09
[2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
commit: 04741740254cd83fb4f2b7747aeb35202104f8fe
[3/4] irqchip/mtk-sysirq: Convert to a platform driver
commit: 3ae3022690e6787839dafa8ea3496450248b53e1
[4/4] irqchip/mtk-cirq: Convert to a platform driver
commit: 538b63351607960ff2249460089daa31337ddebaCheers,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Quoted 14 lines · Marc Zyngier
Quoted 9 lines · Saravana Kannan
Made a series out of the previous v2 patch + some example uses of the macros.
Not sure if the MTK changes work (just compile tested), but saw that Hanks was trying to make those drivers into tristate. So I assume they'll work as platform drivers. Please wait for MTK Ack before picking up patches 3 and 4.
[...]
Applied to irq/irqchip-5.9, thanks!
Quoted 8 lines
[1/4] irqchip: Add IRQCHIP_PLATFORM_DRIVER_BEGIN/END and
IRQCHIP_MATCHhelper macroscommit: f3b5e608ed6d17bdf04dacbf2374f10d51fe9b09 [2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros commit: 04741740254cd83fb4f2b7747aeb35202104f8fe [3/4] irqchip/mtk-sysirq: Convert to a platform driver commit: 3ae3022690e6787839dafa8ea3496450248b53e1 [4/4] irqchip/mtk-cirq: Convert to a platform driver commit: 538b63351607960ff2249460089daa31337ddeba
Thanks!
-Saravana