From: Jordan Crouse <jcrouse@codeaurora.org>
To: Stephen Boyd <sboyd@kernel.org>
Cc: mturquette@baylibre.com, andy.gross@linaro.org,
david.brown@linaro.org, rnayak@codeaurora.org,
okukatla@codeaurora.org, tdas@codeaurora.org,
linux-arm-msm@vger.kernel.orgi, linux-soc@vger.kernel.org,
linux-clk@vger.kernel.org, robdclark@gmail.com,
freedreno@lists.freedesktop.org
Subject: Re: [PATCH 4/4] drm/msm/gpu: Attach to the GPU GX power domain
Date: Wed, 21 Nov 2018 08:00:06 -0700 [thread overview]
Message-ID: <20181121150006.GH31792@jcrouse-lnx.qualcomm.com> (raw)
In-Reply-To: <154278688660.88331.17378009987496625085@swboyd.mtv.corp.google.com>
On Tue, Nov 20, 2018 at 11:54:46PM -0800, Stephen Boyd wrote:
> Quoting Jordan Crouse (2018-11-19 15:47:06)
> > 99.999% of the time during normal operation the GMU is responsible
> > for power and clock control on the GX domain and the CPU remains
> > blissfully unaware. However, there is one situation where the CPU
> > needs to get involved:
> >
> > The power sequencing rules dictate that the GX needs to be turned
> > off before the CX so that the CX can be turned on before the GX
> > during power up. During normal operation when the CPU is taking
> > down the CX domain a stop command is sent to the GMU which turns
> > off the GX domain and then the CPU handles the CX domain.
> >
> > But if the GMU happened to be unresponsive while the GX domain was
> > left then the CPU will need to step in and turn off the GX domain
>
> ^ left on?
>
> > before resetting the CX and rebooting the GMU. This unfortunately
> > means that the CPU needs to be marginally aware of the GX domain
> > even though it is expected to usually keep its hands off.
> >
> > To support this we create a semi-disabled GX power domain that
> > does nothing to the hardware on power up but tries to shut it
> > down normally on power down. In this method the reference counting
> > is correct and we can step in with the pm_runtime_put() at the right
> > time during the failure path.
> >
> > This patch sets up the connection to the GX power domain and does
> > the magic to "enable" and disable it at the right points.
> >
> > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
>
> The pm_runtime gymnastics is scary! But I'm willing to go with it.
>
> > ---
> > drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 41 ++++++++++++++++++++++++++-
> > drivers/gpu/drm/msm/adreno/a6xx_gmu.h | 2 ++
> > 2 files changed, 42 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
> > index 51493f409358..ca71709efc94 100644
> > --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
> > +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
> > @@ -1142,9 +1169,15 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu)
> > if (IS_ERR_OR_NULL(gmu->mmio))
> > return;
> >
> > - pm_runtime_disable(gmu->dev);
> > a6xx_gmu_stop(a6xx_gpu);
> >
> > + pm_runtime_disable(gmu->dev);
> > +
> > + if (!IS_ERR(gmu->gxpd)) {
> > + pm_runtime_disable(gmu->gxpd);
> > + dev_pm_domain_detach(gmu->gxpd, false);
> > + }
> > +
> > a6xx_gmu_irq_disable(gmu);
> > a6xx_gmu_memory_free(gmu, gmu->hfi);
> >
> > @@ -1203,6 +1236,12 @@ int a6xx_gmu_probe(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
> > if (gmu->hfi_irq < 0 || gmu->gmu_irq < 0)
> > goto err;
> >
> > + /*
> > + * Get a link to the GX power domain to reset the GPU in case of GMU
> > + * crash
> > + */
> > + gmu->gxpd = dev_pm_domain_attach_by_name(gmu->dev, "gx");
>
> Are there a6xx devices that don't have this genpd? Just curious if we
> could always assume that if it's an a6xx gpu then this must be there and
> we can always call pm_runtime_get/put on it and avoid the if (!IS_ERR())
> checks.
Mainly I was trying to be backwards compatible with the device tree. I didn't
want to derail various development efforts. I don't mind the checks (though I
wish that pm_runtime_* was error tolerant) but folks really hate them we can
replace this with an error return and force people to update their device trees.
Jordan
> +
> > /* Get the power levels for the GMU and GPU */
> > a6xx_gmu_pwrlevels_probe(gmu);
> >
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2018-11-21 15:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-19 23:47 [RFC 0/4] msm: clk: Define a special power domain for SDM845 GX Jordan Crouse
2018-11-19 23:47 ` [PATCH 1/4] drm/msm/a6xx: Remove unwanted regulator code Jordan Crouse
2018-11-21 7:55 ` Stephen Boyd
2018-11-19 23:47 ` [PATCH 2/4] clk: qcom: gdsc: Don't override existing gdsc pd functions Jordan Crouse
2018-11-20 4:30 ` Rajendra Nayak
2018-11-19 23:47 ` [PATCH 3/4] clk: qcom: Add a dummy enable function for GX gdsc Jordan Crouse
2018-11-19 23:47 ` [PATCH 4/4] drm/msm/gpu: Attach to the GPU GX power domain Jordan Crouse
2018-11-21 7:54 ` Stephen Boyd
2018-11-21 15:00 ` Jordan Crouse [this message]
2018-11-21 19:24 ` Stephen Boyd
2018-11-21 8:00 ` [RFC 0/4] msm: clk: Define a special power domain for SDM845 GX Stephen Boyd
2018-11-21 15:04 ` Jordan Crouse
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=20181121150006.GH31792@jcrouse-lnx.qualcomm.com \
--to=jcrouse@codeaurora.org \
--cc=andy.gross@linaro.org \
--cc=david.brown@linaro.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.orgi \
--cc=linux-clk@vger.kernel.org \
--cc=linux-soc@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=okukatla@codeaurora.org \
--cc=rnayak@codeaurora.org \
--cc=robdclark@gmail.com \
--cc=sboyd@kernel.org \
--cc=tdas@codeaurora.org \
/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