Skip to contentSkip to conversation

tests/qtest: don't step clock at start of npcm7xx periodic IRQ test

RFC PATCH In review Alex Bennée 3 participants 5 messages Jan 20, 2025 – Jan 22, 2025

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 tests/qtest: don't step clock at start of npcm7xx periodic IRQ test

Until there are timers enabled the semantics of clock_step_next() will fail. Since d524441a36 (system/qtest: properly feedback results of clock_[step|set]) we will signal a FAIL if time doesn't advance.

---
 tests/qtest/npcm7xx_timer-test.c | 1 -
 1 file changed, 1 deletion(-)
tests/qtest/npcm7xx_timer-test.c +0 -1
index 58f58c2f71..43711049ca 100644
@@ -465,7 +465,6 @@ static void test_periodic_interrupt(gconstpointer test_data)
     int i;
 
     tim_reset(td);
-    clock_step_next();
 
     tim_write_ticr(td, count);
     tim_write_tcsr(td, CEN | IE | MODE_PERIODIC | PRESCALE(ps));
Signature · 1 line
2.39.5
#1 lore raw

Have you tried that the test can pass with this? If I remember correctly, interrupt won't trigger properly if not advancing the timer

If the test passes it's probably fine to remove that.

Quoted 27 lines · Alex Bennée

Until there are timers enabled the semantics of clock_step_next() will fail. Since d524441a36 (system/qtest: properly feedback results of clock_[step|set]) we will signal a FAIL if time doesn't advance.

---
 tests/qtest/npcm7xx_timer-test.c | 1 -
 1 file changed, 1 deletion(-)
tests/qtest/npcm7xx_timer-test.c +0 -1
index 58f58c2f71..43711049ca 100644
@@ -465,7 +465,6 @@ static void test_periodic_interrupt(gconstpointer
 test_data)
     int i;
 
     tim_reset(td);
-    clock_step_next();
 
     tim_write_ticr(td, count);
     tim_write_tcsr(td, CEN | IE | MODE_PERIODIC | PRESCALE(ps));

--
2.39.5

#2 lore raw
Quoted 4 lines · Hao Wu

Have you tried that the test can pass with this? If I remember correctly, interrupt won't trigger properly if not advancing the timer

If the test passes it's probably fine to remove that.

This specific clock_step_next() call is done immediately after resetting the timer device, so there *is* no pending interrupt. (That's why it's a problem -- it says "step the clock forward to the next pending timer expiry", and there is no next pending timer expiry.)

There's another clock_step_next() just after the context in this patch, and that one is fine, because it's after the test enables the timer and so there will be a next pending expiry to step forward to.

thanks
-- PMM

#3 lore raw
In reply to Hao Wu
Quoted 2 lines · Hao Wu

Have you tried that the test can pass with this? If I remember correctly, interrupt won't trigger properly if not advancing the timer

Yes but the IRQ has yet to be enabled at this point.

Quoted 2 lines

If the test passes it's probably fine to remove that.

Of course.

Quoted 26 lines · Alex Bennée

Until there are timers enabled the semantics of clock_step_next() will fail. Since d524441a36 (system/qtest: properly feedback results of clock_[step|set]) we will signal a FAIL if time doesn't advance.

---

  tests/qtest/npcm7xx_timer-test.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/tests/qtest/npcm7xx_timer-test.c b/tests/qtest/npcm7xx_timer-test.c index 58f58c2f71..43711049ca 100644
--- a/tests/qtest/npcm7xx_timer-test.c
+++ b/tests/qtest/npcm7xx_timer-test.c
@@ -465,7 +465,6 @@ static void test_periodic_interrupt(gconstpointer test_data)

      int i;

      tim_reset(td);

- clock_step_next();

      tim_write_ticr(td, count);
      tim_write_tcsr(td, CEN | IE | MODE_PERIODIC | PRESCALE(ps));

--
2.39.5

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
Reviewed-by
#4 lore raw
Quoted 8 lines · Alex Bennée
Quoted 1 line · Hao Wu

Have you tried that the test can pass with this? If I remember

correctly, interrupt won't trigger properly if not advancing the

Quoted 1 line

timer

Yes but the IRQ has yet to be enabled at this point.

I believe that's the case, so we should be able to remove this line in the test.

Quoted 16 lines
Quoted 3 lines

If the test passes it's probably fine to remove that.

Of course.

Quoted 2 lines

On Mon, Jan 20, 2025 at 11:00 PM Alex Bennée <[email protected]>

Quoted 6 lines · wrote:

Until there are timers enabled the semantics of clock_step_next() will fail. Since d524441a36 (system/qtest: properly feedback results of clock_[step|set]) we will signal a FAIL if time doesn't advance.

Quoted 25 lines
Quoted 5 lines

---

  tests/qtest/npcm7xx_timer-test.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/tests/qtest/npcm7xx_timer-test.c

b/tests/qtest/npcm7xx_timer-test.c

Quoted 4 lines

index 58f58c2f71..43711049ca 100644
--- a/tests/qtest/npcm7xx_timer-test.c
+++ b/tests/qtest/npcm7xx_timer-test.c
@@ -465,7 +465,6 @@ static void test_periodic_interrupt(gconstpointer

test_data)

Quoted 9 lines
      int i;

      tim_reset(td);

- clock_step_next();

      tim_write_ticr(td, count);
      tim_write_tcsr(td, CEN | IE | MODE_PERIODIC | PRESCALE(ps));

--
2.39.5

--
Alex Bennée
Virtualisation Tech Lead @ Linaro