To support the maximum vGPUs on the device that support SRIOV, a larger WPR2 heap size is required. On Ada with SRIOV supported, the size should be set to at least 549MB. By setting the WPR2 heap size up to 549MB, the scrubber ucode image is required to scrub the FB memory before any other ucode image is executed. Override the default WPR2 heap size on Ada when SRIOV is supported. Set the WPR2 heap size up to 576MB when SRIOV is supported on Ada. Cc: Milos Tijanic <mtijanic@xxxxxxxxxx> Signed-off-by: Zhi Wang <zhiw@xxxxxxxxxx> --- drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c index 3ba67eab08d7..1e403dbd7323 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ad102.c @@ -20,6 +20,7 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include <core/pci.h> #include <engine/sec2.h> #include "priv.h" @@ -58,9 +59,18 @@ ad102_execute_scrubber(struct nvkm_gsp *gsp) static int ad102_gsp_init_fw_heap(struct nvkm_gsp *gsp) { + struct nvkm_subdev *subdev = &gsp->subdev; + struct nvkm_device *device = subdev->device; + struct nvkm_device_pci *device_pci = container_of(device, + typeof(*device_pci), device); + int num_vfs; int ret; - nvkm_gsp_init_fw_heap(gsp, 0); + num_vfs = pci_sriov_get_totalvfs(device_pci->pdev); + if (!num_vfs) + nvkm_gsp_init_fw_heap(gsp, 0); + else + nvkm_gsp_init_fw_heap(gsp, 576 * SZ_1M); if (gsp->fb.wpr2.heap.size <= SZ_256M) return 0; -- 2.34.1