summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_rm_emulation.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/gsp_rm_emulation.h')
-rw-r--r--kernel/gsp_rm_emulation.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/kernel/gsp_rm_emulation.h b/kernel/gsp_rm_emulation.h
index 82ae493..17154b7 100644
--- a/kernel/gsp_rm_emulation.h
+++ b/kernel/gsp_rm_emulation.h
@@ -50,6 +50,35 @@ struct gsp_emu_context;
#define GSPRM_RPC_FUNC_UPDATE_BAR_PDE 70
#define GSPRM_RPC_EVENT_POST_EVENT 0x1003
#define GSPRM_MAX_EVENTS 128
+/*
+ * CONT.438: bounded client memory-object table. GSP-client kernel channels
+ * pass a client-allocated USERD as hUserdMemory[subdev] (NV_CHANNEL_ALLOC_PARAMS
+ * @32), not as the userdMem memdesc (@168), so the channel alloc alone cannot
+ * name the USERD PA. Remember the memory-object ALLOCs by (hClient, hObject)
+ * and resolve the channel's handle later. Sized well above the handful of
+ * USERD objects live at once; retired slots are reused.
+ */
+#define GSPRM_MAX_MEM_OBJECTS 128
+
+/* Address-space tag for a remembered memory object (NV_ADDR_* values). */
+enum gsp_rm_mem_as {
+ GSPRM_MEM_AS_UNKNOWN = 0,
+ GSPRM_MEM_AS_SYSMEM = 1, /* NV_ADDR_SYSMEM: base is a guest PA */
+ GSPRM_MEM_AS_VIDMEM = 2, /* NV_ADDR_FBMEM: base is an FB offset */
+ GSPRM_MEM_AS_VIRTUAL = 3, /* VA range only; never a physical base */
+};
+
+struct gsp_rm_mem_object {
+ u32 h_object;
+ u32 h_client;
+ u32 h_parent;
+ u32 class_id;
+ u64 base; /* PA (sysmem), FB offset (vidmem), or VA */
+ u64 size;
+ u8 address_space; /* enum gsp_rm_mem_as */
+ bool valid;
+};
+
/* Max event records written between two replies (status-ring safety). */
#define GSPRM_EVENT_BURST_MAX 24
#define GSPRM_RPC_EVENT_GSP_INIT_DONE 0x1001
@@ -211,6 +240,18 @@ struct gsp_rm_emu {
u64 events_dropped;
u32 event_burst; /* event records written in the current window */
unsigned long event_burst_at; /* m171: burst window start (time-based reset) */
+
+ /*
+ * CONT.438: client memory objects observed through GSP_RM_ALLOC,
+ * keyed by (hClient, hObject), used to turn a channel's
+ * hUserdMemory[subdev] into a physical USERD base. All alloc/free
+ * handling is serialized on the emulation thread, so no lock.
+ */
+ struct gsp_rm_mem_object mem_objects[GSPRM_MAX_MEM_OBJECTS];
+ u32 mem_objects_n;
+ u32 mem_objects_next; /* eviction cursor when full */
+ u32 mem_object_logs; /* bounded mem-object witness budget */
+ u32 mem_object_evictions; /* bounded diagnostic counter */
};
/*