summary refs log tree commit diff stats
path: root/tests/qtest/libqtest.h
diff options
context:
space:
mode:
authorIvan Klokov <ivan.klokov@syntacore.com>2025-01-09 12:10:43 +0300
committerFabiano Rosas <farosas@suse.de>2025-01-17 11:48:43 -0300
commit1addf57177a5646f86ede4eee385932b0214ab72 (patch)
tree34c585653f196f2db82539cdd433036754f54b61 /tests/qtest/libqtest.h
parent4d5d933bbc7cc52f6cc6b9021f91fa06266222d5 (diff)
downloadfocaccia-qemu-1addf57177a5646f86ede4eee385932b0214ab72.tar.gz
focaccia-qemu-1addf57177a5646f86ede4eee385932b0214ab72.zip
target/riscv: Add RISC-V CSR qtest support
The RISC-V architecture supports the creation of custom
CSR-mapped devices. It would be convenient to test them in the same way
as MMIO-mapped devices. To do this, a new call has been added
to read/write CSR registers.

Signed-off-by: Ivan Klokov <ivan.klokov@syntacore.com>
Acked-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Diffstat (limited to 'tests/qtest/libqtest.h')
-rw-r--r--tests/qtest/libqtest.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h
index f23d80e9e5..d771f29d63 100644
--- a/tests/qtest/libqtest.h
+++ b/tests/qtest/libqtest.h
@@ -601,6 +601,20 @@ uint64_t qtest_rtas_call(QTestState *s, const char *name,
                          uint32_t nret, uint64_t ret);
 
 /**
+ * qtest_csr_call:
+ * @s: #QTestState instance to operate on.
+ * @name: name of the command to call.
+ * @cpu: hart number.
+ * @csr: CSR number.
+ * @val: Value for reading/writing.
+ *
+ * Call an RISC-V CSR read/write function
+ */
+uint64_t qtest_csr_call(QTestState *s, const char *name,
+                         uint64_t cpu, int csr,
+                         uint64_t *val);
+
+/**
  * qtest_bufread:
  * @s: #QTestState instance to operate on.
  * @addr: Guest address to read from.