-
Notifications
You must be signed in to change notification settings - Fork 47
x86_64: Add support for QEMU Q35 and ASUS NUC14MNK #204
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
Conversation
| return; | ||
| } | ||
|
|
||
| pub fn get_target_cpu(irq: usize, zone_id: usize) -> usize { |
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.
Why should we add a new function get_target_cpu here?
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.
This is because in x86_64, the target CPU of virtio device interrupt is decided by virtual I/O APIC, while in other archs we can simply use the first CPU as the interrupt receiver. Therefore, I add a generic API get_target_cpu for all archs to decide which CPU should we set as target.
src/device/uart/mod.rs
Outdated
| #[cfg(all(feature = "uart_16550", target_arch = "aarch64"))] | ||
| pub use uart_16550::{console_getchar, console_putchar}; | ||
|
|
||
| #[cfg(target_arch = "x86_64")] |
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.
You can add a new cargo feature here, like #[cfg(all(feature = "uart16550a", target_arch = "x86"))]
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.
Sure, I will add an "uart16550a" feature in Cargo.toml
| pub enum HyperCallCode { | ||
| HvVirtioInit = 0, | ||
| HvVirtioInjectIrq = 1, | ||
| HvVirtioGetIrq = 86, |
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.
Why set this hypercall code to 86?
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.
Because this hypercall code is currently only used by x86_64, so at that time I set it to '86' to avoid conflict with other upcoming codes. Shall I change its number to a smaller one?
src/logging.rs
Outdated
| Level::Trace => ColorCode::BrightBlack, | ||
| }; | ||
|
|
||
| #[cfg(all(feature = "graphics"))] |
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.
You can put the graphics logic in a separate function to hide the details.
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.
Sure, I have changed the implement of SimpleLogger to hide its details.
No description provided.