gpu: nvgpu: use instance specific config pointer

In gk20a_ctrl_get_num_vsms() and gk20a_ctrl_vsm_mapping() use GR
instance specific config pointer to get number of SMs.

Jira NVGPU-5648

Change-Id: I22b1aa2daf5dfd1524d9fc5c1c1a278a808b59fb
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2436751
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2020-10-22 16:36:14 +05:30
committed by Alex Waterman
parent 7b4bff6ebf
commit 7cdfcbafc0

View File

@@ -934,21 +934,20 @@ static int nvgpu_gpu_ioctl_has_any_exception(
} }
static int gk20a_ctrl_get_num_vsms(struct gk20a *g, static int gk20a_ctrl_get_num_vsms(struct gk20a *g,
struct nvgpu_gpu_num_vsms *args) struct nvgpu_gr_config *gr_config, struct nvgpu_gpu_num_vsms *args)
{ {
args->num_vsms = g->ops.gr.init.get_no_of_sm(g); args->num_vsms = nvgpu_gr_config_get_no_of_sm(gr_config);
return 0; return 0;
} }
static int gk20a_ctrl_vsm_mapping(struct gk20a *g, static int gk20a_ctrl_vsm_mapping(struct gk20a *g,
struct nvgpu_gpu_vsms_mapping *args) struct nvgpu_gr_config *gr_config, struct nvgpu_gpu_vsms_mapping *args)
{ {
int err = 0; int err = 0;
u32 no_of_sm = g->ops.gr.init.get_no_of_sm(g); u32 no_of_sm = nvgpu_gr_config_get_no_of_sm(gr_config);
size_t write_size = no_of_sm * size_t write_size = no_of_sm *
sizeof(struct nvgpu_gpu_vsms_mapping_entry); sizeof(struct nvgpu_gpu_vsms_mapping_entry);
struct nvgpu_gpu_vsms_mapping_entry *vsms_buf; struct nvgpu_gpu_vsms_mapping_entry *vsms_buf;
struct nvgpu_gr_config *gr_config = nvgpu_gr_get_config_ptr(g);
u32 i; u32 i;
vsms_buf = nvgpu_kzalloc(g, write_size); vsms_buf = nvgpu_kzalloc(g, write_size);
@@ -2011,11 +2010,11 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
break; break;
case NVGPU_GPU_IOCTL_NUM_VSMS: case NVGPU_GPU_IOCTL_NUM_VSMS:
err = gk20a_ctrl_get_num_vsms(g, err = gk20a_ctrl_get_num_vsms(g, gr_config,
(struct nvgpu_gpu_num_vsms *)buf); (struct nvgpu_gpu_num_vsms *)buf);
break; break;
case NVGPU_GPU_IOCTL_VSMS_MAPPING: case NVGPU_GPU_IOCTL_VSMS_MAPPING:
err = gk20a_ctrl_vsm_mapping(g, err = gk20a_ctrl_vsm_mapping(g, gr_config,
(struct nvgpu_gpu_vsms_mapping *)buf); (struct nvgpu_gpu_vsms_mapping *)buf);
break; break;