summaryrefslogtreecommitdiffstats
path: root/kernel/bar_emulation.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/bar_emulation.c')
-rw-r--r--kernel/bar_emulation.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/kernel/bar_emulation.c b/kernel/bar_emulation.c
index 2d82303..685831a 100644
--- a/kernel/bar_emulation.c
+++ b/kernel/bar_emulation.c
@@ -309,6 +309,35 @@ int nv_vgpu_bar_emul_init(struct nv_vgpu_device *vgpu)
*(u32 *)((u8 *)ctx->bar0_shadow + 0xC08084) = 0x00000103;
*(u32 *)((u8 *)ctx->bar0_shadow + 0xC08088) = 0x01030000;
+ /*
+ * Per-VF static sizes the driver reads through the VF register window
+ * (GPU_VREG_RD32 = BAR0 + sriovState.virtualRegPhysOffset, 0xB80000
+ * for a non-SRIOV virtual GPU). Both are read-only SIZE registers on
+ * real hardware; we pre-fill them so the local (non-RPC) paths agree
+ * with the GSP_RM_CONTROL replies in gsp_rm_emulation.c.
+ *
+ * 0x3010/0x3030 NV_VIRTUAL_FUNCTION_PRIV_MMU_FAULT_BUFFER_SIZE(0/1):
+ * _VAL is in NVC369_BUF_SIZE (32B) units. 0x800 -> 64KB
+ * replayable, 0x80 -> 4KB legacy; matches TU104_GMMU_*_SIZE.
+ * kgmmuSetAndGetDefaultFaultBufferSize_TU102 writes SET_DEFAULT
+ * (bit30) and reads _VAL back, so a pre-filled _VAL is all it
+ * needs.
+ * 0x3110 NV_VIRTUAL_FUNCTION_PRIV_ACCESS_COUNTER_NOTIFY_BUFFER_SIZE:
+ * UVM's uvmGetAccessCounterBufferSize_TU102 multiplies it by
+ * NV_ACCESS_COUNTER_NOTIFY_BUF_SIZE (32B). 0x1000 -> 128KB, the
+ * value the host's physical TU104 reports. Zero makes the
+ * access-counter buffer a 0-byte allocation and cuInit fails in
+ * uvmInitializeAccessCntrBuffer.
+ */
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0xB83010) = 0x00000800;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0xB83030) = 0x00000080;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0x003010) = 0x00000800;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0x003030) = 0x00000080;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0xB83110) = 0x00001000;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0x003110) = 0x00001000;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0xB8311C) = 0x00000000;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0xB83118) = 0x00000000;
+
/*
* Serve a valid VBIOS at the PROM window (BAR0+0x300000).