mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] riscv: dts: sophgo: sg2000-milkv-duo-s: reserve memory for RTOS
@ 2026-09-16 16:06 Andrei Lalaev
  2026-09-16 17:10 ` Samuel Holland
  2026-09-16 18:34 ` Yao Zi
  0 siblings, 2 replies; 5+ messages in thread
From: Andrei Lalaev @ 2026-09-16 16:06 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Chen Wang,
	Inochi Amaoto
  Cc: devicetree, sophgo, linux-riscv, linux-kernel, Andrei Lalaev

The FSBL loads the coprocessor firmware into the last 2 MB of RAM.
Reserve this region to prevent Linux from using it.

Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
---
 arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts b/arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts
index 78a257839f6f..693c9fd7b771 100644
--- a/arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts
+++ b/arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts
@@ -22,6 +22,17 @@ chosen {
 		stdout-path = "serial0:115200n8";
 	};
 
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		coprocessor_rtos: region@9fe00000 {
+			reg = <0x9fe00000 0x200000>;
+			no-map;
+		};
+	};
+
 	wifi_pwrseq: wifi-pwrseq {
 		compatible = "mmc-pwrseq-simple";
 		reset-gpios = <&porta 15 GPIO_ACTIVE_LOW>;

---
base-commit: 9b87fdc9af2fbfcdb5c24a64139685ef80f6573f
change-id: 20260916-milkv-duo-s-rtos-memory-7a94933e35bd

Best regards,
--  
Andrei Lalaev <andrey.lalaev@gmail.com>


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

* Re: [PATCH] riscv: dts: sophgo: sg2000-milkv-duo-s: reserve memory for RTOS
  2026-09-16 16:06 [PATCH] riscv: dts: sophgo: sg2000-milkv-duo-s: reserve memory for RTOS Andrei Lalaev
@ 2026-09-16 17:10 ` Samuel Holland
  2026-09-17  2:02   ` Inochi Amaoto
  2026-09-16 18:34 ` Yao Zi
  1 sibling, 1 reply; 5+ messages in thread
From: Samuel Holland @ 2026-09-16 17:10 UTC (permalink / raw)
  To: Andrei Lalaev, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Chen Wang, Inochi Amaoto
  Cc: devicetree, sophgo, linux-riscv, linux-kernel

Hi Andrei,

On 2026-09-16 11:06 AM, Andrei Lalaev wrote:
> The FSBL loads the coprocessor firmware into the last 2 MB of RAM.
> Reserve this region to prevent Linux from using it.

If the FSBL wants to reserve some RAM, it should modify the devicetree at
runtime to add that reservation. Adding the reservation here creates an
unnecessary ABI surface between the FSBL and all consumers of the devicetree.

Regards,
Samuel

> Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
> ---
>  arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts b/arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts
> index 78a257839f6f..693c9fd7b771 100644
> --- a/arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts
> +++ b/arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts
> @@ -22,6 +22,17 @@ chosen {
>  		stdout-path = "serial0:115200n8";
>  	};
>  
> +	reserved-memory {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		ranges;
> +
> +		coprocessor_rtos: region@9fe00000 {
> +			reg = <0x9fe00000 0x200000>;
> +			no-map;
> +		};
> +	};
> +
>  	wifi_pwrseq: wifi-pwrseq {
>  		compatible = "mmc-pwrseq-simple";
>  		reset-gpios = <&porta 15 GPIO_ACTIVE_LOW>;
> 
> ---
> base-commit: 9b87fdc9af2fbfcdb5c24a64139685ef80f6573f
> change-id: 20260916-milkv-duo-s-rtos-memory-7a94933e35bd
> 
> Best regards,
> --  
> Andrei Lalaev <andrey.lalaev@gmail.com>
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv


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

* Re: [PATCH] riscv: dts: sophgo: sg2000-milkv-duo-s: reserve memory for RTOS
  2026-09-16 16:06 [PATCH] riscv: dts: sophgo: sg2000-milkv-duo-s: reserve memory for RTOS Andrei Lalaev
  2026-09-16 17:10 ` Samuel Holland
@ 2026-09-16 18:34 ` Yao Zi
  1 sibling, 0 replies; 5+ messages in thread
From: Yao Zi @ 2026-09-16 18:34 UTC (permalink / raw)
  To: Andrei Lalaev, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Chen Wang, Inochi Amaoto
  Cc: devicetree, sophgo, linux-riscv, linux-kernel, Yao Zi

On Wed, Sep 16, 2026 at 06:06:30PM +0200, Andrei Lalaev wrote:
> The FSBL loads the coprocessor firmware into the last 2 MB of RAM.
> Reserve this region to prevent Linux from using it.

What if the coprocessor changes the load address, e.g., in a new
release, and how could we support other bootloader implementations
with this modification? Wouldn't the part of memory be wasted if no
coprocessor firmware is loaded at all?

It seems to me the best solution is to modify the FSBL to fix up the
devicetree to reserve memory where the coprocessor firmware is loaded
instead.

Anyway, this reserved region isn't defined by the hardware, thus we
shouldn't include it in the upstream Linux devicetree, since it should
describe the hardware.

> Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>

Best regards.
Yao Zi

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

* Re: [PATCH] riscv: dts: sophgo: sg2000-milkv-duo-s: reserve memory for RTOS
  2026-09-16 17:10 ` Samuel Holland
@ 2026-09-17  2:02   ` Inochi Amaoto
  2026-09-17  3:27     ` Andrei Lalaev
  0 siblings, 1 reply; 5+ messages in thread
From: Inochi Amaoto @ 2026-09-17  2:02 UTC (permalink / raw)
  To: Andrei Lalaev, Samuel Holland
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Chen Wang,
	Inochi Amaoto, devicetree, sophgo, linux-riscv, linux-kernel

On Wed, Sep 16, 2026 at 12:10:23PM -0500, Samuel Holland wrote:
> Hi Andrei,
> 
> On 2026-09-16 11:06 AM, Andrei Lalaev wrote:
> > The FSBL loads the coprocessor firmware into the last 2 MB of RAM.
> > Reserve this region to prevent Linux from using it.
> 
> If the FSBL wants to reserve some RAM, it should modify the devicetree at
> runtime to add that reservation. Adding the reservation here creates an
> unnecessary ABI surface between the FSBL and all consumers of the devicetree.
> 
> Regards,
> Samuel
> 

This is fair, and the fact is that the current fsbl can disable
coprocessor in its configuration. So I will not take this patch
and maybe do a cleanup for existed devicetree if I have enough
time for it.

Regards,
Inohci

> > Signed-off-by: Andrei Lalaev <andrey.lalaev@gmail.com>
> > ---
> >  arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts b/arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts
> > index 78a257839f6f..693c9fd7b771 100644
> > --- a/arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts
> > +++ b/arch/riscv/boot/dts/sophgo/sg2000-milkv-duo-s.dts
> > @@ -22,6 +22,17 @@ chosen {
> >  		stdout-path = "serial0:115200n8";
> >  	};
> >  
> > +	reserved-memory {
> > +		#address-cells = <1>;
> > +		#size-cells = <1>;
> > +		ranges;
> > +
> > +		coprocessor_rtos: region@9fe00000 {
> > +			reg = <0x9fe00000 0x200000>;
> > +			no-map;
> > +		};
> > +	};
> > +
> >  	wifi_pwrseq: wifi-pwrseq {
> >  		compatible = "mmc-pwrseq-simple";
> >  		reset-gpios = <&porta 15 GPIO_ACTIVE_LOW>;
> > 
> > ---
> > base-commit: 9b87fdc9af2fbfcdb5c24a64139685ef80f6573f
> > change-id: 20260916-milkv-duo-s-rtos-memory-7a94933e35bd
> > 
> > Best regards,
> > --  
> > Andrei Lalaev <andrey.lalaev@gmail.com>
> > 
> > 
> > _______________________________________________
> > linux-riscv mailing list
> > linux-riscv@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-riscv
> 

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

* Re: [PATCH] riscv: dts: sophgo: sg2000-milkv-duo-s: reserve memory for RTOS
  2026-09-17  2:02   ` Inochi Amaoto
@ 2026-09-17  3:27     ` Andrei Lalaev
  0 siblings, 0 replies; 5+ messages in thread
From: Andrei Lalaev @ 2026-09-17  3:27 UTC (permalink / raw)
  To: Inochi Amaoto, Samuel Holland, Yao Zi
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Chen Wang,
	devicetree, sophgo, linux-riscv, linux-kernel

Hi Inochi, Samuel, Yao,

On 17.09.26 04:02, Inochi Amaoto wrote:
> On Wed, Sep 16, 2026 at 12:10:23PM -0500, Samuel Holland wrote:
>> Hi Andrei,
>>
>> On 2026-09-16 11:06 AM, Andrei Lalaev wrote:
>>> The FSBL loads the coprocessor firmware into the last 2 MB of RAM.
>>> Reserve this region to prevent Linux from using it.
>>
>> If the FSBL wants to reserve some RAM, it should modify the devicetree at
>> runtime to add that reservation. Adding the reservation here creates an
>> unnecessary ABI surface between the FSBL and all consumers of the devicetree.
>>
>> Regards,
>> Samuel
>>
> 
> This is fair, and the fact is that the current fsbl can disable
> coprocessor in its configuration. So I will not take this patch
> and maybe do a cleanup for existed devicetree if I have enough
> time for it.

I guess you are right. Just thought that it might have been mistakenly
overlooked for Duo-S because both Duo 64M and Duo 256M have the same
node in their DTSes.
If it is okay with you, I will try remove this node from the DTSes for the
64M/256M variants.

Thank you for the review and sorry for the noise.

 
> Regards,
> Inohci
> 
-- 
Best regards,
Andrei Lalaev

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

end of thread, other threads:[~2026-09-17  3:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 16:06 [PATCH] riscv: dts: sophgo: sg2000-milkv-duo-s: reserve memory for RTOS Andrei Lalaev
2026-09-16 17:10 ` Samuel Holland
2026-09-17  2:02   ` Inochi Amaoto
2026-09-17  3:27     ` Andrei Lalaev
2026-09-16 18:34 ` Yao Zi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®