mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: update vsms_mapping ioctl
Update vsms_mapping ioctl to copy from the internal sm_to_cluster array to new nvgpu_gpu_vsms_mapping_entry array before copying the latter back to user. Bug 200260086 Change-Id: I0fccc6fb6e0d6b6f737b3a44818d2b47438cd3c8 Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com> Reviewed-on: http://git-master/r/1266174 (cherry picked from commit e28882c05491cb8f9573ff71c2d7309e5714e385) Reviewed-on: http://git-master/r/1269623 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
8ef013e36e
commit
1b539a33d8
@@ -582,11 +582,24 @@ static int gk20a_ctrl_vsm_mapping(struct gk20a *g,
|
||||
{
|
||||
int err = 0;
|
||||
struct gr_gk20a *gr = &g->gr;
|
||||
size_t write_size = gr->no_of_sm * sizeof(struct sm_info);
|
||||
size_t write_size = gr->no_of_sm *
|
||||
sizeof(struct nvgpu_gpu_vsms_mapping_entry);
|
||||
struct nvgpu_gpu_vsms_mapping_entry *vsms_buf;
|
||||
u32 i;
|
||||
|
||||
vsms_buf = kzalloc(write_size, GFP_KERNEL);
|
||||
if (vsms_buf == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < gr->no_of_sm; i++) {
|
||||
vsms_buf[i].gpc_index = gr->sm_to_cluster[i].gpc_index;
|
||||
vsms_buf[i].tpc_index = gr->sm_to_cluster[i].tpc_index;
|
||||
}
|
||||
|
||||
err = copy_to_user((void __user *)(uintptr_t)
|
||||
args->vsms_map_buf_addr,
|
||||
gr->sm_to_cluster, write_size);
|
||||
vsms_buf, write_size);
|
||||
kfree(vsms_buf);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -383,6 +383,11 @@ struct nvgpu_gpu_num_vsms {
|
||||
__u32 reserved;
|
||||
};
|
||||
|
||||
struct nvgpu_gpu_vsms_mapping_entry {
|
||||
__u8 gpc_index;
|
||||
__u8 tpc_index;
|
||||
};
|
||||
|
||||
struct nvgpu_gpu_vsms_mapping {
|
||||
__u64 vsms_map_buf_addr;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user