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.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel/bar_emulation.c b/kernel/bar_emulation.c
index eaa006c..3448b8c 100644
--- a/kernel/bar_emulation.c
+++ b/kernel/bar_emulation.c
@@ -280,6 +280,36 @@ int nv_vgpu_bar_emul_init(struct nv_vgpu_device *vgpu)
*(u32 *)((u8 *)ctx->bar0_shadow + 0x100ce0) = 0x00000018;
/*
+ * NV_PCFG (BAR0+0x88000) - PCI config space mirror the driver reads
+ * via gpuReadBusConfigReg_HAL (GPU_BUS_CFG_RD32):
+ * 0x88084 NV_XVE_LINK_CAPABILITIES: MAX_LINK_SPEED 3:0 = 3 (8 GT/s,
+ * Gen3), MAX_LINK_WIDTH 9:4 = 0x10 (x16).
+ * 0x88088 NV_XVE_LINK_CONTROL_STATUS: negotiated speed 19:16 = 3,
+ * negotiated width 25:20 = 0x10 (x16).
+ * UVM's nvGpuOpsDeviceCreate -> getPCIELinkRateMBps ->
+ * kbifControlGetPCIEInfo -> kbifGetGpuLinkCapabilities reads 0x88084;
+ * zeros make calculatePCIELinkRateMBps log "Unknown PCIe speed" and
+ * return NV_ERR_INVALID_STATE, which fails cuInit
+ * (CUDA_ERROR_NOT_INITIALIZED in the guest).
+ *
+ * DEVICE_BASE(NV_PCFG) expands to 0 in this driver (nvmisc.h:
+ * "#define DEVICE_BASE(d) (0?d)"), so the read is actually
+ * gpuNvAddr + 0x84 - mirror the values at the low alias as well.
+ */
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0x88084) = 0x00000103;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0x88088) = 0x01030000;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0x00084) = 0x00000103;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0x00088) = 0x01030000;
+ /* Same values under the VF register window aliases, in case this
+ * driver reaches the config mirror through virtualRegPhysOffset. */
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0xB80084) = 0x00000103;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0xB80088) = 0x01030000;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0xB88084) = 0x00000103;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0xB88088) = 0x01030000;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0xC08084) = 0x00000103;
+ *(u32 *)((u8 *)ctx->bar0_shadow + 0xC08088) = 0x01030000;
+
+ /*
* Serve a valid VBIOS at the PROM window (BAR0+0x300000).
*
* The guest driver's physical GSP boot (kgspInitRm -> TU102 path)