diff options
Diffstat (limited to 'kernel/include/nvidia-vgpu-vfio.h')
| -rw-r--r-- | kernel/include/nvidia-vgpu-vfio.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/kernel/include/nvidia-vgpu-vfio.h b/kernel/include/nvidia-vgpu-vfio.h index 1c2f67b..ccd7262 100644 --- a/kernel/include/nvidia-vgpu-vfio.h +++ b/kernel/include/nvidia-vgpu-vfio.h @@ -25,7 +25,18 @@ #define NV_VGPU_MAX_IRQS NVIDIA_VGPU_MAX_IRQS #define NV_VGPU_BAR0_SIZE (16 * 1024 * 1024) -#define NV_VGPU_BAR1_SIZE (256 * 1024 * 1024) +/* + * BAR1 (VRAM aperture) and the emulated framebuffer size. These two move + * together: the guest derives its BAR1 size from fbLength + * (kbusInitBarsSize_VF: pciBarSizes[1] = pGpu->fbLength), and its vidmem + * address space is [0, fbLength). The shadow backing bars[1].vaddr is + * NV_VGPU_BAR1_SIZE, so any guest vidmem PA the emulation translates must + * stay inside it. 512 MiB gives UVM enough headroom after its own + * reservations to satisfy the acceptance program's 3x4 MiB vadd buffers + * (at 256 MiB the guest reported only ~5 MiB free). + */ +#define NV_VGPU_BAR1_SIZE (512 * 1024 * 1024) +#define NV_VGPU_EMUL_FB_SIZE (512ULL * 1024 * 1024) #define NV_VGPU_BAR2_SIZE (32 * 1024 * 1024) #define NV_VGPU_BAR3_SIZE (32 * 1024 * 1024) @@ -56,6 +67,13 @@ struct nv_vgpu_bar { void *vaddr; bool mapped; bool trapped; + /* + * True when vaddr is a host-RAM shadow (vzalloc) owned by this module + * instead of an ioremap'd physical BAR. Guest mappings must then remap + * the shadow's own pages; a real BAR must never be exposed to the + * guest outside the supervised physical claim. + */ + bool emulated; struct mutex lock; }; |
