diff options
Diffstat (limited to 'kernel/dynamic_rpc_dispatcher.h')
| -rw-r--r-- | kernel/dynamic_rpc_dispatcher.h | 66 |
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 |
