-
Notifications
You must be signed in to change notification settings - Fork 13
Interrupt-injection and GPPT #31
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
Merged
Merged
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
d5d8ae9
feat(vcpu): add interrupt injection support and enhance system regist…
luodeb 1b8da5e
feat(sysreg): update handle_read and handle_write to use unused param…
luodeb 32866b4
update dependecies
aarkegz 28b357c
Merge remote-tracking branch 'origin/debin/timer_api' into debin/time…
aarkegz 4017f66
update percpu
aarkegz 1b465d2
Merge branch 'master' into debin/timer_api
aarkegz 2143f59
try setting ich_hcr_el2.en
aarkegz 1df97f2
[feat] use 4 level paging for ept
hky1999 a860bfd
better code and comment for setting ich_hcr_el2
aarkegz 7da58d1
Merge branch 'master' into vgicv3
aarkegz a9bde35
add error messages for `current_el_sync_handler`
aarkegz d393aee
pin rust toolchain version
aarkegz a4f1c10
set `CNTHCTL_EL2::EL1PCEN` and `CNTHCTL_EL2::EL1PTCEN`, unset `HCR_EL…
aarkegz 47f4598
[STINKS] embed vgicv3 devices with HARD-CODED qemu gicv3 address loca…
aarkegz fcfd6ec
[feat] introduce set_return_value API
hky1999 1fb5ac1
[WIP!][TOBEREWRITE!] add gic-vdevice cofigs
aarkegz 211289e
Merge remote-tracking branch 'origin/ivc_and_4lpt' into vgicv3
aarkegz 7171d99
fixes after merging ivc code
aarkegz f8e6514
fix branch names for `axvcpu`
aarkegz ad1d617
emulate `ICC_SGI1R_EL1`
aarkegz 17f554c
update to newest dependencies
aarkegz 0e36a62
de-coupling `arm_vcpu` and `arm_vgic`, fix some warnings
aarkegz ce67fce
fix a missing doc
aarkegz e8eb890
remove `arm_vgic` dependency
aarkegz a64648e
add `builtin_sysreg_access_handler`, add interrupt and timer passthro…
aarkegz b3e1169
remove sysreg emu devices
aarkegz 1753965
rollback `tock-registers` to 0.9
aarkegz 2cdca35
reformatted
aarkegz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [toolchain] | ||
| profile = "minimal" | ||
| channel = "nightly-2024-12-25" | ||
| components = ["rust-src", "llvm-tools", "rustfmt", "clippy"] | ||
| targets = [ | ||
| "aarch64-unknown-none", | ||
| "aarch64-unknown-none-softfloat", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| use aarch64_sysreg::SystemRegType; | ||
|
|
||
| use axaddrspace::GuestPhysAddrRange; | ||
| use axaddrspace::device::{AccessWidth, DeviceAddrRange, SysRegAddr, SysRegAddrRange}; | ||
| use axdevice_base::EmuDeviceType; | ||
| use axdevice_base::{BaseDeviceOps, BaseMmioDeviceOps}; | ||
| use axerrno::AxResult; | ||
|
|
||
| impl BaseDeviceOps<SysRegAddrRange> for SysCntpCtlEl0 { | ||
| fn emu_type(&self) -> EmuDeviceType { | ||
| EmuDeviceType::Console | ||
| } | ||
|
|
||
| fn address_range(&self) -> SysRegAddrRange { | ||
| SysRegAddrRange { | ||
| start: SysRegAddr::new(SystemRegType::CNTP_CTL_EL0 as usize), | ||
| end: SysRegAddr::new(SystemRegType::CNTP_CTL_EL0 as usize), | ||
| } | ||
| } | ||
|
|
||
| fn handle_read( | ||
| &self, | ||
| addr: <SysRegAddrRange as DeviceAddrRange>::Addr, | ||
| width: AccessWidth, | ||
| ) -> AxResult<usize> { | ||
| todo!() | ||
| } | ||
|
|
||
| fn handle_write( | ||
| &self, | ||
| addr: <SysRegAddrRange as DeviceAddrRange>::Addr, | ||
| width: AccessWidth, | ||
| val: usize, | ||
| ) -> AxResult { | ||
| info!("Write to emulator register: {:?}, value: {}", addr, val); | ||
| Ok(()) | ||
| } | ||
| } | ||
|
|
||
| pub struct SysCntpCtlEl0 { | ||
| // Fields | ||
| } | ||
|
|
||
| impl SysCntpCtlEl0 { | ||
| pub fn new() -> Self { | ||
| Self { | ||
| // Initialize fields | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| extern crate alloc; | ||
|
|
||
| use aarch64_sysreg::SystemRegType; | ||
|
|
||
| use aarch64_cpu::registers::{CNTPCT_EL0, Readable}; | ||
|
|
||
| use axaddrspace::{ | ||
| GuestPhysAddrRange, | ||
| device::{AccessWidth, DeviceAddrRange, SysRegAddr, SysRegAddrRange}, | ||
| }; | ||
| use axdevice_base::{BaseDeviceOps, EmuDeviceType}; | ||
| use axerrno::AxResult; | ||
| use axvisor_api::time::{current_time_nanos, register_timer}; | ||
|
|
||
| use alloc::boxed::Box; | ||
| use core::time::Duration; | ||
|
|
||
| impl BaseDeviceOps<SysRegAddrRange> for SysCntpTvalEl0 { | ||
| fn emu_type(&self) -> EmuDeviceType { | ||
| EmuDeviceType::Console | ||
| } | ||
|
|
||
| fn address_range(&self) -> SysRegAddrRange { | ||
| SysRegAddrRange { | ||
| start: SysRegAddr::new(SystemRegType::CNTP_TVAL_EL0 as usize), | ||
| end: SysRegAddr::new(SystemRegType::CNTP_TVAL_EL0 as usize), | ||
| } | ||
| } | ||
|
|
||
| fn handle_read( | ||
| &self, | ||
| _addr: <SysRegAddrRange as DeviceAddrRange>::Addr, | ||
| _width: AccessWidth, | ||
| ) -> AxResult<usize> { | ||
| todo!() | ||
| } | ||
|
|
||
| fn handle_write( | ||
| &self, | ||
| addr: <SysRegAddrRange as DeviceAddrRange>::Addr, | ||
| _width: AccessWidth, | ||
| val: usize, | ||
| ) -> AxResult { | ||
| info!("Write to emulator register: {:?}, value: {}", addr, val); | ||
| let now = current_time_nanos(); | ||
| info!("Current time: {}, deadline: {}", now, now + val as u64); | ||
| register_timer( | ||
| Duration::from_nanos(now + val as u64), | ||
| Box::new(|_| { | ||
| axvisor_api::arch::hardware_inject_virtual_interrupt(30); | ||
| }), | ||
| ); | ||
| Ok(()) | ||
| } | ||
| } | ||
|
|
||
| pub struct SysCntpTvalEl0 { | ||
| // Fields | ||
| } | ||
|
|
||
| impl SysCntpTvalEl0 { | ||
| pub fn new() -> Self { | ||
| Self { | ||
| // Initialize fields | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| use aarch64_sysreg::SystemRegType; | ||
|
|
||
| use aarch64_cpu::registers::{CNTPCT_EL0, Readable}; | ||
|
|
||
| use axaddrspace::{ | ||
| GuestPhysAddrRange, | ||
| device::{AccessWidth, DeviceAddrRange, SysRegAddr, SysRegAddrRange}, | ||
| }; | ||
|
|
||
| use axdevice_base::{BaseDeviceOps, EmuDeviceType}; | ||
|
|
||
| use axerrno::AxResult; | ||
|
|
||
| impl BaseDeviceOps<SysRegAddrRange> for SysCntpctEl0 { | ||
| fn emu_type(&self) -> EmuDeviceType { | ||
| EmuDeviceType::Console | ||
| } | ||
|
|
||
| fn address_range(&self) -> SysRegAddrRange { | ||
| SysRegAddrRange { | ||
| start: SysRegAddr::new(SystemRegType::CNTPCT_EL0 as usize), | ||
| end: SysRegAddr::new(SystemRegType::CNTPCT_EL0 as usize), | ||
| } | ||
| } | ||
|
|
||
| fn handle_read( | ||
| &self, | ||
| addr: <SysRegAddrRange as DeviceAddrRange>::Addr, | ||
| width: AccessWidth, | ||
| ) -> AxResult<usize> { | ||
| Ok(CNTPCT_EL0.get() as usize) | ||
| } | ||
|
|
||
| fn handle_write( | ||
| &self, | ||
| addr: <SysRegAddrRange as DeviceAddrRange>::Addr, | ||
| width: AccessWidth, | ||
| val: usize, | ||
| ) -> AxResult { | ||
| info!("Write to emulator register: {:?}, value: {}", addr, val); | ||
| Ok(()) | ||
| } | ||
| } | ||
|
|
||
| pub struct SysCntpctEl0 { | ||
aarkegz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // Fields | ||
| } | ||
|
|
||
| impl SysCntpctEl0 { | ||
| pub fn new() -> Self { | ||
| Self { | ||
| // Initialize fields | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| extern crate alloc; | ||
|
|
||
| use alloc::sync::Arc; | ||
| use alloc::{vec, vec::Vec}; | ||
| use axdevice_base::BaseSysRegDeviceOps; | ||
|
|
||
| mod cntp_ctl_el0; | ||
| pub use cntp_ctl_el0::SysCntpCtlEl0; | ||
|
|
||
| mod cntpct_el0; | ||
| pub use cntpct_el0::SysCntpctEl0; | ||
|
|
||
| mod cntp_tval_el0; | ||
| pub use cntp_tval_el0::SysCntpTvalEl0; | ||
|
|
||
| /// Create a collection of system register devices. | ||
| pub fn get_sysreg_device() -> Vec<Arc<dyn BaseSysRegDeviceOps>> { | ||
| vec![ | ||
| Arc::new(SysCntpCtlEl0::new()), | ||
| Arc::new(SysCntpctEl0::new()), | ||
| Arc::new(SysCntpTvalEl0::new()), | ||
| ] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.