From: "Inès Varhol" <ines.varhol@telecom-paris.fr>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
qemu-arm@nongnu.org,
"Samuel Tardieu" <samuel.tardieu@telecom-paris.fr>,
"Alistair Francis" <alistair@alistair23.me>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Arnaud Minier" <arnaud.minier@telecom-paris.fr>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Laurent Vivier" <lvivier@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Inès Varhol" <ines.varhol@telecom-paris.fr>
Subject: [PATCH v2 2/2] tests/qtest: Check that EXTI fan-in irqs are correctly connected
Date: Tue, 20 Feb 2024 19:34:36 +0100 [thread overview]
Message-ID: <20240220184145.106107-3-ines.varhol@telecom-paris.fr> (raw)
In-Reply-To: <20240220184145.106107-1-ines.varhol@telecom-paris.fr>
This commit adds a QTest that verifies each input line of a specific
EXTI OR gate can influence the output line.
Signed-off-by: Inès Varhol <ines.varhol@telecom-paris.fr>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
Hello,
I expected this test to fail after switching the two patch commits,
but it didn't.
I'm mentionning it in case it reveals a problem with the test I didn't notice.
tests/qtest/stm32l4x5_exti-test.c | 37 +++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/tests/qtest/stm32l4x5_exti-test.c b/tests/qtest/stm32l4x5_exti-test.c
index c390077713..81830be8ae 100644
--- a/tests/qtest/stm32l4x5_exti-test.c
+++ b/tests/qtest/stm32l4x5_exti-test.c
@@ -31,6 +31,7 @@
#define EXTI0_IRQ 6
#define EXTI1_IRQ 7
+#define EXTI5_9_IRQ 23
#define EXTI35_IRQ 1
static void enable_nvic_irq(unsigned int n)
@@ -499,6 +500,40 @@ static void test_interrupt(void)
g_assert_false(check_nvic_pending(EXTI1_IRQ));
}
+static void test_orred_interrupts(void)
+{
+ /*
+ * For lines EXTI5..9 (fanned-in to NVIC irq 23),
+ * test that raising the line pends interrupt
+ * 23 in NVIC.
+ */
+ enable_nvic_irq(EXTI5_9_IRQ);
+ /* Check that there are no interrupts already pending in PR */
+ g_assert_cmpuint(exti_readl(EXTI_PR1), ==, 0x00000000);
+ /* Check that this specific interrupt isn't pending in NVIC */
+ g_assert_false(check_nvic_pending(EXTI5_9_IRQ));
+
+ /* Enable interrupt lines EXTI[5..9] */
+ exti_writel(EXTI_IMR1, (0x1F << 5));
+
+ /* Configure interrupt on rising edge */
+ exti_writel(EXTI_RTSR1, (0x1F << 5));
+
+ /* Raise GPIO line i, check that the interrupt is pending */
+ for (unsigned i = 5; i < 10; i++) {
+ exti_set_irq(i, 1);
+ g_assert_cmpuint(exti_readl(EXTI_PR1), ==, 1 << i);
+ g_assert_true(check_nvic_pending(EXTI5_9_IRQ));
+
+ exti_writel(EXTI_PR1, 1 << i);
+ g_assert_cmpuint(exti_readl(EXTI_PR1), ==, 0x00000000);
+ g_assert_true(check_nvic_pending(EXTI5_9_IRQ));
+
+ unpend_nvic_irq(EXTI5_9_IRQ);
+ g_assert_false(check_nvic_pending(EXTI5_9_IRQ));
+ }
+}
+
int main(int argc, char **argv)
{
int ret;
@@ -515,6 +550,8 @@ int main(int argc, char **argv)
qtest_add_func("stm32l4x5/exti/masked_interrupt", test_masked_interrupt);
qtest_add_func("stm32l4x5/exti/interrupt", test_interrupt);
qtest_add_func("stm32l4x5/exti/test_edge_selector", test_edge_selector);
+ qtest_add_func("stm32l4x5/exti/test_orred_interrupts",
+ test_orred_interrupts);
qtest_start("-machine b-l475e-iot01a");
ret = g_test_run();
--
2.43.2
next prev parent reply other threads:[~2024-02-20 18:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 18:34 [PATCH v2 0/2] hw/arm: Fix STM32L4x5 EXTI to CPU irq fan-in connections Inès Varhol
2024-02-20 18:34 ` [PATCH v2 1/2] hw/arm: Use TYPE_OR_IRQ when connecting STM32L4x5 EXTI fan-in IRQs Inès Varhol
2024-02-23 6:29 ` Philippe Mathieu-Daudé
2024-02-26 0:17 ` Alistair Francis
2024-02-20 18:34 ` Inès Varhol [this message]
2024-02-22 15:09 ` [PATCH v2 2/2] tests/qtest: Check that EXTI fan-in irqs are correctly connected Peter Maydell
2024-02-22 15:10 ` Peter Maydell
2024-02-22 16:06 ` [PATCH v2 0/2] hw/arm: Fix STM32L4x5 EXTI to CPU irq fan-in connections Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240220184145.106107-3-ines.varhol@telecom-paris.fr \
--to=ines.varhol@telecom-paris.fr \
--cc=alistair@alistair23.me \
--cc=arnaud.minier@telecom-paris.fr \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=samuel.tardieu@telecom-paris.fr \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).