All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 2/3] system/qtest: Check ngl->name for irq_intercept_in
Date: Tue, 27 Oct 2026 09:24:44 -0300	[thread overview]
Message-ID: <87qzhbjppv.fsf@suse.de> (raw)
In-Reply-To: <20261026125655.2668658-3-peter.maydell@linaro.org>

Peter Maydell <peter.maydell@linaro.org> writes:

> Currently we check the name of the NamedGPIOList when doing
> irq_intercept_out, but not for irq_intercept_in.  Even though we
> don't currently support irq_intercept_in on named GPIO lines, we
> still need to check the name, because otherwise we will install the
> observer on every set of GPIO inputs the device has, rather than only
> for the unnamed GPIO inputs.
>
> This doesn't currently affect any test cases, because of all the
> tests which use irq_intercept_in only tests/qtest-l2vic-test.c uses
> it on a device that creates named GPIO inputs.  That device has both
> unnamed GPIO inputs and a named GPIO input "reset".  The effect is
> that a change in the "reset" line state looks like a change in
> interrupt input line 0; but since the test doesn't cause "reset" to
> change this doesn't happen and there are no observable effects of the
> bug.
>
> Check the ngl->name against the specified one for both input
> and output interception. (Currently this will be equivalent to
> a check against NULL for input intercepts.) As we're now checking
> for an exact name match unconditionally, we can break out of the
> loop as soon as we've found it.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> The forbidding of intercept_in for named GPIOs is done before
> the loop. I think the only reason we forbid it is that we don't
> have a mechanism for the "IRQ raise"/"IRQ lower" messages to
> say what GPIO they're for. Similarly I don't think supporting
> intercepts of multiple devices simultaneously would be too
> hard; but I'd rather wait til we have a test that actually wants
> that functionality.
> ---
>  system/qtest.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/system/qtest.c b/system/qtest.c
> index a3de815ce65..5ff3f9f27d8 100644
> --- a/system/qtest.c
> +++ b/system/qtest.c
> @@ -422,23 +422,24 @@ static void qtest_process_command(CharFrontend *chr, gchar **words)
>          }
>  
>          QLIST_FOREACH(ngl, &dev->gpios, node) {
> -            /* We don't support inbound interception of named GPIOs yet */
> +            /* NULL is valid and matchable, for "unnamed GPIO" */
> +            if (g_strcmp0(ngl->name, words[2]) != 0) {
> +                continue;
> +            }
> +
>              if (is_outbound) {
> -                /* NULL is valid and matchable, for "unnamed GPIO" */
> -                if (g_strcmp0(ngl->name, words[2]) == 0) {
> -                    int i;
> -                    qtest_init_irq_intercept(ngl->num_out);
> -                    for (i = 0; i < ngl->num_out; ++i) {
> -                        qtest_install_gpio_out_intercept(dev, ngl->name, i);
> -                    }
> -                    interception_succeeded = true;
> +                int i;
> +                qtest_init_irq_intercept(ngl->num_out);
> +                for (i = 0; i < ngl->num_out; ++i) {
> +                    qtest_install_gpio_out_intercept(dev, ngl->name, i);
>                  }
>              } else {
>                  qtest_init_irq_intercept(ngl->num_in);
>                  qemu_irq_set_observer(ngl->in, qtest_irq_handler,
>                                        ngl->num_in);
> -                interception_succeeded = true;
>              }
> +            interception_succeeded = true;
> +            break;
>          }
>  
>          if (interception_succeeded) {

Reviewed-by: Fabiano Rosas <farosas@suse.de>


  reply	other threads:[~2026-10-27 12:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 12:56 [PATCH 0/3] qtest: Remove 256 IRQ limit on irq intercepts Peter Maydell
2026-10-26 12:56 ` [PATCH 1/3] system/qtest: Avoid fixed-size irq_levels array for IRQ intercept Peter Maydell
2026-10-27 12:21   ` Fabiano Rosas
2026-10-26 12:56 ` [PATCH 2/3] system/qtest: Check ngl->name for irq_intercept_in Peter Maydell
2026-10-27 12:24   ` Fabiano Rosas [this message]
2026-10-26 12:56 ` [PATCH 3/3] tests/qtest/libqtest: Use a GArray for QTestState::irq_level[] Peter Maydell
2026-10-27 12:30   ` Fabiano Rosas
2026-10-27 12:30 ` [PATCH 0/3] qtest: Remove 256 IRQ limit on irq intercepts Fabiano Rosas

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=87qzhbjppv.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.