OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anup Patel <apatel@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH 1/2] lib: utils/ipi: Fix size check in aclint_mswi_cold_init()
Date: Sat,  8 Jan 2022 09:33:35 +0530	[thread overview]
Message-ID: <20220108040336.14414-2-apatel@ventanamicro.com> (raw)
In-Reply-To: <20220108040336.14414-1-apatel@ventanamicro.com>

Currently, the ACLINT MSWI size check is forcing size to be at least
0x4000. This is inappropriate check because most systems will never
utilize full 16KB for a single ACLINT MSWI device so instead we should
check that ACLINT MSWI size is enough for on the associated HARTs.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
 lib/utils/ipi/aclint_mswi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/utils/ipi/aclint_mswi.c b/lib/utils/ipi/aclint_mswi.c
index a3de2f5..832e223 100644
--- a/lib/utils/ipi/aclint_mswi.c
+++ b/lib/utils/ipi/aclint_mswi.c
@@ -74,7 +74,7 @@ int aclint_mswi_cold_init(struct aclint_mswi_data *mswi)
 
 	/* Sanity checks */
 	if (!mswi || (mswi->addr & (ACLINT_MSWI_ALIGN - 1)) ||
-	    (mswi->size < ACLINT_MSWI_SIZE) ||
+	    (mswi->size < (mswi->hart_count * sizeof(u32))) ||
 	    (mswi->first_hartid >= SBI_HARTMASK_MAX_BITS) ||
 	    (mswi->hart_count > ACLINT_MSWI_MAX_HARTS))
 		return SBI_EINVAL;
-- 
2.25.1



  reply	other threads:[~2022-01-08  4:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-08  4:03 [PATCH 0/2] Misc driver improvements Anup Patel
2022-01-08  4:03 ` Anup Patel [this message]
2022-01-08  8:34   ` [PATCH 1/2] lib: utils/ipi: Fix size check in aclint_mswi_cold_init() Dong Du
2022-01-08 11:35     ` Anup Patel
2022-01-08 14:50       ` Dong Du
2022-01-08 17:09         ` Anup Patel
2022-01-09  4:45           ` Dong Du
2022-01-08  4:03 ` [PATCH 2/2] lib: utils/sys: Extend HTIF library to allow custom base address Anup Patel
2022-01-08  9:08   ` Dong Du
2022-01-08 11:44     ` Anup Patel
2022-01-09  4:51       ` Dong Du

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=20220108040336.14414-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