diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-08-03 18:42:07 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-08-03 18:42:07 +0300 |
| commit | 551b5427798e0fabcd14dc801b064a79df5de41a (patch) | |
| tree | 0c2fb2df8a190a94287755fefae7063b8fcb69cc /arch/riscv64 | |
| parent | 4829e11dabc681e8901fa5e148129cd0c7116342 (diff) | |
| download | kmi-551b5427798e0fabcd14dc801b064a79df5de41a.tar.gz kmi-551b5427798e0fabcd14dc801b064a79df5de41a.zip | |
fix cpu_send_ipi
Diffstat (limited to 'arch/riscv64')
| -rw-r--r-- | arch/riscv64/kernel/cpu.c | 29 | ||||
| -rw-r--r-- | arch/riscv64/kernel/sbi.h | 4 |
2 files changed, 3 insertions, 30 deletions
diff --git a/arch/riscv64/kernel/cpu.c b/arch/riscv64/kernel/cpu.c index 44950ea..dc87a13 100644 --- a/arch/riscv64/kernel/cpu.c +++ b/arch/riscv64/kernel/cpu.c @@ -44,34 +44,7 @@ struct tcb *cur_tcb() return t; } -/** - * Helper for cpu_send_ipi() to convert linear \p cpu_id to SBI \c - * hart_mask_base. - * - * @param cpu_id CPU id to convert. - * @return Corresponding \c hart_mask_base. - */ -static long __cpu_offset(id_t cpu_id) -{ - return cpu_id / (sizeof(long) * 8); -} - -/** - * Helper for cpu_send_ipi() to convert linear \p cpu_id to SBI \c - * hart_mask. - * - * @param cpu_id CPU id to convert. - * @param offset Offset from __cpu_offset(). - * @return Corresponding \c hart_mask. - */ -static long __cpu_mask(id_t cpu_id, long offset) -{ - return cpu_id - offset * sizeof(long) * 8; -} - void cpu_send_ipi(id_t cpu_id) { - long offset = __cpu_offset(cpu_id); - long mask = __cpu_mask(cpu_id, offset); - sbi_send_ipi(mask, offset); + sbi_send_ipi(1, cpu_id); } diff --git a/arch/riscv64/kernel/sbi.h b/arch/riscv64/kernel/sbi.h index 9b3ffbc..ef38b35 100644 --- a/arch/riscv64/kernel/sbi.h +++ b/arch/riscv64/kernel/sbi.h @@ -122,8 +122,8 @@ static inline struct sbiret sbi_system_reset(uint32_t reset_type, static inline struct sbiret sbi_send_ipi(unsigned long hart_mask, unsigned long hart_mask_base) { - return sbi_ecall(EID_sPI, FID_IPI, hart_mask, hart_mask_base, 0, 0, 0, - 0); + return sbi_ecall(EID_sPI, FID_IPI, hart_mask, hart_mask_base, + 0, 0, 0, 0); } #endif /* KMI_RISCV_SBI_H */ |
