Set the max supported vGPU count according to the number of VFs when SRIOV is supported on Ada. Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Cc: Surath Mitra <smitra@xxxxxxxxxx> Signed-off-by: Zhi Wang <zhiw@xxxxxxxxxx> --- drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c | 4 +++- drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h index c6fe2d9d47de..6e244af1e815 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h @@ -64,6 +64,7 @@ struct nvkm_gsp { } frts, boot, elf, heap; u64 addr; u64 size; + u64 max_vgpu_count; } wpr2; struct { u64 addr; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c index 1e403dbd7323..80d6d73fe352 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c @@ -69,8 +69,10 @@ ad102_gsp_init_fw_heap(struct nvkm_gsp *gsp) num_vfs = pci_sriov_get_totalvfs(device_pci->pdev); if (!num_vfs) nvkm_gsp_init_fw_heap(gsp, 0); - else + else { nvkm_gsp_init_fw_heap(gsp, 576 * SZ_1M); + gsp->fb.wpr2.max_vgpu_count = num_vfs; + } if (gsp->fb.wpr2.heap.size <= SZ_256M) return 0; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c index 5a47201bf0c4..2647a83773d2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c @@ -1968,6 +1968,7 @@ r535_gsp_wpr_meta_init(struct nvkm_gsp *gsp) meta->partitionRpcAddr = 0; meta->partitionRpcRequestOffset = 0; meta->partitionRpcReplyOffset = 0; + meta->gspFwHeapVfPartitionCount = gsp->fb.wpr2.max_vgpu_count; meta->verified = 0; return 0; } -- 2.34.1