diff options
author | Peter Daifuku <pdaifuku@nvidia.com> | 2018-09-27 20:23:37 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-29 02:04:32 -0400 |
commit | 1e125f245e95982d02746aab0fd2b9ea8db009f8 (patch) | |
tree | 4582918af8fbb26c805cb4ad948804f417b38a99 | |
parent | 82baff9f6f3c7bb242d5378e3118763069460033 (diff) |
gpu: nvgpu: support for clk.measure_freq for igpu
Add support for the measure_freq clock op for igpu:
- add nvgpu_clk_measure_freq(), which in turn calls
the get_rate() clock op.
- Initialize the measure_freq clock op to nvgpu_clk_measure_freq()
for native linux and vgpu.
JIRA ESRM-398
Change-Id: I8a3b2ee79e29e3491a16f55281494f05cd841b07
Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1850585
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Nirav Patel <nipatel@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/clk/clk_arb.c | 14 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/clk_arb.h | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/clk.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/clk_vgpu.c | 2 |
4 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_arb.c b/drivers/gpu/nvgpu/clk/clk_arb.c index 3d97535d..6cf005c8 100644 --- a/drivers/gpu/nvgpu/clk/clk_arb.c +++ b/drivers/gpu/nvgpu/clk/clk_arb.c | |||
@@ -1049,6 +1049,20 @@ int nvgpu_clk_arb_get_arbiter_actual_mhz(struct gk20a *g, | |||
1049 | return err; | 1049 | return err; |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | unsigned long nvgpu_clk_measure_freq(struct gk20a *g, u32 api_domain) | ||
1053 | { | ||
1054 | unsigned long freq = 0UL; | ||
1055 | |||
1056 | switch (api_domain) { | ||
1057 | case CTRL_CLK_DOMAIN_GPC2CLK: | ||
1058 | freq = g->ops.clk.get_rate(g, CTRL_CLK_DOMAIN_GPCCLK) * 2UL; | ||
1059 | break; | ||
1060 | default: | ||
1061 | break; | ||
1062 | } | ||
1063 | return freq; | ||
1064 | } | ||
1065 | |||
1052 | int nvgpu_clk_arb_get_arbiter_effective_mhz(struct gk20a *g, | 1066 | int nvgpu_clk_arb_get_arbiter_effective_mhz(struct gk20a *g, |
1053 | u32 api_domain, u16 *freq_mhz) | 1067 | u32 api_domain, u16 *freq_mhz) |
1054 | { | 1068 | { |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h b/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h index a04e3542..43af6312 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h +++ b/drivers/gpu/nvgpu/include/nvgpu/clk_arb.h | |||
@@ -369,6 +369,8 @@ void nvgpu_clk_notification_queue_free(struct gk20a *g, | |||
369 | 369 | ||
370 | void nvgpu_clk_arb_event_post_event(struct nvgpu_clk_dev *dev); | 370 | void nvgpu_clk_arb_event_post_event(struct nvgpu_clk_dev *dev); |
371 | 371 | ||
372 | unsigned long nvgpu_clk_measure_freq(struct gk20a *g, u32 api_domain); | ||
373 | |||
372 | #ifdef CONFIG_DEBUG_FS | 374 | #ifdef CONFIG_DEBUG_FS |
373 | int nvgpu_clk_arb_debugfs_init(struct gk20a *g); | 375 | int nvgpu_clk_arb_debugfs_init(struct gk20a *g); |
374 | #endif | 376 | #endif |
diff --git a/drivers/gpu/nvgpu/os/linux/clk.c b/drivers/gpu/nvgpu/os/linux/clk.c index e76720ac..36c13577 100644 --- a/drivers/gpu/nvgpu/os/linux/clk.c +++ b/drivers/gpu/nvgpu/os/linux/clk.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "platform_gk20a.h" | 26 | #include "platform_gk20a.h" |
27 | 27 | ||
28 | #include <nvgpu/gk20a.h> | 28 | #include <nvgpu/gk20a.h> |
29 | #include <nvgpu/clk_arb.h> | ||
29 | 30 | ||
30 | #define HZ_TO_MHZ(x) ((x) / 1000000) | 31 | #define HZ_TO_MHZ(x) ((x) / 1000000) |
31 | 32 | ||
@@ -280,4 +281,5 @@ void nvgpu_linux_init_clk_support(struct gk20a *g) | |||
280 | g->ops.clk.clk_domain_get_f_points = nvgpu_linux_clk_get_f_points; | 281 | g->ops.clk.clk_domain_get_f_points = nvgpu_linux_clk_get_f_points; |
281 | g->ops.clk.get_clk_range = nvgpu_clk_get_range; | 282 | g->ops.clk.get_clk_range = nvgpu_clk_get_range; |
282 | g->ops.clk.clk_get_round_rate = nvgpu_clk_get_round_rate; | 283 | g->ops.clk.clk_get_round_rate = nvgpu_clk_get_round_rate; |
284 | g->ops.clk.measure_freq = nvgpu_clk_measure_freq; | ||
283 | } | 285 | } |
diff --git a/drivers/gpu/nvgpu/vgpu/clk_vgpu.c b/drivers/gpu/nvgpu/vgpu/clk_vgpu.c index 6aea7c8f..4167f905 100644 --- a/drivers/gpu/nvgpu/vgpu/clk_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/clk_vgpu.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <nvgpu/vgpu/vgpu.h> | 23 | #include <nvgpu/vgpu/vgpu.h> |
24 | #include <nvgpu/vgpu/vgpu_ivc.h> | 24 | #include <nvgpu/vgpu/vgpu_ivc.h> |
25 | #include <nvgpu/clk_arb.h> | ||
25 | 26 | ||
26 | #include "gk20a/gk20a.h" | 27 | #include "gk20a/gk20a.h" |
27 | #include "clk_vgpu.h" | 28 | #include "clk_vgpu.h" |
@@ -214,6 +215,7 @@ void vgpu_init_clk_support(struct gk20a *g) | |||
214 | g->ops.clk.clk_get_round_rate = vgpu_clk_get_round_rate; | 215 | g->ops.clk.clk_get_round_rate = vgpu_clk_get_round_rate; |
215 | g->ops.clk.get_clk_range = vgpu_clk_get_range; | 216 | g->ops.clk.get_clk_range = vgpu_clk_get_range; |
216 | g->ops.clk.clk_domain_get_f_points = vgpu_clk_get_f_points; | 217 | g->ops.clk.clk_domain_get_f_points = vgpu_clk_get_f_points; |
218 | g->ops.clk.measure_freq = nvgpu_clk_measure_freq; | ||
217 | } | 219 | } |
218 | 220 | ||
219 | int vgpu_clk_get_freqs(struct gk20a *g, unsigned long **freqs_out, | 221 | int vgpu_clk_get_freqs(struct gk20a *g, unsigned long **freqs_out, |