OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anup Patel <apatel@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v2 1/9] lib: utils/ipi: Use sbi_domain_root_add_memrange() for ACLINT mswi
Date: Thu, 10 Oct 2024 14:30:50 +0530	[thread overview]
Message-ID: <20241010090058.179381-2-apatel@ventanamicro.com> (raw)
In-Reply-To: <20241010090058.179381-1-apatel@ventanamicro.com>

The sbi_domain_root_add_memrange() should be preferred for creating
multiple memregions over a range. Update ACLINT mswi driver to use
sbi_domain_root_add_memrange() instead of explicitly registering
memregions.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
---
 lib/utils/ipi/aclint_mswi.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/lib/utils/ipi/aclint_mswi.c b/lib/utils/ipi/aclint_mswi.c
index c8ebb7ac..0ef3d003 100644
--- a/lib/utils/ipi/aclint_mswi.c
+++ b/lib/utils/ipi/aclint_mswi.c
@@ -84,8 +84,6 @@ int aclint_mswi_cold_init(struct aclint_mswi_data *mswi)
 	u32 i;
 	int rc;
 	struct sbi_scratch *scratch;
-	unsigned long pos, region_size;
-	struct sbi_domain_memregion reg;
 
 	/* Sanity checks */
 	if (!mswi || (mswi->addr & (ACLINT_MSWI_ALIGN - 1)) ||
@@ -114,18 +112,12 @@ int aclint_mswi_cold_init(struct aclint_mswi_data *mswi)
 	}
 
 	/* Add MSWI regions to the root domain */
-	for (pos = 0; pos < mswi->size; pos += ACLINT_MSWI_ALIGN) {
-		region_size = ((mswi->size - pos) < ACLINT_MSWI_ALIGN) ?
-			      (mswi->size - pos) : ACLINT_MSWI_ALIGN;
-		sbi_domain_memregion_init(mswi->addr + pos, region_size,
-					  (SBI_DOMAIN_MEMREGION_MMIO |
-					   SBI_DOMAIN_MEMREGION_M_READABLE |
-					   SBI_DOMAIN_MEMREGION_M_WRITABLE),
-					  &reg);
-		rc = sbi_domain_root_add_memregion(&reg);
-		if (rc)
-			return rc;
-	}
+	rc = sbi_domain_root_add_memrange(mswi->addr, mswi->size, ACLINT_MSWI_ALIGN,
+					  SBI_DOMAIN_MEMREGION_MMIO |
+					  SBI_DOMAIN_MEMREGION_M_READABLE |
+					  SBI_DOMAIN_MEMREGION_M_WRITABLE);
+	if (rc)
+		return rc;
 
 	sbi_ipi_set_device(&aclint_mswi);
 
-- 
2.43.0



  reply	other threads:[~2024-10-10  9:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-10  9:00 [PATCH v2 0/9] OpenSBI domain data support Anup Patel
2024-10-10  9:00 ` Anup Patel [this message]
2024-10-10  9:00 ` [PATCH v2 2/9] lib: utils/irqchip: Use sbi_domain_root_add_memrange() for IMSIC Anup Patel
2024-10-10  9:00 ` [PATCH v2 3/9] lib: utils/irqchip: Use sbi_domain_root_add_memrange() for APLIC Anup Patel
2024-10-10  9:00 ` [PATCH v2 4/9] lib: sbi_domain: Make sbi_domain_root_add_memregion() as local function Anup Patel
2024-10-10  9:00 ` [PATCH v2 5/9] lib: utils/fdt: Use sbi_domain_memregion_init() when parsing domains Anup Patel
2024-10-10  9:00 ` [PATCH v2 6/9] include: sbi: Remove cyclic include in sbi_domain_context.h Anup Patel
2024-10-10  9:00 ` [PATCH v2 7/9] lib: sbi: Introduce domain data Anup Patel
2024-10-10  9:00 ` [PATCH v2 8/9] lib: sbi_domain: Use domain data support for per-domain hart context Anup Patel
2024-10-10  9:00 ` [PATCH v2 9/9] docs: Remove hartindex_to_context_table from domain_support.md Anup Patel
2024-10-25 17:31 ` [PATCH v2 0/9] OpenSBI domain data support 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=20241010090058.179381-2-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox