summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_rm_emulation.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-05 12:25:05 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-05 12:25:05 -0400
commit708a3802824358c1770d5ad0b3c2e24fae114eb8 (patch)
tree6d4d98c9279a74464be8c6ba796d994eef81bbce /kernel/gsp_rm_emulation.c
parentf90b1a123a60dea44ac98f05529ec2fd545c26eb (diff)
downloadopen-iov-708a3802824358c1770d5ad0b3c2e24fae114eb8.tar.gz
open-iov-708a3802824358c1770d5ad0b3c2e24fae114eb8.zip
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.
Diffstat (limited to 'kernel/gsp_rm_emulation.c')
-rw-r--r--kernel/gsp_rm_emulation.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/kernel/gsp_rm_emulation.c b/kernel/gsp_rm_emulation.c
index f123792..f2656bb 100644
--- a/kernel/gsp_rm_emulation.c
+++ b/kernel/gsp_rm_emulation.c
@@ -1025,7 +1025,7 @@ static void gsp_rm_handle_set_guest_system_info(struct gsp_emu_context *ctx,
* Builds the 1656-byte GspStaticConfigInfo for TU104.
* ============================================================ */
-static void gsp_rm_build_static_info(u8 *buf)
+static void gsp_rm_build_static_info(u8 *buf, u64 fb_size)
{
u64 val64;
u32 val32;
@@ -1058,7 +1058,7 @@ static void gsp_rm_build_static_info(u8 *buf)
{
struct tu104_fb_region *region = (void *)(p + 8); /* 8-aligned */
val64 = 0; memcpy(&region->base, &val64, 8);
- val64 = (NV_VGPU_EMUL_FB_SIZE - 1);
+ val64 = (fb_size - 1);
memcpy(&region->limit, &val64, 8);
val64 = 0; memcpy(&region->reserved, &val64, 8);
val32 = 0; memcpy(&region->performance, &val32, 4);
@@ -1097,9 +1097,10 @@ static void gsp_rm_build_static_info(u8 *buf)
/* poisonFuseEnabled (offset 1216, 1 byte) */
buf[TU104_GSCI_OFF_poisonFuseEnabled] = 0;
- /* fb_length (offset 1224, 8 bytes) - 512MB. Kept in lockstep with
- * NV_PFB_PRI_MMU_LOCAL_MEMORY_RANGE and wpr2_addr_lo. */
- val64 = NV_VGPU_EMUL_FB_SIZE;
+ /* fb_length (offset 1224, 8 bytes) - this mdev's emulated FB size.
+ * Kept in lockstep with NV_PFB_PRI_MMU_LOCAL_MEMORY_RANGE and
+ * wpr2_addr_lo (all derive from nv_vgpu_fb_emul_size). */
+ val64 = fb_size;
memcpy(buf + TU104_GSCI_OFF_fb_length, &val64, 8);
/* fbio_mask (offset 1232, 8 bytes) - 8 FBIOs for 256-bit bus */
@@ -1167,7 +1168,7 @@ static void gsp_rm_build_static_info(u8 *buf)
/* fwWprLayoutOffset (offset 1640, 16 bytes): nonWprHeapOffset, frtsOffset */
val64 = 0;
memcpy(buf + TU104_GSCI_OFF_fwWprLayoutOffset, &val64, 8);
- val64 = NV_VGPU_EMUL_FB_SIZE - 0x200000; /* frtsOffset = fbSize - 2MB */
+ val64 = fb_size - 0x200000; /* frtsOffset = fbSize - 2MB */
memcpy(buf + TU104_GSCI_OFF_fwWprLayoutOffset + 8, &val64, 8);
}
@@ -1241,12 +1242,13 @@ static void gsp_rm_handle_get_static_info(struct gsp_emu_context *ctx,
return;
}
- gsp_rm_build_static_info(reply);
+ gsp_rm_build_static_info(reply, nv_vgpu_fb_emul_size(ctx->vgpu));
gsp_rm_apply_static_overlay(ctx, reply);
nv_vgpu_info(ctx->vgpu, "vgsp-rm: GET_GSP_STATIC_INFO seq=%u -> %u bytes (fb=%lluMB, engines=0x%x/0x%x)",
sequence, TU104_GSCI_SIZE,
- (unsigned long long)(NV_VGPU_EMUL_FB_SIZE >> 20), 0x60003E02, 0x362020);
+ (unsigned long long)(nv_vgpu_fb_emul_size(ctx->vgpu) >> 20),
+ 0x60003E02, 0x362020);
if (gsp_rm_send(ctx, GSPRM_RPC_FUNC_GET_GSP_STATIC_INFO, sequence, 0,
reply, TU104_GSCI_SIZE))
@@ -1993,7 +1995,7 @@ static void gsp_rm_handle_kgr_get_context_buffers_info(
*/
static u32 tu104_fb_info_data(struct gsp_emu_context *ctx, u32 index)
{
- u64 fb = NV_VGPU_EMUL_FB_SIZE;
+ u64 fb = nv_vgpu_fb_emul_size(ctx->vgpu);
switch (index) {
case TU104_FB_INFO_IDX_TILE_REGION_COUNT: