gpu: nvgpu: register pm_qos min & max frequency notifiers

nvpmodel updates the devfreq frequency limits as per power requirements
for specific chip. Clock arbiter ignored these limits and set clock
to maximum supported frequency which may lead to leaking power and
over heating.

Add support to get the devfreq limits by registering PM_QOS notifiers.
Note that with this patch we enable CONFIG_GK20A_PM_QOS when PM_DEVFREQ
is enabled. So it will be enabled for all supported kernels (4.9, 4.14
kernels continue to support this. For 5.10+ kernels notifiers added in
this patch will be used. Thermal framework related notifiers for kernels
after 4.14 will not be registered as those use downstream interfaces
that are not available.)

We maintain devfreq min/max limits in the scale profile and update those
in the notifier calls. We use these limits to clamp the frequency in the
clock arbiter.

Bug 3852824

Change-Id: I734a9fb080fee1a91e9b5da071b662dbd9a18682
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2822686
(cherry picked from commit eacaf8cec2)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2822682
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Sagar Kamble
2022-12-05 21:42:12 +05:30
committed by mobile promotions
parent 01eb416745
commit 9726ae3ba8
11 changed files with 267 additions and 13 deletions

View File

@@ -247,6 +247,8 @@ done:
#ifdef CONFIG_GK20A_PM_QOS
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
static int vgpu_qos_notify(struct notifier_block *nb,
unsigned long n, void *data)
{
@@ -299,6 +301,7 @@ static void vgpu_pm_qos_remove(struct device *dev)
g->scale_profile = NULL;
}
#endif
#endif
static int vgpu_pm_init(struct device *dev)
@@ -317,9 +320,11 @@ static int vgpu_pm_init(struct device *dev)
gk20a_scale_init(dev);
#ifdef CONFIG_GK20A_PM_QOS
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
err = vgpu_pm_qos_init(dev);
if (err)
return err;
#endif
#endif
return err;
@@ -519,7 +524,9 @@ int vgpu_remove(struct platform_device *pdev)
nvgpu_mutex_destroy(&l->dmabuf_priv_list_lock);
#ifdef CONFIG_GK20A_PM_QOS
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
vgpu_pm_qos_remove(dev);
#endif
#endif
if (g->remove_support)
g->remove_support(g);