diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmu/perf.h b/drivers/gpu/nvgpu/include/nvgpu/pmu/perf.h new file mode 100644 index 000000000..537fb2936 --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/pmu/perf.h @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2016-2019, 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_PMU_PERF_H +#define NVGPU_PMU_PERF_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct gk20a; + +struct nvgpu_vfe_invalidate { + bool state_change; + struct nvgpu_cond wq; + struct nvgpu_thread state_task; +}; + +struct vfe_vars { + struct boardobjgrp_e32 super; + u8 polling_periodms; +}; + +struct vfe_equs { + struct boardobjgrp_e255 super; +}; + +struct change_seq_pmu_script { + struct perf_change_seq_pmu_script buf; + u32 super_surface_offset; +}; + +struct change_seq { + u8 version; + bool b_enabled_pmu_support; + u32 thread_seq_id_last; + u64 thread_carry_over_timens; + struct ctrl_perf_change_seq_change last_pstate_values; + struct boardobjgrpmask_e32 clk_domains_exclusion_mask; + struct boardobjgrpmask_e32 clk_domains_inclusion_mask; + u32 client_lock_mask; +}; + +struct change_seq_pmu { + struct change_seq super; + bool b_lock; + bool b_vf_point_check_ignore; + u32 cpu_adverised_step_id_mask; + u32 cpu_step_id_mask; + u32 event_mask_pending; + u32 event_mask_received; + u32 last_completed_change_Seq_id; + struct change_seq_pmu_script script_curr; + struct change_seq_pmu_script script_last; + struct change_seq_pmu_script script_query; +}; + +struct perf_pmupstate { + struct vfe_vars vfe_varobjs; + struct vfe_equs vfe_equobjs; + struct pstates pstatesobjs; + struct obj_volt volt; + struct obj_lwpr lpwr; + struct nvgpu_vfe_invalidate vfe_init; + struct change_seq_pmu changeseq_pmu; +}; + +int perf_pmu_vfe_load(struct gk20a *g); +int perf_pmu_init_pmupstate(struct gk20a *g); +void perf_pmu_free_pmupstate(struct gk20a *g); + +int vfe_equ_sw_setup(struct gk20a *g); +int vfe_equ_pmu_setup(struct gk20a *g); + +int vfe_var_sw_setup(struct gk20a *g); +int vfe_var_pmu_setup(struct gk20a *g); + +int nvgpu_perf_change_seq_sw_setup(struct gk20a *g); +int nvgpu_perf_change_seq_pmu_setup(struct gk20a *g); + +#endif /* NVGPU_PMU_PERF_H */ diff --git a/drivers/gpu/nvgpu/lpwr/lpwr.c b/drivers/gpu/nvgpu/lpwr/lpwr.c index 11f0de40c..49d83cfa0 100644 --- a/drivers/gpu/nvgpu/lpwr/lpwr.c +++ b/drivers/gpu/nvgpu/lpwr/lpwr.c @@ -26,9 +26,9 @@ #include #include #include +#include #include "gp106/bios_gp106.h" -#include "pmu_perf/pmu_perf.h" #include "lpwr.h" static int get_lpwr_idx_table(struct gk20a *g) diff --git a/drivers/gpu/nvgpu/pmu_perf/change_seq.c b/drivers/gpu/nvgpu/pmu_perf/change_seq.c index 383f8b729..b672188b5 100644 --- a/drivers/gpu/nvgpu/pmu_perf/change_seq.c +++ b/drivers/gpu/nvgpu/pmu_perf/change_seq.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "pmu_perf.h" diff --git a/drivers/gpu/nvgpu/pmu_perf/change_seq.h b/drivers/gpu/nvgpu/pmu_perf/change_seq.h index b82f0ef57..ba45a6d6e 100644 --- a/drivers/gpu/nvgpu/pmu_perf/change_seq.h +++ b/drivers/gpu/nvgpu/pmu_perf/change_seq.h @@ -25,39 +25,4 @@ #ifndef NVGPU_CHANGE_SEQ_H #define NVGPU_CHANGE_SEQ_H -#include - -struct change_seq_pmu_script { - struct perf_change_seq_pmu_script buf; - u32 super_surface_offset; -}; - -struct change_seq { - u8 version; - bool b_enabled_pmu_support; - u32 thread_seq_id_last; - u64 thread_carry_over_timens; - struct ctrl_perf_change_seq_change last_pstate_values; - struct boardobjgrpmask_e32 clk_domains_exclusion_mask; - struct boardobjgrpmask_e32 clk_domains_inclusion_mask; - u32 client_lock_mask; -}; - -struct change_seq_pmu { - struct change_seq super; - bool b_lock; - bool b_vf_point_check_ignore; - u32 cpu_adverised_step_id_mask; - u32 cpu_step_id_mask; - u32 event_mask_pending; - u32 event_mask_received; - u32 last_completed_change_Seq_id; - struct change_seq_pmu_script script_curr; - struct change_seq_pmu_script script_last; - struct change_seq_pmu_script script_query; -}; - -int nvgpu_perf_change_seq_sw_setup(struct gk20a *g); -int nvgpu_perf_change_seq_pmu_setup(struct gk20a *g); - #endif /* NVGPU_CHANGE_SEQ_H */ diff --git a/drivers/gpu/nvgpu/pmu_perf/perf_gv100.c b/drivers/gpu/nvgpu/pmu_perf/perf_gv100.c index 4b7515c98..ce5bd09cd 100644 --- a/drivers/gpu/nvgpu/pmu_perf/perf_gv100.c +++ b/drivers/gpu/nvgpu/pmu_perf/perf_gv100.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "perf_gv100.h" #include "pmu_perf.h" diff --git a/drivers/gpu/nvgpu/pmu_perf/perf_tu104.c b/drivers/gpu/nvgpu/pmu_perf/perf_tu104.c index c5c4a0dd0..faa92a64a 100644 --- a/drivers/gpu/nvgpu/pmu_perf/perf_tu104.c +++ b/drivers/gpu/nvgpu/pmu_perf/perf_tu104.c @@ -26,6 +26,8 @@ #include #include #include +#include + #include "perf_tu104.h" #include "pmu_perf/pmu_perf.h" diff --git a/drivers/gpu/nvgpu/pmu_perf/pmu_perf.c b/drivers/gpu/nvgpu/pmu_perf/pmu_perf.c index 29a8aabc4..c39aa8228 100644 --- a/drivers/gpu/nvgpu/pmu_perf/pmu_perf.c +++ b/drivers/gpu/nvgpu/pmu_perf/pmu_perf.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "pmu_perf.h" diff --git a/drivers/gpu/nvgpu/pmu_perf/pmu_perf.h b/drivers/gpu/nvgpu/pmu_perf/pmu_perf.h index 07a4a372e..680a7a83a 100644 --- a/drivers/gpu/nvgpu/pmu_perf/pmu_perf.h +++ b/drivers/gpu/nvgpu/pmu_perf/pmu_perf.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2019, 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"), @@ -19,17 +19,8 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ -#ifndef NVGPU_PERF_H -#define NVGPU_PERF_H - -#include -#include -#include -#include - -#include "vfe_equ.h" -#include "vfe_var.h" -#include "change_seq.h" +#ifndef NVGPU_PMU_PERF_PERF_H +#define NVGPU_PMU_PERF_PERF_H #define CTRL_PERF_VFE_VAR_TYPE_INVALID 0x00U #define CTRL_PERF_VFE_VAR_TYPE_DERIVED 0x01U @@ -72,26 +63,4 @@ #define CTRL_PERF_VFE_EQU_COMPARE_FUNCTION_GREATER_EQ 0x01U #define CTRL_PERF_VFE_EQU_COMPARE_FUNCTION_GREATER 0x02U -struct gk20a; - -struct nvgpu_vfe_invalidate { - bool state_change; - struct nvgpu_cond wq; - struct nvgpu_thread state_task; -}; - -struct perf_pmupstate { - struct vfe_vars vfe_varobjs; - struct vfe_equs vfe_equobjs; - struct pstates pstatesobjs; - struct obj_volt volt; - struct obj_lwpr lpwr; - struct nvgpu_vfe_invalidate vfe_init; - struct change_seq_pmu changeseq_pmu; -}; - -int perf_pmu_init_pmupstate(struct gk20a *g); -void perf_pmu_free_pmupstate(struct gk20a *g); -int perf_pmu_vfe_load(struct gk20a *g); - -#endif /* NVGPU_PERF_H */ +#endif /* NVGPU_PMU_PERF_PERF_H */ diff --git a/drivers/gpu/nvgpu/pmu_perf/vfe_equ.c b/drivers/gpu/nvgpu/pmu_perf/vfe_equ.c index 4672864c6..fa881736f 100644 --- a/drivers/gpu/nvgpu/pmu_perf/vfe_equ.c +++ b/drivers/gpu/nvgpu/pmu_perf/vfe_equ.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "pmu_perf.h" #include "vfe_equ.h" diff --git a/drivers/gpu/nvgpu/pmu_perf/vfe_equ.h b/drivers/gpu/nvgpu/pmu_perf/vfe_equ.h index 0904afc24..bba7ca091 100644 --- a/drivers/gpu/nvgpu/pmu_perf/vfe_equ.h +++ b/drivers/gpu/nvgpu/pmu_perf/vfe_equ.h @@ -28,9 +28,6 @@ #include "vfe_var.h" #include -int vfe_equ_sw_setup(struct gk20a *g); -int vfe_equ_pmu_setup(struct gk20a *g); - #define VFE_EQU_GET(_pperf, _idx) \ ((struct vfe_equ *)BOARDOBJGRP_OBJ_GET_BY_IDX( \ &((_pperf)->vfe.equs.super.super), (_idx))) @@ -57,10 +54,6 @@ struct vfe_equ { bool b_is_dynamic; }; -struct vfe_equs { - struct boardobjgrp_e255 super; -}; - struct vfe_equ_compare { struct vfe_equ super; u8 func_id; diff --git a/drivers/gpu/nvgpu/pmu_perf/vfe_var.c b/drivers/gpu/nvgpu/pmu_perf/vfe_var.c index e50816485..d63434b64 100644 --- a/drivers/gpu/nvgpu/pmu_perf/vfe_var.c +++ b/drivers/gpu/nvgpu/pmu_perf/vfe_var.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "pmu_perf.h" #include "vfe_var.h" diff --git a/drivers/gpu/nvgpu/pmu_perf/vfe_var.h b/drivers/gpu/nvgpu/pmu_perf/vfe_var.h index 680deb55f..b7d9fb413 100644 --- a/drivers/gpu/nvgpu/pmu_perf/vfe_var.h +++ b/drivers/gpu/nvgpu/pmu_perf/vfe_var.h @@ -28,9 +28,6 @@ #include #include -int vfe_var_sw_setup(struct gk20a *g); -int vfe_var_pmu_setup(struct gk20a *g); - #define VFE_VAR_GET(_pperf, _idx) \ ((struct vfe_var)BOARDOBJGRP_OBJ_GET_BY_IDX( \ &((_pperf)->vfe.vars.super.super), (_idx))) @@ -48,11 +45,6 @@ struct vfe_var { bool b_is_dynamic; }; -struct vfe_vars { - struct boardobjgrp_e32 super; - u8 polling_periodms; -}; - struct vfe_var_derived { struct vfe_var super; }; diff --git a/drivers/gpu/nvgpu/pstate/pstate.c b/drivers/gpu/nvgpu/pstate/pstate.c index 6cec7899d..b985b4483 100644 --- a/drivers/gpu/nvgpu/pstate/pstate.c +++ b/drivers/gpu/nvgpu/pstate/pstate.c @@ -28,9 +28,7 @@ #include #include #include - -#include "pmu_perf/pmu_perf.h" -#include "pmu_perf/change_seq.h" +#include #include "pstate.h" diff --git a/drivers/gpu/nvgpu/volt/volt_dev.c b/drivers/gpu/nvgpu/volt/volt_dev.c index 81a1133dc..a57f3d1ab 100644 --- a/drivers/gpu/nvgpu/volt/volt_dev.c +++ b/drivers/gpu/nvgpu/volt/volt_dev.c @@ -30,8 +30,8 @@ #include #include #include +#include -#include "pmu_perf/pmu_perf.h" #include "gp106/bios_gp106.h" #include "volt.h" diff --git a/drivers/gpu/nvgpu/volt/volt_pmu.c b/drivers/gpu/nvgpu/volt/volt_pmu.c index f36599c00..65adaea49 100644 --- a/drivers/gpu/nvgpu/volt/volt_pmu.c +++ b/drivers/gpu/nvgpu/volt/volt_pmu.c @@ -28,8 +28,8 @@ #include #include #include +#include -#include "pmu_perf/pmu_perf.h" #include "gp106/bios_gp106.h" #include "volt.h" diff --git a/drivers/gpu/nvgpu/volt/volt_policy.c b/drivers/gpu/nvgpu/volt/volt_policy.c index 0433d6f46..1cabb7a91 100644 --- a/drivers/gpu/nvgpu/volt/volt_policy.c +++ b/drivers/gpu/nvgpu/volt/volt_policy.c @@ -26,8 +26,8 @@ #include #include #include +#include -#include "pmu_perf/pmu_perf.h" #include "gp106/bios_gp106.h" #include "volt.h" diff --git a/drivers/gpu/nvgpu/volt/volt_rail.c b/drivers/gpu/nvgpu/volt/volt_rail.c index bc20ba50e..49401eb74 100644 --- a/drivers/gpu/nvgpu/volt/volt_rail.c +++ b/drivers/gpu/nvgpu/volt/volt_rail.c @@ -26,8 +26,8 @@ #include #include #include +#include -#include "pmu_perf/pmu_perf.h" #include "gp106/bios_gp106.h" #include "volt.h"