Skip to contentSkip to conversation

lib: utils: Make the enforce permission bit configurable from DT

PATCH New Chao Du 3 participants 3 messages Jan 7, 2025 – Feb 11, 2025

lore
Share & tools
lore

Chao Du

author
#0 lore raw

PATCH 1/1 lib: utils: Make the enforce permission bit configurable from DT

The domain_support.md documentation states that the enforce permission bit (BIT[6]) could be set in the "regions" property of a domain instance DT node. However, this bit is masked in the current implementation. This patch unmasks the bit to make it configurable from DT.

---
 lib/utils/fdt/fdt_domain.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/utils/fdt/fdt_domain.c +3 -1
index 4bc7ed8..d7efc56 100644
@@ -289,8 +289,10 @@ static int __fdt_parse_region(const void *fdt, int domain_offset,
 		return SBI_EINVAL;
 	order = val32;
 
+	flags = region_access & (SBI_DOMAIN_MEMREGION_ACCESS_MASK
+				| SBI_DOMAIN_MEMREGION_ENF_PERMISSIONS);
+
 	/* Read "mmio" DT property */
-	flags = region_access & SBI_DOMAIN_MEMREGION_ACCESS_MASK;
 	if (fdt_get_property(fdt, region_offset, "mmio", NULL))
 		flags |= SBI_DOMAIN_MEMREGION_MMIO;
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 lib: utils: Make the enforce permission bit configurable from DT

? 2025-01-07?? 02:43 +0000?Chao Du???

Quoted 7 lines

The domain_support.md documentation states that the enforce permission bit (BIT[6]) could be set in the "regions" property of a domain instance DT node. However, this bit is masked in the current implementation. This patch unmasks the bit to make it configurable from DT.

look good to me.

Quoted 24 lines

---
?lib/utils/fdt/fdt_domain.c | 4 +++-
?1 file changed, 3 insertions(+), 1 deletion(-)

lib/utils/fdt/fdt_domain.c +0 -0
index 4bc7ed8..d7efc56 100644
@@ -289,8 +289,10 @@ static int __fdt_parse_region(const void *fdt, int domain_offset,
 ?		return SBI_EINVAL;
 ?	order = val32;

?

lib/utils/fdt/fdt_domain.c +3 -0
+	flags = region_access & (SBI_DOMAIN_MEMREGION_ACCESS_MASK
+				| SBI_DOMAIN_MEMREGION_ENF_PERMISSIONS);
+

? /* Read "mmio" DT property */

lib/utils/fdt/fdt_domain.c +0 -1
-	flags = region_access & SBI_DOMAIN_MEMREGION_ACCESS_MASK;

? if (fdt_get_property(fdt, region_offset, "mmio", NULL))
? flags |= SBI_DOMAIN_MEMREGION_MMIO;
?

Signature · 1 line
2.34.1
Applied
#2 lore raw

PATCH 1/1 lib: utils: Make the enforce permission bit configurable from DT

In reply to Chao Du
Quoted 8 lines · On Tue, Jan 7, 2025 at 8:13?AM Chao Du <[email protected]> wrote:

The domain_support.md documentation states that the enforce permission bit (BIT[6]) could be set in the "regions" property of a domain instance DT node. However, this bit is masked in the current implementation. This patch unmasks the bit to make it configurable from DT.

LGTM.

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 28 lines
---
 lib/utils/fdt/fdt_domain.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/utils/fdt/fdt_domain.c +3 -2
index 4bc7ed8..d7efc56 100644
@@ -289,8 +289,10 @@ static int __fdt_parse_region(const void *fdt, int domain_offset,
                return SBI_EINVAL;
        order = val32;
 
+       flags = region_access & (SBI_DOMAIN_MEMREGION_ACCESS_MASK
+                               | SBI_DOMAIN_MEMREGION_ENF_PERMISSIONS);
+
        /* Read "mmio" DT property */
-       flags = region_access & SBI_DOMAIN_MEMREGION_ACCESS_MASK;
        if (fdt_get_property(fdt, region_offset, "mmio", NULL))
                flags |= SBI_DOMAIN_MEMREGION_MMIO;
 
--

2.34.1

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