All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anup Patel <apatel@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH 8/8] include: sbi: Remove sbi_hartmask_for_each_hart() macro
Date: Mon,  4 Sep 2023 09:33:46 +0530	[thread overview]
Message-ID: <20230904040346.118604-9-apatel@ventanamicro.com> (raw)
In-Reply-To: <20230904040346.118604-1-apatel@ventanamicro.com>

The sbi_hartmask_for_each_hart() macro is slow and has only one user
so let us completely remove the sbi_hartmask_for_each_hart() macro.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
 include/sbi/sbi_hartmask.h | 13 -------------
 lib/sbi/sbi_system.c       |  3 ++-
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/include/sbi/sbi_hartmask.h b/include/sbi/sbi_hartmask.h
index 105653e..bcfa50d 100644
--- a/include/sbi/sbi_hartmask.h
+++ b/include/sbi/sbi_hartmask.h
@@ -169,19 +169,6 @@ static inline void sbi_hartmask_xor(struct sbi_hartmask *dstp,
 		   sbi_hartmask_bits(src2p), SBI_HARTMASK_MAX_BITS);
 }
 
-/**
- * Iterate over each HART in hartmask
- * __h hart id
- * __i hart index
- * __m hartmask
-*/
-#define sbi_hartmask_for_each_hart(__h, __i, __m) \
-	for((__i) = find_first_bit((__m)->bits, SBI_HARTMASK_MAX_BITS), \
-		(__h) = sbi_hartindex_to_hartid(__i); \
-		(__i) < SBI_HARTMASK_MAX_BITS; \
-		(__i) = find_next_bit((__m)->bits, SBI_HARTMASK_MAX_BITS, (__i) + 1), \
-		(__h) = sbi_hartindex_to_hartid(__i))
-
 /**
  * Iterate over each HART index in hartmask
  * __i hart index
diff --git a/lib/sbi/sbi_system.c b/lib/sbi/sbi_system.c
index bae9730..d1fa349 100644
--- a/lib/sbi/sbi_system.c
+++ b/lib/sbi/sbi_system.c
@@ -170,7 +170,8 @@ int sbi_system_suspend(u32 sleep_type, ulong resume_addr, ulong opaque)
 	if (prev_mode != PRV_S && prev_mode != PRV_U)
 		return SBI_EFAIL;
 
-	sbi_hartmask_for_each_hart(i, j, &dom->assigned_harts) {
+	sbi_hartmask_for_each_hartindex(j, &dom->assigned_harts) {
+		i = sbi_hartindex_to_hartid(j);
 		if (i == hartid)
 			continue;
 		if (__sbi_hsm_hart_get_state(i) != SBI_HSM_STATE_STOPPED)
-- 
2.34.1



  parent reply	other threads:[~2023-09-04  4:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04  4:03 [PATCH 0/8] OpenSBI sparse HART id support Anup Patel
2023-09-04  4:03 ` [PATCH 1/8] lib: sbi: Introduce HART index in sbi_scratch Anup Patel
2023-09-20 17:54   ` Xiang W
2023-09-22  5:44     ` Anup Patel
2023-09-22  7:56       ` Xiang W
2023-09-22  8:23         ` Anup Patel
2023-09-22  8:38         ` Anup Patel
2023-09-22 12:58           ` Xiang W
2023-09-24  6:06             ` Anup Patel
2023-09-04  4:03 ` [PATCH 2/8] lib: sbi: Remove sbi_platform_hart_index/invalid() functions Anup Patel
2023-09-04  4:03 ` [PATCH 3/8] lib: sbi: Extend sbi_hartmask to support both hartid and hartindex Anup Patel
2023-09-04  4:03 ` [PATCH 4/8] lib: sbi: Use sbi_scratch_last_hartindex() in remote TLB managment Anup Patel
2023-09-04  4:03 ` [PATCH 5/8] lib: sbi: Prefer hartindex over hartid in IPI framework Anup Patel
2023-09-04  4:03 ` [PATCH 6/8] lib: sbi: Remove sbi_scratch_last_hartid() macro Anup Patel
2023-09-04  4:03 ` [PATCH 7/8] lib: sbi: Maximize the use of HART index in sbi_domain Anup Patel
2023-09-04  4:03 ` Anup Patel [this message]
2023-09-24  6:34 ` [PATCH 0/8] OpenSBI sparse HART id 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=20230904040346.118604-9-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.