From 234835b9d1b74b318a8d976cd5284697cf99fff1 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 8 Jun 2017 09:24:17 -0700 Subject: gpu: nvgpu: Move devfreq field to os_linux Move devfreq field from struct gk20a to os_linux. It's a Linux specific framework. JIRA NVGPU-38 Change-Id: I1e00f5a80e31deb4aaba379274c3a7a7b04d963b Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/1505176 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/os_linux.h | 2 ++ drivers/gpu/nvgpu/gk20a/gk20a.h | 2 -- drivers/gpu/nvgpu/gk20a/gk20a_scale.c | 30 +++++++++++++++++++----------- drivers/gpu/nvgpu/vgpu/vgpu.c | 7 ++++--- 4 files changed, 25 insertions(+), 16 deletions(-) (limited to 'drivers/gpu/nvgpu') diff --git a/drivers/gpu/nvgpu/common/linux/os_linux.h b/drivers/gpu/nvgpu/common/linux/os_linux.h index a61d07e6..e39d3c4d 100644 --- a/drivers/gpu/nvgpu/common/linux/os_linux.h +++ b/drivers/gpu/nvgpu/common/linux/os_linux.h @@ -65,6 +65,8 @@ struct nvgpu_os_linux { dev_t cdev_region; + struct devfreq *devfreq; + struct device_dma_parameters dma_parms; }; diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index c53e83dd..c1898d2c 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -1186,8 +1186,6 @@ struct gk20a { struct nvgpu_spinlock items_lock; } channel_worker; - struct devfreq *devfreq; - struct gk20a_scale_profile *scale_profile; unsigned long last_freq; diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c index 160776bc..df4e4996 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c @@ -28,8 +28,8 @@ #include "gk20a.h" #include "platform_gk20a.h" -#include "clk_gk20a.h" #include "gk20a_scale.h" +#include "common/linux/os_linux.h" /* * gk20a_scale_qos_notify() @@ -46,7 +46,8 @@ int gk20a_scale_qos_notify(struct notifier_block *nb, container_of(nb, struct gk20a_scale_profile, qos_notify_block); struct gk20a *g = get_gk20a(profile->dev); - struct devfreq *devfreq = g->devfreq; + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); + struct devfreq *devfreq = l->devfreq; if (!devfreq) return NOTIFY_OK; @@ -79,6 +80,7 @@ int gk20a_scale_qos_notify(struct notifier_block *nb, qos_notify_block); struct gk20a_platform *platform = dev_get_drvdata(profile->dev); struct gk20a *g = get_gk20a(profile->dev); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); unsigned long freq; if (!platform->postscale) @@ -88,8 +90,8 @@ int gk20a_scale_qos_notify(struct notifier_block *nb, * has higher demand than qos */ freq = platform->clk_round_rate(profile->dev, (u32)pm_qos_read_min_bound(PM_QOS_GPU_FREQ_BOUNDS)); - if (g->devfreq) - freq = max(g->devfreq->previous_freq, freq); + if (l->devfreq) + freq = max(l->devfreq->previous_freq, freq); /* Update gpu load because we may scale the emc target * if the gpu load changed. */ @@ -138,8 +140,9 @@ static int gk20a_scale_target(struct device *dev, unsigned long *freq, { struct gk20a_platform *platform = dev_get_drvdata(dev); struct gk20a *g = platform->g; + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct gk20a_scale_profile *profile = g->scale_profile; - struct devfreq *devfreq = g->devfreq; + struct devfreq *devfreq = l->devfreq; unsigned long local_freq = *freq; unsigned long rounded_rate; unsigned long min_freq = 0, max_freq = 0; @@ -236,7 +239,8 @@ static void update_load_estimate_gpmu(struct device *dev) void gk20a_scale_suspend(struct device *dev) { struct gk20a *g = get_gk20a(dev); - struct devfreq *devfreq = g->devfreq; + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); + struct devfreq *devfreq = l->devfreq; if (!devfreq) return; @@ -253,7 +257,8 @@ void gk20a_scale_suspend(struct device *dev) void gk20a_scale_resume(struct device *dev) { struct gk20a *g = get_gk20a(dev); - struct devfreq *devfreq = g->devfreq; + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); + struct devfreq *devfreq = l->devfreq; if (!devfreq) return; @@ -272,8 +277,9 @@ void gk20a_scale_resume(struct device *dev) static void gk20a_scale_notify(struct device *dev, bool busy) { struct gk20a *g = get_gk20a(dev); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct gk20a_scale_profile *profile = g->scale_profile; - struct devfreq *devfreq = g->devfreq; + struct devfreq *devfreq = l->devfreq; /* Is the device profile initialised? */ if (!(profile && devfreq)) @@ -355,6 +361,7 @@ void gk20a_scale_init(struct device *dev) { struct gk20a_platform *platform = dev_get_drvdata(dev); struct gk20a *g = platform->g; + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct gk20a_scale_profile *profile; int err; @@ -398,7 +405,7 @@ void gk20a_scale_init(struct device *dev) if (IS_ERR(devfreq)) devfreq = NULL; - g->devfreq = devfreq; + l->devfreq = devfreq; } /* Should we register QoS callback for this device? */ @@ -422,6 +429,7 @@ void gk20a_scale_exit(struct device *dev) { struct gk20a_platform *platform = dev_get_drvdata(dev); struct gk20a *g = platform->g; + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); int err; if (platform->qos_notify) { @@ -432,8 +440,8 @@ void gk20a_scale_exit(struct device *dev) } if (platform->devfreq_governor) { - err = devfreq_remove_device(g->devfreq); - g->devfreq = NULL; + err = devfreq_remove_device(l->devfreq); + l->devfreq = NULL; } nvgpu_kfree(g, g->scale_profile); diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c index f2abb76b..559ba4ea 100644 --- a/drivers/gpu/nvgpu/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/vgpu.c @@ -568,6 +568,7 @@ static void vgpu_pm_qos_remove(struct device *dev) static int vgpu_pm_init(struct device *dev) { struct gk20a *g = get_gk20a(dev); + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); unsigned long *freqs; int num_freqs; int err = 0; @@ -579,7 +580,7 @@ static int vgpu_pm_init(struct device *dev) if (IS_ENABLED(CONFIG_GK20A_DEVFREQ)) gk20a_scale_init(dev); - if (g->devfreq) { + if (l->devfreq) { /* set min/max frequency based on frequency table */ err = vgpu_clk_get_freqs(dev, &freqs, &num_freqs); if (err) @@ -588,8 +589,8 @@ static int vgpu_pm_init(struct device *dev) if (num_freqs < 1) return -EINVAL; - g->devfreq->min_freq = freqs[0]; - g->devfreq->max_freq = freqs[num_freqs - 1]; + l->devfreq->min_freq = freqs[0]; + l->devfreq->max_freq = freqs[num_freqs - 1]; } err = vgpu_pm_qos_init(dev); -- cgit v1.2.2