qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 6/7] tests/qtest: Add API functions to capture IRQ togglin


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v3 6/7] tests/qtest: Add API functions to capture IRQ toggling
Date: Tue, 7 Jan 2025 19:57:04 +0100
User-agent: Mozilla Thunderbird

On 7/1/25 19:35, Philippe Mathieu-Daudé wrote:
Cc'ing maintainers:

$ ./scripts/get_maintainer.pl -f tests/qtest/libqtest.c
Fabiano Rosas <farosas@suse.de> (maintainer:qtest)
Laurent Vivier <lvivier@redhat.com> (maintainer:qtest)
Paolo Bonzini <pbonzini@redhat.com> (reviewer:qtest)

On 16/12/24 15:18, Gustavo Romero wrote:
Currently, the QTest API does not provide a function to capture when an
IRQ line is raised or lowered, although the QTest Protocol already
reports such IRQ transitions. As a consequence, it is also not possible
to capture when an IRQ line is toggled. Functions like qtest_get_irq()
only read the current state of the intercepted IRQ lines, which is
already high (or low) when the function is called if the IRQ line is
toggled. Therefore, these functions miss the IRQ line state transitions.

This commit introduces two new API functions:
qtest_get_irq_raised_counter() and qtest_get_irq_lowered_counter().
These functions allow capturing the number of times an observed IRQ line
transitioned from low to high state or from high to low state,
respectively.

When used together, these new API functions then allow checking if one
or more pulses were generated (indicating if the IRQ line was toggled).

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Thomas Huth <thuth@redhat.com>
---
  tests/qtest/libqtest.c | 24 ++++++++++++++++++++++++
  tests/qtest/libqtest.h | 28 ++++++++++++++++++++++++++++
  2 files changed, 52 insertions(+)


+uint64_t qtest_get_irq_raised_counter(QTestState *s, int num)
+{
+    /* dummy operation in order to make sure irq is up to date */
+    qtest_inb(s, 0);

Isn't it better to simply call:

        qtest_rsp(s);

?

Sorry I misunderstood. You want to flush the qtest socket, right?
Could this be sufficient?

          s->ops.send(s, "\n");

Otherwise I'd rather add a "nop" command. Seeing "inb" in traces
is very confusing.


+
+    return s->irq_raised_counter[num];
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]