[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/19] qtest/aspeed_gpio: Add input pin modification test
From: |
Cédric Le Goater |
Subject: |
[PULL 17/19] qtest/aspeed_gpio: Add input pin modification test |
Date: |
Thu, 14 Jul 2022 17:44:54 +0200 |
From: Peter Delevoryas <peter@pjd.dev>
Verify the current behavior, which is that input pins can be modified by
guest OS register writes.
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20220712023219.41065-2-peter@pjd.dev>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
tests/qtest/aspeed_gpio-test.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/tests/qtest/aspeed_gpio-test.c b/tests/qtest/aspeed_gpio-test.c
index bac63e8742f4..8f524540998d 100644
--- a/tests/qtest/aspeed_gpio-test.c
+++ b/tests/qtest/aspeed_gpio-test.c
@@ -28,6 +28,11 @@
#include "qapi/qmp/qdict.h"
#include "libqtest-single.h"
+#define AST2600_GPIO_BASE 0x1E780000
+
+#define GPIO_ABCD_DATA_VALUE 0x000
+#define GPIO_ABCD_DIRECTION 0x004
+
static void test_set_colocated_pins(const void *data)
{
QTestState *s = (QTestState *)data;
@@ -46,6 +51,27 @@ static void test_set_colocated_pins(const void *data)
g_assert(!qtest_qom_get_bool(s, "/machine/soc/gpio", "gpioV7"));
}
+static void test_set_input_pins(const void *data)
+{
+ QTestState *s = (QTestState *)data;
+ char name[16];
+ uint32_t value;
+
+ qtest_writel(s, AST2600_GPIO_BASE + GPIO_ABCD_DIRECTION, 0x00000000);
+ for (char c = 'A'; c <= 'D'; c++) {
+ for (int i = 0; i < 8; i++) {
+ sprintf(name, "gpio%c%d", c, i);
+ qtest_qom_set_bool(s, "/machine/soc/gpio", name, true);
+ }
+ }
+ value = qtest_readl(s, AST2600_GPIO_BASE + GPIO_ABCD_DATA_VALUE);
+ g_assert_cmphex(value, ==, 0xffffffff);
+
+ qtest_writel(s, AST2600_GPIO_BASE + GPIO_ABCD_DATA_VALUE, 0x00000000);
+ value = qtest_readl(s, AST2600_GPIO_BASE + GPIO_ABCD_DATA_VALUE);
+ g_assert_cmphex(value, ==, 0x00000000);
+}
+
int main(int argc, char **argv)
{
QTestState *s;
@@ -56,6 +82,7 @@ int main(int argc, char **argv)
s = qtest_init("-machine ast2600-evb");
qtest_add_data_func("/ast2600/gpio/set_colocated_pins", s,
test_set_colocated_pins);
+ qtest_add_data_func("/ast2600/gpio/set_input_pins", s,
test_set_input_pins);
r = g_test_run();
qtest_quit(s);
--
2.35.3
- [PULL 12/19] docs: aspeed: Add fby35 multi-SoC machine section, (continued)
- [PULL 12/19] docs: aspeed: Add fby35 multi-SoC machine section, Cédric Le Goater, 2022/07/14
- [PULL 16/19] hw: m25p80: add tests for BP and TB bit write protect, Cédric Le Goater, 2022/07/14
- [PULL 19/19] aspeed: Add fby35-bmc slot GPIO's, Cédric Le Goater, 2022/07/14
- [PULL 07/19] aspeed: Make aspeed_board_init_flashes public, Cédric Le Goater, 2022/07/14
- [PULL 08/19] aspeed: Add fby35 skeleton, Cédric Le Goater, 2022/07/14
- [PULL 14/19] test/avocado/machine_aspeed.py: Add SDK tests, Cédric Le Goater, 2022/07/14
- [PULL 11/19] aspeed: Add AST1030 (BIC) to fby35, Cédric Le Goater, 2022/07/14
- [PULL 10/19] aspeed: fby35: Add a bootrom for the BMC, Cédric Le Goater, 2022/07/14
- [PULL 13/19] docs: aspeed: Minor updates, Cédric Le Goater, 2022/07/14
- [PULL 15/19] hw: m25p80: Add Block Protect and Top Bottom bits for write protect, Cédric Le Goater, 2022/07/14
- [PULL 17/19] qtest/aspeed_gpio: Add input pin modification test,
Cédric Le Goater <=
- [PULL 18/19] hw/gpio/aspeed: Don't let guests modify input pins, Cédric Le Goater, 2022/07/14
- Re: [PULL v2 00/19] aspeed queue, Peter Maydell, 2022/07/15