From 78e3d22da3c2513d425c8c2560468ce854a982dd Mon Sep 17 00:00:00 2001 From: Aparna Das Date: Tue, 11 Sep 2018 17:11:44 -0700 Subject: gpu: nvgpu: vgpu: support clk-arb 1. Implement the following vgpu functions to support clk-arb: - vgpu_clk_get_range() to return min and max freqs from supported frequencies - implement vgpu_clk_get_round_rate() which sets rounded rate to input rate. Rounding is handled in RM Server - modify vgpu_clk_get_freqs() to retrieve freq table in IVM memory instead of copying the value in array as part of cmd message. 2. Add support for clk-arb related HALs for vgpu. 3. support_clk_freq_controller is assigned true for vgpu provided guest VM has the privilege to set clock frequency. Bug 200422845 Bug 2363882 Jira EVLR-3254 Change-Id: I91fc392db381c5db1d52b19d45ec0481fdc27554 Signed-off-by: Aparna Das Reviewed-on: https://git-master.nvidia.com/r/1812379 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'drivers/gpu/nvgpu/os') diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c index e01178ed..aa2fa998 100644 --- a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c +++ b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "vgpu_linux.h" #include "vgpu/fecs_trace_vgpu.h" @@ -72,12 +73,19 @@ static void vgpu_remove_support(struct gk20a *g) static void vgpu_init_vars(struct gk20a *g, struct gk20a_platform *platform) { struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); + struct vgpu_priv_data *priv = vgpu_get_priv_data(g); nvgpu_mutex_init(&g->power_lock); nvgpu_mutex_init(&g->ctxsw_disable_lock); + nvgpu_mutex_init(&g->clk_arb_enable_lock); + + nvgpu_mutex_init(&priv->vgpu_clk_get_freq_lock); + l->regs_saved = l->regs; l->bar1_saved = l->bar1; + nvgpu_atomic_set(&g->clk_arb_global_nr, 0); + g->aggressive_sync_destroy = platform->aggressive_sync_destroy; g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh; __nvgpu_set_enabled(g, NVGPU_HAS_SYNCPOINTS, platform->has_syncpoints); @@ -206,6 +214,12 @@ int vgpu_pm_finalize_poweron(struct device *dev) goto done; } + err = nvgpu_clk_arb_init_arbiter(g); + if (err) { + nvgpu_err(g, "failed to init clk arb"); + goto done; + } + err = g->ops.chip_init_gpu_characteristics(g); if (err) { nvgpu_err(g, "failed to init gk20a gpu characteristics"); -- cgit v1.2.2