arch: sw_isr: revamp multi-level interrupt architecture

Previously the multi-level irq lookup table is generated by
looping through the devicetree nodes using macros & Kconfig,
which is hard to read and flimsy.

This PR shifts the heavy lifting to devicetree & DT macros such
that an interrupt controller driver, which has its info in the
devicetree, can register itself directly with the multi-level
interrupt architecture, which is more straightforward.

The previous auto-generated look up table with macros is now
moved in a file of its own. A new compatibility Kconfig:
`CONFIG_LEGACY_MULTI_LEVEL_TABLE_GENERATION` is added and
enabled by default to compile the legacy look up table for
interrupt controller drivers that aren't updated to support the
new architecture yet.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
Yong Cong Sin 2023-12-20 21:06:14 +08:00 committed by Johan Hedberg
commit c5f5b964c1
12 changed files with 307 additions and 129 deletions

View file

@ -407,7 +407,9 @@ static void test_multi_level_bit_masks_fn(uint32_t irq1, uint32_t irq2, uint32_t
const bool has_l3 = irq3 > 0;
const bool has_l2 = irq2 > 0;
const uint32_t level = has_l3 ? 3 : has_l2 ? 2 : 1;
const uint32_t irqn = (irq3 << l3_shift) | (irq2 << l2_shift) | irq1;
const uint32_t irqn_l1 = irq1;
const uint32_t irqn_l2 = (irq2 << l2_shift) | irqn_l1;
const uint32_t irqn = (irq3 << l3_shift) | irqn_l2;
zassert_equal(level, irq_get_level(irqn));
@ -422,6 +424,17 @@ static void test_multi_level_bit_masks_fn(uint32_t irq1, uint32_t irq2, uint32_t
zassert_equal((hwirq3 + 1) << l3_shift, irq_to_level_3(hwirq3));
zassert_equal(hwirq2 + 1, irq_parent_level_3(irqn));
}
if (has_l3) {
zassert_equal(irqn_l2, irq_get_intc_irq(irqn));
} else if (has_l2) {
zassert_equal(irqn_l1, irq_get_intc_irq(irqn));
} else {
/* degenerate cases */
if (false) {
zassert_equal(irqn, irq_get_intc_irq(irqn));
}
}
}
ZTEST(gen_isr_table, test_multi_level_bit_masks_l1)