From 9a7263fce4e3156349a526631805fce66b87fb1b Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Sun, 13 Sep 2026 22:17:09 -0400 Subject: Phase 5: Fix MDEV creation blocker - mdev parent registration & ioctl-based vGPU type registration - Implemented nv_vgpu_mdev_register_parent() using mdev_register_parent() API with nv_vgpu_mdev_types array for proper mdev parent registration - Added ioctl NV_VGPU_IOCTL_REGISTER_VGPU_TYPE for userspace vGPU type registration - Created separate header nv-vgpu-vfio-interface-nvidia.h for nvidia.ko with only extern declarations to avoid duplicate symbol exports - Used KBUILD_EXTRA_SYMBOLS to provide only needed symbols (nvidia_vgpu_vfio_*) - Updated create_mdev.sh to use correct mdev type names (pci-nvidia-vgpu-*) - Updated load_vgpu_stack.sh to load open-iov-vfio.ko before nvidia.ko Result: 4 mdev types now show available_instances=8, mdev creation successful --- kernel/include/ioctl.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'kernel/include/ioctl.h') diff --git a/kernel/include/ioctl.h b/kernel/include/ioctl.h index 4ff3df9..36d28ac 100644 --- a/kernel/include/ioctl.h +++ b/kernel/include/ioctl.h @@ -32,6 +32,18 @@ #define NV_VGPU_IOCTL_SET_GSP_FIRMWARE \ _IOWR(NV_VGPU_IOCTL_MAGIC, 0x09, struct nv_vgpu_ioctl_firmware) +#define NV_VGPU_IOCTL_REGISTER_VGPU_TYPE \ + _IOWR(NV_VGPU_IOCTL_MAGIC, 0x0A, struct nv_vgpu_ioctl_register_vgpu_type) + +/* vGPU type info structure (shared between main.c and ioctl.c) */ +struct nv_vgpu_type_info { + char name[64]; + char description[128]; + u64 vdev_id; + u64 pdev_id; + u32 max_instances; +}; + struct nv_vgpu_ioctl_get_info { u32 vgpu_type; u32 vgpu_id; @@ -93,6 +105,14 @@ struct nv_vgpu_ioctl_firmware { u32 firmware_type; }; +struct nv_vgpu_ioctl_register_vgpu_type { + char name[64]; + char description[128]; + u64 vdev_id; + u64 pdev_id; + u32 max_instances; +}; + int nv_vgpu_ioctl_get_info(struct nv_vgpu_device *vgpu, void __user *arg); int nv_vgpu_ioctl_map_bar(struct nv_vgpu_device *vgpu, void __user *arg); int nv_vgpu_ioctl_unmap_bar(struct nv_vgpu_device *vgpu, void __user *arg); @@ -101,5 +121,6 @@ int nv_vgpu_ioctl_disable_irq(struct nv_vgpu_device *vgpu, void __user *arg); int nv_vgpu_ioctl_gsp_rpc(struct nv_vgpu_device *vgpu, void __user *arg); int nv_vgpu_ioctl_migrate_save(struct nv_vgpu_device *vgpu, void __user *arg); int nv_vgpu_ioctl_migrate_restore(struct nv_vgpu_device *vgpu, void __user *arg); +int nv_vgpu_ioctl_register_vgpu_type(void __user *arg); #endif \ No newline at end of file -- cgit v1.2.3