diff options
Diffstat (limited to 'kernel/main.c')
| -rw-r--r-- | kernel/main.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/kernel/main.c b/kernel/main.c index fa88d19..f86dc98 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -31,6 +31,7 @@ #include "ioctl.h" #include "nv-vgpu-vfio-interface.h" +#include "gsp_phys_gpu.h" #define NV_VERSION_STRING "550.163.01" @@ -155,6 +156,8 @@ static rm_vgpu_vfio_ops_t g_rm_vgpu_vfio_ops; /* mdev parent structure for our physical device */ static struct mdev_parent *g_mdev_parent = NULL; +static bool gsp_phys_gpu_param; + /* VFIO ops implementation */ static NV_STATUS nv_vgpu_vfio_probe(struct pci_dev *pdev, NvU32 vgpu_type_id, NvU32 *vgpu_id); static void nv_vgpu_vfio_remove(struct pci_dev *pdev); @@ -1443,6 +1446,13 @@ static int __init nv_vgpu_init(void) } pr_info("gsp-resman-vfio: VFIO ops set\n"); + if (gsp_phys_gpu_param) { + ret = gsp_phys_gpu_claim(); + if (ret) + pr_warn("gsp-resman-vfio: physical GPU claim failed: %d\n", + ret); + } + pr_info("NVIDIA vGPU VFIO driver loaded (version %s)\n", NVIDIA_VGPU_VFIO_VERSION); /* Start the emulated-GPU progress service: it discovers the guest's * GPU-VA -> guest-PA map and applies copy-engine semaphore releases so @@ -1478,6 +1488,8 @@ static void __exit nv_vgpu_exit(void) pr_info("gsp-resman-vfio: nv_vgpu_exit: clearing VFIO ops to break circular dependency\n"); g_vgpu_vfio_ops = NULL; + gsp_phys_gpu_release(); + if (nv_vgpu_driver.device_count > 0) { struct nv_vgpu_device *vgpu; mutex_lock(&nv_vgpu_driver.lock); @@ -2428,6 +2440,15 @@ module_param_cb(chan_dump, &nv_vgpu_chan_dump_ops, NULL, 0200); MODULE_PARM_DESC(chan_dump, "Dump the sema service channel table (any value)"); /* + * Physical GPU ownership for the real-GSP execution backend (bring-up rung + * 1: claim). Default off. On claim the distribution driver is unbound from + * the physical GPU, this module's pci_driver binds it and the BARs are + * mapped. Only set when no VM holds an mdev; release happens on unload. + */ +module_param_named(gsp_phys_gpu, gsp_phys_gpu_param, bool, 0644); +MODULE_PARM_DESC(gsp_phys_gpu, "Claim the physical GPU for the real-GSP backend (default 0)"); + +/* * GR ring discovery: pin the compute channels' rings/USERDs, which follow the * CE rings in the channel video-memory allocation. Default on; set 0 to leave * GR channels untranslated when debugging push-execution side effects. |
