Skip to contentSkip to conversation

AST2700-A2 interrupt controller hierarchy and route support

PATCH Superseded Ryan Chen 2 participants 6 messages Mar 26 – Mar 27

Subsystems (4)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Ryan Chen

author reviewer
#0 lore raw

v3 cover AST2700-A2 interrupt controller hierarchy and route support

The AST2700 SoC has undergone multiple silicon revisions (A0, A1, A2) prior to mass production.

A0 laid the ground-work with a split controller design (INTC0 and INTC1) used for early development and bring-up. The interrupt architecture was substantially reworked in the A1 to introduce an explicit routing model and clearer hierarchy, though the split controllers remained. The A1 interrupt architecture is unchanged in A2.

A2 is the production design. A0 and A1 are pre-production silicon and are no longer intended for deployment outside of ASPEED.

The existing binding and driver were written against A0 prior to the A1 rework. The A0 design directly wired INTC1 instances to INTC0, and INTC0 to the GIC of the Primary Service Processor (PSP, a Cortex-A35). The A0 binding and driver therefore do not account for the alternative destinations of the Secondary and Tertiary Service Processors (SSP, TSP) and BootMCU, or the necessary route selection logic present in the production design.

With the above context, this series replaces the existing binding and driver.

It is not necessary for projects to maintain support for A0 due to its pre-production nature, and between Linux, U-Boot and Zephyr there are no upstream devicetree users of the current binding.

The new binding uses localised interrupt numbers and models the hardware connectivity between interrupt controllers using the aspeed,interrupt-ranges property. It is introduced in a new file before the existing binding is removed in order to keep the diff readable.

The INTC0 driver creates a hierarchical irqdomain under the selected upstream interrupt controller and implements route resolution logic. INTC1 driver instances defer route selection to INTC0 and expose a linear interrupt namespace to their parent.

A brief history of related submissions
--------------------------------------

Some modifications to the existing binding were sent to the lists in the past. Due to process choices the revisions were difficult to track. They are listed below.

The approaches took several forms but ended in the minor adjustment in v6 being applied. This enabled use of the A1 design but requires assumptions about platform route configuration defined in firmware. These assumptions are removed by this current series.

* [PATCH] dt-bindings: interrupt-controller: aspeed: Refine AST2700 binding description and example
https://lore.kernel.org/all/[email protected]/

* [PATCH v2] dt-bindings: interrupt-controller: aspeed: Add parent node compatibles and refine documentation
https://lore.kernel.org/all/[email protected]/

* [PATCH v3 0/2] irqchip: aspeed: Add AST2700 INTC debugfs support and yaml update
https://lore.kernel.org/all/[email protected]/

* [PATCH v4 0/2] irqchip/ast2700-intc: Add AST2700 INTC debugfs support and yaml update
https://lore.kernel.org/all/[email protected]/

* [PATCH v5 0/3] AST2700 interrupt controller hierarchy support
https://lore.kernel.org/all/[email protected]/

* [PATCH v6 0/1] Update correct AST2700 interrupt controller binding
https://lore.kernel.org/all/[email protected]/

---
Changes in v3:
- 1/4 Squash patch 5/5 and 1/5.
- 1/4 modify wrap lines at 80 char.
- 1/4 modify maintainers name and email.
- 1/4 modify typo Sevice-> Service
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Change suject to "AST2700-A2 interrupt controller hierarchy and route support".
- Describe timeline for (pre-)production design evolution and
binding development to support the break in compatibility.
- fix "make dt_binding_check" compatible string consistance with
example.
- Split KUnit coverage out of the main driver patch.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Ryan Chen (4):
dt-bindings: interrupt-controller: Describe AST2700-A2 hardware instead of A0 irqchip/ast2700-intc: Add AST2700-A2 support irqchip/ast2700-intc: Add KUnit tests for route resolution irqchip/aspeed-intc: Remove AST2700-A0 support

 .../interrupt-controller/aspeed,ast2700-intc.yaml  |  90 ----
 .../aspeed,ast2700-interrupt.yaml                  | 188 +++++++
 drivers/irqchip/.kunitconfig                       |   5 +
 drivers/irqchip/Kconfig                            |  23 +
 drivers/irqchip/Makefile                           |   3 +-
 drivers/irqchip/irq-aspeed-intc.c                  | 139 -----
 drivers/irqchip/irq-ast2700-intc0-test.c           | 473 +++++++++++++++++
 drivers/irqchip/irq-ast2700-intc0.c                | 584 +++++++++++++++++++++
 drivers/irqchip/irq-ast2700-intc1.c                | 282 ++++++++++
 drivers/irqchip/irq-ast2700.c                      | 106 ++++
 drivers/irqchip/irq-ast2700.h                      |  47 ++
 11 files changed, 1710 insertions(+), 230 deletions(-)

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260205-irqchip-7eaef3674de9

Best regards,

Signature · 1 line
Ryan Chen <[email protected]>
author reviewer
#1 lore raw

PATCH v3 1/4 dt-bindings: interrupt-controller: Describe AST2700-A2 hardware instead of A0

Introduce a new binding describing the AST2700 interrupt controller architecture implemented in the A2 production silicon.

The AST2700 SoC has undergone multiple silicon revisions (A0, A1, A2) prior to mass production. The interrupt architecture was substantially reworked after the A0 revision for A1, and the A1 design is retained unchanged in the A2 production silicon.

The existing AST2700 interrupt controller binding ("aspeed,ast2700-intc-ic")was written against the pre-production A0 design. That binding does not accurately describe the interrupt hierarchy and routing model present in A1/A2, where interrupts can be routed to multiple processor-local interrupt controllers (Primary Service Processor (PSP) GIC, Secondary Service Processor (SSP)/Tertiary Service Processor (TSP) NVICs, and BootMCU APLIC) depending on the execution context.

Remove the binding for the pre-production A0 design in favour of the binding for the A2 production design. There is no significant user impact from the removal as there are no existing devicetrees in any of Linux, u-boot or Zephyr that make use of the A0 binding.

Hardware connectivity between interrupt controllers is expressed using the aspeed,interrupt-ranges property.

---
Changes in v3:
- squash patch 5/5.
- modify wrap lines at 80 char.
- modify maintainers name and email.
- modify typo Sevice-> Service
Changes in v2:
- Describe AST2700 A0/A1/A2 design evolution.
- Drop the redundant '-ic' suffix from compatible strings.
- Expand commit message to match the series cover letter context.
- fix ascii diagram
- remove intc0 label
- remove spaces before >
- drop intc1 example

---
 .../interrupt-controller/aspeed,ast2700-intc.yaml  |  90 ----------
 .../aspeed,ast2700-interrupt.yaml                  | 188 +++++++++++++++++++++
 2 files changed, 188 insertions(+), 90 deletions(-)
Documentation/devicetree/bindings/interrupt-controller/aspeed,ast2700-intc.yaml deleted +0 -90
deleted file mode 100644
index 258d21fe6e35..000000000000
@@ -1,90 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
-%YAML 1.2
----
-$id: http://devicetree.org/schemas/interrupt-controller/aspeed,ast2700-intc.yaml#
-$schema: http://devicetree.org/meta-schemas/core.yaml#
-
-title: Aspeed AST2700 Interrupt Controller
-
-description:
-  This interrupt controller hardware is second level interrupt controller that
-  is hooked to a parent interrupt controller. It's useful to combine multiple
-  interrupt sources into 1 interrupt to parent interrupt controller.
-
-maintainers:
-  - Kevin Chen <[email protected]>
-
-properties:
-  compatible:
-    enum:
-      - aspeed,ast2700-intc-ic
-
-  reg:
-    maxItems: 1
-
-  interrupt-controller: true
-
-  '#interrupt-cells':
-    const: 1
-    description:
-      The first cell is the IRQ number, the second cell is the trigger
-      type as defined in interrupt.txt in this directory.
-
-  interrupts:
-    minItems: 1
-    maxItems: 10
-    description: |
-      Depend to which INTC0 or INTC1 used.
-      INTC0 and INTC1 are two kinds of interrupt controller with enable and raw
-      status registers for use.
-      INTC0 is used to assert GIC if interrupt in INTC1 asserted.
-      INTC1 is used to assert INTC0 if interrupt of modules asserted.
-      +-----+   +-------+     +---------+---module0
-      | GIC |---| INTC0 |--+--| INTC1_0 |---module2
-      |     |   |       |  |  |         |---...
-      +-----+   +-------+  |  +---------+---module31
-                           |
-                           |   +---------+---module0
-                           +---| INTC1_1 |---module2
-                           |   |         |---...
-                           |   +---------+---module31
-                          ...
-                           |   +---------+---module0
-                           +---| INTC1_5 |---module2
-                               |         |---...
-                               +---------+---module31
-
-required:
-  - compatible
-  - reg
-  - interrupt-controller
-  - '#interrupt-cells'
-  - interrupts
-
-additionalProperties: false
-
-examples:
-  - |
-    #include <dt-bindings/interrupt-controller/arm-gic.h>
-
-    bus {
-        #address-cells = <2>;
-        #size-cells = <2>;
-
-        interrupt-controller@12101b00 {
-            compatible = "aspeed,ast2700-intc-ic";
-            reg = <0 0x12101b00 0 0x10>;
-            #interrupt-cells = <1>;
-            interrupt-controller;
-            interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>,
-                         <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>,
-                         <GIC_SPI 194 IRQ_TYPE_LEVEL_HIGH>,
-                         <GIC_SPI 195 IRQ_TYPE_LEVEL_HIGH>,
-                         <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>,
-                         <GIC_SPI 197 IRQ_TYPE_LEVEL_HIGH>,
-                         <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>,
-                         <GIC_SPI 199 IRQ_TYPE_LEVEL_HIGH>,
-                         <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>,
-                         <GIC_SPI 201 IRQ_TYPE_LEVEL_HIGH>;
-        };
-    };
Documentation/devicetree/bindings/interrupt-controller/aspeed,ast2700-interrupt.yaml new file +188 -0

188 lines not on this page · raw message

Signature · 1 line
2.34.1
author reviewer
#2 lore raw

PATCH v3 2/4 irqchip/ast2700-intc: Add AST2700-A2 support

In reply to Ryan Chen

The AST2700 interrupt fabric is shared by multiple integrated processors (PSP/SSP/TSP/BootMCU), each with its own interrupt controller and its own devicetree view of the system. As a result, interrupt routing cannot be treated as fixed: the valid route for a peripheral interrupt depends on which processor is consuming it.

The INTC0 driver models this by creating a hierarchical irqdomain under the upstream interrupt controller selected by the interrupt-parent property in the devicetree. Information derived from this relationship is incorporated into the route resolution logic for the controller.

The INTC1 driver implements the banked INTM-fed controller and forwards interrupts toward INTC0, without embedding assumptions about the final destination processor.

---
Changes in v2:
- remove typedef u32 aspeed_intc_output_t
- modify #include <asm-generic/errno.h> to <linux/err.h>
- add newline after include "irq-ast2700.h"
- make defines tabular
- Struct declarations should align the struct member names in a table
- modify raw_spinlock_irqsave() to raw_spin_lock()
- use u32 ier replace mask/unmask
- remove pointless line break
- refine aspeed_intc0_routes, aspeed_intc1_routes array
- remove range_contains_element(), use in_range32()
- remove dev_dbg()
- remove EXPORT_SYMBOL_GPL(aspeed_intc0_resolve_route);
- make irq_set_chip_and_handler() with one line
- replace magic constants to macro define
- move struct aspeed_intc0 to irq-ast2700.h
- add mcro define for upstream param

---
 drivers/irqchip/Kconfig             |  12 +
 drivers/irqchip/Makefile            |   1 +
 drivers/irqchip/irq-ast2700-intc0.c | 584 ++++++++++++++++++++++++++++++++++++
 drivers/irqchip/irq-ast2700-intc1.c | 282 +++++++++++++++++
 drivers/irqchip/irq-ast2700.c       | 106 +++++++
 drivers/irqchip/irq-ast2700.h       |  47 +++
 6 files changed, 1032 insertions(+)
drivers/irqchip/Kconfig +12 -0
index f07b00d7fef9..0156fee89b2c 100644
@@ -110,6 +110,18 @@ config AL_FIC
 	help
 	  Support Amazon's Annapurna Labs Fabric Interrupt Controller.
 
+config ASPEED_AST2700_INTC
+	bool "ASPEED AST2700 Interrupt Controller support"
+	depends on OF
+	depends on ARCH_ASPEED || COMPILE_TEST
+	select IRQ_DOMAIN_HIERARCHY
+	help
+	  Enable support for the ASPEED AST2700 interrupt controller.
+	  This driver handles interrupt, routing and merged interrupt
+	  sources to upstream parent interrupt controllers.
+
+	  If unsure, say N.
+
 config ATMEL_AIC_IRQ
 	bool
 	select GENERIC_IRQ_CHIP
drivers/irqchip/Makefile +1 -0
index 26aa3b6ec99f..62790663f982 100644
@@ -89,6 +89,7 @@ obj-$(CONFIG_MVEBU_PIC)			+= irq-mvebu-pic.o
 obj-$(CONFIG_MVEBU_SEI)			+= irq-mvebu-sei.o
 obj-$(CONFIG_LS_EXTIRQ)			+= irq-ls-extirq.o
 obj-$(CONFIG_LS_SCFG_MSI)		+= irq-ls-scfg-msi.o
+obj-$(CONFIG_ASPEED_AST2700_INTC)	+= irq-ast2700.o irq-ast2700-intc0.o irq-ast2700-intc1.o
 obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-vic.o irq-aspeed-i2c-ic.o irq-aspeed-scu-ic.o
 obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-intc.o
 obj-$(CONFIG_STM32MP_EXTI)		+= irq-stm32mp-exti.o
drivers/irqchip/irq-ast2700-intc0.c new file +584 -0

584 lines not on this page · raw message

drivers/irqchip/irq-ast2700-intc1.c new file +282 -0

282 lines not on this page · raw message

drivers/irqchip/irq-ast2700.c new file +106 -0

106 lines not on this page · raw message

drivers/irqchip/irq-ast2700.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
2.34.1
author reviewer
#3 lore raw

PATCH v3 3/4 irqchip/ast2700-intc: Add KUnit tests for route resolution

In reply to Ryan Chen

Add a KUnit suite for aspeed_intc0_resolve_route().

Cover invalid arguments, invalid domain/range data, connected and disconnected mappings, and malformed upstream range cases.

---
Changes in v2:
- add line break before include "irq-ast2700.h"
- remove pointless newline.
- rename arm_gicv3_fwnode_read_string_array to
gicv3_fwnode_read_string_array
- add .kunitconfig file

---
 drivers/irqchip/.kunitconfig             |   5 +
 drivers/irqchip/Kconfig                  |  11 +
 drivers/irqchip/Makefile                 |   1 +
 drivers/irqchip/irq-ast2700-intc0-test.c | 473 +++++++++++++++++++++++++++++++
 4 files changed, 490 insertions(+)
drivers/irqchip/.kunitconfig new file +5 -0
new file mode 100644
index 000000000000..00a12703f635
@@ -0,0 +1,5 @@
+CONFIG_KUNIT=y
+CONFIG_OF=y
+CONFIG_COMPILE_TEST=y
+CONFIG_ASPEED_AST2700_INTC=y
+CONFIG_ASPEED_AST2700_INTC_TEST=y
drivers/irqchip/Kconfig +11 -0
index 0156fee89b2c..143af3f30a4b 100644
@@ -122,6 +122,17 @@ config ASPEED_AST2700_INTC
 
 	  If unsure, say N.
 
+config ASPEED_AST2700_INTC_TEST
+	bool "Tests for the ASPEED AST2700 Interrupt Controller"
+	depends on ASPEED_AST2700_INTC && KUNIT=y
+	default KUNIT_ALL_TESTS
+	help
+	  Enable KUnit tests for AST2700 INTC route resolution.
+	  The tests exercise error handling and route selection paths.
+	  This option is intended for test builds.
+
+	  If unsure, say N.
+
 config ATMEL_AIC_IRQ
 	bool
 	select GENERIC_IRQ_CHIP
drivers/irqchip/Makefile +1 -0
index 62790663f982..ac04a4b97797 100644
@@ -90,6 +90,7 @@ obj-$(CONFIG_MVEBU_SEI)			+= irq-mvebu-sei.o
 obj-$(CONFIG_LS_EXTIRQ)			+= irq-ls-extirq.o
 obj-$(CONFIG_LS_SCFG_MSI)		+= irq-ls-scfg-msi.o
 obj-$(CONFIG_ASPEED_AST2700_INTC)	+= irq-ast2700.o irq-ast2700-intc0.o irq-ast2700-intc1.o
+obj-$(CONFIG_ASPEED_AST2700_INTC_TEST)	+= irq-ast2700-intc0-test.o
 obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-vic.o irq-aspeed-i2c-ic.o irq-aspeed-scu-ic.o
 obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-intc.o
 obj-$(CONFIG_STM32MP_EXTI)		+= irq-stm32mp-exti.o
drivers/irqchip/irq-ast2700-intc0-test.c new file +473 -0

473 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v3 3/4] irqchip/ast2700-intc: Add KUnit tests for route resolution

kernel test robot noticed the following build warnings:

Hi Ryan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f]

url:    https://github.com/intel-lab-lkp/linux/commits/Ryan-Chen/dt-bindings-interrupt-controller-Describe-AST2700-A2-hardware-instead-of-A0/20260327-190127
base:   6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
patch link:    https://lore.kernel.org/r/20260326-irqchip-v3-3-366739f57acf%40aspeedtech.com
patch subject: [PATCH v3 3/4] irqchip/ast2700-intc: Add KUnit tests for route resolution
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20260328/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260328/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/irqchip/irq-ast2700-intc0-test.c: In function 'aspeed_intc0_resolve_route_c1i1o1mc0i2o1':

>> drivers/irqchip/irq-ast2700-intc0-test.c:351:1: warning: the frame size of 1296 bytes is larger than 1280 bytes [-Wframe-larger-than=]
     351 | }
         | ^
   drivers/irqchip/irq-ast2700-intc0-test.c: In function 'aspeed_intc0_resolve_route_c1i2o2mc0i1o1':
   drivers/irqchip/irq-ast2700-intc0-test.c:292:1: warning: the frame size of 1296 bytes is larger than 1280 bytes [-Wframe-larger-than=]
     292 | }
         | ^

vim +351 drivers/irqchip/irq-ast2700-intc0-test.c

293
294 static void aspeed_intc0_resolve_route_c1i1o1mc0i2o1(struct kunit *test)
295 {
296 struct device_node intc0_node = {
297 .fwnode = { .ops = &intc0_fwnode_ops },
298 };
299 struct aspeed_intc_interrupt_range c1ranges[] = {
300 {
301 .start = 0,
302 .count = 1,
303 .upstream = {
304 .fwnode = &intc0_node.fwnode,
305 .param_count = 1,
306 .param = { 510 }
307 }
308 },
309 };
310 static const u32 c1outs[] = { 0 };
311 struct aspeed_intc_interrupt_range resolved;
312 struct aspeed_intc_interrupt_range intc0_ranges[] = {
313 {
314 .start = 192,
315 .count = 1,
316 .upstream = {
317 .fwnode = NULL,
318 .param_count = 0,
319 .param = {0},
320 }
321 },
322 {
323 .start = 208,
324 .count = 1,
325 .upstream = {
326 .fwnode = NULL,
327 .param_count = 0,
328 .param = {0},
329 }
330 }
331 };
332 struct aspeed_intc0 intc0 = {
333 .ranges = {
334 .ranges = intc0_ranges,
335 .nranges = ARRAY_SIZE(intc0_ranges),
336 }
337 };
338 const struct irq_domain c0domain = {
339 .host_data = &intc0,
340 .fwnode = &intc0_node.fwnode
341 };
342 int rc;
343
344 rc = aspeed_intc0_resolve_route(&c0domain, ARRAY_SIZE(c1outs), c1outs,
345 ARRAY_SIZE(c1ranges), c1ranges,
346 &resolved);
347 KUNIT_EXPECT_EQ(test, rc, 0);
348 KUNIT_EXPECT_EQ(test, resolved.start, 0);
349 KUNIT_EXPECT_EQ(test, resolved.count, 1);
350 KUNIT_EXPECT_EQ(test, resolved.upstream.param[0], 510);

 > 351	}

352

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author reviewer
#5 lore raw

PATCH v3 4/4 irqchip/aspeed-intc: Remove AST2700-A0 support

In reply to Ryan Chen

The existing AST2700 interrupt controller driver ("aspeed,ast2700-intc-ic") was written against the A0 pre-production design.

From A1 onwards (retained in the A2 production silicon), the interrupt fabric was re-architected: interrupt routing is programmable and interrupt outputs can be directed to multiple upstream controllers (PSP GIC, Secondary Service Processor (SSP) NVIC, Tertiary Service Processor (TSP) NVIC, and Boot MCU interrupt controller). This design requires route resolution and a controller hierarchy model which the A0 driver cannot represent.

Remove driver support for A0 in favour of the driver for the A2 production design.

---
 drivers/irqchip/Makefile          |   1 -
 drivers/irqchip/irq-aspeed-intc.c | 139 --------------------------------------
 2 files changed, 140 deletions(-)
drivers/irqchip/Makefile +0 -1
index ac04a4b97797..3d02441b3ee6 100644
@@ -92,7 +92,6 @@ obj-$(CONFIG_LS_SCFG_MSI)		+= irq-ls-scfg-msi.o
 obj-$(CONFIG_ASPEED_AST2700_INTC)	+= irq-ast2700.o irq-ast2700-intc0.o irq-ast2700-intc1.o
 obj-$(CONFIG_ASPEED_AST2700_INTC_TEST)	+= irq-ast2700-intc0-test.o
 obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-vic.o irq-aspeed-i2c-ic.o irq-aspeed-scu-ic.o
-obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-intc.o
 obj-$(CONFIG_STM32MP_EXTI)		+= irq-stm32mp-exti.o
 obj-$(CONFIG_STM32_EXTI) 		+= irq-stm32-exti.o
 obj-$(CONFIG_QCOM_IRQ_COMBINER)		+= qcom-irq-combiner.o
drivers/irqchip/irq-aspeed-intc.c deleted +0 -139

139 lines not on this page · raw message

Signature · 1 line
2.34.1