All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anup Patel <apatel@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH 5/9] lib: utils/fdt: Use sbi_domain_memregion_init() when parsing domains
Date: Mon, 23 Sep 2024 17:26:56 +0530	[thread overview]
Message-ID: <20240923115700.381916-6-apatel@ventanamicro.com> (raw)
In-Reply-To: <20240923115700.381916-1-apatel@ventanamicro.com>

Use sbi_domain_memregion_init() at the time of parsing domains from
FDT so that sbi_domain_memregion_init() is always used for setting
up all memregions.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
 lib/utils/fdt/fdt_domain.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c
index 4fde50f5..4bc7ed86 100644
--- a/lib/utils/fdt/fdt_domain.c
+++ b/lib/utils/fdt/fdt_domain.c
@@ -253,8 +253,8 @@ static int __fdt_parse_region(const void *fdt, int domain_offset,
 	u32 val32;
 	u64 val64;
 	const u32 *val;
+	unsigned long base, order, flags;
 	struct parse_region_data *preg = opaque;
-	struct sbi_domain_memregion *region;
 
 	/*
 	 * Non-root domains cannot add a region with only M-mode
@@ -271,7 +271,6 @@ static int __fdt_parse_region(const void *fdt, int domain_offset,
 	/* Find next region of the domain */
 	if (preg->max_regions <= preg->region_count)
 		return SBI_ENOSPC;
-	region = &preg->dom->regions[preg->region_count];
 
 	/* Read "base" DT property */
 	val = fdt_getprop(fdt, region_offset, "base", &len);
@@ -279,7 +278,7 @@ static int __fdt_parse_region(const void *fdt, int domain_offset,
 		return SBI_EINVAL;
 	val64 = fdt32_to_cpu(val[0]);
 	val64 = (val64 << 32) | fdt32_to_cpu(val[1]);
-	region->base = val64;
+	base = val64;
 
 	/* Read "order" DT property */
 	val = fdt_getprop(fdt, region_offset, "order", &len);
@@ -288,12 +287,15 @@ static int __fdt_parse_region(const void *fdt, int domain_offset,
 	val32 = fdt32_to_cpu(*val);
 	if (val32 < 3 || __riscv_xlen < val32)
 		return SBI_EINVAL;
-	region->order = val32;
+	order = val32;
 
 	/* Read "mmio" DT property */
-	region->flags = region_access & SBI_DOMAIN_MEMREGION_ACCESS_MASK;
+	flags = region_access & SBI_DOMAIN_MEMREGION_ACCESS_MASK;
 	if (fdt_get_property(fdt, region_offset, "mmio", NULL))
-		region->flags |= SBI_DOMAIN_MEMREGION_MMIO;
+		flags |= SBI_DOMAIN_MEMREGION_MMIO;
+
+	sbi_domain_memregion_init(base, (order == __riscv_xlen) ? ~0UL : BIT(order),
+				  flags, &preg->dom->regions[preg->region_count]);
 
 	preg->region_count++;
 
-- 
2.43.0



  parent reply	other threads:[~2024-09-23 11:56 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23 11:56 [PATCH 0/9] OpenSBI domain data support Anup Patel
2024-09-23 11:56 ` [PATCH 1/9] lib: utils/ipi: Use sbi_domain_root_add_memrange() for ACLINT mswi Anup Patel
2024-10-09 23:00   ` Samuel Holland
2024-10-10  5:19     ` Anup Patel
2024-09-23 11:56 ` [PATCH 2/9] lib: utils/irqchip: Use sbi_domain_root_add_memrange() for IMSIC Anup Patel
2024-10-09 23:04   ` Samuel Holland
2024-10-10  5:20     ` Anup Patel
2024-09-23 11:56 ` [PATCH 3/9] lib: utils/irqchip: Use sbi_domain_root_add_memrange() for APLIC Anup Patel
2024-10-09 23:05   ` Samuel Holland
2024-10-10  5:20     ` Anup Patel
2024-09-23 11:56 ` [PATCH 4/9] lib: sbi_domain: Make sbi_domain_root_add_memregion() as local function Anup Patel
2024-10-09 23:06   ` Samuel Holland
2024-10-10  5:20     ` Anup Patel
2024-09-23 11:56 ` Anup Patel [this message]
2024-10-09 23:11   ` [PATCH 5/9] lib: utils/fdt: Use sbi_domain_memregion_init() when parsing domains Samuel Holland
2024-09-23 11:56 ` [PATCH 6/9] include: sbi: Remove cyclic include in sbi_domain_context.h Anup Patel
2024-10-09 23:12   ` Samuel Holland
2024-10-09 23:15   ` Samuel Holland
2024-10-10  5:22     ` Anup Patel
2024-09-23 11:56 ` [PATCH 7/9] lib: sbi: Introduce domain data Anup Patel
2024-10-04 10:56   ` Yu-Chien Peter Lin
2024-10-10  5:26     ` Anup Patel
2024-09-23 11:56 ` [PATCH 8/9] lib: sbi_domain: Use domain data support for per-domain hart context Anup Patel
2024-10-04 10:51   ` Yu-Chien Peter Lin
2024-09-23 11:57 ` [PATCH 9/9] docs: Remove hartindex_to_context_table from domain_support.md Anup Patel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240923115700.381916-6-apatel@ventanamicro.com \
    --to=apatel@ventanamicro.com \
    --cc=opensbi@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.