Skip to contentSkip to conversation

lib/utils: fdt: Update FDT expand size to 1024 for reserved memory node

PATCH New Bin Meng 3 participants 3 messages Jun 25, 2020 – Jul 6, 2020

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 lib/utils: fdt: Update FDT expand size to 1024 for reserved memory node

From: Bin Meng <[email protected]>

Currently 256 bytes is used for the FDT expand size when fixing up reserved memory node. Increase it to 1024 bytes with an estimated size of 64 bytes per PMP memory region by 16 regions in total.

---

 lib/utils/fdt/fdt_fixup.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
lib/utils/fdt/fdt_fixup.c +8 -2
index adf1be3..a3bccae 100644
@@ -151,8 +151,14 @@ int fdt_reserved_memory_fixup(void *fdt)
 	int na = fdt_address_cells(fdt, 0);
 	int ns = fdt_size_cells(fdt, 0);
 
-	/* expand the device tree to accommodate new node */
-	err  = fdt_open_into(fdt, fdt, fdt_totalsize(fdt) + 256);
+	/*
+	 * Expand the device tree to accommodate new node
+	 * by the following estimated size:
+	 *
+	 * Each PMP memory region entry occupies 64 bytes.
+	 * With 16 PMP memory regions we need 64 * 16 = 1024 bytes.
+	 */
+	err = fdt_open_into(fdt, fdt, fdt_totalsize(fdt) + 1024);
 	if (err < 0)
 		return err;
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 lib/utils: fdt: Update FDT expand size to 1024 for reserved memory node

Quoted 38 lines · Bin Meng

From: Bin Meng <[email protected]>

Currently 256 bytes is used for the FDT expand size when fixing up reserved memory node. Increase it to 1024 bytes with an estimated size of 64 bytes per PMP memory region by 16 regions in total.

---

 lib/utils/fdt/fdt_fixup.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
lib/utils/fdt/fdt_fixup.c +8 -3
index adf1be3..a3bccae 100644
@@ -151,8 +151,14 @@ int fdt_reserved_memory_fixup(void *fdt)
        int na = fdt_address_cells(fdt, 0);
        int ns = fdt_size_cells(fdt, 0);
 
-       /* expand the device tree to accommodate new node */
-       err  = fdt_open_into(fdt, fdt, fdt_totalsize(fdt) + 256);
+       /*
+        * Expand the device tree to accommodate new node
+        * by the following estimated size:
+        *
+        * Each PMP memory region entry occupies 64 bytes.
+        * With 16 PMP memory regions we need 64 * 16 = 1024 bytes.
+        */
+       err = fdt_open_into(fdt, fdt, fdt_totalsize(fdt) + 1024);
        if (err < 0)
                return err;
 
--

2.7.4

Quoted 4 lines

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

Signature · 2 lines
Regards,
Atish
Applied
#2 lore raw

PATCH 1/1 lib/utils: fdt: Update FDT expand size to 1024 for reserved memory node

Quoted 51 lines

-----Original Message-----
From: opensbi <[email protected]> On Behalf Of Atish Patra
Sent: 25 June 2020 23:00
To: Bin Meng <[email protected]>
Cc: Atish Patra <[email protected]>; Bin Meng <[email protected]>; OpenSBI <[email protected]>
Subject: Re: [PATCH] lib/utils: fdt: Update FDT expand size to 1024 for reserved memory node

Quoted 38 lines · Bin Meng

From: Bin Meng <[email protected]>

Currently 256 bytes is used for the FDT expand size when fixing up reserved memory node. Increase it to 1024 bytes with an estimated size of 64 bytes per PMP memory region by 16 regions in total.

---

 lib/utils/fdt/fdt_fixup.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
lib/utils/fdt/fdt_fixup.c +8 -3
index adf1be3..a3bccae 100644
@@ -151,8 +151,14 @@ int fdt_reserved_memory_fixup(void *fdt)
        int na = fdt_address_cells(fdt, 0);
        int ns = fdt_size_cells(fdt, 0);
 
-       /* expand the device tree to accommodate new node */
-       err  = fdt_open_into(fdt, fdt, fdt_totalsize(fdt) + 256);
+       /*
+        * Expand the device tree to accommodate new node
+        * by the following estimated size:
+        *
+        * Each PMP memory region entry occupies 64 bytes.
+        * With 16 PMP memory regions we need 64 * 16 = 1024 bytes.
+        */
+       err = fdt_open_into(fdt, fdt, fdt_totalsize(fdt) + 1024);
        if (err < 0)
                return err;
 
--

2.7.4

Quoted 7 lines
Quoted 4 lines

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup