From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The first 128MB of memory is reserved on this board for secure area.
Secure area is a RAM region used by firmware. The rzg3s-smarc-som.dtsi
memory node (memory@48000000) excludes the secure area.
Update the PCIe dma-ranges property to reflect this.
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v4:
- updated the patch description with secure area meaning
- added reference clock for pcie_port0
Changes in v3:
- collected tags
Changes in v2:
- none, this patch is new
arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi b/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi
index 39845faec894..4c1bb97ac9ed 100644
--- a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi
@@ -214,6 +214,16 @@ &sdhi2 {
};
#endif
+&pcie {
+ /* First 128MB is reserved for secure area. */
+ dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>;
+};
+
+&pcie_port0 {
+ clocks = <&versa3 5>;
+ clock-names = "ref";
+};
+
&pinctrl {
#if SW_CONFIG3 == SW_ON
eth0-phy-irq-hog {
--
2.43.0
Hi Claudiu, On Fri, 12 Sept 2025 at 14:24, Claudiu <claudiu.beznea@tuxon.dev> wrote: > From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > > The first 128MB of memory is reserved on this board for secure area. > Secure area is a RAM region used by firmware. The rzg3s-smarc-som.dtsi > memory node (memory@48000000) excludes the secure area. > Update the PCIe dma-ranges property to reflect this. > > Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Thanks for your patch! > --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi > +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi > @@ -214,6 +214,16 @@ &sdhi2 { > }; > #endif > > +&pcie { > + /* First 128MB is reserved for secure area. */ Do you really have to take that into account here? I believe that 128 MiB region will never be used anyway, as it is excluded from the memory map (see memory@48000000). > + dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>; Hence shouldn't you add dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>; to the pcie node in arch/arm64/boot/dts/renesas/r9a08g045s33.dtsi instead, like is done for all other Renesas SoCs that have PCIe? > +}; > + > +&pcie_port0 { > + clocks = <&versa3 5>; > + clock-names = "ref"; > +}; This is not related. > + > &pinctrl { > #if SW_CONFIG3 == SW_ON > eth0-phy-irq-hog { Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi, Geert, On 9/18/25 12:09, Geert Uytterhoeven wrote: > Hi Claudiu, > > On Fri, 12 Sept 2025 at 14:24, Claudiu <claudiu.beznea@tuxon.dev> wrote: >> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >> >> The first 128MB of memory is reserved on this board for secure area. >> Secure area is a RAM region used by firmware. The rzg3s-smarc-som.dtsi >> memory node (memory@48000000) excludes the secure area. >> Update the PCIe dma-ranges property to reflect this. >> >> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> >> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > > Thanks for your patch! > >> --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi >> +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi >> @@ -214,6 +214,16 @@ &sdhi2 { >> }; >> #endif >> >> +&pcie { >> + /* First 128MB is reserved for secure area. */ > > Do you really have to take that into account here? I believe that > 128 MiB region will never be used anyway, as it is excluded from the > memory map (see memory@48000000). > >> + dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>; > > Hence shouldn't you add > > dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>; > > to the pcie node in arch/arm64/boot/dts/renesas/r9a08g045s33.dtsi > instead, like is done for all other Renesas SoCs that have PCIe? I chose to add it here as the rzg3s-smarc-som.dtsi is the one that defines the available memory for board, as the available memory is something board dependent. If you consider it is better to have it in the SoC file, please let me know. > >> +}; >> + >> +&pcie_port0 { >> + clocks = <&versa3 5>; >> + clock-names = "ref"; >> +}; > > This is not related. Ah, right! Could you please let me know if you prefer to have another patch or to update the patch description? Thank you, Claudiu > >> + >> &pinctrl { >> #if SW_CONFIG3 == SW_ON >> eth0-phy-irq-hog { > > Gr{oetje,eeting}s, > > Geert > > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds >
Hi Claudiu, On Thu, 18 Sept 2025 at 11:47, Claudiu Beznea <claudiu.beznea@tuxon.dev> wrote: > On 9/18/25 12:09, Geert Uytterhoeven wrote: > > On Fri, 12 Sept 2025 at 14:24, Claudiu <claudiu.beznea@tuxon.dev> wrote: > >> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > >> > >> The first 128MB of memory is reserved on this board for secure area. > >> Secure area is a RAM region used by firmware. The rzg3s-smarc-som.dtsi > >> memory node (memory@48000000) excludes the secure area. > >> Update the PCIe dma-ranges property to reflect this. > >> > >> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > >> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > > > > Thanks for your patch! > > > >> --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi > >> +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi > >> @@ -214,6 +214,16 @@ &sdhi2 { > >> }; > >> #endif > >> > >> +&pcie { > >> + /* First 128MB is reserved for secure area. */ > > > > Do you really have to take that into account here? I believe that > > 128 MiB region will never be used anyway, as it is excluded from the > > memory map (see memory@48000000). > > > >> + dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>; > > > > Hence shouldn't you add > > > > dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>; Oops, I really meant (forgot to edit after copying it): dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0x0 0x40000000>; > > > > to the pcie node in arch/arm64/boot/dts/renesas/r9a08g045s33.dtsi > > instead, like is done for all other Renesas SoCs that have PCIe? > > I chose to add it here as the rzg3s-smarc-som.dtsi is the one that defines > the available memory for board, as the available memory is something board > dependent. But IMHO it is independent from the amount of memory on the board. On other SoCs, it has a comment: /* Map all possible DDR as inbound ranges */ > > If you consider it is better to have it in the SoC file, please let me know. Hence yes please. However, I missed you already have: /* Map all possible DRAM ranges (4 GB). */ dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0x1 0x0>; in r9a08g045.dtsi, so life's good. + > >> +}; > >> + > >> +&pcie_port0 { > >> + clocks = <&versa3 5>; > >> + clock-names = "ref"; > >> +}; > > > > This is not related. > > Ah, right! Could you please let me know if you prefer to have another patch > or to update the patch description? Given the dma-ranges changes is IMHO not needed, this can just be a separate patch. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi, Geert, On 9/18/25 13:00, Geert Uytterhoeven wrote: > Hi Claudiu, > > On Thu, 18 Sept 2025 at 11:47, Claudiu Beznea <claudiu.beznea@tuxon.dev> wrote: >> On 9/18/25 12:09, Geert Uytterhoeven wrote: >>> On Fri, 12 Sept 2025 at 14:24, Claudiu <claudiu.beznea@tuxon.dev> wrote: >>>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>>> >>>> The first 128MB of memory is reserved on this board for secure area. >>>> Secure area is a RAM region used by firmware. The rzg3s-smarc-som.dtsi >>>> memory node (memory@48000000) excludes the secure area. >>>> Update the PCIe dma-ranges property to reflect this. >>>> >>>> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> >>>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>> >>> Thanks for your patch! >>> >>>> --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi >>>> +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi >>>> @@ -214,6 +214,16 @@ &sdhi2 { >>>> }; >>>> #endif >>>> >>>> +&pcie { >>>> + /* First 128MB is reserved for secure area. */ >>> >>> Do you really have to take that into account here? I believe that >>> 128 MiB region will never be used anyway, as it is excluded from the >>> memory map (see memory@48000000). >>> >>>> + dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>; >>> >>> Hence shouldn't you add >>> >>> dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>; > > Oops, I really meant (forgot to edit after copying it): > > dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0x0 0x40000000>; > >>> >>> to the pcie node in arch/arm64/boot/dts/renesas/r9a08g045s33.dtsi >>> instead, like is done for all other Renesas SoCs that have PCIe? >> >> I chose to add it here as the rzg3s-smarc-som.dtsi is the one that defines >> the available memory for board, as the available memory is something board >> dependent. > > But IMHO it is independent from the amount of memory on the board. > On other SoCs, it has a comment: > > /* Map all possible DDR as inbound ranges */ > >> >> If you consider it is better to have it in the SoC file, please let me know. > > Hence yes please. > > However, I missed you already have: > > /* Map all possible DRAM ranges (4 GB). */ > dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0x1 0x0>; > > in r9a08g045.dtsi, so life's good. > > + >>>> +}; >>>> + >>>> +&pcie_port0 { >>>> + clocks = <&versa3 5>; >>>> + clock-names = "ref"; >>>> +}; >>> >>> This is not related. >> >> Ah, right! Could you please let me know if you prefer to have another patch >> or to update the patch description? > > Given the dma-ranges changes is IMHO not needed, I kept it here as the driver configures the PCIe registers for the inbound windows with the values passed though the dma-ranges. This is done through rzg3s_pcie_set_inbound_windows() -> rzg3s_pcie_set_inbound_window(). The controller will be aware that the secure area zone is something valid to work with. In that case, if my understanding of PCIe windows is right, I added this in the idea that an endpoint (a malicious one?) could DMA into/from secure area if we don't exclude it here? Thank you, Claudiu > this can just be > a separate patch. > > Gr{oetje,eeting}s, > > Geert >
On Fri, Sep 19, 2025 at 10:38:52AM +0300, Claudiu Beznea wrote: > Hi, Geert, > > On 9/18/25 13:00, Geert Uytterhoeven wrote: > > Hi Claudiu, > > > > On Thu, 18 Sept 2025 at 11:47, Claudiu Beznea <claudiu.beznea@tuxon.dev> wrote: > >> On 9/18/25 12:09, Geert Uytterhoeven wrote: > >>> On Fri, 12 Sept 2025 at 14:24, Claudiu <claudiu.beznea@tuxon.dev> wrote: > >>>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > >>>> > >>>> The first 128MB of memory is reserved on this board for secure area. > >>>> Secure area is a RAM region used by firmware. The rzg3s-smarc-som.dtsi > >>>> memory node (memory@48000000) excludes the secure area. > >>>> Update the PCIe dma-ranges property to reflect this. > >>>> > >>>> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > >>>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > >>> > >>> Thanks for your patch! > >>> > >>>> --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi > >>>> +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi > >>>> @@ -214,6 +214,16 @@ &sdhi2 { > >>>> }; > >>>> #endif > >>>> > >>>> +&pcie { > >>>> + /* First 128MB is reserved for secure area. */ > >>> > >>> Do you really have to take that into account here? I believe that > >>> 128 MiB region will never be used anyway, as it is excluded from the > >>> memory map (see memory@48000000). > >>> > >>>> + dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>; > >>> > >>> Hence shouldn't you add > >>> > >>> dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>; > > > > Oops, I really meant (forgot to edit after copying it): > > > > dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0x0 0x40000000>; > > > >>> > >>> to the pcie node in arch/arm64/boot/dts/renesas/r9a08g045s33.dtsi > >>> instead, like is done for all other Renesas SoCs that have PCIe? > >> > >> I chose to add it here as the rzg3s-smarc-som.dtsi is the one that defines > >> the available memory for board, as the available memory is something board > >> dependent. > > > > But IMHO it is independent from the amount of memory on the board. > > On other SoCs, it has a comment: > > > > /* Map all possible DDR as inbound ranges */ > > > >> > >> If you consider it is better to have it in the SoC file, please let me know. > > > > Hence yes please. > > > > However, I missed you already have: > > > > /* Map all possible DRAM ranges (4 GB). */ > > dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0x1 0x0>; > > > > in r9a08g045.dtsi, so life's good. > > > > + > >>>> +}; > >>>> + > >>>> +&pcie_port0 { > >>>> + clocks = <&versa3 5>; > >>>> + clock-names = "ref"; > >>>> +}; > >>> > >>> This is not related. > >> > >> Ah, right! Could you please let me know if you prefer to have another patch > >> or to update the patch description? > > > > Given the dma-ranges changes is IMHO not needed, > > I kept it here as the driver configures the PCIe registers for the inbound > windows with the values passed though the dma-ranges. This is done through > rzg3s_pcie_set_inbound_windows() -> rzg3s_pcie_set_inbound_window(). The > controller will be aware that the secure area zone is something valid to > work with. In that case, if my understanding of PCIe windows is right, I > added this in the idea that an endpoint (a malicious one?) could DMA > into/from secure area if we don't exclude it here? > That's true. But do you really have an usecase to setup inbound window for the endpoints? What does the endpoint do with this memory? - Mani -- மணிவண்ணன் சதாசிவம்
On 9/19/25 11:25, Manivannan Sadhasivam wrote: > On Fri, Sep 19, 2025 at 10:38:52AM +0300, Claudiu Beznea wrote: >> Hi, Geert, >> >> On 9/18/25 13:00, Geert Uytterhoeven wrote: >>> Hi Claudiu, >>> >>> On Thu, 18 Sept 2025 at 11:47, Claudiu Beznea <claudiu.beznea@tuxon.dev> wrote: >>>> On 9/18/25 12:09, Geert Uytterhoeven wrote: >>>>> On Fri, 12 Sept 2025 at 14:24, Claudiu <claudiu.beznea@tuxon.dev> wrote: >>>>>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>>>>> >>>>>> The first 128MB of memory is reserved on this board for secure area. >>>>>> Secure area is a RAM region used by firmware. The rzg3s-smarc-som.dtsi >>>>>> memory node (memory@48000000) excludes the secure area. >>>>>> Update the PCIe dma-ranges property to reflect this. >>>>>> >>>>>> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> >>>>>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> >>>>> >>>>> Thanks for your patch! >>>>> >>>>>> --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi >>>>>> +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi >>>>>> @@ -214,6 +214,16 @@ &sdhi2 { >>>>>> }; >>>>>> #endif >>>>>> >>>>>> +&pcie { >>>>>> + /* First 128MB is reserved for secure area. */ >>>>> >>>>> Do you really have to take that into account here? I believe that >>>>> 128 MiB region will never be used anyway, as it is excluded from the >>>>> memory map (see memory@48000000). >>>>> >>>>>> + dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>; >>>>> >>>>> Hence shouldn't you add >>>>> >>>>> dma-ranges = <0x42000000 0 0x48000000 0 0x48000000 0x0 0x38000000>; >>> >>> Oops, I really meant (forgot to edit after copying it): >>> >>> dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0x0 0x40000000>; >>> >>>>> >>>>> to the pcie node in arch/arm64/boot/dts/renesas/r9a08g045s33.dtsi >>>>> instead, like is done for all other Renesas SoCs that have PCIe? >>>> >>>> I chose to add it here as the rzg3s-smarc-som.dtsi is the one that defines >>>> the available memory for board, as the available memory is something board >>>> dependent. >>> >>> But IMHO it is independent from the amount of memory on the board. >>> On other SoCs, it has a comment: >>> >>> /* Map all possible DDR as inbound ranges */ >>> >>>> >>>> If you consider it is better to have it in the SoC file, please let me know. >>> >>> Hence yes please. >>> >>> However, I missed you already have: >>> >>> /* Map all possible DRAM ranges (4 GB). */ >>> dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0x1 0x0>; >>> >>> in r9a08g045.dtsi, so life's good. >>> >>> + >>>>>> +}; >>>>>> + >>>>>> +&pcie_port0 { >>>>>> + clocks = <&versa3 5>; >>>>>> + clock-names = "ref"; >>>>>> +}; >>>>> >>>>> This is not related. >>>> >>>> Ah, right! Could you please let me know if you prefer to have another patch >>>> or to update the patch description? >>> >>> Given the dma-ranges changes is IMHO not needed, >> >> I kept it here as the driver configures the PCIe registers for the inbound >> windows with the values passed though the dma-ranges. This is done through >> rzg3s_pcie_set_inbound_windows() -> rzg3s_pcie_set_inbound_window(). The >> controller will be aware that the secure area zone is something valid to >> work with. In that case, if my understanding of PCIe windows is right, I >> added this in the idea that an endpoint (a malicious one?) could DMA >> into/from secure area if we don't exclude it here? >> > > That's true. But do you really have an usecase to setup inbound window for the > endpoints? What does the endpoint do with this memory? I don't have a usecase for this. I did this update just to be safe for the described scenario. > > - Mani >
© 2016 - 2025 Red Hat, Inc.