-
Notifications
You must be signed in to change notification settings - Fork 24
feat(smp): enable multi-core startup and basic shell support for all archs #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -246,6 +246,11 @@ pub fn rust_main(cpu_id: usize, arg: usize) -> ! { | |
| core::hint::spin_loop(); | ||
| } | ||
|
|
||
| #[cfg(target_arch = "riscv64")] | ||
| unsafe { | ||
| use riscv::register::sstatus; | ||
| sstatus::set_sum(); | ||
| } | ||
|
Comment on lines
+249
to
+253
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this part should be moved into https://github.com/Starry-OS/axcpu/blob/main/src/riscv/init.rs. You may take a look at Starry-OS/axcpu#8, where they also encountered a similar issue to enable user memory access in supervisor.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, I will modify it later. |
||
| unsafe { main() }; | ||
|
|
||
| #[cfg(feature = "multitask")] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,14 @@ pub fn rust_main_secondary(cpu_id: usize) -> ! { | |
| #[cfg(feature = "ipi")] | ||
| axipi::init(); | ||
|
|
||
| #[cfg(target_arch = "riscv64")] | ||
| { | ||
| use riscv::register::sstatus; | ||
| unsafe { | ||
| sstatus::set_sum(); | ||
| } | ||
| } | ||
|
|
||
|
Comment on lines
+54
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
| info!("Secondary CPU {:x} init OK.", cpu_id); | ||
| super::INITED_CPUS.fetch_add(1, Ordering::Release); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it’s essential on other riscv64 plat? I mean directly use axplat_riscv64_qemu_virt api here,it only works on this platform?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I feel sorry that I didn't consider other riscv64 plat right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
platforms/axplat-riscv64-qemu-virt/src/init.rs
maybe it should put here
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That falls back to the same problem. The fundamental issue is that there's currently no way to obtain the CPU ID in
axplat.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? PlatinitIf has cpu_id param? Doesn’t it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize for the inaccuracy in my statement. The exact issue is that there's currently no way to obtain the hart ID at https://github.com/Starry-OS/axplat_crates/blob/main/platforms/axplat-riscv64-qemu-virt/src/irq.rs#L192.