From patchwork Thu Aug 24 09:28:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 716510 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp1235970wrp; Thu, 24 Aug 2023 02:29:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlZcOFnpI9fGuaiu3rcJ3NKcMv7FENcfHJbBXcvEhoJkjLeC4566ED58MhKnkCH4v78Q/d X-Received: by 2002:a05:620a:1a06:b0:76d:b7fe:6b2e with SMTP id bk6-20020a05620a1a0600b0076db7fe6b2emr7155210qkb.29.1692869388379; Thu, 24 Aug 2023 02:29:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692869388; cv=none; d=google.com; s=arc-20160816; b=jFTr2pnAzOF36gnnRneQ72AVQaIL1tlk8pFWRGjy9fAzMabxeq5KGMEcsnRhieS5or D4577Fd+1RWNO7b4aiX6rFRcCEaWXzmYU/HZuY6LH4T8eV/IcsGyvSxam46tNcYH8c2/ L6Q2TCK4Kts5yGuC0UHCkk9QjUAiKlyfQKTyU0f0ih3R8L8vYefCmiIelkaFdlMHxJqs OK4rwescPJKxuR8GCFizZ5+z2CX3J/pLG4v4LswTH6YQHa4ppDkDKhTt2gFQi1O0nltT GLE2DqCxevfNocQECgIeKW5mBhXtuFQ6TIFERWsZZMWSx1rdFBQCnukQPwS/fSAcQoYa tLHA== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=UyC6pkxktpI+U9x2+x+ifLYzV9VlMFeTgo38T5/icxQ=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=V0ggyvP7v/Jc/814nl4ou7Ds5OGeUQdJ+Pr0FXRC95EaW1LXnSg16kQlMoX3kbvl6E NbdJL1xjwc1w1WSM5esd+FAbGsZbzdaXSjH/DUwdvpW6ePgZSH2M+Kq0IVTqrgV1oFue JnRf0NBD9Prik9uZGC6tm/CVEHBGdl7Dl/+II26oJpYkU8yAyP/4uTW735iv+94vyp2a ycWZE2JCpYPr/aPgMGMgxAhSXJa2Uh4OEOKeg/Ew8MYm592/PZz63gBi/O55iaClBIN6 dZN4ZMuAURtSngm1dNLkBmzy7aOwynkvpYnozXU0HVFtkE9S5kCANxecoqYsSkU2fDF3 qPqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wx8gdMfW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ot8-20020a05620a818800b0076dbc59d341si1411349qkn.525.2023.08.24.02.29.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Aug 2023 02:29:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=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=@linaro.org header.s=google header.b=Wx8gdMfW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZ6eM-0005gZ-Cw; Thu, 24 Aug 2023 05:29:11 -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 1qZ6e1-00044Y-K8 for qemu-devel@nongnu.org; Thu, 24 Aug 2023 05:28:51 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qZ6du-0004xW-1c for qemu-devel@nongnu.org; Thu, 24 Aug 2023 05:28:45 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4018af103bcso1964745e9.1 for ; Thu, 24 Aug 2023 02:28:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692869319; x=1693474119; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=UyC6pkxktpI+U9x2+x+ifLYzV9VlMFeTgo38T5/icxQ=; b=Wx8gdMfW30eA1RrycIVlqqkVSDqoSwdi7EKm2NHAXwk3tPCnNfZRFQZmiJ0X41puE8 8IHizylLf2XXdM9K6C8V8x1HDjjfYlDLXQCLw+noCVchnsPkZZqJ2Kc55lMyAf+yEdGU cnJA4iTKrMl24fEGQYUkaEFvlhiqJsKH/nwqhtFunDxJ4ZHPUWHw3APeRfYdPS/OiOn5 um8oR7lihGFE8s73wiZLCEBhcmThpvgUt+pLFqeGeihKWjpurrrYHjHAitObuNrn8RXo 8n1AkTQaYlLirdVDLbMVCjzK7OQn04mBv5bjPoNAU01J4gUMFllc0C9rJ70NhIbO5JGm zQ9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692869319; x=1693474119; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UyC6pkxktpI+U9x2+x+ifLYzV9VlMFeTgo38T5/icxQ=; b=NoivfNdf0QWuPcumfDf8h9S5e4L2v44Td6Ffghy1XnfRqdG0imYNtdizRFYqllM0wQ UEPvspHjr63kNOszawxnzRDYMcy77wS6paAgB9TL95MEenRILljh04NRkl01zyA+w4s3 6UQPFb3tvvinMgUzFH6CtQR8g0OizUi2iIR7BI75xNcFpTCgStbmxvLg40cUET+f4DBm f9UUlbTbT924VX7IEeoZ1EDVEI3luS0A50IvYvFYIV9B/v8JzredRBWLxzz+K2SuqDMx fjr9sxnJCTZ/zBfWAapA8HB3SjZX6WSU3Pryk61RnfAbp/fv0bBG7oJsBmcFi1P6cQzW GFAQ== X-Gm-Message-State: AOJu0YxbAU6/Ar+ltWnNYTCh5wmf8mHiJaXZcOuPWjgbd5dDOAlGPHDg 7ck3ZoG3V/Sxtr3Go2QYefOIzaB4Kezj73VauN4= X-Received: by 2002:a05:600c:210e:b0:3ff:516b:5c4c with SMTP id u14-20020a05600c210e00b003ff516b5c4cmr3722808wml.18.1692869319116; Thu, 24 Aug 2023 02:28:39 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id s12-20020adfeccc000000b00317b5c8a4f1sm21844004wro.60.2023.08.24.02.28.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 02:28:38 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/35] qtest: implement named interception of out-GPIO Date: Thu, 24 Aug 2023 10:28:04 +0100 Message-Id: <20230824092836.2239644-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230824092836.2239644-1-peter.maydell@linaro.org> References: <20230824092836.2239644-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.google.com 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_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Chris Laplante 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 Message-id: 20230728160324.1159090-4-chris@laplante.io Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- tests/qtest/libqtest.h | 11 +++++++++++ softmmu/qtest.c | 18 ++++++++++-------- tests/qtest/libqtest.c | 6 ++++++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index 3a71bc45fcf..e53e350e3a6 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); +/** + * 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, const char *name); + /** * qtest_set_irq_in: * @s: QTestState instance to operate on. diff --git a/softmmu/qtest.c b/softmmu/qtest.c index 1b864891629..0f1d478bda5 100644 --- a/softmmu/qtest.c +++ b/softmmu/qtest.c @@ -397,8 +397,10 @@ static void qtest_process_command(CharBackend *chr, gchar **words) || strcmp(words[0], "irq_intercept_in") == 0) { DeviceState *dev; NamedGPIOList *ngl; + bool is_outbound; g_assert(words[1]); + is_outbound = words[0][14] == 'o'; dev = DEVICE(object_resolve_path(words[1], NULL)); if (!dev) { qtest_send_prefix(chr); @@ -417,14 +419,14 @@ static void qtest_process_command(CharBackend *chr, gchar **words) } QLIST_FOREACH(ngl, &dev->gpios, node) { - /* We don't support intercept of named GPIOs yet */ - if (ngl->name) { - continue; - } - if (words[0][14] == 'o') { - int i; - for (i = 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) { + /* NULL is valid and matchable, for "unnamed GPIO" */ + if (g_strcmp0(ngl->name, words[2]) == 0) { + int i; + for (i = 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 c22dfc30d3d..471529e6cc3 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); } +void qtest_irq_intercept_out_named(QTestState *s, const char *qom_path, const 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);