irqchip/aclint-sswi: XuanTie C9XX generic probe and csky compatible
Subsystems (4)
GUO Ren (XuanTie)
maintainercover irqchip/aclint-sswi: XuanTie C9XX generic probe and csky compatible
This series cleans up the XuanTie C9XX support in the aclint-sswi driver and adds the csky,c900-aclint-sswi compatible.
Patch 1 drops the XuanTie C9XX specific probe: its sxstatus.CLINTEE check is redundant because the firmware (OpenSBI/zsbl) always sets CLINTEE before exposing the SSWI device in the device tree, so the generic probe can be used like the other vendors.
Patches 2 and 3 add the csky,c900-aclint-sswi compatible to the binding and the driver; thead,c900-aclint-sswi is deprecated.
---
GUO Ren (XuanTie) (3):
irqchip/aclint-sswi: Use generic probe for the XuanTie C9XX variant
dt-bindings: interrupt-controller: Add csky,c900-aclint-sswi compatible irqchip/aclint-sswi: Add csky,c900-aclint-sswi support
.../thead,c900-aclint-sswi.yaml | 4 ++- drivers/irqchip/irq-aclint-sswi.c | 32 ++-------------------- 2 files changed, 5 insertions(+), 31 deletions(-)
---
base-commit: 8d7fe9885c62fc9a95bf55d9db244d9672a8aadc
change-id: 20261129-sswi-643f81d4ea01
Best regards,
Signature · 1 line
GUO Ren (XuanTie) <[email protected]>
GUO Ren (XuanTie)
maintainerPATCH 1/3 irqchip/aclint-sswi: Use generic probe for the XuanTie C9XX variant
The XuanTie C9XX specific probe refuses to register the SSWI device unless the sxstatus.CLINTEE bit is set. The check was added because the XuanTie C9XX CLINT S-mode extension requires the M-mode firmware to set mxstatus.CLINTEE, otherwise writes to the SSWI registers do not generate supervisor software interrupts [1].
In practice, the firmware (OpenSBI/zsbl) always sets CLINTEE before exposing the SSWI device in the device tree, so the presence of a "thead,c900-aclint-sswi" node already implies that SSWI is usable and the kernel-side check is redundant. The MIPS P8700, Nuclei UX900 and SpacemiT K3 variants have no such vendor checks and use the generic probe directly.
Drop the XuanTie C9XX specific probe and point "thead,c900-aclint-sswi" at generic_aclint_sswi_early_probe() to align with the other vendors.
--- drivers/irqchip/irq-aclint-sswi.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-)
drivers/irqchip/irq-aclint-sswi.c +1 -30
@@ -180,33 +180,4 @@ static int __init generic_aclint_sswi_early_probe(struct device_node *node,IRQCHIP_DECLARE (mips_p8700_sswi,"mips,p8700-aclint-sswi" , generic_aclint_sswi_early_probe);IRQCHIP_DECLARE (nuclei_ux900_sswi,"nuclei,ux900-aclint-sswi" , generic_aclint_sswi_early_probe);IRQCHIP_DECLARE (spacemit_k3_sswi,"spacemit,k3-aclint-sswi" , generic_aclint_sswi_early_probe); - -/* THEAD variant */ -#define THEAD_C9XX_CSR_SXSTATUS 0x5c0 -#define THEAD_C9XX_SXSTATUS_CLINTEE BIT(17) - -static int __init thead_aclint_sswi_probe (struct fwnode_handle *fwnode) -{ -int rc; - -/* If it is T-HEAD CPU, check whether SSWI is enabled */ -if (riscv_cached_mvendorid (0 ) ==THEAD_VENDOR_ID && - !(csr_read (THEAD_C9XX_CSR_SXSTATUS ) &THEAD_C9XX_SXSTATUS_CLINTEE )) -return -ENOTSUPP ; - - rc =aclint_sswi_probe (fwnode); -if (rc) -return rc; - -/* Announce that SSWI is providing IPIs */ -pr_info ("providing IPIs using THEAD ACLINT SSWI\n" ); - -return 0 ; -} - -static int __init thead_aclint_sswi_early_probe (struct device_node *node, -struct device_node *parent) -{ -return thead_aclint_sswi_probe (&node->fwnode); -} -IRQCHIP_DECLARE (thead_aclint_sswi,"thead,c900-aclint-sswi" , thead_aclint_sswi_early_probe); +IRQCHIP_DECLARE (thead_aclint_sswi,"thead,c900-aclint-sswi" , generic_aclint_sswi_early_probe);
Signature · 1 line
2.43.0
GUO Ren (XuanTie)
maintainerPATCH 2/3 dt-bindings: interrupt-controller: Add csky,c900-aclint-sswi compatible
In reply to GUO Ren (XuanTie)Add the "csky,c900-aclint-sswi" compatible for the XuanTie C9XX SSWI device. The "thead,c900-aclint-sswi" compatible is deprecated.
--- .../bindings/interrupt-controller/thead,c900-aclint-sswi.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-sswi.yaml +3 -1
@@ -18,13 +18,15 @@ description: Following variants of the SSWI ACLINT supported, using dedicated compatible string - - THEAD C900 + - THEAD C900 (deprecated) - MIPS P8700 + - C-SKY C900 properties: compatible: oneOf: - enum: + - csky,c900-aclint-sswi - mips,p8700-aclint-sswi - spacemit,k3-aclint-sswi - items:
Signature · 1 line
2.43.0
GUO Ren (XuanTie)
maintainerPATCH 3/3 irqchip/aclint-sswi: Add csky,c900-aclint-sswi support
In reply to GUO Ren (XuanTie)Add a match entry for the "csky,c900-aclint-sswi" compatible of the XuanTie C9XX SSWI device. It is identical to the device matched by the deprecated "thead,c900-aclint-sswi" compatible, so use the generic probe.
--- drivers/irqchip/irq-aclint-sswi.c | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/irq-aclint-sswi.c +1 -0
@@ -181,3 +181,4 @@ IRQCHIP_DECLARE(mips_p8700_sswi, "mips,p8700-aclint-sswi", generic_aclint_sswi_eIRQCHIP_DECLARE (nuclei_ux900_sswi,"nuclei,ux900-aclint-sswi" , generic_aclint_sswi_early_probe);IRQCHIP_DECLARE (spacemit_k3_sswi,"spacemit,k3-aclint-sswi" , generic_aclint_sswi_early_probe);IRQCHIP_DECLARE (thead_aclint_sswi,"thead,c900-aclint-sswi" , generic_aclint_sswi_early_probe); +IRQCHIP_DECLARE (csky_aclint_sswi,"csky,c900-aclint-sswi" , generic_aclint_sswi_early_probe);
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 2/3] dt-bindings: interrupt-controller: Add csky,c900-aclint-sswi compatible
In reply to GUO Ren (XuanTie)Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] dt-bindings: interrupt-controller: csky,c900-aclint-sswi lacks SoC compatible - [Low] dt-bindings…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Medium] dt-bindings: interrupt-controller: csky,c900-aclint-sswi lacks SoC compatible
- [Low] dt-bindings: interrupt-controller: missing rationale for csky prefix change
--
commit a2dfb82469c639b2df7e139b363104634c20abd7
Author: GUO Ren (XuanTie) <[email protected]>
Quoted 6 lines
dt-bindings: interrupt-controller: Add csky,c900-aclint-sswi compatible
Add the "csky,c900-aclint-sswi" compatible for the XuanTie C9XX SSWI device. The "thead,c900-aclint-sswi" compatible is deprecated.
Signed-off-by GUO Ren (XuanTie) <[email protected]>
[Severity: Low]
Could the commit message explain why thead,c900-aclint-sswi is being deprecated in favor of the csky vendor prefix? All other XuanTie C900 and C9XX RISC-V bindings in the tree (such as thead,c900-aclint-mswi, thead,c900-aclint-mtimer, thead,c900-clint, and thead,c900-plic) use the thead prefix, while csky has historically been used for 32-bit C-SKY architecture IP blocks.
Quoted 11 lines
Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-sswi.yaml +1
-1@@ -18,13 +18,15 @@ description: Following variants of the SSWI ACLINT supported, using dedicated compatible string - - THEAD C900 + - THEAD C900 (deprecated) - MIPS P8700
Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-sswi.yaml description: · line 32
Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-sswi.yaml +2
-0+ - C-SKY C900 properties: compatible: oneOf: - enum: + - csky,c900-aclint-sswi - mips,p8700-aclint-sswi - spacemit,k3-aclint-sswi - items:
[Severity: Medium]
Should csky,c900-aclint-sswi be a fallback constant behind a SoC-specific compatible rather than a standalone entry in enum?
XuanTie C900/C9XX is a licensable CPU IP family integrated into vendor SoCs, and both this binding (for sophgo,sg2044-aclint-sswi with thead,c900-aclint-sswi) and the sibling thead,c900-aclint-mswi and thead,c900-aclint-mtimer bindings require a SoC-specific compatible ahead of the generic C900 fallback:
Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-sswi.yaml:
- items:
- enum:
- sophgo,sg2044-aclint-sswi
- const: thead,c900-aclint-sswi
Putting csky,c900-aclint-sswi in the single-item enum allows bare generic compatible strings without a SoC-specific identifier and rejects nodes that pair a SoC compatible such as sophgo,sg2044-aclint-sswi with csky,c900-aclint-sswi.
In addition, thead,c900-aclint-sswi is only marked deprecated in the description text; its schema entry lacks deprecated: true and the first example still uses thead,c900-aclint-sswi.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH 2/3] dt-bindings: interrupt-controller: Add csky,c900-aclint-sswi compatible
In reply to GUO Ren (XuanTie)Quoted 33 lines · GUO Ren (XuanTie)
Add the "csky,c900-aclint-sswi" compatible for the XuanTie C9XX SSWI device. The "thead,c900-aclint-sswi" compatible is deprecated.
Signed-off-by GUO Ren (XuanTie) <[email protected]>--- .../bindings/interrupt-controller/thead,c900-aclint-sswi.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-sswi.yaml +3
-1@@ -18,13 +18,15 @@ description: Following variants of the SSWI ACLINT supported, using dedicated compatible string - - THEAD C900 + - THEAD C900 (deprecated) - MIPS P8700 + - C-SKY C900 properties: compatible: oneOf: - enum: + - csky,c900-aclint-sswi - mips,p8700-aclint-sswi - spacemit,k3-aclint-sswi - items:Signature · 2 lines
-- 2.43.0
Hi Guo,
Since T-HEAD C900 is marked as deprecated, is it better to also mark the compatible thead,c900-aclint-sswi as deprecated.
Regards,
Inochi
Re: [PATCH 1/3] irqchip/aclint-sswi: Use generic probe for the XuanTie C9XX variant
In reply to GUO Ren (XuanTie)Quoted 65 lines · GUO Ren (XuanTie)
The XuanTie C9XX specific probe refuses to register the SSWI device unless the sxstatus.CLINTEE bit is set. The check was added because the XuanTie C9XX CLINT S-mode extension requires the M-mode firmware to set mxstatus.CLINTEE, otherwise writes to the SSWI registers do not generate supervisor software interrupts [1].
In practice, the firmware (OpenSBI/zsbl) always sets CLINTEE before exposing the SSWI device in the device tree, so the presence of a "thead,c900-aclint-sswi" node already implies that SSWI is usable and the kernel-side check is redundant. The MIPS P8700, Nuclei UX900 and SpacemiT K3 variants have no such vendor checks and use the generic probe directly.
Drop the XuanTie C9XX specific probe and point "thead,c900-aclint-sswi" at
generic_aclint_sswi_early_probe()to align with the other vendors.Signed-off-by GUO Ren (XuanTie) <[email protected]>--- drivers/irqchip/irq-aclint-sswi.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-)drivers/irqchip/irq-aclint-sswi.c +1
-30@@ -180,33 +180,4 @@ static int __init generic_aclint_sswi_early_probe(struct device_node *node,IRQCHIP_DECLARE (mips_p8700_sswi,"mips,p8700-aclint-sswi" , generic_aclint_sswi_early_probe);IRQCHIP_DECLARE (nuclei_ux900_sswi,"nuclei,ux900-aclint-sswi" , generic_aclint_sswi_early_probe);IRQCHIP_DECLARE (spacemit_k3_sswi,"spacemit,k3-aclint-sswi" , generic_aclint_sswi_early_probe); - -/* THEAD variant */ -#define THEAD_C9XX_CSR_SXSTATUS 0x5c0 -#define THEAD_C9XX_SXSTATUS_CLINTEE BIT(17) - -static int __init thead_aclint_sswi_probe (struct fwnode_handle *fwnode) -{ -int rc; - -/* If it is T-HEAD CPU, check whether SSWI is enabled */ -if (riscv_cached_mvendorid (0 ) ==THEAD_VENDOR_ID && - !(csr_read (THEAD_C9XX_CSR_SXSTATUS ) &THEAD_C9XX_SXSTATUS_CLINTEE )) -return -ENOTSUPP ; - - rc =aclint_sswi_probe (fwnode); -if (rc) -return rc; - -/* Announce that SSWI is providing IPIs */ -pr_info ("providing IPIs using THEAD ACLINT SSWI\n" ); - -return 0 ; -} - -static int __init thead_aclint_sswi_early_probe (struct device_node *node, -struct device_node *parent) -{ -return thead_aclint_sswi_probe (&node->fwnode); -} -IRQCHIP_DECLARE (thead_aclint_sswi,"thead,c900-aclint-sswi" , thead_aclint_sswi_early_probe); +IRQCHIP_DECLARE (thead_aclint_sswi,"thead,c900-aclint-sswi" , generic_aclint_sswi_early_probe);Signature · 2 lines
-- 2.43.0
Thanks, LGTM.
Re: [PATCH 3/3] irqchip/aclint-sswi: Add csky,c900-aclint-sswi support
In reply to GUO Ren (XuanTie)Quoted 23 lines · GUO Ren (XuanTie)
Add a match entry for the "csky,c900-aclint-sswi" compatible of the XuanTie C9XX SSWI device. It is identical to the device matched by the deprecated "thead,c900-aclint-sswi" compatible, so use the generic probe.
Signed-off-by GUO Ren (XuanTie) <[email protected]>--- drivers/irqchip/irq-aclint-sswi.c | 1 + 1 file changed, 1 insertion(+)drivers/irqchip/irq-aclint-sswi.c +1
-0@@ -181,3 +181,4 @@ IRQCHIP_DECLARE(mips_p8700_sswi, "mips,p8700-aclint-sswi", generic_aclint_sswi_eIRQCHIP_DECLARE (nuclei_ux900_sswi,"nuclei,ux900-aclint-sswi" , generic_aclint_sswi_early_probe);IRQCHIP_DECLARE (spacemit_k3_sswi,"spacemit,k3-aclint-sswi" , generic_aclint_sswi_early_probe);IRQCHIP_DECLARE (thead_aclint_sswi,"thead,c900-aclint-sswi" , generic_aclint_sswi_early_probe); +IRQCHIP_DECLARE (csky_aclint_sswi,"csky,c900-aclint-sswi" , generic_aclint_sswi_early_probe);Signature · 2 lines
-- 2.43.0
LGTM.
Guo Ren
maintainerRe: [PATCH 2/3] dt-bindings: interrupt-controller: Add csky,c900-aclint-sswi compatible
In reply to Inochi AmaotoQuoted 32 lines · Inochi Amaoto
Quoted 30 lines · GUO Ren (XuanTie)
Add the "csky,c900-aclint-sswi" compatible for the XuanTie C9XX SSWI device. The "thead,c900-aclint-sswi" compatible is deprecated.
Signed-off-by GUO Ren (XuanTie) <[email protected]>--- .../bindings/interrupt-controller/thead,c900-aclint-sswi.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-sswi.yaml +3
-1@@ -18,13 +18,15 @@ description: Following variants of the SSWI ACLINT supported, using dedicated compatible string - - THEAD C900 + - THEAD C900 (deprecated) - MIPS P8700 + - C-SKY C900 properties: compatible: oneOf: - enum: + - csky,c900-aclint-sswi - mips,p8700-aclint-sswi - spacemit,k3-aclint-sswi - items:
Quoted 8 lines
Quoted 3 lines
--
2.43.0Hi Guo,
Since T-HEAD C900 is marked as deprecated, is it better to also mark the compatible thead,c900-aclint-sswi as deprecated.
Yes, I would put below in the next version:
Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-sswi.yaml +8 -2
@@ -18,8 +18,9 @@ description: Following variants of the SSWI ACLINT supported, using dedicated compatible string - - THEAD C900 + - THEAD C900 (deprecated) - MIPS P8700 + - C-SKY C900 properties: compatible:
@@ -27,10 +28,15 @@ properties: - enum: - mips,p8700-aclint-sswi - spacemit,k3-aclint-sswi + - items: + - enum: + - sophgo,sg2044-aclint-sswi + - const: csky,c900-aclint-sswi - items: - enum: - sophgo,sg2044-aclint-sswi - const: thead,c900-aclint-sswi + deprecated: true - items: - enum: - anlogic,dr1v90-aclint-sswi
@@ -82,7 +88,7 @@ examples: - | //Example 1 interrupt-controller@94000000 { - compatible = "sophgo,sg2044-aclint-sswi", "thead,c900-aclint-sswi"; + compatible = "sophgo,sg2044-aclint-sswi", "csky,c900-aclint-sswi"; reg = <0x94000000 0x00004000>; #interrupt-cells = <0>; interrupt-controller;
Signature · 2 lines
Best Regards Guo Ren