summaryrefslogtreecommitdiffstats
path: root/kernel/dynamic_rpc_dispatcher.h
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-13 19:28:03 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-13 19:28:03 -0400
commitbfd269ee74d166be4f386640f8b5daad31d5d6ed (patch)
tree82da0efeeea759d44605ff69b0f20c8f248623e2 /kernel/dynamic_rpc_dispatcher.h
parent7adef330df18691acabda9f5c988742f23a2917d (diff)
downloadopen-iov-bfd269ee74d166be4f386640f8b5daad31d5d6ed.tar.gz
open-iov-bfd269ee74d166be4f386640f8b5daad31d5d6ed.zip
Phase 4: Portable Architecture Implementation
- Firmware Analyzer: Runtime firmware signature computation (CRC32, SHA256) and pattern-based RPC handler address discovery - Dynamic RPC Dispatcher: Version-aware dispatch with native firmware handlers (550/560/570/580) and emulation fallback - Hardware Architecture Layer: Turing, Ampere, Blackwell configs with BAR layouts, doorbell offsets, MSI-X vectors - Driver Version Adaptation Layer: Feature detection per driver version - Declarative YAML configs for hardware (turing/ampere/blackwell) and versions (550/560/570/580) - Kernel unit tests for GSP emulation (gsp_emulation_test.c) - Test infrastructure scripts (test_gsp_emu.sh, test_guest_driver.sh, test_cuda_workloads.sh, test_graphics_workloads.sh, test_windows_guest.sh, test_vgpu_stack.sh) - Updated kernel Makefile with new source files
Diffstat (limited to 'kernel/dynamic_rpc_dispatcher.h')
-rw-r--r--kernel/dynamic_rpc_dispatcher.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/kernel/dynamic_rpc_dispatcher.h b/kernel/dynamic_rpc_dispatcher.h
new file mode 100644
index 0000000..2abecb5
--- /dev/null
+++ b/kernel/dynamic_rpc_dispatcher.h
@@ -0,0 +1,66 @@
+#ifndef _DYNAMIC_RPC_DISPATCHER_H_
+#define _DYNAMIC_RPC_DISPATCHER_H_
+
+#include <linux/types.h>
+#include "gsp_rpc_client.h"
+#include "firmware_analyzer.h"
+
+/* Version-specific RPC interface */
+struct rpc_interface {
+ char version[32];
+ struct fw_addresses fw_addrs;
+
+ /* Native firmware handlers */
+ int (*alloc)(struct gsp_client *, u64, u64, u32, u32, u64, u32, u64 *, u64 *, u64 *);
+ int (*free)(struct gsp_client *, u64);
+ int (*map)(struct gsp_client *, u64, u64, u64, u32, u32, u64, u64 *);
+ int (*unmap)(struct gsp_client *, u64, u64, u64);
+ int (*pin)(struct gsp_client *, u64, u64, u64, u32, u64 *, u32 *);
+ int (*unpin)(struct gsp_client *, u64, u64, u64);
+ int (*schedule)(struct gsp_client *, u64, u64, u64, u32, u32);
+ int (*yield)(struct gsp_client *);
+ int (*bar_trap)(struct gsp_client *, u64, u32, u32, u64, u32, u64 *);
+ int (*migrate_save)(struct gsp_client *, u64, u64, u64, u64, u64 *);
+ int (*migrate_restore)(struct gsp_client *, u64, u64, u64, u64, u64);
+ int (*notify_register)(struct gsp_client *, u32, void (*)(struct gsp_client *, struct gsp_rpc_response *, void *), void *);
+ void (*notify_unregister)(struct gsp_client *, u32);
+
+ /* Emulation fallback flags */
+ bool use_emulation[GSP_RPC_MAX_TYPE];
+};
+
+/* Public API */
+int dynamic_dispatcher_init(const char *fw_path);
+void dynamic_dispatcher_fini(void);
+struct rpc_interface *dynamic_dispatcher_get_interface(void);
+bool dynamic_dispatcher_use_emulation(enum gsp_rpc_type type);
+
+/* Dispatcher functions */
+int dynamic_dispatcher_alloc(struct gsp_client *client, u64 size, u64 alignment, u32 mem_type,
+ u32 flags, u64 addr_hint, u32 pid, u64 *gpu_va, u64 *handle, u64 *actual_size);
+int dynamic_dispatcher_free(struct gsp_client *client, u64 handle);
+int dynamic_dispatcher_map(struct gsp_client *client, u64 handle, u64 gpu_va, u64 size,
+ u32 prot, u32 flags, u64 offset, u64 *mapped_va);
+int dynamic_dispatcher_unmap(struct gsp_client *client, u64 handle, u64 gpu_va, u64 size);
+int dynamic_dispatcher_pin(struct gsp_client *client, u64 handle, u64 offset, u64 size,
+ u32 flags, u64 *dma_addr, u32 *num_pages);
+int dynamic_dispatcher_unpin(struct gsp_client *client, u64 handle, u64 offset, u64 size);
+int dynamic_dispatcher_schedule(struct gsp_client *client, u64 work_handle, u64 callback, u64 arg,
+ u32 priority, u32 flags);
+int dynamic_dispatcher_yield(struct gsp_client *client);
+int dynamic_dispatcher_bar_trap(struct gsp_client *client, u64 bar_addr, u32 access_type, u32 size,
+ u64 value, u32 bar_num, u64 *ret_value);
+int dynamic_dispatcher_migrate_save(struct gsp_client *client, u64 src_gpu_id, u64 dst_gpu_id,
+ u64 memory_bitmap, u64 page_table_ptr, u64 *checkpoint);
+int dynamic_dispatcher_migrate_restore(struct gsp_client *client, u64 src_gpu_id, u64 dst_gpu_id,
+ u64 memory_bitmap, u64 page_table_ptr, u64 checkpoint);
+int dynamic_dispatcher_notify_register(struct gsp_client *client, u32 type,
+ void (*callback)(struct gsp_client *, struct gsp_rpc_response *, void *),
+ void *ctx);
+void dynamic_dispatcher_notify_unregister(struct gsp_client *client, u32 type);
+
+/* Info */
+const char *dynamic_dispatcher_get_version(void);
+const struct fw_addresses *dynamic_dispatcher_get_fw_addresses(void);
+
+#endif /* _DYNAMIC_RPC_DISPATCHER_H_ */ \ No newline at end of file