linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Support multiple reserved memory regions
@ 2024-07-31 12:17 Shun-yi Wang
  2024-07-31 12:17 ` [PATCH v2 1/2] dt-bindings: remoteproc: " Shun-yi Wang
  2024-07-31 12:17 ` [PATCH v2 2/2] remoteproc: mediatek: " Shun-yi Wang
  0 siblings, 2 replies; 7+ messages in thread
From: Shun-yi Wang @ 2024-07-31 12:17 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Rob Herring
  Cc: Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno,
	Conor Dooley, Tinghan Shen, linux-remoteproc, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek,
	Project_Global_Chrome_Upstream_Group, jason-ch.chen, yaya.chang,
	teddy.chen, shun-yi.wang

From: "shun-yi.wang" <shun-yi.wang@mediatek.com>

Besides the reserved memory region for SCP, there are additional 
reserved memory regions for specific hardware use.
Currently, only a single memory region is supported.
Modifications are made to support multiple memory regions.

Changes in v2:
 - Modify description of memory region in dt-bindings document
 - Fix comments in v1, initial value and from '!i' 'i == 0'
 - Link to v1: https://lore.kernel.org/all/20240703115308.17436-1-shun-yi.wang@mediatek.com

shun-yi.wang (2):
  dt-bindings: remoteproc: Support multiple reserved memory regions
  remoteproc: mediatek: Support multiple reserved memory regions

 .../bindings/remoteproc/mtk,scp.yaml          |  8 ++++--
 drivers/remoteproc/mtk_scp.c                  | 27 ++++++++++++-------
 2 files changed, 24 insertions(+), 11 deletions(-)

-- 
2.18.0



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

* [PATCH v2 1/2] dt-bindings: remoteproc: Support multiple reserved memory regions
  2024-07-31 12:17 [PATCH v2 0/2] Support multiple reserved memory regions Shun-yi Wang
@ 2024-07-31 12:17 ` Shun-yi Wang
  2024-07-31 12:40   ` Krzysztof Kozlowski
  2024-07-31 12:17 ` [PATCH v2 2/2] remoteproc: mediatek: " Shun-yi Wang
  1 sibling, 1 reply; 7+ messages in thread
From: Shun-yi Wang @ 2024-07-31 12:17 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Rob Herring
  Cc: Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno,
	Conor Dooley, Tinghan Shen, linux-remoteproc, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek,
	Project_Global_Chrome_Upstream_Group, jason-ch.chen, yaya.chang,
	teddy.chen, shun-yi.wang

From: "shun-yi.wang" <shun-yi.wang@mediatek.com>

Remove the maximum number of 1 for memory regions.
Instead, add some descriptions to ensure the integrity
of the documentation.

Signed-off-by: shun-yi.wang <shun-yi.wang@mediatek.com>
---
 Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
index d05d1563ec19..3362c8ffdccc 100644
--- a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
+++ b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
@@ -55,7 +55,9 @@ properties:
       initializing SCP.
 
   memory-region:
-    maxItems: 1
+    description:
+      List of phandles to the reserved memory nodes used by
+      remoteproc devices.
 
   cros-ec-rpmsg:
     $ref: /schemas/mfd/google,cros-ec.yaml
@@ -123,7 +125,9 @@ patternProperties:
           initializing sub cores of multi-core SCP.
 
       memory-region:
-        maxItems: 1
+        description:
+          List of phandles to the reserved memory nodes used by
+          remoteproc devices.
 
       cros-ec-rpmsg:
         $ref: /schemas/mfd/google,cros-ec.yaml
-- 
2.18.0



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

* [PATCH v2 2/2] remoteproc: mediatek: Support multiple reserved memory regions
  2024-07-31 12:17 [PATCH v2 0/2] Support multiple reserved memory regions Shun-yi Wang
  2024-07-31 12:17 ` [PATCH v2 1/2] dt-bindings: remoteproc: " Shun-yi Wang
@ 2024-07-31 12:17 ` Shun-yi Wang
  1 sibling, 0 replies; 7+ messages in thread
From: Shun-yi Wang @ 2024-07-31 12:17 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Rob Herring
  Cc: Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno,
	Conor Dooley, Tinghan Shen, linux-remoteproc, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek,
	Project_Global_Chrome_Upstream_Group, jason-ch.chen, yaya.chang,
	teddy.chen, shun-yi.wang

From: "shun-yi.wang" <shun-yi.wang@mediatek.com>

SCP supports multiple reserved memory regions, intended for
specific hardwards.

Signed-off-by: shun-yi.wang <shun-yi.wang@mediatek.com>
---
 drivers/remoteproc/mtk_scp.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 857a61760b27..0e799d0bf73d 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -1006,20 +1006,29 @@ EXPORT_SYMBOL_GPL(scp_mapping_dm_addr);
 
 static int scp_map_memory_region(struct mtk_scp *scp)
 {
-	int ret;
 	const struct mtk_scp_sizes_data *scp_sizes;
+	struct device_node *node = scp->dev->of_node;
+	struct of_phandle_iterator it;
+	int ret, err;
+	int i = 0;
 
-	ret = of_reserved_mem_device_init(scp->dev);
+	of_for_each_phandle(&it, err, node, "memory-region", NULL, 0) {
+		ret = of_reserved_mem_device_init_by_idx(scp->dev, node, i);
 
-	/* reserved memory is optional. */
-	if (ret == -ENODEV) {
-		dev_info(scp->dev, "skipping reserved memory initialization.");
-		return 0;
+		if (ret) {
+			dev_err(scp->dev, "failed to assign memory-region: %s\n",
+				it.node->name);
+			of_node_put(it.node);
+			return -ENOMEM;
+		}
+
+		i++;
 	}
 
-	if (ret) {
-		dev_err(scp->dev, "failed to assign memory-region: %d\n", ret);
-		return -ENOMEM;
+	/* reserved memory is optional. */
+	if (i == 0) {
+		dev_dbg(scp->dev, "skipping reserved memory initialization.");
+		return 0;
 	}
 
 	/* Reserved SCP code size */
-- 
2.18.0



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

* Re: [PATCH v2 1/2] dt-bindings: remoteproc: Support multiple reserved memory regions
  2024-07-31 12:17 ` [PATCH v2 1/2] dt-bindings: remoteproc: " Shun-yi Wang
@ 2024-07-31 12:40   ` Krzysztof Kozlowski
  2024-07-31 13:41     ` Shun-Yi Wang (王順億)
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2024-07-31 12:40 UTC (permalink / raw)
  To: Shun-yi Wang, Bjorn Andersson, Mathieu Poirier, Rob Herring
  Cc: Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno,
	Conor Dooley, Tinghan Shen, linux-remoteproc, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek,
	Project_Global_Chrome_Upstream_Group, jason-ch.chen, yaya.chang,
	teddy.chen

On 31/07/2024 14:17, Shun-yi Wang wrote:
> From: "shun-yi.wang" <shun-yi.wang@mediatek.com>
> 
> Remove the maximum number of 1 for memory regions.

Why?

> Instead, add some descriptions to ensure the integrity
> of the documentation.

What? How is this related?

> 
> Signed-off-by: shun-yi.wang <shun-yi.wang@mediatek.com>
> ---
>  Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
> index d05d1563ec19..3362c8ffdccc 100644
> --- a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
> +++ b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
> @@ -55,7 +55,9 @@ properties:
>        initializing SCP.
>  
>    memory-region:
> -    maxItems: 1

No, no, no. Bindings must be specific/constrainted.

> +    description:
> +      List of phandles to the reserved memory nodes used by
> +      remoteproc devices.

No, drop, it's entirely redundant and pointless. You did not add any new
information. This is always a list, always phandles and always reserved
memory regions. So what does it bring?

Please do not upstream random junk from your downstream kernel. :(

Best regards,
Krzysztof



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

* Re: [PATCH v2 1/2] dt-bindings: remoteproc: Support multiple reserved memory regions
  2024-07-31 12:40   ` Krzysztof Kozlowski
@ 2024-07-31 13:41     ` Shun-Yi Wang (王順億)
  2024-07-31 13:54       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Shun-Yi Wang (王順億) @ 2024-07-31 13:41 UTC (permalink / raw)
  To: robh@kernel.org, mathieu.poirier@linaro.org, andersson@kernel.org,
	krzk@kernel.org
  Cc: linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org,
	Jason-ch Chen (陳建豪),
	Yaya Chang (張雅清), conor+dt@kernel.org,
	Project_Global_Chrome_Upstream_Group,
	Teddy Chen (陳乾元),
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	krzk+dt@kernel.org, angelogioacchino.delregno@collabora.com,
	TingHan Shen (沈廷翰)

Hi Krzysztof,

Thanks for the reviews.

On Wed, 2024-07-31 at 14:40 +0200, Krzysztof Kozlowski wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  On 31/07/2024 14:17, Shun-yi Wang wrote:
> > From: "shun-yi.wang" <shun-yi.wang@mediatek.com>
> > 
> > Remove the maximum number of 1 for memory regions.
> 
> Why?
> 

For future applications, MTK SCP will reserve multiple regions for
specific hardware use.

> > Instead, add some descriptions to ensure the integrity
> > of the documentation.
> 
> What? How is this related?
> 

My original thinking was to keep the memory-region option.
But currently, there is no maximum value limitation, so I
add some description. Should I just drop the description directly?

Best regards,
Shun-yi

> > 
> > Signed-off-by: shun-yi.wang <shun-yi.wang@mediatek.com>
> > ---
> >  Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml | 8
> ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git
> a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
> b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
> > index d05d1563ec19..3362c8ffdccc 100644
> > --- a/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
> > +++ b/Documentation/devicetree/bindings/remoteproc/mtk,scp.yaml
> > @@ -55,7 +55,9 @@ properties:
> >        initializing SCP.
> >  
> >    memory-region:
> > -    maxItems: 1
> 
> No, no, no. Bindings must be specific/constrainted.
> 
> > +    description:
> > +      List of phandles to the reserved memory nodes used by
> > +      remoteproc devices.
> 
> No, drop, it's entirely redundant and pointless. You did not add any
> new
> information. This is always a list, always phandles and always
> reserved
> memory regions. So what does it bring?
> 
> Please do not upstream random junk from your downstream kernel. :(
> 
> Best regards,
> Krzysztof
> 

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

* Re: [PATCH v2 1/2] dt-bindings: remoteproc: Support multiple reserved memory regions
  2024-07-31 13:41     ` Shun-Yi Wang (王順億)
@ 2024-07-31 13:54       ` Krzysztof Kozlowski
  2024-07-31 16:49         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2024-07-31 13:54 UTC (permalink / raw)
  To: Shun-Yi Wang (王順億), robh@kernel.org,
	mathieu.poirier@linaro.org, andersson@kernel.org
  Cc: linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org,
	Jason-ch Chen (陳建豪),
	Yaya Chang (張雅清), conor+dt@kernel.org,
	Project_Global_Chrome_Upstream_Group,
	Teddy Chen (陳乾元),
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	krzk+dt@kernel.org, angelogioacchino.delregno@collabora.com,
	TingHan Shen (沈廷翰)

On 31/07/2024 15:41, Shun-Yi Wang (王順億) wrote:
> Hi Krzysztof,
> 
> Thanks for the reviews.
> 
> On Wed, 2024-07-31 at 14:40 +0200, Krzysztof Kozlowski wrote:
>>  	 
>> External email : Please do not click links or open attachments until
>> you have verified the sender or the content.
>>  On 31/07/2024 14:17, Shun-yi Wang wrote:
>>> From: "shun-yi.wang" <shun-yi.wang@mediatek.com>
>>>
>>> Remove the maximum number of 1 for memory regions.
>>
>> Why?
>>
> 
> For future applications, MTK SCP will reserve multiple regions for
> specific hardware use.

That's not a reason to drop constrain on an entry.

> 
>>> Instead, add some descriptions to ensure the integrity
>>> of the documentation.
>>
>> What? How is this related?
>>
> 
> My original thinking was to keep the memory-region option.
> But currently, there is no maximum value limitation, so I
> add some description. Should I just drop the description directly?

Read all comments.

Best regards,
Krzysztof



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

* Re: [PATCH v2 1/2] dt-bindings: remoteproc: Support multiple reserved memory regions
  2024-07-31 13:54       ` Krzysztof Kozlowski
@ 2024-07-31 16:49         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2024-07-31 16:49 UTC (permalink / raw)
  To: Shun-Yi Wang (王順億), robh@kernel.org,
	mathieu.poirier@linaro.org, andersson@kernel.org
  Cc: linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org,
	Jason-ch Chen (陳建豪),
	Yaya Chang (張雅清), conor+dt@kernel.org,
	Project_Global_Chrome_Upstream_Group,
	Teddy Chen (陳乾元),
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	krzk+dt@kernel.org, angelogioacchino.delregno@collabora.com,
	TingHan Shen (沈廷翰)

On 31/07/2024 15:54, Krzysztof Kozlowski wrote:
> On 31/07/2024 15:41, Shun-Yi Wang (王順億) wrote:
>> Hi Krzysztof,
>>
>> Thanks for the reviews.
>>
>> On Wed, 2024-07-31 at 14:40 +0200, Krzysztof Kozlowski wrote:
>>>  	 
>>> External email : Please do not click links or open attachments until
>>> you have verified the sender or the content.
>>>  On 31/07/2024 14:17, Shun-yi Wang wrote:
>>>> From: "shun-yi.wang" <shun-yi.wang@mediatek.com>
>>>>
>>>> Remove the maximum number of 1 for memory regions.
>>>
>>> Why?
>>>
>>
>> For future applications, MTK SCP will reserve multiple regions for
>> specific hardware use.
> 
> That's not a reason to drop constrain on an entry.

Maybe I was not that clear, so to explain more - entries must be
constrained, so provide widest constraints in top-level properties place
and narrow the constrains per variant in allOf:if:then: like:

https://elixir.bootlin.com/linux/v6.8/source/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml#L132

Best regards,
Krzysztof



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

end of thread, other threads:[~2024-07-31 16:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31 12:17 [PATCH v2 0/2] Support multiple reserved memory regions Shun-yi Wang
2024-07-31 12:17 ` [PATCH v2 1/2] dt-bindings: remoteproc: " Shun-yi Wang
2024-07-31 12:40   ` Krzysztof Kozlowski
2024-07-31 13:41     ` Shun-Yi Wang (王順億)
2024-07-31 13:54       ` Krzysztof Kozlowski
2024-07-31 16:49         ` Krzysztof Kozlowski
2024-07-31 12:17 ` [PATCH v2 2/2] remoteproc: mediatek: " Shun-yi Wang

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).