include: sbi: Remove sbi_hartmask_for_each_hart() macro
authorAnup Patel <apatel@ventanamicro.com>
Sat, 2 Sep 2023 12:04:32 +0000 (17:34 +0530)
committerAnup Patel <anup@brainfault.org>
Sun, 24 Sep 2023 06:18:21 +0000 (11:48 +0530)
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
lib/sbi/sbi_system.c

index 105653e1446d5feaa181938ded94701119da8790..bcfa50db12e7b7c64ff641ded2f345c70234c51a 100644 (file)
@@ -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
index bae973041d202fc017f47454a08357bc5752a11c..d1fa349544cb22af3474a38276f74b6092850b02 100644 (file)
@@ -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)