summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_rpc_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/gsp_rpc_client.c')
-rw-r--r--kernel/gsp_rpc_client.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/kernel/gsp_rpc_client.c b/kernel/gsp_rpc_client.c
index ae45513..93c1876 100644
--- a/kernel/gsp_rpc_client.c
+++ b/kernel/gsp_rpc_client.c
@@ -375,8 +375,8 @@ int gsp_rpc_unpin(struct gsp_client *client, u64 handle, u64 offset, u64 size)
/* BAR Trap Emulation */
int gsp_rpc_bar_trap(struct gsp_client *client,
- u64 bar_addr, u32 access_type, u32 size,
- u64 value, u32 bar_num, u64 *ret_value)
+ u64 bar_addr, u32 access_type, u32 size,
+ u64 value, u32 bar_num, u64 *ret_value)
{
struct gsp_bar_trap_req req = {0};
struct gsp_bar_trap_rsp rsp = {0};
@@ -384,6 +384,17 @@ int gsp_rpc_bar_trap(struct gsp_client *client,
u32 seq = gsp_next_seq(client);
int ret;
+ /* In emulation mode there is no real firmware to submit to, and
+ * submit_raw would ring the very doorbell the emulation thread polls
+ * (self-triggered RPC livelock + timeout stall). Guest BAR access is
+ * synchronous MMIO via the shadow mapping and never needs this RPC.
+ * Real shadow-register handlers are TODO; fail fast and loudly. */
+ if (gsp_rpc_emulation_is_enabled()) {
+ pr_warn_ratelimited("gsp_rpc_bar_trap: not supported in emulation mode (bar=%u addr=0x%llx)\n",
+ bar_num, bar_addr);
+ return -ENOTSUPP;
+ }
+
req.bar_addr = bar_addr;
req.access_type = access_type;
req.size = size;
@@ -413,9 +424,19 @@ int gsp_rpc_migrate_save(struct gsp_client *client,
struct gsp_migrate_req req = {0};
struct gsp_migrate_rsp rsp = {0};
struct gsp_rpc_response response = {0};
- u32 seq = gsp_next_seq(client);
+ u32 seq;
int ret;
+ /* Emulation mode: no real firmware; submit_raw would ring the doorbell
+ * the emulation thread polls (self-triggered livelock + 30s stall).
+ * Live migration over the emulated vGPU is not yet implemented;
+ * see kernel/migration.c for the 4-phase host-side protocol work. */
+ if (gsp_rpc_emulation_is_enabled()) {
+ pr_warn_ratelimited("gsp_rpc_migrate_save: not supported in emulation mode\n");
+ return -ENOTSUPP;
+ }
+
+ seq = gsp_next_seq(client);
req.src_gpu_id = src_gpu_id;
req.dst_gpu_id = dst_gpu_id;
req.memory_bitmap = memory_bitmap;
@@ -444,9 +465,16 @@ int gsp_rpc_migrate_restore(struct gsp_client *client,
{
struct gsp_migrate_req req = {0};
struct gsp_rpc_response response = {0};
- u32 seq = gsp_next_seq(client);
+ u32 seq;
int ret;
+ /* Emulation mode: no real firmware; see gsp_rpc_migrate_save note. */
+ if (gsp_rpc_emulation_is_enabled()) {
+ pr_warn_ratelimited("gsp_rpc_migrate_restore: not supported in emulation mode\n");
+ return -ENOTSUPP;
+ }
+
+ seq = gsp_next_seq(client);
req.src_gpu_id = src_gpu_id;
req.dst_gpu_id = dst_gpu_id;
req.memory_bitmap = memory_bitmap;
@@ -777,7 +805,7 @@ int gsp_rpc_schedule(struct gsp_client *client,
u32 seq = gsp_next_seq(client);
int ret;
- if (gsp_emulation_enabled) {
+ if (gsp_rpc_emulation_is_enabled()) {
struct gsp_sched_work *sched = kzalloc(sizeof(*sched), GFP_KERNEL);
if (!sched)
return -ENOMEM;
@@ -827,7 +855,7 @@ int gsp_rpc_yield(struct gsp_client *client)
u32 seq = gsp_next_seq(client);
int ret;
- if (gsp_emulation_enabled) {
+ if (gsp_rpc_emulation_is_enabled()) {
/* In emulation, yield is a no-op success */
return 0;
}