* [PATCH v1 0/4] drm/msm/a6xx: Add support for zap shader
@ 2019-03-12 18:13 Jordan Crouse
[not found] ` <1552414422-9568-1-git-send-email-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Jordan Crouse @ 2019-03-12 18:13 UTC (permalink / raw)
To: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Kees Cook, Arnd Bergmann,
David Airlie, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
Sharat Masetty, Douglas Anderson,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Bjorn Andersson,
David Brown, Rob Clark, Rob Herring, Jonathan Marek,
Thomas Zimmermann, Mamta Shukla, Andy Gross, Daniel Vetter,
Sean Paul, Daniel Mack
This patch series adds support for loading the zap shader on a6xx and using it
to get the GPU out of secure mode.
The Adreno a5xx and a6xx GPUs boot in "secure" mode which restricts the memory
the GPU is allowed to use. To get the GPU out of secure mode we need to write
to a register. However some bootloaders block access to this register and
require that the GPU instead perform a sequence to pull the GPU out of secure
mode. This sequence requires a special "zap" shader that will execute in
secure mode, clear out all the internal GPU settings and then transition to
in-secure mode.
This series adds support for loading and using the zap shader on a6xx assuming
that the shader exists and that the bootloader supports the secure mode. If any
part of the sequence fails then fall back to writing the register. If we get it
wrong, then writing to the register will trigger a protection mode error and
the system will go down.
The actual zap shader works almost identically to the one on 5xx outside of
a minor workaround for system resume. The first patch moves the a5xx specific
support to the generic adreno driver. The second patch add support for the
zap shader and the final two patches add the DT bindings and DT settings for
setting up the reserved memory that the shader requires.
Jordan Crouse (4):
drm/msm/gpu: Move zap shader loading to adreno
drm/msm/a6xx: Add zap shader load
dt-bindings: drm/msm/gpu: Document a5xx / a6xx zap shader region
arm64: dts: sdm845: Add zap shader region for GPU
.../devicetree/bindings/display/msm/gpu.txt | 7 ++
arch/arm64/boot/dts/qcom/sdm845.dtsi | 11 ++
drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 109 +-------------------
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 38 ++++++-
drivers/gpu/drm/msm/adreno/adreno_device.c | 1 +
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 113 +++++++++++++++++++++
drivers/gpu/drm/msm/adreno/adreno_gpu.h | 6 ++
7 files changed, 176 insertions(+), 109 deletions(-)
--
2.7.4
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 3/4] dt-bindings: drm/msm/gpu: Document a5xx / a6xx zap shader region
[not found] ` <1552414422-9568-1-git-send-email-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2019-03-12 18:13 ` Jordan Crouse
2019-03-28 13:32 ` Rob Herring
2019-03-12 18:13 ` [PATCH v1 4/4] arm64: dts: sdm845: Add zap shader region for GPU Jordan Crouse
1 sibling, 1 reply; 8+ messages in thread
From: Jordan Crouse @ 2019-03-12 18:13 UTC (permalink / raw)
To: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA, David Airlie,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Bjorn Andersson,
Rob Clark, Rob Herring, Daniel Vetter, Sean Paul
Describe the zap-shader node that defines a reserved memory region
to store the zap shader.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
---
Documentation/devicetree/bindings/display/msm/gpu.txt | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/display/msm/gpu.txt b/Documentation/devicetree/bindings/display/msm/gpu.txt
index aad1aef..1e6d870 100644
--- a/Documentation/devicetree/bindings/display/msm/gpu.txt
+++ b/Documentation/devicetree/bindings/display/msm/gpu.txt
@@ -25,6 +25,9 @@ Required properties:
- qcom,gmu: For GMU attached devices a phandle to the GMU device that will
control the power for the GPU. Applicable targets:
- qcom,adreno-630.2
+- zap-shader: For a5xx and a6xx devices this node contains a memory-region that
+ points to reserved memory to store the zap shader that can be used to help
+ bring the GPU out of secure mode.
Example 3xx/4xx/a5xx:
@@ -71,5 +74,9 @@ Example a6xx (with GMU):
operating-points-v2 = <&gpu_opp_table>;
qcom,gmu = <&gmu>;
+
+ zap-shader {
+ memory-region = <&zap_shader_region>;
+ };
};
};
--
2.7.4
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v1 4/4] arm64: dts: sdm845: Add zap shader region for GPU
[not found] ` <1552414422-9568-1-git-send-email-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2019-03-12 18:13 ` [PATCH v1 3/4] dt-bindings: drm/msm/gpu: Document a5xx / a6xx zap shader region Jordan Crouse
@ 2019-03-12 18:13 ` Jordan Crouse
2019-03-13 15:42 ` [Freedreno] " Rob Clark
1 sibling, 1 reply; 8+ messages in thread
From: Jordan Crouse @ 2019-03-12 18:13 UTC (permalink / raw)
To: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Bjorn Andersson, David Brown,
Rob Herring, Andy Gross
Some Adreno GPU targets require a special zap shader to bring the GPU
out of secure mode. Define a region to allocate and store the zap
shader.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
---
arch/arm64/boot/dts/qcom/sdm845.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index fed7a29..526456d 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -100,6 +100,11 @@
no-map;
};
+ zap_shader_region: memory@8c415000 {
+ reg = <0 0x8c415000 0 0x2000>;
+ no-map;
+ };
+
mpss_region: memory@8e000000 {
reg = <0 0x8e000000 0 0x7800000>;
no-map;
@@ -109,6 +114,8 @@
reg = <0 0x96500000 0 0x200000>;
no-map;
};
+
+
};
cpus {
@@ -1514,6 +1521,10 @@
qcom,gmu = <&gmu>;
+ zap-shader {
+ memory-region = <&zap_shader_region>;
+ };
+
gpu_opp_table: opp-table {
compatible = "operating-points-v2";
--
2.7.4
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Freedreno] [PATCH v1 4/4] arm64: dts: sdm845: Add zap shader region for GPU
2019-03-12 18:13 ` [PATCH v1 4/4] arm64: dts: sdm845: Add zap shader region for GPU Jordan Crouse
@ 2019-03-13 15:42 ` Rob Clark
[not found] ` <CAF6AEGt74Hs+VMgMOMAyFw9FGk5mrY2NU07JUh=OKSOhj-h6CA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Rob Clark @ 2019-03-13 15:42 UTC (permalink / raw)
To: Jordan Crouse
Cc: freedreno, Mark Rutland, devicetree, linux-arm-msm,
Linux Kernel Mailing List, Bjorn Andersson, David Brown,
Rob Herring, Andy Gross
On Tue, Mar 12, 2019 at 2:14 PM Jordan Crouse <jcrouse@codeaurora.org> wrote:
>
> Some Adreno GPU targets require a special zap shader to bring the GPU
> out of secure mode. Define a region to allocate and store the zap
> shader.
>
> Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> ---
>
> arch/arm64/boot/dts/qcom/sdm845.dtsi | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi
> index fed7a29..526456d 100644
> --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
> @@ -100,6 +100,11 @@
> no-map;
> };
>
> + zap_shader_region: memory@8c415000 {
> + reg = <0 0x8c415000 0 0x2000>;
> + no-map;
> + };
> +
> mpss_region: memory@8e000000 {
> reg = <0 0x8e000000 0 0x7800000>;
> no-map;
> @@ -109,6 +114,8 @@
> reg = <0 0x96500000 0 0x200000>;
> no-map;
> };
> +
> +
I guess we don't really need this hunk..
other than that, the series lgtm
BR,
-R
> };
>
> cpus {
> @@ -1514,6 +1521,10 @@
>
> qcom,gmu = <&gmu>;
>
> + zap-shader {
> + memory-region = <&zap_shader_region>;
> + };
> +
> gpu_opp_table: opp-table {
> compatible = "operating-points-v2";
>
> --
> 2.7.4
>
> _______________________________________________
> Freedreno mailing list
> Freedreno@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 4/4] arm64: dts: sdm845: Add zap shader region for GPU
[not found] ` <CAF6AEGt74Hs+VMgMOMAyFw9FGk5mrY2NU07JUh=OKSOhj-h6CA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-03-14 5:20 ` Bjorn Andersson
2019-03-14 16:59 ` Rob Clark
0 siblings, 1 reply; 8+ messages in thread
From: Bjorn Andersson @ 2019-03-14 5:20 UTC (permalink / raw)
To: Rob Clark
Cc: Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-msm,
Linux Kernel Mailing List, David Brown, Jordan Crouse,
Rob Herring, Andy Gross, freedreno
On Wed 13 Mar 08:42 PDT 2019, Rob Clark wrote:
> On Tue, Mar 12, 2019 at 2:14 PM Jordan Crouse <jcrouse@codeaurora.org> wrote:
> >
> > Some Adreno GPU targets require a special zap shader to bring the GPU
> > out of secure mode. Define a region to allocate and store the zap
> > shader.
> >
> > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> > ---
> >
> > arch/arm64/boot/dts/qcom/sdm845.dtsi | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi
> > index fed7a29..526456d 100644
> > --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
> > @@ -100,6 +100,11 @@
> > no-map;
> > };
> >
> > + zap_shader_region: memory@8c415000 {
> > + reg = <0 0x8c415000 0 0x2000>;
> > + no-map;
> > + };
> > +
> > mpss_region: memory@8e000000 {
> > reg = <0 0x8e000000 0 0x7800000>;
> > no-map;
> > @@ -109,6 +114,8 @@
> > reg = <0 0x96500000 0 0x200000>;
> > no-map;
> > };
> > +
> > +
>
> I guess we don't really need this hunk..
>
I'll trim that as I pick up the patch.
> other than that, the series lgtm
>
Will you pick up patch 1-3 and I'll pick patch 4 through Andy's tree?
Regards,
Bjorn
> BR,
> -R
>
> > };
> >
> > cpus {
> > @@ -1514,6 +1521,10 @@
> >
> > qcom,gmu = <&gmu>;
> >
> > + zap-shader {
> > + memory-region = <&zap_shader_region>;
> > + };
> > +
> > gpu_opp_table: opp-table {
> > compatible = "operating-points-v2";
> >
> > --
> > 2.7.4
> >
> > _______________________________________________
> > Freedreno mailing list
> > Freedreno@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/freedreno
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 4/4] arm64: dts: sdm845: Add zap shader region for GPU
2019-03-14 5:20 ` Bjorn Andersson
@ 2019-03-14 16:59 ` Rob Clark
0 siblings, 0 replies; 8+ messages in thread
From: Rob Clark @ 2019-03-14 16:59 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-msm,
Linux Kernel Mailing List, David Brown, Jordan Crouse,
Rob Herring, Andy Gross, freedreno
On Thu, Mar 14, 2019 at 1:20 AM Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> On Wed 13 Mar 08:42 PDT 2019, Rob Clark wrote:
>
> > On Tue, Mar 12, 2019 at 2:14 PM Jordan Crouse <jcrouse@codeaurora.org> wrote:
> > >
> > > Some Adreno GPU targets require a special zap shader to bring the GPU
> > > out of secure mode. Define a region to allocate and store the zap
> > > shader.
> > >
> > > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> > > ---
> > >
> > > arch/arm64/boot/dts/qcom/sdm845.dtsi | 11 +++++++++++
> > > 1 file changed, 11 insertions(+)
> > >
> > > diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi
> > > index fed7a29..526456d 100644
> > > --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
> > > +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
> > > @@ -100,6 +100,11 @@
> > > no-map;
> > > };
> > >
> > > + zap_shader_region: memory@8c415000 {
> > > + reg = <0 0x8c415000 0 0x2000>;
> > > + no-map;
> > > + };
> > > +
> > > mpss_region: memory@8e000000 {
> > > reg = <0 0x8e000000 0 0x7800000>;
> > > no-map;
> > > @@ -109,6 +114,8 @@
> > > reg = <0 0x96500000 0 0x200000>;
> > > no-map;
> > > };
> > > +
> > > +
> >
> > I guess we don't really need this hunk..
> >
>
> I'll trim that as I pick up the patch.
>
> > other than that, the series lgtm
> >
>
> Will you pick up patch 1-3 and I'll pick patch 4 through Andy's tree?
yeah, sounds good.
BR,
-R
> Regards,
> Bjorn
>
> > BR,
> > -R
> >
> > > };
> > >
> > > cpus {
> > > @@ -1514,6 +1521,10 @@
> > >
> > > qcom,gmu = <&gmu>;
> > >
> > > + zap-shader {
> > > + memory-region = <&zap_shader_region>;
> > > + };
> > > +
> > > gpu_opp_table: opp-table {
> > > compatible = "operating-points-v2";
> > >
> > > --
> > > 2.7.4
> > >
> > > _______________________________________________
> > > Freedreno mailing list
> > > Freedreno@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/freedreno
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 3/4] dt-bindings: drm/msm/gpu: Document a5xx / a6xx zap shader region
2019-03-12 18:13 ` [PATCH v1 3/4] dt-bindings: drm/msm/gpu: Document a5xx / a6xx zap shader region Jordan Crouse
@ 2019-03-28 13:32 ` Rob Herring
2019-04-01 16:13 ` Jordan Crouse
0 siblings, 1 reply; 8+ messages in thread
From: Rob Herring @ 2019-03-28 13:32 UTC (permalink / raw)
To: Jordan Crouse
Cc: freedreno, Bjorn Andersson, Sean Paul, devicetree, linux-arm-msm,
linux-kernel, dri-devel, Rob Clark, David Airlie, Mark Rutland,
Daniel Vetter
On Tue, Mar 12, 2019 at 12:13:41PM -0600, Jordan Crouse wrote:
> Describe the zap-shader node that defines a reserved memory region
> to store the zap shader.
>
> Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> ---
>
> Documentation/devicetree/bindings/display/msm/gpu.txt | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/display/msm/gpu.txt b/Documentation/devicetree/bindings/display/msm/gpu.txt
> index aad1aef..1e6d870 100644
> --- a/Documentation/devicetree/bindings/display/msm/gpu.txt
> +++ b/Documentation/devicetree/bindings/display/msm/gpu.txt
> @@ -25,6 +25,9 @@ Required properties:
> - qcom,gmu: For GMU attached devices a phandle to the GMU device that will
> control the power for the GPU. Applicable targets:
> - qcom,adreno-630.2
> +- zap-shader: For a5xx and a6xx devices this node contains a memory-region that
> + points to reserved memory to store the zap shader that can be used to help
> + bring the GPU out of secure mode.
This is the properties section and zap-shader is not a property.
But why do you need a child node in the first place? Just add
'memory-region' to the parent.
>
> Example 3xx/4xx/a5xx:
>
> @@ -71,5 +74,9 @@ Example a6xx (with GMU):
> operating-points-v2 = <&gpu_opp_table>;
>
> qcom,gmu = <&gmu>;
> +
> + zap-shader {
> + memory-region = <&zap_shader_region>;
> + };
> };
> };
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 3/4] dt-bindings: drm/msm/gpu: Document a5xx / a6xx zap shader region
2019-03-28 13:32 ` Rob Herring
@ 2019-04-01 16:13 ` Jordan Crouse
0 siblings, 0 replies; 8+ messages in thread
From: Jordan Crouse @ 2019-04-01 16:13 UTC (permalink / raw)
To: Rob Herring
Cc: freedreno, Bjorn Andersson, Sean Paul, devicetree, linux-arm-msm,
linux-kernel, dri-devel, Rob Clark, David Airlie, Mark Rutland,
Daniel Vetter
On Thu, Mar 28, 2019 at 08:32:15AM -0500, Rob Herring wrote:
> On Tue, Mar 12, 2019 at 12:13:41PM -0600, Jordan Crouse wrote:
> > Describe the zap-shader node that defines a reserved memory region
> > to store the zap shader.
> >
> > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> > ---
> >
> > Documentation/devicetree/bindings/display/msm/gpu.txt | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/display/msm/gpu.txt b/Documentation/devicetree/bindings/display/msm/gpu.txt
> > index aad1aef..1e6d870 100644
> > --- a/Documentation/devicetree/bindings/display/msm/gpu.txt
> > +++ b/Documentation/devicetree/bindings/display/msm/gpu.txt
> > @@ -25,6 +25,9 @@ Required properties:
> > - qcom,gmu: For GMU attached devices a phandle to the GMU device that will
> > control the power for the GPU. Applicable targets:
> > - qcom,adreno-630.2
> > +- zap-shader: For a5xx and a6xx devices this node contains a memory-region that
> > + points to reserved memory to store the zap shader that can be used to help
> > + bring the GPU out of secure mode.
>
> This is the properties section and zap-shader is not a property.
Thanks, I can fix that.
> But why do you need a child node in the first place? Just add
> 'memory-region' to the parent.
Two reasons. First, this memory is locked in the secure world once the MDT
loader is run and it isn't really intended for CPU access. If the parent device
tries to set up DMA operations thinking it has access to the memory it might not
work out very well. Putting it in a child makes it clear that this is a special
chunk of memory for a special case.
The second reason is that not all target platforms require the zap shader, so it
would be nice to have it as a child node so that it could be removed on target
platforms that don't need it.
Jordan
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-04-01 16:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-12 18:13 [PATCH v1 0/4] drm/msm/a6xx: Add support for zap shader Jordan Crouse
[not found] ` <1552414422-9568-1-git-send-email-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2019-03-12 18:13 ` [PATCH v1 3/4] dt-bindings: drm/msm/gpu: Document a5xx / a6xx zap shader region Jordan Crouse
2019-03-28 13:32 ` Rob Herring
2019-04-01 16:13 ` Jordan Crouse
2019-03-12 18:13 ` [PATCH v1 4/4] arm64: dts: sdm845: Add zap shader region for GPU Jordan Crouse
2019-03-13 15:42 ` [Freedreno] " Rob Clark
[not found] ` <CAF6AEGt74Hs+VMgMOMAyFw9FGk5mrY2NU07JUh=OKSOhj-h6CA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-14 5:20 ` Bjorn Andersson
2019-03-14 16:59 ` Rob Clark
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).