/* * GSP Emulation Engine for Host-Side GSP Emulation * Replaces guest-side GSP communication with host kernel emulation */ #ifndef _GSP_EMULATION_H_ #define _GSP_EMULATION_H_ #include #include #include #include #include #include #include #include #include "nvidia-vgpu-vfio.h" #include "gsp_rpc_client.h" #include "bar_emulation.h" #include "irq.h" #include "memory.h" /* ============================================================ * GSP Emulation Context * ============================================================ */ struct gsp_emu_context { struct nv_vgpu_device *vgpu; struct task_struct *thread; void __iomem *bar0_vaddr; void __iomem *doorbell_reg; void __iomem *shared_mem; struct gsp_client *rpc_client; spinlock_t lock; bool running; bool initialized; /* Shared memory for RPC communication (4KB at BAR0+0x1000) */ void *shared_mem_virt; dma_addr_t shared_mem_dma; size_t shared_mem_size; /* Statistics */ u64 processed_rpcs; u64 failed_rpcs; u64 total_latency_ns; /* MSI-X injection */ struct eventfd_ctx *msix_trigger[NV_VGPU_MAX_IRQS]; }; /* ============================================================ * Public API * ============================================================ */ int gsp_emu_init(struct nv_vgpu_device *vgpu); void gsp_emu_cleanup(struct nv_vgpu_device *vgpu); int gsp_emu_process_rpc(struct gsp_emu_context *ctx); void gsp_emu_inject_completion_interrupt(struct gsp_emu_context *ctx, u32 seq_id); /* ============================================================ * Debug/Statistics * ============================================================ */ void gsp_emu_get_stats(struct gsp_emu_context *ctx, u64 *processed, u64 *failed, u64 *total_latency_ns); #endif /* _GSP_EMULATION_H_ */