GSP firmware needs to know the number of max-supported vGPUs when
initialization.

The field of VF partition count in the GSP WPR2 is required to be set
according to the number of max-supported vGPUs.

Set the VF partition count in the GSP WPR2 when NVKM is loading the GSP
firmware and initializes the GSP WPR2, if vGPU is enabled.

Cc: Neo Jia <c...@nvidia.com>
Cc: Surath Mitra <smi...@nvidia.com>
Signed-off-by: Zhi Wang <z...@nvidia.com>
---
 drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 1 +
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c    | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h 
b/drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h
index 3fbc57b16a05..f52143df45c1 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h
@@ -61,6 +61,7 @@ struct nvkm_gsp {
                        } frts, boot, elf, heap;
                        u64 addr;
                        u64 size;
+                       u8 vf_partition_count;
                } wpr2;
                struct {
                        u64 addr;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
index a38a6abcac6f..14fc152d6859 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
@@ -2037,6 +2037,7 @@ r535_gsp_wpr_meta_init(struct nvkm_gsp *gsp)
        meta->vgaWorkspaceOffset = gsp->fb.bios.vga_workspace.addr;
        meta->vgaWorkspaceSize = gsp->fb.bios.vga_workspace.size;
        meta->bootCount = 0;
+       meta->gspFwHeapVfPartitionCount = gsp->fb.wpr2.vf_partition_count;
        meta->partitionRpcAddr = 0;
        meta->partitionRpcRequestOffset = 0;
        meta->partitionRpcReplyOffset = 0;
@@ -2640,6 +2641,7 @@ r535_gsp_oneinit(struct nvkm_gsp *gsp)
 
        if (nvkm_vgpu_mgr_is_supported(device)) {
                gsp->fb.wpr2.heap.size = SZ_256M;
+               gsp->fb.wpr2.vf_partition_count = NVIDIA_MAX_VGPUS;
        } else {
 
                u32 fb_size_gb = DIV_ROUND_UP_ULL(gsp->fb.size, 1 << 30);
-- 
2.34.1

Reply via email to