All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remoteproc: mediatek: enable cache for mt8186 SCP
@ 2022-03-22 12:28 ` Allen-KH Cheng
  0 siblings, 0 replies; 8+ messages in thread
From: Allen-KH Cheng @ 2022-03-22 12:28 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Bjorn Andersson, Mathieu Poirier, Rob Herring,
	Matthias Brugger
  Cc: Tinghan Shen, Project_Global_Chrome_Upstream_Group, linux-kernel,
	devicetree, linux-mediatek, linux-arm-kernel, linux-remoteproc,
	Allen-KH Cheng

1. Set SCP cache size before loading SCP FW. (8KB+8KB)
2. Adjust ipi_buf_offset from 0x7bdb0 to 0x3BDB0 for enableing cache

SCP side
 - IPI Buffer: 0x3BDB0 <-> 0x3C000
 - Cache: 0x3C000 <-> 0x40000

Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
---
 drivers/remoteproc/mtk_scp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 38609153bf64..24065b6b4da8 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -401,6 +401,14 @@ static int mt8186_scp_before_load(struct mtk_scp *scp)
 	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_P1);
 	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_p2);
 
+	/*
+	 * Set I-cache and D-cache size before loading SCP FW.
+	 * SCP SRAM logical address may change when cache size setting differs.
+	 */
+	writel(MT8183_SCP_CACHE_CON_WAYEN | MT8183_SCP_CACHESIZE_8KB,
+	       scp->reg_base + MT8183_SCP_CACHE_CON);
+	writel(MT8183_SCP_CACHESIZE_8KB, scp->reg_base + MT8183_SCP_DCACHE_CON);
+
 	return 0;
 }
 
@@ -905,7 +913,7 @@ static const struct mtk_scp_of_data mt8186_of_data = {
 	.scp_da_to_va = mt8183_scp_da_to_va,
 	.host_to_scp_reg = MT8183_HOST_TO_SCP,
 	.host_to_scp_int_bit = MT8183_HOST_IPC_INT_BIT,
-	.ipi_buf_offset = 0x7bdb0,
+	.ipi_buf_offset = 0x3bdb0,
 };
 
 static const struct mtk_scp_of_data mt8192_of_data = {
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] remoteproc: mediatek: enable cache for mt8186 SCP
@ 2022-03-22 12:28 ` Allen-KH Cheng
  0 siblings, 0 replies; 8+ messages in thread
From: Allen-KH Cheng @ 2022-03-22 12:28 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Bjorn Andersson, Mathieu Poirier, Rob Herring,
	Matthias Brugger
  Cc: Tinghan Shen, Project_Global_Chrome_Upstream_Group, linux-kernel,
	devicetree, linux-mediatek, linux-arm-kernel, linux-remoteproc,
	Allen-KH Cheng

1. Set SCP cache size before loading SCP FW. (8KB+8KB)
2. Adjust ipi_buf_offset from 0x7bdb0 to 0x3BDB0 for enableing cache

SCP side
 - IPI Buffer: 0x3BDB0 <-> 0x3C000
 - Cache: 0x3C000 <-> 0x40000

Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
---
 drivers/remoteproc/mtk_scp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 38609153bf64..24065b6b4da8 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -401,6 +401,14 @@ static int mt8186_scp_before_load(struct mtk_scp *scp)
 	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_P1);
 	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_p2);
 
+	/*
+	 * Set I-cache and D-cache size before loading SCP FW.
+	 * SCP SRAM logical address may change when cache size setting differs.
+	 */
+	writel(MT8183_SCP_CACHE_CON_WAYEN | MT8183_SCP_CACHESIZE_8KB,
+	       scp->reg_base + MT8183_SCP_CACHE_CON);
+	writel(MT8183_SCP_CACHESIZE_8KB, scp->reg_base + MT8183_SCP_DCACHE_CON);
+
 	return 0;
 }
 
@@ -905,7 +913,7 @@ static const struct mtk_scp_of_data mt8186_of_data = {
 	.scp_da_to_va = mt8183_scp_da_to_va,
 	.host_to_scp_reg = MT8183_HOST_TO_SCP,
 	.host_to_scp_int_bit = MT8183_HOST_IPC_INT_BIT,
-	.ipi_buf_offset = 0x7bdb0,
+	.ipi_buf_offset = 0x3bdb0,
 };
 
 static const struct mtk_scp_of_data mt8192_of_data = {
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] remoteproc: mediatek: enable cache for mt8186 SCP
@ 2022-03-22 12:28 ` Allen-KH Cheng
  0 siblings, 0 replies; 8+ messages in thread
From: Allen-KH Cheng @ 2022-03-22 12:28 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Bjorn Andersson, Mathieu Poirier, Rob Herring,
	Matthias Brugger
  Cc: Tinghan Shen, Project_Global_Chrome_Upstream_Group, linux-kernel,
	devicetree, linux-mediatek, linux-arm-kernel, linux-remoteproc,
	Allen-KH Cheng

1. Set SCP cache size before loading SCP FW. (8KB+8KB)
2. Adjust ipi_buf_offset from 0x7bdb0 to 0x3BDB0 for enableing cache

SCP side
 - IPI Buffer: 0x3BDB0 <-> 0x3C000
 - Cache: 0x3C000 <-> 0x40000

Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
---
 drivers/remoteproc/mtk_scp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 38609153bf64..24065b6b4da8 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -401,6 +401,14 @@ static int mt8186_scp_before_load(struct mtk_scp *scp)
 	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_P1);
 	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_p2);
 
+	/*
+	 * Set I-cache and D-cache size before loading SCP FW.
+	 * SCP SRAM logical address may change when cache size setting differs.
+	 */
+	writel(MT8183_SCP_CACHE_CON_WAYEN | MT8183_SCP_CACHESIZE_8KB,
+	       scp->reg_base + MT8183_SCP_CACHE_CON);
+	writel(MT8183_SCP_CACHESIZE_8KB, scp->reg_base + MT8183_SCP_DCACHE_CON);
+
 	return 0;
 }
 
@@ -905,7 +913,7 @@ static const struct mtk_scp_of_data mt8186_of_data = {
 	.scp_da_to_va = mt8183_scp_da_to_va,
 	.host_to_scp_reg = MT8183_HOST_TO_SCP,
 	.host_to_scp_int_bit = MT8183_HOST_IPC_INT_BIT,
-	.ipi_buf_offset = 0x7bdb0,
+	.ipi_buf_offset = 0x3bdb0,
 };
 
 static const struct mtk_scp_of_data mt8192_of_data = {
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] remoteproc: mediatek: enable cache for mt8186 SCP
  2022-03-22 12:28 ` Allen-KH Cheng
  (?)
@ 2022-03-24 15:56   ` Mathieu Poirier
  -1 siblings, 0 replies; 8+ messages in thread
From: Mathieu Poirier @ 2022-03-24 15:56 UTC (permalink / raw)
  To: Allen-KH Cheng
  Cc: Ohad Ben-Cohen, Bjorn Andersson, Rob Herring, Matthias Brugger,
	Tinghan Shen, Project_Global_Chrome_Upstream_Group, linux-kernel,
	devicetree, linux-mediatek, linux-arm-kernel, linux-remoteproc

Hi Allen,

On Tue, Mar 22, 2022 at 08:28:45PM +0800, Allen-KH Cheng wrote:
> 1. Set SCP cache size before loading SCP FW. (8KB+8KB)
> 2. Adjust ipi_buf_offset from 0x7bdb0 to 0x3BDB0 for enableing cache
> 
> SCP side
>  - IPI Buffer: 0x3BDB0 <-> 0x3C000
>  - Cache: 0x3C000 <-> 0x40000
>

I would also like to find in this changelog "why" this patch is needed and more
importantly, how it remains compatible with existing implementation.  I am
mostly worried about implemenations where the application processor is using
caches while the SCP is not.

I will also need a couple of "Tested-by" tags before moving forward with this
patch.

Thanks,
Mathieu

> Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> ---
>  drivers/remoteproc/mtk_scp.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index 38609153bf64..24065b6b4da8 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -401,6 +401,14 @@ static int mt8186_scp_before_load(struct mtk_scp *scp)
>  	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_P1);
>  	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_p2);
>  
> +	/*
> +	 * Set I-cache and D-cache size before loading SCP FW.
> +	 * SCP SRAM logical address may change when cache size setting differs.
> +	 */
> +	writel(MT8183_SCP_CACHE_CON_WAYEN | MT8183_SCP_CACHESIZE_8KB,
> +	       scp->reg_base + MT8183_SCP_CACHE_CON);
> +	writel(MT8183_SCP_CACHESIZE_8KB, scp->reg_base + MT8183_SCP_DCACHE_CON);
> +
>  	return 0;
>  }
>  
> @@ -905,7 +913,7 @@ static const struct mtk_scp_of_data mt8186_of_data = {
>  	.scp_da_to_va = mt8183_scp_da_to_va,
>  	.host_to_scp_reg = MT8183_HOST_TO_SCP,
>  	.host_to_scp_int_bit = MT8183_HOST_IPC_INT_BIT,
> -	.ipi_buf_offset = 0x7bdb0,
> +	.ipi_buf_offset = 0x3bdb0,
>  };
>  
>  static const struct mtk_scp_of_data mt8192_of_data = {
> -- 
> 2.18.0
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] remoteproc: mediatek: enable cache for mt8186 SCP
@ 2022-03-24 15:56   ` Mathieu Poirier
  0 siblings, 0 replies; 8+ messages in thread
From: Mathieu Poirier @ 2022-03-24 15:56 UTC (permalink / raw)
  To: Allen-KH Cheng
  Cc: Ohad Ben-Cohen, Bjorn Andersson, Rob Herring, Matthias Brugger,
	Tinghan Shen, Project_Global_Chrome_Upstream_Group, linux-kernel,
	devicetree, linux-mediatek, linux-arm-kernel, linux-remoteproc

Hi Allen,

On Tue, Mar 22, 2022 at 08:28:45PM +0800, Allen-KH Cheng wrote:
> 1. Set SCP cache size before loading SCP FW. (8KB+8KB)
> 2. Adjust ipi_buf_offset from 0x7bdb0 to 0x3BDB0 for enableing cache
> 
> SCP side
>  - IPI Buffer: 0x3BDB0 <-> 0x3C000
>  - Cache: 0x3C000 <-> 0x40000
>

I would also like to find in this changelog "why" this patch is needed and more
importantly, how it remains compatible with existing implementation.  I am
mostly worried about implemenations where the application processor is using
caches while the SCP is not.

I will also need a couple of "Tested-by" tags before moving forward with this
patch.

Thanks,
Mathieu

> Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> ---
>  drivers/remoteproc/mtk_scp.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index 38609153bf64..24065b6b4da8 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -401,6 +401,14 @@ static int mt8186_scp_before_load(struct mtk_scp *scp)
>  	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_P1);
>  	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_p2);
>  
> +	/*
> +	 * Set I-cache and D-cache size before loading SCP FW.
> +	 * SCP SRAM logical address may change when cache size setting differs.
> +	 */
> +	writel(MT8183_SCP_CACHE_CON_WAYEN | MT8183_SCP_CACHESIZE_8KB,
> +	       scp->reg_base + MT8183_SCP_CACHE_CON);
> +	writel(MT8183_SCP_CACHESIZE_8KB, scp->reg_base + MT8183_SCP_DCACHE_CON);
> +
>  	return 0;
>  }
>  
> @@ -905,7 +913,7 @@ static const struct mtk_scp_of_data mt8186_of_data = {
>  	.scp_da_to_va = mt8183_scp_da_to_va,
>  	.host_to_scp_reg = MT8183_HOST_TO_SCP,
>  	.host_to_scp_int_bit = MT8183_HOST_IPC_INT_BIT,
> -	.ipi_buf_offset = 0x7bdb0,
> +	.ipi_buf_offset = 0x3bdb0,
>  };
>  
>  static const struct mtk_scp_of_data mt8192_of_data = {
> -- 
> 2.18.0
> 

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] remoteproc: mediatek: enable cache for mt8186 SCP
@ 2022-03-24 15:56   ` Mathieu Poirier
  0 siblings, 0 replies; 8+ messages in thread
From: Mathieu Poirier @ 2022-03-24 15:56 UTC (permalink / raw)
  To: Allen-KH Cheng
  Cc: Ohad Ben-Cohen, Bjorn Andersson, Rob Herring, Matthias Brugger,
	Tinghan Shen, Project_Global_Chrome_Upstream_Group, linux-kernel,
	devicetree, linux-mediatek, linux-arm-kernel, linux-remoteproc

Hi Allen,

On Tue, Mar 22, 2022 at 08:28:45PM +0800, Allen-KH Cheng wrote:
> 1. Set SCP cache size before loading SCP FW. (8KB+8KB)
> 2. Adjust ipi_buf_offset from 0x7bdb0 to 0x3BDB0 for enableing cache
> 
> SCP side
>  - IPI Buffer: 0x3BDB0 <-> 0x3C000
>  - Cache: 0x3C000 <-> 0x40000
>

I would also like to find in this changelog "why" this patch is needed and more
importantly, how it remains compatible with existing implementation.  I am
mostly worried about implemenations where the application processor is using
caches while the SCP is not.

I will also need a couple of "Tested-by" tags before moving forward with this
patch.

Thanks,
Mathieu

> Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> ---
>  drivers/remoteproc/mtk_scp.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index 38609153bf64..24065b6b4da8 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -401,6 +401,14 @@ static int mt8186_scp_before_load(struct mtk_scp *scp)
>  	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_P1);
>  	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_p2);
>  
> +	/*
> +	 * Set I-cache and D-cache size before loading SCP FW.
> +	 * SCP SRAM logical address may change when cache size setting differs.
> +	 */
> +	writel(MT8183_SCP_CACHE_CON_WAYEN | MT8183_SCP_CACHESIZE_8KB,
> +	       scp->reg_base + MT8183_SCP_CACHE_CON);
> +	writel(MT8183_SCP_CACHESIZE_8KB, scp->reg_base + MT8183_SCP_DCACHE_CON);
> +
>  	return 0;
>  }
>  
> @@ -905,7 +913,7 @@ static const struct mtk_scp_of_data mt8186_of_data = {
>  	.scp_da_to_va = mt8183_scp_da_to_va,
>  	.host_to_scp_reg = MT8183_HOST_TO_SCP,
>  	.host_to_scp_int_bit = MT8183_HOST_IPC_INT_BIT,
> -	.ipi_buf_offset = 0x7bdb0,
> +	.ipi_buf_offset = 0x3bdb0,
>  };
>  
>  static const struct mtk_scp_of_data mt8192_of_data = {
> -- 
> 2.18.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] remoteproc: mediatek: enable cache for mt8186 SCP
  2022-03-24 15:56   ` Mathieu Poirier
@ 2022-03-25  9:01     ` allen-kh.cheng
  -1 siblings, 0 replies; 8+ messages in thread
From: allen-kh.cheng @ 2022-03-25  9:01 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: Ohad Ben-Cohen, Bjorn Andersson, Rob Herring, Matthias Brugger,
	Tinghan Shen, Project_Global_Chrome_Upstream_Group, linux-kernel,
	devicetree, linux-mediatek, linux-arm-kernel, linux-remoteproc

Hi Mathieu,

On Thu, 2022-03-24 at 09:56 -0600, Mathieu Poirier wrote:
> Hi Allen,
> 
> On Tue, Mar 22, 2022 at 08:28:45PM +0800, Allen-KH Cheng wrote:
> > 1. Set SCP cache size before loading SCP FW. (8KB+8KB)
> > 2. Adjust ipi_buf_offset from 0x7bdb0 to 0x3BDB0 for enableing
> > cache
> > 
> > SCP side
> >  - IPI Buffer: 0x3BDB0 <-> 0x3C000
> >  - Cache: 0x3C000 <-> 0x40000
> > 
> 
> I would also like to find in this changelog "why" this patch is
> needed and more
> importantly, how it remains compatible with existing
> implementation.  I am
> mostly worried about implemenations where the application processor
> is using
> caches while the SCP is not.
> 
> I will also need a couple of "Tested-by" tags before moving forward
> with this
> patch.
> 
> Thanks,
> Mathieu
> 

Sorry for the confusion.

This patch is for enableing cache in SCP.

In mt8186 SCP, we don't have enough SRAM so SCP will use DRAM as
execution space. 

The DRAM power and latency is much larger than SRAM, so cache is used
to slight these affects.

The cache support is designed in SCP bus Architecture.

We reserve 0x3C000 <-> 0x40000 in SRAM(SCP) to support cache and set
I-cache and D-cache size before loading SCP FW.

If there isn't no this patch, SCP is still working and would not
support cache when using DRAM.

This patch will not affect implemenations where the application
processor is using caches.

I will add more information in commit message for this PATCH
and Tested-by tags in next version.

Thanks,
Allen

> > Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> > ---
> >  drivers/remoteproc/mtk_scp.c | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/remoteproc/mtk_scp.c
> > b/drivers/remoteproc/mtk_scp.c
> > index 38609153bf64..24065b6b4da8 100644
> > --- a/drivers/remoteproc/mtk_scp.c
> > +++ b/drivers/remoteproc/mtk_scp.c
> > @@ -401,6 +401,14 @@ static int mt8186_scp_before_load(struct
> > mtk_scp *scp)
> >  	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_P1);
> >  	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_p2);
> >  
> > +	/*
> > +	 * Set I-cache and D-cache size before loading SCP FW.
> > +	 * SCP SRAM logical address may change when cache size setting
> > differs.
> > +	 */
> > +	writel(MT8183_SCP_CACHE_CON_WAYEN | MT8183_SCP_CACHESIZE_8KB,
> > +	       scp->reg_base + MT8183_SCP_CACHE_CON);
> > +	writel(MT8183_SCP_CACHESIZE_8KB, scp->reg_base +
> > MT8183_SCP_DCACHE_CON);
> > +
> >  	return 0;
> >  }
> >  
> > @@ -905,7 +913,7 @@ static const struct mtk_scp_of_data
> > mt8186_of_data = {
> >  	.scp_da_to_va = mt8183_scp_da_to_va,
> >  	.host_to_scp_reg = MT8183_HOST_TO_SCP,
> >  	.host_to_scp_int_bit = MT8183_HOST_IPC_INT_BIT,
> > -	.ipi_buf_offset = 0x7bdb0,
> > +	.ipi_buf_offset = 0x3bdb0,
> >  };
> >  
> >  static const struct mtk_scp_of_data mt8192_of_data = {
> > -- 
> > 2.18.0
> > 


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] remoteproc: mediatek: enable cache for mt8186 SCP
@ 2022-03-25  9:01     ` allen-kh.cheng
  0 siblings, 0 replies; 8+ messages in thread
From: allen-kh.cheng @ 2022-03-25  9:01 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: Ohad Ben-Cohen, Bjorn Andersson, Rob Herring, Matthias Brugger,
	Tinghan Shen, Project_Global_Chrome_Upstream_Group, linux-kernel,
	devicetree, linux-mediatek, linux-arm-kernel, linux-remoteproc

Hi Mathieu,

On Thu, 2022-03-24 at 09:56 -0600, Mathieu Poirier wrote:
> Hi Allen,
> 
> On Tue, Mar 22, 2022 at 08:28:45PM +0800, Allen-KH Cheng wrote:
> > 1. Set SCP cache size before loading SCP FW. (8KB+8KB)
> > 2. Adjust ipi_buf_offset from 0x7bdb0 to 0x3BDB0 for enableing
> > cache
> > 
> > SCP side
> >  - IPI Buffer: 0x3BDB0 <-> 0x3C000
> >  - Cache: 0x3C000 <-> 0x40000
> > 
> 
> I would also like to find in this changelog "why" this patch is
> needed and more
> importantly, how it remains compatible with existing
> implementation.  I am
> mostly worried about implemenations where the application processor
> is using
> caches while the SCP is not.
> 
> I will also need a couple of "Tested-by" tags before moving forward
> with this
> patch.
> 
> Thanks,
> Mathieu
> 

Sorry for the confusion.

This patch is for enableing cache in SCP.

In mt8186 SCP, we don't have enough SRAM so SCP will use DRAM as
execution space. 

The DRAM power and latency is much larger than SRAM, so cache is used
to slight these affects.

The cache support is designed in SCP bus Architecture.

We reserve 0x3C000 <-> 0x40000 in SRAM(SCP) to support cache and set
I-cache and D-cache size before loading SCP FW.

If there isn't no this patch, SCP is still working and would not
support cache when using DRAM.

This patch will not affect implemenations where the application
processor is using caches.

I will add more information in commit message for this PATCH
and Tested-by tags in next version.

Thanks,
Allen

> > Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> > ---
> >  drivers/remoteproc/mtk_scp.c | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/remoteproc/mtk_scp.c
> > b/drivers/remoteproc/mtk_scp.c
> > index 38609153bf64..24065b6b4da8 100644
> > --- a/drivers/remoteproc/mtk_scp.c
> > +++ b/drivers/remoteproc/mtk_scp.c
> > @@ -401,6 +401,14 @@ static int mt8186_scp_before_load(struct
> > mtk_scp *scp)
> >  	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_P1);
> >  	writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_p2);
> >  
> > +	/*
> > +	 * Set I-cache and D-cache size before loading SCP FW.
> > +	 * SCP SRAM logical address may change when cache size setting
> > differs.
> > +	 */
> > +	writel(MT8183_SCP_CACHE_CON_WAYEN | MT8183_SCP_CACHESIZE_8KB,
> > +	       scp->reg_base + MT8183_SCP_CACHE_CON);
> > +	writel(MT8183_SCP_CACHESIZE_8KB, scp->reg_base +
> > MT8183_SCP_DCACHE_CON);
> > +
> >  	return 0;
> >  }
> >  
> > @@ -905,7 +913,7 @@ static const struct mtk_scp_of_data
> > mt8186_of_data = {
> >  	.scp_da_to_va = mt8183_scp_da_to_va,
> >  	.host_to_scp_reg = MT8183_HOST_TO_SCP,
> >  	.host_to_scp_int_bit = MT8183_HOST_IPC_INT_BIT,
> > -	.ipi_buf_offset = 0x7bdb0,
> > +	.ipi_buf_offset = 0x3bdb0,
> >  };
> >  
> >  static const struct mtk_scp_of_data mt8192_of_data = {
> > -- 
> > 2.18.0
> > 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-25  9:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 12:28 [PATCH] remoteproc: mediatek: enable cache for mt8186 SCP Allen-KH Cheng
2022-03-22 12:28 ` Allen-KH Cheng
2022-03-22 12:28 ` Allen-KH Cheng
2022-03-24 15:56 ` Mathieu Poirier
2022-03-24 15:56   ` Mathieu Poirier
2022-03-24 15:56   ` Mathieu Poirier
2022-03-25  9:01   ` allen-kh.cheng
2022-03-25  9:01     ` allen-kh.cheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.