summaryrefslogtreecommitdiffstats
path: root/kernel/main.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-22 23:32:44 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-22 23:32:44 -0400
commit14283fe73fb5e432a7af45de94961655714910f6 (patch)
treee993bf56f3e2ef93195019ac0fd996d82204384a /kernel/main.c
parentb34e4531d8f0b984dc15660d3ab406ae48822931 (diff)
downloadopen-iov-14283fe73fb5e432a7af45de94961655714910f6.tar.gz
open-iov-14283fe73fb5e432a7af45de94961655714910f6.zip
kernel: FB/BUS info-list controls + PCIe link caps for the UVM path
CUDA (cuInit) now reaches UVM's device create: libcuda opens nvidia-uvm, UVM calls nvGpuOpsDeviceCreate/gpuGetGpuInfo, and the driver fails at getPCIELinkRateMBps -> calculatePCIELinkRateMBps ("Unknown PCIe speed", NV_ERR_INVALID_STATE) -> nv_open_device aborts -> cuInit returns CUDA_ERROR_NOT_INITIALIZED (3). Implemented along the way: - FB_GET_INFO_V2 (0x20801303): echo the requested FB info indices and answer TU104 values (256MB RAM/heap/BAR1, GDDR6, 8 LTCs, 4MB L2, ...). Fixes the kern_mem_sys_ctrl.c:911 asserts and gives CUDA/UVM real memory sizes. - BUS_GET_INFO_V2 (0x20801823): echo indices; PCIe Gen3 x16 link caps / GEN info / link status, SYSMEM_CONNECTION_TYPE=PCIE. UVM's gpuGetSysmemLinkInfo reads SYSMEM_CONNECTION_TYPE and the nominal link bandwidth from here. - PCIe Link Capabilities in the emulated config space (0x8C/0x92) and in the BAR0 PCFG mirror (gpuReadBusConfigReg -> NV_PCFG+0x84 = BAR0+ 0x88084): MAX_SPEED=3 (8GT/s Gen3), MAX_WIDTH=0x10 (x16); link status mirror at 0x88088. Also mirrored under the VF-window/low aliases. - Temporary change-watch on PCFG[0x88084] to see if the guest overwrites it (it does not - stays 0x103). Verified: guest nvidia-smi -L still works and reports PCIe Generation Max/Current = 3. cuInit still fails; the remaining question is which address the driver's kbifGetGpuLinkCapabilities read sees as zero (the PCFG shadow holds 0x103). Guest-side kprobe tracing of that function panicked the VM (free_swap_cache page fault on a corrupted pointer) - possible guest memory corruption to investigate separately.
Diffstat (limited to 'kernel/main.c')
-rw-r--r--kernel/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/main.c b/kernel/main.c
index 0fea09e..209942b 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -1723,14 +1723,14 @@ static int nv_vgpu_config_space_init(struct nv_vgpu_device *vgpu, struct pci_dev
cfg[0x89] = 0x00;
cfg[0x8a] = 0x10; /* Device Status */
cfg[0x8b] = 0x00;
- cfg[0x8c] = 0x00; /* Link Capabilities */
- cfg[0x8d] = 0x00;
+ cfg[0x8c] = 0x03; /* Link Capabilities: MAX_SPEED 3:0 = 3 (8 GT/s) */
+ cfg[0x8d] = 0x01; /* ... MAX_WIDTH 9:4 = 0x10 (x16) -> 0x103 */
cfg[0x8e] = 0x00;
cfg[0x8f] = 0x00;
cfg[0x90] = 0x00; /* Link Control */
cfg[0x91] = 0x00;
- cfg[0x92] = 0x00; /* Link Status */
- cfg[0x93] = 0x00;
+ cfg[0x92] = 0x03; /* Link Status: speed 3:0 = 3 (Gen3) */
+ cfg[0x93] = 0x01; /* ... width 9:4 = 0x10 (x16) */
cfg[0x94] = 0x00; /* Slot Capabilities */
cfg[0x95] = 0x00;
cfg[0x96] = 0x00;