diff mbox series

[v2,05/11] clk: qcom: gcc-msm8998: Mark gpu_cfg_ahb_clk as critical

Message ID 20210114221059.483390-6-angelogioacchino.delregno@somainline.org
State Accepted
Commit f86114913085e33716e183c51ecd6849701f3ac2
Headers show
Series Clock fixes for MSM8998 GCC, MMCC, GPUCC | expand

Commit Message

AngeloGioacchino Del Regno Jan. 14, 2021, 10:10 p.m. UTC
The GPU IOMMU depends on this clock and the hypervisor will crash
the SoC if this clock gets disabled because the secure contexts
that have been set on this IOMMU by the bootloader will become
unaccessible (or they get reset).
Mark this clock as critical to avoid this issue when the Adreno
GPU is enabled.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
---
 drivers/clk/qcom/gcc-msm8998.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

AngeloGioacchino Del Regno Jan. 14, 2021, 11:05 p.m. UTC | #1
Il 14/01/21 23:37, Jeffrey Hugo ha scritto:
> On Thu, Jan 14, 2021 at 3:13 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@somainline.org> wrote:
>>
>> The GPU IOMMU depends on this clock and the hypervisor will crash
>> the SoC if this clock gets disabled because the secure contexts
>> that have been set on this IOMMU by the bootloader will become
>> unaccessible (or they get reset).
>> Mark this clock as critical to avoid this issue when the Adreno
>> GPU is enabled.
>>
> 
> You should go review the last attempt to do this -
> https://lkml.org/lkml/2019/12/17/881
> 

Thanks for the tip, but unfortunately this isn't possible on the 
gpu_cfg_ahb_clk, as it is also needed for the Adreno IOMMU, which has 
secure contexts that are set up from one of the bootloader stages and if 
you reset/"mess up" one of them (by - in this case - un-clocking the 
MMU), then the hypervisor will kick in and generate a fault, rebooting 
the SoC.

Of course, this scenario is for the case in which you want to boot the 
device without any gpucc nor any runtime pm user of that.. and the 
aforementioned issue makes that solution not really usable.

Again, unfortunately.
Jeffrey Hugo Jan. 15, 2021, 12:09 a.m. UTC | #2
On Thu, Jan 14, 2021 at 4:05 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@somainline.org> wrote:
>

> Il 14/01/21 23:37, Jeffrey Hugo ha scritto:

> > On Thu, Jan 14, 2021 at 3:13 PM AngeloGioacchino Del Regno

> > <angelogioacchino.delregno@somainline.org> wrote:

> >>

> >> The GPU IOMMU depends on this clock and the hypervisor will crash

> >> the SoC if this clock gets disabled because the secure contexts

> >> that have been set on this IOMMU by the bootloader will become

> >> unaccessible (or they get reset).

> >> Mark this clock as critical to avoid this issue when the Adreno

> >> GPU is enabled.

> >>

> >

> > You should go review the last attempt to do this -

> > https://lkml.org/lkml/2019/12/17/881

> >

>

> Thanks for the tip, but unfortunately this isn't possible on the

> gpu_cfg_ahb_clk, as it is also needed for the Adreno IOMMU, which has

> secure contexts that are set up from one of the bootloader stages and if

> you reset/"mess up" one of them (by - in this case - un-clocking the

> MMU), then the hypervisor will kick in and generate a fault, rebooting

> the SoC.

>

> Of course, this scenario is for the case in which you want to boot the

> device without any gpucc nor any runtime pm user of that.. and the

> aforementioned issue makes that solution not really usable.

>

> Again, unfortunately.


Intresting, that's not true on all devices, but presumably you have
devices where it is.  Fun.
Stephen Boyd Feb. 8, 2021, 6:18 p.m. UTC | #3
Quoting AngeloGioacchino Del Regno (2021-01-14 14:10:53)
> The GPU IOMMU depends on this clock and the hypervisor will crash

> the SoC if this clock gets disabled because the secure contexts

> that have been set on this IOMMU by the bootloader will become

> unaccessible (or they get reset).

> Mark this clock as critical to avoid this issue when the Adreno

> GPU is enabled.

> 

> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

> ---

>  drivers/clk/qcom/gcc-msm8998.c | 6 ++++++

>  1 file changed, 6 insertions(+)

> 

> diff --git a/drivers/clk/qcom/gcc-msm8998.c b/drivers/clk/qcom/gcc-msm8998.c

> index c8d4c0348952..afea60a3ef43 100644

> --- a/drivers/clk/qcom/gcc-msm8998.c

> +++ b/drivers/clk/qcom/gcc-msm8998.c

> @@ -2081,6 +2081,12 @@ static struct clk_branch gcc_gpu_cfg_ahb_clk = {

>                 .hw.init = &(struct clk_init_data){

>                         .name = "gcc_gpu_cfg_ahb_clk",

>                         .ops = &clk_branch2_ops,

> +                       /*

> +                        * The GPU IOMMU depends on this clock and hypervisor

> +                        * will crash the SoC if this clock goes down, due to

> +                        * secure contexts protection.

> +                        */

> +                       .flags = CLK_IS_CRITICAL,

>                 },

>         },


Please send a followup patch that hits the branch on at probe time and
removes this clk from the kernel. That will save some memory and
overhead of worrying about this clk.
Stephen Boyd Feb. 8, 2021, 6:19 p.m. UTC | #4
Quoting AngeloGioacchino Del Regno (2021-01-14 14:10:53)
> The GPU IOMMU depends on this clock and the hypervisor will crash

> the SoC if this clock gets disabled because the secure contexts

> that have been set on this IOMMU by the bootloader will become

> unaccessible (or they get reset).

> Mark this clock as critical to avoid this issue when the Adreno

> GPU is enabled.

> 

> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

> ---


Applied to clk-next
AngeloGioacchino Del Regno Feb. 9, 2021, 1:20 p.m. UTC | #5
Il 08/02/21 19:18, Stephen Boyd ha scritto:
> Quoting AngeloGioacchino Del Regno (2021-01-14 14:10:53)

>> The GPU IOMMU depends on this clock and the hypervisor will crash

>> the SoC if this clock gets disabled because the secure contexts

>> that have been set on this IOMMU by the bootloader will become

>> unaccessible (or they get reset).

>> Mark this clock as critical to avoid this issue when the Adreno

>> GPU is enabled.

>>

>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

>> ---

>>   drivers/clk/qcom/gcc-msm8998.c | 6 ++++++

>>   1 file changed, 6 insertions(+)

>>

>> diff --git a/drivers/clk/qcom/gcc-msm8998.c b/drivers/clk/qcom/gcc-msm8998.c

>> index c8d4c0348952..afea60a3ef43 100644

>> --- a/drivers/clk/qcom/gcc-msm8998.c

>> +++ b/drivers/clk/qcom/gcc-msm8998.c

>> @@ -2081,6 +2081,12 @@ static struct clk_branch gcc_gpu_cfg_ahb_clk = {

>>                  .hw.init = &(struct clk_init_data){

>>                          .name = "gcc_gpu_cfg_ahb_clk",

>>                          .ops = &clk_branch2_ops,

>> +                       /*

>> +                        * The GPU IOMMU depends on this clock and hypervisor

>> +                        * will crash the SoC if this clock goes down, due to

>> +                        * secure contexts protection.

>> +                        */

>> +                       .flags = CLK_IS_CRITICAL,

>>                  },

>>          },

> 

> Please send a followup patch that hits the branch on at probe time and

> removes this clk from the kernel. That will save some memory and

> overhead of worrying about this clk.

> 


Will do!
diff mbox series

Patch

diff --git a/drivers/clk/qcom/gcc-msm8998.c b/drivers/clk/qcom/gcc-msm8998.c
index c8d4c0348952..afea60a3ef43 100644
--- a/drivers/clk/qcom/gcc-msm8998.c
+++ b/drivers/clk/qcom/gcc-msm8998.c
@@ -2081,6 +2081,12 @@  static struct clk_branch gcc_gpu_cfg_ahb_clk = {
 		.hw.init = &(struct clk_init_data){
 			.name = "gcc_gpu_cfg_ahb_clk",
 			.ops = &clk_branch2_ops,
+			/*
+			 * The GPU IOMMU depends on this clock and hypervisor
+			 * will crash the SoC if this clock goes down, due to
+			 * secure contexts protection.
+			 */
+			.flags = CLK_IS_CRITICAL,
 		},
 	},
 };