summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
diff options
context:
space:
mode:
authorThomas Steinle <tsteinle@nvidia.com>2021-02-11 07:59:33 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2021-02-25 09:11:02 -0500
commitcc717e314576b7c707dd48597a9b8bebf698c677 (patch)
treebd57c153f28a3899b6e24bd2bbcfe8dd4a2adba6 /drivers/gpu/nvgpu/gk20a/gr_gk20a.c
parent535e9b1dd73cca91bf2217ccce49585c7b1afdeb (diff)
drivers: gk20a: Add gr.ops NULL-ptr check
This fix add NULL-ptr checks for some of the user-accessible ioctl. Bug 3240771 Bug 200696704 Change-Id: Ibe7f75b31b2521a530883253a93ba832f010dc80 Signed-off-by: Thomas Steinle <tsteinle@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2483635 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: Peter Daifuku <pdaifuku@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Phoenix Jung <pjung@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
index 7bcf5281..abb53e66 100644
--- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * GK20A Graphics 2 * GK20A Graphics
3 * 3 *
4 * Copyright (c) 2011-2020, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2011-2021, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
@@ -8851,6 +8851,10 @@ int gr_gk20a_wait_for_pause(struct gk20a *g, struct nvgpu_warpstate *w_state)
8851 u32 gpc, tpc, sm, sm_id; 8851 u32 gpc, tpc, sm, sm_id;
8852 u32 global_mask; 8852 u32 global_mask;
8853 8853
8854 if (!g->ops.gr.get_sm_no_lock_down_hww_global_esr_mask ||
8855 !g->ops.gr.lock_down_sm || !g->ops.gr.bpt_reg_info)
8856 return -EINVAL;
8857
8854 /* Wait for the SMs to reach full stop. This condition is: 8858 /* Wait for the SMs to reach full stop. This condition is:
8855 * 1) All SMs with valid warps must be in the trap handler (SM_IN_TRAP_MODE) 8859 * 1) All SMs with valid warps must be in the trap handler (SM_IN_TRAP_MODE)
8856 * 2) All SMs in the trap handler must have equivalent VALID and PAUSED warp 8860 * 2) All SMs in the trap handler must have equivalent VALID and PAUSED warp
@@ -8908,6 +8912,9 @@ int gr_gk20a_clear_sm_errors(struct gk20a *g)
8908 u32 global_esr; 8912 u32 global_esr;
8909 u32 sm_per_tpc = nvgpu_get_litter_value(g, GPU_LIT_NUM_SM_PER_TPC); 8913 u32 sm_per_tpc = nvgpu_get_litter_value(g, GPU_LIT_NUM_SM_PER_TPC);
8910 8914
8915 if (!g->ops.gr.get_sm_hww_global_esr || !g->ops.gr.clear_sm_hww)
8916 return -EINVAL;
8917
8911 for (gpc = 0; gpc < gr->gpc_count; gpc++) { 8918 for (gpc = 0; gpc < gr->gpc_count; gpc++) {
8912 8919
8913 /* check if any tpc has an exception */ 8920 /* check if any tpc has an exception */