Skip to content

Commit c916391

Browse files
sulixKAGA-KOKO
authored andcommitted
genirq/test: Fix depth tests on architectures with NOREQUEST by default.
The new irq KUnit tests fail on some architectures (notably PowerPC and 32-bit ARM), as the request_irq() call fails due to the ARCH_IRQ_INIT_FLAGS containing IRQ_NOREQUEST, yielding the following errors: [10:17:45] # irq_free_disabled_test: EXPECTATION FAILED at kernel/irq/irq_test.c:88 [10:17:45] Expected ret == 0, but [10:17:45] ret == -22 (0xffffffffffffffea) [10:17:45] # irq_free_disabled_test: EXPECTATION FAILED at kernel/irq/irq_test.c:90 [10:17:45] Expected desc->depth == 0, but [10:17:45] desc->depth == 1 (0x1) [10:17:45] # irq_free_disabled_test: EXPECTATION FAILED at kernel/irq/irq_test.c:93 [10:17:45] Expected desc->depth == 1, but [10:17:45] desc->depth == 2 (0x2) By clearing IRQ_NOREQUEST from the interrupt descriptor, these tests now pass on ARM and PowerPC. Fixes: 66067c3 ("genirq: Add kunit tests for depth counts") Signed-off-by: David Gow <davidgow@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Brian Norris <briannorris@chromium.org> Link: https://lore.kernel.org/all/20250816094528.3560222-2-davidgow@google.com
1 parent 673f124 commit c916391

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

kernel/irq/irq_test.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ static void irq_disable_depth_test(struct kunit *test)
5454
desc = irq_to_desc(virq);
5555
KUNIT_ASSERT_PTR_NE(test, desc, NULL);
5656

57+
/* On some architectures, IRQs are NOREQUEST | NOPROBE by default. */
58+
irq_settings_clr_norequest(desc);
59+
5760
ret = request_irq(virq, noop_handler, 0, "test_irq", NULL);
5861
KUNIT_EXPECT_EQ(test, ret, 0);
5962

@@ -81,6 +84,9 @@ static void irq_free_disabled_test(struct kunit *test)
8184
desc = irq_to_desc(virq);
8285
KUNIT_ASSERT_PTR_NE(test, desc, NULL);
8386

87+
/* On some architectures, IRQs are NOREQUEST | NOPROBE by default. */
88+
irq_settings_clr_norequest(desc);
89+
8490
ret = request_irq(virq, noop_handler, 0, "test_irq", NULL);
8591
KUNIT_EXPECT_EQ(test, ret, 0);
8692

@@ -120,6 +126,9 @@ static void irq_shutdown_depth_test(struct kunit *test)
120126
desc = irq_to_desc(virq);
121127
KUNIT_ASSERT_PTR_NE(test, desc, NULL);
122128

129+
/* On some architectures, IRQs are NOREQUEST | NOPROBE by default. */
130+
irq_settings_clr_norequest(desc);
131+
123132
data = irq_desc_get_irq_data(desc);
124133
KUNIT_ASSERT_PTR_NE(test, data, NULL);
125134

@@ -180,6 +189,9 @@ static void irq_cpuhotplug_test(struct kunit *test)
180189
desc = irq_to_desc(virq);
181190
KUNIT_ASSERT_PTR_NE(test, desc, NULL);
182191

192+
/* On some architectures, IRQs are NOREQUEST | NOPROBE by default. */
193+
irq_settings_clr_norequest(desc);
194+
183195
data = irq_desc_get_irq_data(desc);
184196
KUNIT_ASSERT_PTR_NE(test, data, NULL);
185197

0 commit comments

Comments
 (0)