From b08989c6ab43892a4f19798bb51c720f0000dc80 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Wed, 30 Sep 2026 23:10:52 -0400 Subject: gsp-phys: claim the physical GPU and stage real GSP firmware (backend rungs 1-2) Rung 1 (ownership): a default-off gsp_phys_gpu module param; on claim the distribution driver is released from 10de:1ed3, our pci_driver binds it, BAR0/1/3 are mapped and the falcon state is sampled; release unbinds ours and rebinds the distribution driver. Verified live: claim reads BOOT0=0x164000a1 with the falcon halted and mailboxes clear; rmmod rebinds nvidia and nvidia-smi stays healthy. Rung 2 (firmware): while the device is owned, gsp_phys_fw (default nvidia/570.211.01/gsp_tu10x.bin) is fetched with request_firmware, checked as ELF64 RISC-V, and its sections are logged (.fwimage, .fwversion, .fwsignature_tu10x). The image is held for the boot rung. The claim is default-off; the emulation path is unchanged. --- kernel/main.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'kernel/main.c') 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); @@ -2427,6 +2439,15 @@ static const struct kernel_param_ops nv_vgpu_chan_dump_ops = { 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 -- cgit v1.2.3