summaryrefslogtreecommitdiffstats
path: root/kernel/main.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-21 14:10:43 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-21 14:11:45 -0400
commitc8249854284c3e8181587b96e3c5b4177d705e0c (patch)
treef0f1c16b055c88b059d159db715407d2f7406090 /kernel/main.c
parent85d888e4763837a5b2f5843c771bf6b6d6e6bfe3 (diff)
downloadopen-iov-c8249854284c3e8181587b96e3c5b4177d705e0c.tar.gz
open-iov-c8249854284c3e8181587b96e3c5b4177d705e0c.zip
kernel: Present physical TU104 to guest + emulate GSP boot (FWSEC/Booter) + VBIOS serving
Guest driver probe fixes (unmodified 570.144 open driver on physical path): - kernel/main.c: add show_description to the mdev driver. Userspace mdev management tools parse 'framebuffer=<n>M' from every mdev type's description sysfs file before creating an mdev; the missing file made such tools fail to create the vGPU. Also fix create_mdev.sh for the real type dir name pci-nvidia-vgpu-* (mdev core names dirs dev_driver_string(parent)-<sysfs_name>; the parent registers before nvidia.ko binds so dev_driver_string == 'pci'). - kernel/bar_emulation.c: seed BAR0 shadow so guest sees a REAL, PHYSICAL, non-virtual TU104 (user directive: no PV/VF vGPU paths, unmodified driver): * PMC_BOOT_0/1/42 = physical TU104 values captured from host hardware (0x164000a1 / 0x0 / 0x164a1000). Without these, halmgrGetHalForGpu() fails and probe aborts with 'does not include the required GSP'. * Serve a valid VBIOS at the PROM window (BAR0+0x300000) loaded from /lib/firmware/tu104_vbios.bin (dump of host TU104 ROM). Guest's kgspExtractVbiosFromRom_TU102 needs it for the mandatory FWSEC ucode (kgspGetFrtsSize is hardwired to 1MB on Turing). * Pre-set GSP secure-boot (GFW) completion state: PGC6 PLM (0x118128)=1, GFW_BOOT progress (0x118234)=0xFF, GSP falcon CPUCTL HALTED (0x110100). The driver's post-FLR GFW wait only *waits* (never kicks), so the pre-set state satisfies it immediately. - kernel/gsp_emulation.c/h: physical GSP boot emulation. * Falcon boot-watch: poll GSP falcon/PGC6/WPR2/scratch registers and log changes (guest BAR0 is mmap-based, otherwise invisible to host). * gsp_emu_poll_boot: STARTCPU auto-complete state machine. Guest kicks FWSEC then Booter Load via GSP falcon CPUCTL; detect each kick and complete the stage (HALTED + FRTS err NONE + WPR2 + mailbox + RISCV-active) so the guest believes its ucodes ran. Diagnosis that led here (documented in Handoff-vGPU-IO.md): - Open nvidia.ko can never be an SR-IOV VF vGPU guest: os_is_grid_supported() is a stub returning FALSE in the open build (disassembled). PV path also rejected per user directive. Only the physical path with a fully emulated local GSP boot remains.
Diffstat (limited to 'kernel/main.c')
-rw-r--r--kernel/main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/main.c b/kernel/main.c
index 3da7dc6..a47fe23 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -96,12 +96,27 @@ static unsigned int nv_vgpu_get_available(struct mdev_type *mtype)
return active >= max ? 0 : max - active;
}
+/*
+ * show_description - mdev type description for management tools.
+ *
+ * / parses "framebuffer=<n>M" from this string for EVERY
+ * supported type before creating an mdev, so the field is mandatory
+ * (missing description file -> readFile failure -> no vGPU).
+ * 256M matches the vGPU BAR1 (VRAM aperture) size we expose to guests.
+ */
+static ssize_t nv_vgpu_show_description(struct mdev_type *mtype, char *buf)
+{
+ return sysfs_emit(buf, "num_heads=1, frl_config=60, framebuffer=256M, "
+ "max_resolution=5120x2880, max_instance=1\n");
+}
+
struct mdev_driver nv_vgpu_mdev_driver = {
.device_api = VFIO_DEVICE_API_PCI_STRING,
.max_instances = 8,
.probe = nv_vgpu_mdev_create,
.remove = nv_vgpu_mdev_remove,
.get_available = nv_vgpu_get_available,
+ .show_description = nv_vgpu_show_description,
.driver = {
.name = "nvidia-vgpu-vfio-mdev",
},