From: Rob Clark <robdclark@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
Rob Clark <robdclark@chromium.org>,
Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 2/2] drm/msm/gpu: Respect PM QoS constraints
Date: Wed, 3 Nov 2021 14:04:02 -0700 [thread overview]
Message-ID: <20211103210402.623099-2-robdclark@gmail.com> (raw)
In-Reply-To: <20211103210402.623099-1-robdclark@gmail.com>
From: Rob Clark <robdclark@chromium.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
---
drivers/gpu/drm/msm/msm_gpu_devfreq.c | 31 +++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_gpu_devfreq.c b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
index b24e5475cafb..427c55002f4d 100644
--- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c
+++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
@@ -158,6 +158,33 @@ void msm_devfreq_suspend(struct msm_gpu *gpu)
devfreq_suspend_device(gpu->devfreq.devfreq);
}
+static void set_target(struct msm_gpu *gpu, unsigned long freq)
+{
+ struct msm_gpu_devfreq *df = &gpu->devfreq;
+ unsigned long min_freq, max_freq;
+ u32 flags = 0;
+
+ /*
+ * When setting the target freq internally, we need to apply PM QoS
+ * constraints (such as cooling):
+ */
+ min_freq = dev_pm_qos_read_value(df->devfreq->dev.parent,
+ DEV_PM_QOS_MIN_FREQUENCY);
+ max_freq = dev_pm_qos_read_value(df->devfreq->dev.parent,
+ DEV_PM_QOS_MAX_FREQUENCY);
+
+ if (freq < min_freq) {
+ freq = min_freq;
+ flags &= ~DEVFREQ_FLAG_LEAST_UPPER_BOUND; /* Use GLB */
+ }
+ if (freq > max_freq) {
+ freq = max_freq;
+ flags |= DEVFREQ_FLAG_LEAST_UPPER_BOUND; /* Use LUB */
+ }
+
+ msm_devfreq_target(&gpu->pdev->dev, &freq, flags);
+}
+
void msm_devfreq_boost(struct msm_gpu *gpu, unsigned factor)
{
struct msm_gpu_devfreq *df = &gpu->devfreq;
@@ -173,7 +200,7 @@ void msm_devfreq_boost(struct msm_gpu *gpu, unsigned factor)
freq *= factor;
- msm_devfreq_target(&gpu->pdev->dev, &freq, 0);
+ set_target(gpu, freq);
mutex_unlock(&df->devfreq->lock);
}
@@ -212,7 +239,7 @@ void msm_devfreq_active(struct msm_gpu *gpu)
df->idle_freq = 0;
- msm_devfreq_target(&gpu->pdev->dev, &target_freq, 0);
+ set_target(gpu, target_freq);
/*
* Reset the polling interval so we aren't inconsistent
--
2.31.1
next prev parent reply other threads:[~2021-11-03 20:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 21:04 [PATCH 1/2] drm/msm/devfreq: Add some locking asserts Rob Clark
2021-11-03 21:04 ` Rob Clark [this message]
2021-11-05 20:49 ` [PATCH 2/2] drm/msm/gpu: Respect PM QoS constraints Doug Anderson
-- strict thread matches above, loose matches on Subject: below --
2021-11-19 22:51 [PATCH 1/2] drm/msm/gpu: Fix idle_work time Rob Clark
2021-11-19 22:51 ` [PATCH 2/2] drm/msm/gpu: Respect PM QoS constraints Rob Clark
2021-11-20 0:21 ` Doug Anderson
2021-11-20 18:08 ` Rob Clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211103210402.623099-2-robdclark@gmail.com \
--to=robdclark@gmail.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robdclark@chromium.org \
--cc=sean@poorly.run \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox