From 708a3802824358c1770d5ad0b3c2e24fae114eb8 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Mon, 5 Oct 2026 12:25:05 -0400 Subject: vgsp: per-mdev emulated VRAM size (1.0 multiple mediate sizes) - nv_vgpu_type_info/ioctl gain vram_mb; nv_vgpu_device gains fb_emul_size bound from the mdev type at create (default 512 MiB). - New nvidia-vgpu-turing-1g type (1024 MiB); turing max_instances 1 -> 2; show_description reports the per-type framebuffer and max_instance. - Thread fb_emul_size through GSCI fb_length/region/frtsOffset, WPR2, NV_PFB_PRI_MMU_LOCAL_MEMORY_RANGE, the vidmem allocator bound and the BAR1 shadow; bar_info callback uses the per-device size. - UNTESTED at commit time: builds clean; validation blocked by the Xid 140 incident (reboot pending). See Handoff-vGPU-IO.md ADDENDUM 48. --- kernel/bar_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'kernel/bar_init.c') diff --git a/kernel/bar_init.c b/kernel/bar_init.c index 5e4b0a0..f4c982a 100644 --- a/kernel/bar_init.c +++ b/kernel/bar_init.c @@ -62,9 +62,10 @@ int nv_vgpu_bar_init(struct nv_vgpu_device *vgpu) * accesses must hit our own clean buffer, not the (broken) host * GPU's VRAM. Allocated lazily on first use to keep mdev create * cheap; 256MB to match the GSCI fb size. */ - vgpu->bars[1].vaddr = vzalloc(NV_VGPU_BAR1_SIZE); + vgpu->bars[1].vaddr = vzalloc(nv_vgpu_fb_emul_size(vgpu)); if (!vgpu->bars[1].vaddr) { - nv_vgpu_err(vgpu, "Failed to allocate emulated vidmem (256MB)"); + nv_vgpu_err(vgpu, "Failed to allocate emulated vidmem (%llu MiB)", + (unsigned long long)(nv_vgpu_fb_emul_size(vgpu) >> 20)); return -ENOMEM; } nv_vgpu_info(vgpu, "BAR1: gpa=0x%llx, size=0x%llx, emulated vidmem=%p", -- cgit v1.2.3