qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Inès Varhol" <ines.varhol@telecom-paris.fr>, qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	 Alistair Francis <alistair@alistair23.me>,
	Arnaud Minier <arnaud.minier@telecom-paris.fr>,
	qemu-arm@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
	Thomas Huth <thuth@redhat.com>
Subject: Re: [PATCH v3 2/3] tests/qtest: Add STM32L4x5 SYSCFG QTest testcase
Date: Thu, 4 Jan 2024 14:37:12 +0100	[thread overview]
Message-ID: <f69286a2-cedf-428a-9c9f-a4b94d787507@linaro.org> (raw)
In-Reply-To: <20231229164915.133199-3-ines.varhol@telecom-paris.fr>

On 29/12/23 17:47, Inès Varhol wrote:
> Acked-by: Alistair Francis <alistair.francis@wdc.com>
> 
> Signed-off-by: Arnaud Minier <arnaud.minier@telecom-paris.fr>
> Signed-off-by: Inès Varhol <ines.varhol@telecom-paris.fr>
> ---
>   tests/qtest/meson.build             |   3 +-
>   tests/qtest/stm32l4x5_syscfg-test.c | 408 ++++++++++++++++++++++++++++
>   2 files changed, 410 insertions(+), 1 deletion(-)
>   create mode 100644 tests/qtest/stm32l4x5_syscfg-test.c

Helper suggestion to ease readability:

static void syscfg_set_irq(int num, int level)
{
    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg",
                     NULL, num, level);
}

When the SoC is parented to the machine, this patch needs:

-- >8 --
diff --git a/tests/qtest/stm32l4x5_syscfg-test.c 
b/tests/qtest/stm32l4x5_syscfg-test.c
index 3edd13b222..272ba91055 100644
--- a/tests/qtest/stm32l4x5_syscfg-test.c
+++ b/tests/qtest/stm32l4x5_syscfg-test.c
@@ -240,3 +240,3 @@ static void test_interrupt(void)
       */
-    qtest_irq_intercept_in(global_qtest, 
"/machine/unattached/device[0]/exti");
+    qtest_irq_intercept_in(global_qtest, "/machine/soc/exti");
      /* Enable interrupt on rising edge of GPIO PA[0] */
@@ -245,4 +245,3 @@ static void test_interrupt(void)

-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 1);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 1);

@@ -254,4 +253,3 @@ static void test_interrupt(void)

-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 15, 1);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 15, 1);

@@ -264,4 +262,3 @@ static void test_interrupt(void)

-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 17, 1);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 17, 1);

@@ -271,8 +268,5 @@ static void test_interrupt(void)
      syscfg_writel(SYSCFG_EXTICR1, 0x00000000);
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 0);
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 15, 0);
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 17, 0);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 0);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 15, 0);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 17, 0);
  }
@@ -285,3 +279,3 @@ static void test_irq_pin_multiplexer(void)

-    qtest_irq_intercept_in(global_qtest, 
"/machine/unattached/device[0]/exti");
+    qtest_irq_intercept_in(global_qtest, "/machine/soc/exti");

@@ -291,4 +285,3 @@ static void test_irq_pin_multiplexer(void)

-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 1);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 1);

@@ -299,4 +292,3 @@ static void test_irq_pin_multiplexer(void)
      /* Clean the test */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 0);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 0);

@@ -306,4 +298,3 @@ static void test_irq_pin_multiplexer(void)

-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 15, 1);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 15, 1);

@@ -314,4 +305,3 @@ static void test_irq_pin_multiplexer(void)
      /* Clean the test */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 15, 0);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 15, 0);
  }
@@ -324,3 +314,3 @@ static void test_irq_gpio_multiplexer(void)

-    qtest_irq_intercept_in(global_qtest, 
"/machine/unattached/device[0]/exti");
+    qtest_irq_intercept_in(global_qtest, "/machine/soc/exti");

@@ -331,4 +321,3 @@ static void test_irq_gpio_multiplexer(void)
      /* Check that setting rising pin GPIOA[0] generates an irq */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 1);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 1);

@@ -337,8 +326,6 @@ static void test_irq_gpio_multiplexer(void)
      /* Clean the test */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 0);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 0);

      /* Check that setting rising pin GPIOB[0] doesn't generate an irq */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 16, 1);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 16, 1);

@@ -347,4 +334,3 @@ static void test_irq_gpio_multiplexer(void)
      /* Clean the test */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 16, 0);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 16, 0);

@@ -356,4 +342,3 @@ static void test_irq_gpio_multiplexer(void)
      /* Check that setting rising pin GPIOA[0] doesn't generate an irq */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 1);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 1);

@@ -362,8 +347,6 @@ static void test_irq_gpio_multiplexer(void)
      /* Clean the test */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 0);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 0);

      /* Check that setting rising pin GPIOB[0] generates an irq */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 16, 1);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 16, 1);

@@ -372,4 +355,3 @@ static void test_irq_gpio_multiplexer(void)
      /* Clean the test */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 16, 0);
+    qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 16, 0);
      syscfg_writel(SYSCFG_EXTICR1, 0x00000000);
---

With the helper included (since I tested it):

-- >8 --
diff --git a/tests/qtest/stm32l4x5_syscfg-test.c 
b/tests/qtest/stm32l4x5_syscfg-test.c
index 3edd13b222..19a5f83ebe 100644
--- a/tests/qtest/stm32l4x5_syscfg-test.c
+++ b/tests/qtest/stm32l4x5_syscfg-test.c
@@ -47,2 +47,8 @@ static void exti_writel(unsigned int offset, uint32_t 
value)

+static void syscfg_set_irq(int num, int level)
+{
+   qtest_set_irq_in(global_qtest, "/machine/soc/syscfg",
+                    NULL, num, level);
+}
+
  static void system_reset(void)
@@ -240,3 +246,3 @@ static void test_interrupt(void)
       */
-    qtest_irq_intercept_in(global_qtest, 
"/machine/unattached/device[0]/exti");
+    qtest_irq_intercept_in(global_qtest, "/machine/soc/exti");
      /* Enable interrupt on rising edge of GPIO PA[0] */
@@ -245,4 +251,3 @@ static void test_interrupt(void)

-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 1);
+    syscfg_set_irq(0, 1);

@@ -254,4 +259,3 @@ static void test_interrupt(void)

-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 15, 1);
+    syscfg_set_irq(15, 1);

@@ -264,4 +268,3 @@ static void test_interrupt(void)

-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 17, 1);
+    syscfg_set_irq(17, 1);

@@ -271,8 +274,5 @@ static void test_interrupt(void)
      syscfg_writel(SYSCFG_EXTICR1, 0x00000000);
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 0);
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 15, 0);
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 17, 0);
+    syscfg_set_irq(0, 0);
+    syscfg_set_irq(15, 0);
+    syscfg_set_irq(17, 0);
  }
@@ -285,3 +285,3 @@ static void test_irq_pin_multiplexer(void)

-    qtest_irq_intercept_in(global_qtest, 
"/machine/unattached/device[0]/exti");
+    qtest_irq_intercept_in(global_qtest, "/machine/soc/exti");

@@ -291,4 +291,3 @@ static void test_irq_pin_multiplexer(void)

-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 1);
+    syscfg_set_irq(0, 1);

@@ -299,4 +298,3 @@ static void test_irq_pin_multiplexer(void)
      /* Clean the test */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 0);
+    syscfg_set_irq(0, 0);

@@ -306,4 +304,3 @@ static void test_irq_pin_multiplexer(void)

-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 15, 1);
+    syscfg_set_irq(15, 1);

@@ -314,4 +311,3 @@ static void test_irq_pin_multiplexer(void)
      /* Clean the test */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 15, 0);
+    syscfg_set_irq(15, 0);
  }
@@ -324,3 +320,3 @@ static void test_irq_gpio_multiplexer(void)

-    qtest_irq_intercept_in(global_qtest, 
"/machine/unattached/device[0]/exti");
+    qtest_irq_intercept_in(global_qtest, "/machine/soc/exti");

@@ -331,4 +327,3 @@ static void test_irq_gpio_multiplexer(void)
      /* Check that setting rising pin GPIOA[0] generates an irq */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 1);
+    syscfg_set_irq(0, 1);

@@ -337,8 +332,6 @@ static void test_irq_gpio_multiplexer(void)
      /* Clean the test */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 0);
+    syscfg_set_irq(0, 0);

      /* Check that setting rising pin GPIOB[0] doesn't generate an irq */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 16, 1);
+    syscfg_set_irq(16, 1);

@@ -347,4 +340,3 @@ static void test_irq_gpio_multiplexer(void)
      /* Clean the test */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 16, 0);
+    syscfg_set_irq(16, 0);

@@ -356,4 +348,3 @@ static void test_irq_gpio_multiplexer(void)
      /* Check that setting rising pin GPIOA[0] doesn't generate an irq */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 1);
+    syscfg_set_irq(0, 1);

@@ -362,8 +353,6 @@ static void test_irq_gpio_multiplexer(void)
      /* Clean the test */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 0, 0);
+    syscfg_set_irq(0, 0);

      /* Check that setting rising pin GPIOB[0] generates an irq */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 16, 1);
+    syscfg_set_irq(16, 1);

@@ -372,4 +361,3 @@ static void test_irq_gpio_multiplexer(void)
      /* Clean the test */
-    qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
-                     NULL, 16, 0);
+    syscfg_set_irq(16, 0);
      syscfg_writel(SYSCFG_EXTICR1, 0x00000000);
---

Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Regards,

Phil.


  parent reply	other threads:[~2024-01-04 13:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-29 16:47 [PATCH v3 0/3] Add device STM32L4x5 SYSCFG Inès Varhol
2023-12-29 16:47 ` [PATCH v3 1/3] hw/misc: Implement " Inès Varhol
2024-01-05  5:12   ` Alistair Francis
2023-12-29 16:47 ` [PATCH v3 2/3] tests/qtest: Add STM32L4x5 SYSCFG QTest testcase Inès Varhol
2024-01-04 13:23   ` Philippe Mathieu-Daudé
2024-01-04 13:37   ` Philippe Mathieu-Daudé [this message]
2023-12-29 16:47 ` [PATCH v3 3/3] hw/arm: Connect STM32L4x5 SYSCFG to STM32L4x5 SoC Inès Varhol
2024-01-04 13:20   ` Philippe Mathieu-Daudé
2024-01-04 13:47 ` [PATCH v3 0/3] Add device STM32L4x5 SYSCFG Philippe Mathieu-Daudé

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=f69286a2-cedf-428a-9c9f-a4b94d787507@linaro.org \
    --to=philmd@linaro.org \
    --cc=alistair@alistair23.me \
    --cc=arnaud.minier@telecom-paris.fr \
    --cc=ines.varhol@telecom-paris.fr \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --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).