qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Gustavo Romero <gustavo.romero@linaro.org>,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org,
	alex.bennee@linaro.org, thuth@redhat.com, armbru@redhat.com,
	Fabiano Rosas <farosas@suse.de>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>
Subject: Re: [PATCH v3 6/7] tests/qtest: Add API functions to capture IRQ toggling
Date: Tue, 7 Jan 2025 19:57:04 +0100	[thread overview]
Message-ID: <d1674d1e-e6ac-441f-acbd-ad3a2dcd15aa@linaro.org> (raw)
In-Reply-To: <77ee967d-00e6-45fa-a8b1-42192e61b553@linaro.org>

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	other threads:[~2025-01-07 18:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16 14:18 [RESEND][PATCH v3 0/7] Add ivshmem-flat device Gustavo Romero
2024-12-16 14:18 ` [PATCH v3 1/7] hw/misc/ivshmem-flat: " Gustavo Romero
2024-12-31 18:01   ` Philippe Mathieu-Daudé
2024-12-31 19:10   ` Philippe Mathieu-Daudé
2024-12-16 14:18 ` [PATCH v3 2/7] hw/misc/ivshmem-flat: Allow device to wire itself on sysbus Gustavo Romero
2024-12-16 14:18 ` [PATCH v3 3/7] hw/arm: Allow some machines to use the ivshmem-flat device Gustavo Romero
2024-12-16 14:18 ` [PATCH v3 4/7] hw/misc/ivshmem: Rename ivshmem to ivshmem-pci Gustavo Romero
2024-12-16 14:18 ` [PATCH v3 5/7] tests/qtest: Reorganize common code in ivshmem-test Gustavo Romero
2024-12-16 14:18 ` [PATCH v3 6/7] tests/qtest: Add API functions to capture IRQ toggling Gustavo Romero
2025-01-07 18:35   ` Philippe Mathieu-Daudé
2025-01-07 18:57     ` Philippe Mathieu-Daudé [this message]
2024-12-16 14:18 ` [PATCH v3 7/7] tests/qtest: Add ivshmem-flat test Gustavo Romero
2025-01-07 14:25 ` [RESEND][PATCH v3 0/7] Add ivshmem-flat device Markus Armbruster
2025-01-07 17:02   ` Alex Bennée

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=d1674d1e-e6ac-441f-acbd-ad3a2dcd15aa@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=farosas@suse.de \
    --cc=gustavo.romero@linaro.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --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).