From 9e9046f03cf3125067666dc652499a4b7f39d9c0 Mon Sep 17 00:00:00 2001 From: Peter Daifuku Date: Tue, 14 Jan 2020 11:14:38 -0800 Subject: gpu: nvgpu: add struct nvgpu_sched_ctrl to gk20a Add struct nvgpu_sched_ctrl to struct gk20a Delete struct gk20a_sched_ctrl from struct nvgpu_os_linux Update sched_ctrl functions to use the nvgpu_sched_ctrl struct Bug 200576520 Change-Id: I35b13219e5ef0a8a03333dfd7d46e1d308aec541 Signed-off-by: Peter Daifuku Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2279152 Reviewed-by: Thomas Fleury Reviewed-by: Satish Arora Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/include/nvgpu/gk20a.h | 4 +++- drivers/gpu/nvgpu/include/nvgpu/sched.h | 42 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/nvgpu/include/nvgpu/sched.h (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h index 238329be..a0af0c5c 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2020, NVIDIA CORPORATION. All rights reserved. * * GK20A Graphics * @@ -71,6 +71,7 @@ struct nvgpu_setup_bind_args; #include #include #include +#include #include "gk20a/clk_gk20a.h" #include "gk20a/ce2_gk20a.h" @@ -1478,6 +1479,7 @@ struct gk20a { struct pmgr_pmupstate pmgr_pmu; struct therm_pmupstate therm_pmu; struct nvgpu_sec2 sec2; + struct nvgpu_sched_ctrl sched_ctrl; #ifdef CONFIG_DEBUG_FS struct railgate_stats pstats; diff --git a/drivers/gpu/nvgpu/include/nvgpu/sched.h b/drivers/gpu/nvgpu/include/nvgpu/sched.h new file mode 100644 index 00000000..c49b7d1a --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/sched.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#ifndef __NVGPU_SCHED_COMMON_H +#define __NVGPU_SCHED_COMMON_H + +struct nvgpu_sched_ctrl { + struct nvgpu_mutex control_lock; + bool control_locked; + bool sw_ready; + struct nvgpu_mutex status_lock; + struct nvgpu_mutex busy_lock; + + u64 status; + + size_t bitmap_size; + u64 *active_tsg_bitmap; + u64 *recent_tsg_bitmap; + u64 *ref_tsg_bitmap; + + struct nvgpu_cond readout_wq; +}; + +#endif /* __NVGPU_SCHED_COMMON_H */ -- cgit v1.2.2