[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/35] qtest: implement named interception of out-GPIO
From: |
Peter Maydell |
Subject: |
[PULL 03/35] qtest: implement named interception of out-GPIO |
Date: |
Thu, 24 Aug 2023 10:28:04 +0100 |
From: Chris Laplante <chris@laplante.io>
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 <chris@laplante.io>
Message-id: 20230728160324.1159090-4-chris@laplante.io
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
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);
--
2.34.1
- [PULL 00/35] target-arm queue, Peter Maydell, 2023/08/24
- [PULL 05/35] qtest: irq_intercept_[out/in]: return FAIL if no intercepts are installed, Peter Maydell, 2023/08/24
- [PULL 03/35] qtest: implement named interception of out-GPIO,
Peter Maydell <=
- [PULL 06/35] qtest: microbit-test: add tests for nRF51 DETECT, Peter Maydell, 2023/08/24
- [PULL 01/35] hw/gpio/nrf51: implement DETECT signal, Peter Maydell, 2023/08/24
- [PULL 02/35] qtest: factor out qtest_install_gpio_out_intercept, Peter Maydell, 2023/08/24
- [PULL 04/35] qtest: bail from irq_intercept_in if name is specified, Peter Maydell, 2023/08/24
- [PULL 28/35] target/arm/ptw: Load stage-2 tables from realm physical space, Peter Maydell, 2023/08/24
- [PULL 13/35] target/arm/ptw: Don't set fi->s1ptw for UnsuppAtomicUpdate fault, Peter Maydell, 2023/08/24
- [PULL 24/35] target/arm/ptw: Set attributes correctly for MMU disabled data accesses, Peter Maydell, 2023/08/24
- [PULL 09/35] mips: Report an error when KVM_VM_MIPS_VZ is unavailable, Peter Maydell, 2023/08/24
- [PULL 16/35] target/arm/ptw: Pass ptw into get_phys_addr_pmsa*() and get_phys_addr_disabled(), Peter Maydell, 2023/08/24
- [PULL 11/35] accel/kvm: Free as when an error occurred, Peter Maydell, 2023/08/24