Received: by 2002:a17:906:2484:b0:98d:b2f5:1316 with SMTP id e4csp265933ejb; Tue, 25 Jul 2023 20:32:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlH+uWZImyDzn1cAJW/GvRK4eT8EtkaK0KGDb3kxyOq2LPCh0Mxz3/Zl7eadWWGAPW962xgb X-Received: by 2002:a05:620a:b43:b0:767:4068:1df4 with SMTP id x3-20020a05620a0b4300b0076740681df4mr705826qkg.31.1690342376242; Tue, 25 Jul 2023 20:32:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690342376; cv=none; d=google.com; s=arc-20160816; b=qJny6CL+eK+QdbIFr4AO5A0Ey7jsw4rG/pKha7ooV/x1cVyd+U9Qj+pp84kOhDj+R1 sRNCRdXwrJ8PC6ej/8hpt5AChPPaXNhQA3yHehX+DJQVCDztwCzCBrgPOLO1vcfo2iA7 7HK7AdX4zfECPerOtIOakAOxugIP17KnWUCrE9j9BfZi/36iIeDPOGFMVeUdTzc2IpmE pjo11+Hm3uAlB4cmyoapMulMCnCT8yAbHpZyudwh1XSxuHxntOePVoSv3mnpPyU/alWv QICo/2s9mQyv3vkczN0SwTZB5uffEe3f3EcMkAFUL3fgPae8pJZt98V/x6uCkE332Upn pC+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:feedback-id:references:in-reply-to:message-id:subject :cc:from:to:dkim-signature:date; bh=yb1pYUgxIoRCfHqojFYKWD+C5vWzpg6C6lYB0UTVhpk=; fh=51RBXPp2dGsIxW/A/2XX6J9OY4lNIg77Uvb7eAIehHk=; b=bXHjNxjtTI+JKLFxiNFtOIVnYNot4SbddwsUyG5tsHedHr1r5lTjpMrXBkXg9PQuTV Hz6Sq0dMG2X4O9EAIor3n5crwQqVyU76BHrflrjVHwXW/Vxb3LI8qgwOnSezbXXJT3rr m9cwKwj/d5Tkj7r3Omg9TVgRkigwOD5dqn1laCrE/N+cyRu49RteyJ/1ZxhCzOJRkQzB GAJwn0UsX7rWuf2fjgfCd1mz7YVK8qKnSSE+gwnny6T63Gl/nDRMD0Fh3DRq/9C145iu vhz9nMXaAhI1/9DaszK2RtCgE6IlvKL5WEs9LWAeGm/TXXSASErJwwfWk4gwmX4+zcNl dH5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@laplante.io header.s=protonmail3 header.b=7D46uXQo; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=laplante.io Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pe8-20020a05620a850800b00763afa9c13csi6903595qkn.554.2023.07.25.20.32.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Jul 2023 20:32:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@laplante.io header.s=protonmail3 header.b=7D46uXQo; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=laplante.io Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOVGF-0005ON-3f; Tue, 25 Jul 2023 23:32:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOVGB-0005NR-0W for qemu-devel@nongnu.org; Tue, 25 Jul 2023 23:32:25 -0400 Received: from mail-4018.proton.ch ([185.70.40.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOVG8-00070p-TS for qemu-devel@nongnu.org; Tue, 25 Jul 2023 23:32:22 -0400 Date: Wed, 26 Jul 2023 03:32:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=laplante.io; s=protonmail3; t=1690342336; x=1690601536; bh=yb1pYUgxIoRCfHqojFYKWD+C5vWzpg6C6lYB0UTVhpk=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=7D46uXQokYjAjnS1fVHbP23gWtD8PczmLhVwsIA9A8GugWRVCaFrDKcFJhSv4yeCz P6MzvXHvFzk06si6uOsySS3cSflPRGc/0U/8vqsXmxLqnCwExmI45HS0Ro/KoIFBaG /y64nzapqZEi+odpuK0qk9a4IT4yX4l+oAzaKmFbvwK9E3bgwQpHZfEjIwP62SOlil i8ASCW5KbQw9Oiwpp/ddThA7dszIToc7nj6EanFjvdgjkc6GAgeABI3hblRXal/kTY NnngN8mPARsfI/QVr2UM9zGsbqnxNQTVEGh9EvZ7z7L+BKSRRhqOF/eaZObwG1jPQp XoQNWOUOEc30A== To: qemu-devel@nongnu.org From: Chris Laplante Cc: Joel Stanley , Peter Maydell , qemu-arm@nongnu.org, Chris Laplante Subject: [PATCH v2 3/6] qtest: implement named interception of out-GPIO Message-ID: <20230726030450.757462-4-chris@laplante.io> In-Reply-To: <20230726030450.757462-1-chris@laplante.io> References: <20230726030450.757462-1-chris@laplante.io> Feedback-ID: 43500449:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.40.18; envelope-from=chris@laplante.io; helo=mail-4018.proton.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: ezLasxCO9OK5 Adds qtest_irq_intercept_out_named method, which utilizes a new optional name parameter to the irq_intercept_out qtest command. Signed-off-by: Chris Laplante --- softmmu/qtest.c | 24 ++++++++++++++++-------- tests/qtest/libqtest.c | 6 ++++++ tests/qtest/libqtest.h | 11 +++++++++++ 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/softmmu/qtest.c b/softmmu/qtest.c index 1c92e5a6a3..7fd8546ed2 100644 --- a/softmmu/qtest.c +++ b/softmmu/qtest.c @@ -397,8 +397,12 @@ static void qtest_process_command(CharBackend *chr, gc= har **words) || strcmp(words[0], "irq_intercept_in") =3D=3D 0) { DeviceState *dev; NamedGPIOList *ngl; + bool is_named; + bool is_outbound; =20 g_assert(words[1]); + is_named =3D words[2] !=3D NULL; + is_outbound =3D words[0][14] =3D=3D 'o'; dev =3D DEVICE(object_resolve_path(words[1], NULL)); if (!dev) { qtest_send_prefix(chr); @@ -417,14 +421,18 @@ static void qtest_process_command(CharBackend *chr, g= char **words) } =20 QLIST_FOREACH(ngl, &dev->gpios, node) { - /* We don't support intercept of named GPIOs yet */ - if (ngl->name) { - continue; - } - if (words[0][14] =3D=3D 'o') { - int i; - for (i =3D 0; i < ngl->num_out; ++i) { - qtest_install_gpio_out_intercept(dev, ngl->name, i); + /* We don't support inbound interception of named GPIOs yet */ + if (is_outbound) { + if (is_named) { + if (ngl->name && strcmp(ngl->name, words[2]) =3D=3D 0)= { + qtest_install_gpio_out_intercept(dev, ngl->name, 0= ); + break; + } + } else if (!ngl->name) { + int i; + for (i =3D 0; i < ngl->num_out; ++i) { + qtest_install_gpio_out_intercept(dev, ngl->name, i= ); + } } } else { qemu_irq_intercept_in(ngl->in, qtest_irq_handler, diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index c22dfc30d3..471529e6cc 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -993,6 +993,12 @@ void qtest_irq_intercept_out(QTestState *s, const char= *qom_path) qtest_rsp(s); } =20 +void qtest_irq_intercept_out_named(QTestState *s, const char *qom_path, co= nst char *name) +{ + qtest_sendf(s, "irq_intercept_out %s %s\n", qom_path, name); + qtest_rsp(s); +} + void qtest_irq_intercept_in(QTestState *s, const char *qom_path) { qtest_sendf(s, "irq_intercept_in %s\n", qom_path); diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index 3a71bc45fc..e53e350e3a 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -371,6 +371,17 @@ void qtest_irq_intercept_in(QTestState *s, const char = *string); */ void qtest_irq_intercept_out(QTestState *s, const char *string); =20 +/** + * qtest_irq_intercept_out_named: + * @s: #QTestState instance to operate on. + * @qom_path: QOM path of a device. + * @name: Name of the GPIO out pin + * + * Associate a qtest irq with the named GPIO-out pin of the device + * whose path is specified by @string and whose name is @name. + */ +void qtest_irq_intercept_out_named(QTestState *s, const char *qom_path, co= nst char *name); + /** * qtest_set_irq_in: * @s: QTestState instance to operate on. --=20 2.41.0