Skip to contentSkip to conversation

lib: utils: Fix reserved memory node for firmware memory

PATCH New Mayuresh Chitale 2 participants 3 messages Jan 21, 2023 – Jan 23, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: utils: Fix reserved memory node for firmware memory

The commit 9e0ba090 introduced more fine grained permissions for memory regions and did not update the fdt_reserved_memory_fixup() function. As a result, the fdt_reserved_memory_fixup continued to use the older coarse permissions which causes the reserved memory node to be not inserted into the DT.

To fix the above issue, we correct the flags used for memory region permission checks in the fdt_reserved_memory_fixup() function.

Fixes 9e0ba090 ("include: sbi: Fine grain the permissions for M and SU modes")
---
 lib/utils/fdt/fdt_fixup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/utils/fdt/fdt_fixup.c +3 -3
index 41f6cbb..42692cc 100644
@@ -259,11 +259,11 @@ int fdt_reserved_memory_fixup(void *fdt)
 		/* Ignore MMIO or READABLE or WRITABLE or EXECUTABLE regions */
 		if (reg->flags & SBI_DOMAIN_MEMREGION_MMIO)
 			continue;
-		if (reg->flags & SBI_DOMAIN_MEMREGION_READABLE)
+		if (reg->flags & SBI_DOMAIN_MEMREGION_SU_READABLE)
 			continue;
-		if (reg->flags & SBI_DOMAIN_MEMREGION_WRITEABLE)
+		if (reg->flags & SBI_DOMAIN_MEMREGION_SU_WRITABLE)
 			continue;
-		if (reg->flags & SBI_DOMAIN_MEMREGION_EXECUTABLE)
+		if (reg->flags & SBI_DOMAIN_MEMREGION_SU_EXECUTABLE)
 			continue;
 
 		addr = reg->base;
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 lib: utils: Fix reserved memory node for firmware memory

Quoted 7 lines · Mayuresh Chitale

The commit 9e0ba090 introduced more fine grained permissions for memory regions and did not update the fdt_reserved_memory_fixup() function. As a result, the fdt_reserved_memory_fixup continued to use the older coarse permissions which causes the reserved memory node to be not inserted into the DT.

Quoted 5 lines

To fix the above issue, we correct the flags used for memory region permission checks in the fdt_reserved_memory_fixup() function.

Fixes 9e0ba090 ("include: sbi: Fine grain the permissions for M and SU modes")

Thanks for catching and fixing this issue.

Regards,
Anup

Quoted 26 lines
---
 lib/utils/fdt/fdt_fixup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/utils/fdt/fdt_fixup.c +3 -4
index 41f6cbb..42692cc 100644
@@ -259,11 +259,11 @@ int fdt_reserved_memory_fixup(void *fdt)
                /* Ignore MMIO or READABLE or WRITABLE or EXECUTABLE regions */
                if (reg->flags & SBI_DOMAIN_MEMREGION_MMIO)
                        continue;
-               if (reg->flags & SBI_DOMAIN_MEMREGION_READABLE)
+               if (reg->flags & SBI_DOMAIN_MEMREGION_SU_READABLE)
                        continue;
-               if (reg->flags & SBI_DOMAIN_MEMREGION_WRITEABLE)
+               if (reg->flags & SBI_DOMAIN_MEMREGION_SU_WRITABLE)
                        continue;
-               if (reg->flags & SBI_DOMAIN_MEMREGION_EXECUTABLE)
+               if (reg->flags & SBI_DOMAIN_MEMREGION_SU_EXECUTABLE)
                        continue;
 
                addr = reg->base;
--

2.34.1

Applied
#2 lore raw

PATCH 1/1 lib: utils: Fix reserved memory node for firmware memory

In reply to Mayuresh Chitale
Quoted 7 lines · Mayuresh Chitale

The commit 9e0ba090 introduced more fine grained permissions for memory regions and did not update the fdt_reserved_memory_fixup() function. As a result, the fdt_reserved_memory_fixup continued to use the older coarse permissions which causes the reserved memory node to be not inserted into the DT.

Quoted 5 lines

To fix the above issue, we correct the flags used for memory region permission checks in the fdt_reserved_memory_fixup() function.

Fixes 9e0ba090 ("include: sbi: Fine grain the permissions for M and SU modes")

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 26 lines
---
 lib/utils/fdt/fdt_fixup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/utils/fdt/fdt_fixup.c +3 -4
index 41f6cbb..42692cc 100644
@@ -259,11 +259,11 @@ int fdt_reserved_memory_fixup(void *fdt)
                /* Ignore MMIO or READABLE or WRITABLE or EXECUTABLE regions */
                if (reg->flags & SBI_DOMAIN_MEMREGION_MMIO)
                        continue;
-               if (reg->flags & SBI_DOMAIN_MEMREGION_READABLE)
+               if (reg->flags & SBI_DOMAIN_MEMREGION_SU_READABLE)
                        continue;
-               if (reg->flags & SBI_DOMAIN_MEMREGION_WRITEABLE)
+               if (reg->flags & SBI_DOMAIN_MEMREGION_SU_WRITABLE)
                        continue;
-               if (reg->flags & SBI_DOMAIN_MEMREGION_EXECUTABLE)
+               if (reg->flags & SBI_DOMAIN_MEMREGION_SU_EXECUTABLE)
                        continue;
 
                addr = reg->base;
--

2.34.1