Skip to contentSkip to conversation

firmware: qcom: scm: add missing IRQ_DOMAIN select to QCOM_SCM

PATCH In review Julian Braha 3 participants 3 messages Jul 1 – Jul 2

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

PATCH 1/1 firmware: qcom: scm: add missing IRQ_DOMAIN select to QCOM_SCM

'drivers/firmware/qcom/qcom_scm.c' calls 'irq_create_fwspec_mapping' so it will fail to compile if IRQ_DOMAIN is disabled:

drivers/firmware/qcom/qcom_scm.c: In function ‘qcom_scm_get_waitq_irq’:
drivers/firmware/qcom/qcom_scm.c:2512:16: error: implicit declaration
of function ‘irq_create_fwspec_mapping’; did you mean ‘irq_create_of_mapping’? [-Wimplicit-function-declaration]

   2512 |         return irq_create_fwspec_mapping(&fwspec);
        |                ^~~~~~~~~~~~~~~~~~~~~~~~~
        |                irq_create_of_mapping

A patch-set in review proposes making QCOM_SCM visible in the kconfig frontend, so let's ensure that it's safe for users to enable:
https://lore.kernel.org/lkml/akS_6izxrhgK-I22@sumit-xelite/

---
 drivers/firmware/qcom/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/firmware/qcom/Kconfig +1 -0
index b477d54b495a..9d137fa2aa23 100644
@@ -7,6 +7,7 @@
 menu "Qualcomm firmware drivers"
 
 config QCOM_SCM
+	select IRQ_DOMAIN
 	select QCOM_TZMEM
 	tristate
 
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Julian Braha

'drivers/firmware/qcom/qcom_scm.c' calls 'irq_create_fwspec_mapping' so it will fail to compile if IRQ_DOMAIN is disabled:

drivers/firmware/qcom/qcom_scm.c: In function ‘qcom_scm_get_waitq_irq’:
drivers/firmware/qcom/qcom_scm.c:2512:16: error: implicit declaration
of function ‘irq_create_fwspec_mapping’; did you mean ‘irq_create_of_mapping’? [-Wimplicit-function-declaration]

   2512 |         return irq_create_fwspec_mapping(&fwspec);
        |                ^~~~~~~~~~~~~~~~~~~~~~~~~
        |                irq_create_of_mapping
Quoted 6 lines

A patch-set in review proposes making QCOM_SCM visible in the kconfig frontend, so let's ensure that it's safe for users to enable:
https://lore.kernel.org/lkml/akS_6izxrhgK-I22@sumit-xelite/

---

Konrad

#2 lore raw
In reply to Julian Braha
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] qcom_scm_get_waitq_irq() returns 0 on failure, but qcom_scm_probe() only checks if (irq < 0). This causes the driver to skip the fallback platform_get_irq_optional() and incorrectly attempt to request IRQ 0, leading to a probe failure. --

commit a810ba9e83e9707877b7e2fd4e5099068b665038
Author: Julian Braha <[email protected]>

firmware: qcom: scm: add missing IRQ_DOMAIN select to QCOM_SCM

This commit adds the missing select for IRQ_DOMAIN to the QCOM_SCM kconfig. This ensures the driver will compile successfully since it relies on irq_create_fwspec_mapping().

drivers/firmware/qcom/Kconfig line 10

Quoted 9 lines
drivers/firmware/qcom/Kconfig +1 -0
index b477d54b495a6..9d137fa2aa232 100644
@@ -7,6 +7,7 @@
 menu "Qualcomm firmware drivers"
 
 config QCOM_SCM
+	select IRQ_DOMAIN

[Severity: High]
This is a pre-existing issue, but since this patch ensures the code using irq_create_fwspec_mapping() is compiled, I noticed a potential regression in how its return value is handled.

In drivers/firmware/qcom/qcom_scm.c:qcom_scm_get_waitq_irq():

	return irq_create_fwspec_mapping(&fwspec);

If irq_create_fwspec_mapping() fails, it returns 0. However, when checked in qcom_scm_probe():

	irq = qcom_scm_get_waitq_irq(scm);
	if (irq < 0)
		irq = platform_get_irq_optional(pdev, 0);

Since 0 is not less than 0, the check misses the failure. Does this cause the driver to skip the fallback path and incorrectly attempt to request irq 0, resulting in a probe failure?

Should this check be updated to if (irq <= 0) to properly trigger the fallback path?

Quoted 3 lines
drivers/firmware/qcom/Kconfig +0 -0
 	select QCOM_TZMEM
 	tristate
 
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1