Skip to content

Conversation

luojia65
Copy link
Contributor

@luojia65 luojia65 commented Mar 3, 2024

The SBI legacy extensions are deprecated 4 years ago ( riscv-non-isa/riscv-sbi-doc@705e955 ). We replace it using functions from SBI 2.0 extensions. Specifically:

  • the legacy console_putchar is replaced into console_write_byte in SBI DBCN extension;
  • legacy shutdown is replaced to system_reset in SBI SRST extension with ColdReboot and NoReason as parameters;
  • legacy set_timer is replaced with SBI TIME set_timer;
  • legacy send_ipi is replaced to SBI IPI extension. The code implemented in file processor.rs creates a HartMask with only one hart_id selected as an IPI target.

By updating to SBI 2.0, this commit supports to send IPI to hart IDs greater than 63 (on 64-bit devices). The current code encodes hart_id parameter in bit-vector like 1 << hart_id, which will cause the bit to be shifted out from usize range when hart_id >= 64. SBI 2.0 fixed this problem by adding a hart_mask_base parameter, allowing us to specify any hart ID within usize range when is provided as an SBI IPI hart mask.

@mkroening mkroening self-requested a review March 3, 2024 15:01
@mkroening mkroening self-assigned this Mar 3, 2024
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be an issue with QEMU again, but we are experiencing crashes in CI. 🤔

Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the loader and OpenSBI.

We are having reboots, though.

The SBI legacy extensions are deprecated 4 years ago ( riscv-non-isa/riscv-sbi-doc@705e955 ).
We replace it using functions from SBI 2.0 extensions. Specifically:
- the legacy console_putchar is replaced into console_write_byte in SBI DBCN extension;
- legacy shutdown is replaced to system_reset in SBI SRST extension with ColdReboot and NoReason as parameters;
- legacy set_timer is replaced with SBI TIME set_timer;
- legacy send_ipi is replaced to SBI IPI extension. The code implemented in file processor.rs creates a HartMask with only one hart_id selected as an IPI target.

Signed-off-by: Zhouqi Jiang <luojia@hust.edu.cn>
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! And thanks for being patient! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants