summaryrefslogtreecommitdiffstats
path: root/kernel/tests/gsp_emulation_test.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-02 15:13:06 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-02 15:13:06 -0400
commit4bb8550a72597ec098c6d62a75006a0aba61972e (patch)
treebd0ec74c26ff056251052a5e1ba0b59d14fb1f6a /kernel/tests/gsp_emulation_test.c
parent8b491c4e7ebde76c17faddaad47f92898d6c97de (diff)
downloadopen-iov-4bb8550a72597ec098c6d62a75006a0aba61972e.tar.gz
open-iov-4bb8550a72597ec098c6d62a75006a0aba61972e.zip
kernel: GR context-promote bisection modes 4-17 and server-managed-ctxbuf registry variant; complete vgsp rename; docs/tooling refresh
- gsp_phys_booter: GR promote bisection modes 4-17 (two-phase zero-field VA, batched entries, hVirtMemory, bare VA, KMD SKIP_CTXBUFFER_ALLOC channel, old-interface GPU_INITIALIZE_CTX, FBMEM context buffer, UVM-faithful PA-only, PATCH/PM auxiliary promotes, server-managed no-promote path); PATCH/PM geometry queries and buffers; pre-boot SET_REGISTRY profile selection - gsp_phys_gpu: gsp_phys_rmcall_gr_promote clamp 0..17 and gsp_phys_srv_ctxbuf parameter; registry image variant with RMSetClientRMAllocatedCtxBuffer=0 - vgsp rename across kernel, scripts, tools and docs (module vgsp.ko, /sys/kernel/debug/vgsp/, vgsp-<subsystem>: log prefixes) - risc-v-gsp-rm-debugger user-facing rename and docs/CI refresh; guest-diag tool updates; README/SBOM/install/Makefile sync Live status: CE ladder and P6 guest-copy forwarding green; GR engine context commit still open (all promote shapes accepted or cleanly refused; the channel stays CTXNOTVALID) - see Handoff-vGPU-IO.md Addendum 21 (local).
Diffstat (limited to 'kernel/tests/gsp_emulation_test.c')
-rw-r--r--kernel/tests/gsp_emulation_test.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/kernel/tests/gsp_emulation_test.c b/kernel/tests/gsp_emulation_test.c
index d63fcdb..973d26f 100644
--- a/kernel/tests/gsp_emulation_test.c
+++ b/kernel/tests/gsp_emulation_test.c
@@ -15,9 +15,11 @@
* Those paths are exercised by the live QEMU guest integration test
* (scripts/test_vgpu_stack.sh).
*
- * Requires open-iov-vfio.ko loaded first (links against its exports).
+ * Requires vgsp.ko loaded first (links against its exports).
*/
+#define pr_fmt(fmt) "" fmt
+
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
@@ -29,7 +31,7 @@
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Open-IOV");
MODULE_DESCRIPTION("GSP Emulation Unit Tests");
-MODULE_SOFTDEP("pre: open_iov_vfio");
+MODULE_SOFTDEP("pre: vgsp");
#define SHMEM_SIZE 4096
#define RSP_OFFSET 0x80
@@ -44,7 +46,7 @@ static int test_failures;
#define T_CHECK(cond, name, ...) do { \
if (!(cond)) { \
- pr_err("GSP_EMU_TEST: FAIL %s: " #name ": " __VA_ARGS__); \
+ pr_err("FAIL %s: " #name ": " __VA_ARGS__); \
test_failures++; \
return -1; \
} \
@@ -72,7 +74,7 @@ static int run_rpc(u32 type, u32 subcmd, const void *payload, size_t plen,
memcpy(rsp, r, sizeof(*rsp));
if (rsp->seq_id != msg->seq_id) {
- pr_err("GSP_EMU_TEST: response seq mismatch (got %u, want %u)\n",
+ pr_err("response seq mismatch (got %u, want %u)\n",
rsp->seq_id, msg->seq_id);
return -EBADMSG;
}
@@ -85,7 +87,7 @@ static int test_seq_id_zero(void)
struct gsp_rpc_msg *msg = test_shmem;
int ret;
- pr_info("GSP_EMU_TEST: Testing seq_id=0 rejection...\n");
+ pr_info("Testing seq_id=0 rejection...\n");
memset(test_shmem, 0, SHMEM_SIZE);
msg->type = GSP_RPC_YIELD;
@@ -94,7 +96,7 @@ static int test_seq_id_zero(void)
ret = gsp_emu_process_rpc(test_ctx);
T_CHECK(ret == -EINVAL, seq_zero, "expected -EINVAL, got %d\n", ret);
- pr_info("GSP_EMU_TEST: seq_id=0 correctly rejected\n");
+ pr_info("seq_id=0 correctly rejected\n");
return 0;
}
@@ -104,7 +106,7 @@ static int test_uninitialized_ctx(void)
struct gsp_emu_context *bad;
int ret;
- pr_info("GSP_EMU_TEST: Testing uninitialized ctx rejection...\n");
+ pr_info("Testing uninitialized ctx rejection...\n");
bad = kzalloc(sizeof(*bad), GFP_KERNEL);
T_CHECK(bad != NULL, alloc, "out of memory\n");
@@ -114,7 +116,7 @@ static int test_uninitialized_ctx(void)
kfree(bad);
T_CHECK(ret == -ENODEV, uninit, "expected -ENODEV, got %d\n", ret);
- pr_info("GSP_EMU_TEST: uninitialized ctx correctly rejected\n");
+ pr_info("uninitialized ctx correctly rejected\n");
return 0;
}
@@ -124,7 +126,7 @@ static int test_unknown_type(void)
struct gsp_rpc_response rsp;
int ret;
- pr_info("GSP_EMU_TEST: Testing unknown type rejection...\n");
+ pr_info("Testing unknown type rejection...\n");
ret = run_rpc(UNKNOWN_TYPE, 0, NULL, 0, &rsp);
T_CHECK(ret == -ENOTSUPP, unkret, "expected -ENOTSUPP, got %d\n", ret);
@@ -133,7 +135,7 @@ static int test_unknown_type(void)
T_CHECK(rsp.type == UNKNOWN_TYPE, unktype,
"expected type echo 0x%x, got 0x%x\n", UNKNOWN_TYPE, rsp.type);
- pr_info("GSP_EMU_TEST: unknown type correctly rejected\n");
+ pr_info("unknown type correctly rejected\n");
return 0;
}
@@ -143,7 +145,7 @@ static int test_schedule(void)
struct gsp_rpc_response rsp;
int ret;
- pr_info("GSP_EMU_TEST: Testing SCHEDULE...\n");
+ pr_info("Testing SCHEDULE...\n");
sreq.work_handle = 0x1234;
sreq.callback = 0; /* emulation worker never invokes callback */
@@ -158,7 +160,7 @@ static int test_schedule(void)
T_CHECK(rsp.type == GSP_RPC_SCHEDULE, schedtype,
"type echo 0x%x\n", rsp.type);
- pr_info("GSP_EMU_TEST: SCHEDULE succeeded\n");
+ pr_info("SCHEDULE succeeded\n");
return 0;
}
@@ -167,14 +169,14 @@ static int test_yield(void)
struct gsp_rpc_response rsp;
int ret;
- pr_info("GSP_EMU_TEST: Testing YIELD...\n");
+ pr_info("Testing YIELD...\n");
ret = run_rpc(GSP_RPC_YIELD, 0, NULL, 0, &rsp);
T_CHECK(ret == 0, yieldret, "dispatch returned %d\n", ret);
T_CHECK((s32)rsp.status == 0, yieldstatus,
"status %d\n", (s32)rsp.status);
- pr_info("GSP_EMU_TEST: YIELD succeeded\n");
+ pr_info("YIELD succeeded\n");
return 0;
}
@@ -183,7 +185,7 @@ static int test_notify(void)
struct gsp_rpc_response rsp;
int ret;
- pr_info("GSP_EMU_TEST: Testing NOTIFY...\n");
+ pr_info("Testing NOTIFY...\n");
/* subcmd carries the event type; dispatch is log-only, must succeed
* even with a NULL vgpu (exercises NULL-safe logging macros). */
@@ -192,7 +194,7 @@ static int test_notify(void)
T_CHECK((s32)rsp.status == 0, notifystatus,
"status %d\n", (s32)rsp.status);
- pr_info("GSP_EMU_TEST: NOTIFY succeeded\n");
+ pr_info("NOTIFY succeeded\n");
return 0;
}
@@ -201,14 +203,14 @@ static int test_debug(void)
struct gsp_rpc_response rsp;
int ret;
- pr_info("GSP_EMU_TEST: Testing DEBUG...\n");
+ pr_info("Testing DEBUG...\n");
ret = run_rpc(GSP_RPC_DEBUG, 0, NULL, 0, &rsp);
T_CHECK(ret == 0, dbgret, "dispatch returned %d\n", ret);
T_CHECK((s32)rsp.status == 0, dbgstatus,
"status %d\n", (s32)rsp.status);
- pr_info("GSP_EMU_TEST: DEBUG succeeded\n");
+ pr_info("DEBUG succeeded\n");
return 0;
}
@@ -219,7 +221,7 @@ static int test_dispatch_stress(void)
struct gsp_rpc_response rsp;
int i, ret;
- pr_info("GSP_EMU_TEST: Testing dispatch stress (100 iterations)...\n");
+ pr_info("Testing dispatch stress (100 iterations)...\n");
sreq.work_handle = 0xBEEF;
sreq.priority = 5;
@@ -235,7 +237,7 @@ static int test_dispatch_stress(void)
"iteration %d status %d\n", i, (s32)rsp.status);
}
- pr_info("GSP_EMU_TEST: dispatch stress passed (100/100)\n");
+ pr_info("dispatch stress passed (100/100)\n");
return 0;
}
@@ -274,7 +276,7 @@ static int init_test_context(void)
test_ctx->initialized = true;
/* msix_trigger[] zeroed by kzalloc; eventfd_signal is guarded */
- pr_info("GSP_EMU_TEST: Test context initialized\n");
+ pr_info("Test context initialized\n");
return 0;
err_client:
@@ -303,7 +305,7 @@ static void cleanup_test_context(void)
test_shmem = NULL;
}
gsp_rpc_emulation_set(false);
- pr_info("GSP_EMU_TEST: Test context cleaned up\n");
+ pr_info("Test context cleaned up\n");
}
static int run_all_tests(void)
@@ -311,7 +313,7 @@ static int run_all_tests(void)
test_failures = 0;
if (init_test_context()) {
- pr_err("GSP_EMU_TEST: Failed to initialize test context\n");
+ pr_err("Failed to initialize test context\n");
return -1;
}
@@ -327,23 +329,23 @@ static int run_all_tests(void)
cleanup_test_context();
if (test_failures == 0) {
- pr_info("GSP_EMU_TEST: ALL TESTS PASSED\n");
+ pr_info("ALL TESTS PASSED\n");
return 0;
}
- pr_err("GSP_EMU_TEST: %d TEST(S) FAILED\n", test_failures);
+ pr_err("%d TEST(S) FAILED\n", test_failures);
return -1;
}
static int __init gsp_emulation_test_init(void)
{
- pr_info("GSP_EMU_TEST: Starting GSP emulation unit tests...\n");
+ pr_info("Starting GSP emulation unit tests...\n");
return run_all_tests();
}
static void __exit gsp_emulation_test_exit(void)
{
- pr_info("GSP_EMU_TEST: Module unloaded\n");
+ pr_info("Module unloaded\n");
}
module_init(gsp_emulation_test_init);