-
-
Notifications
You must be signed in to change notification settings - Fork 182
Introduction of arm_boards crate & GIC driver fixes
#915
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
kevinaboos
merged 23 commits into
theseus-os:theseus_main
from
NathanRoyer:gic-redist-fixes
Apr 4, 2023
Merged
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b29102a
Bump vte dependency from 0.10.1 to 0.11.0
NathanRoyer 6fac3fb
Make CpuId conversions and constructions `const`
NathanRoyer 3bb3d3c
Introduce arm_boards crate
NathanRoyer 19b8c66
Use arm_boards in GIC driver
NathanRoyer dfac795
Use arm_boards in multicore_bringup instead of CpuId bruteforcing
NathanRoyer f9ab052
Assert that the GIC distributor is allowed to pick a core that is asl…
NathanRoyer 0bc3b7f
Introduce AffinityShift for safer affinity level readings from an Mpi…
NathanRoyer e7cc06c
Dedicated Offset Types to prevent confusion between 32b & 64b registers
NathanRoyer e153838
Assert PE selectability policy for "1 of N" interrupts in redistribut…
NathanRoyer 03f05c5
Revert "Introduce AffinityShift for safer affinity level readings fro…
NathanRoyer d9cfc4e
Fix missing import in gic
NathanRoyer d7f9267
Fix doc builds
NathanRoyer d8bf0c6
Remove `arrayvec` dep of `gic` in favor of `core::array::try_from_fn`
NathanRoyer 2903a98
Rename `current_redist_index` as `get_current_cpu_redist_index` and d…
NathanRoyer 0cabe63
Rename default arm_boards file
NathanRoyer 77f5052
Introduce arm_boards::BoardConfig
NathanRoyer aed9ac0
Rename default arm_boards file to `unselected.rs`
NathanRoyer baba04c
Introduce `arm_boards::mpidr::DefinedMpidrValue`, a hardcoded equival…
NathanRoyer 76d8678
Fix unselected board file path
NathanRoyer 5f83734
Doc & x86 builds fix
NathanRoyer 605f93a
Fix doc builds by removing the gic crate from them
NathanRoyer 1eb0588
clean up
kevinaboos f7de8b1
fix gic redistributor timeout
kevinaboos 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,17 @@ | ||
| [package] | ||
| authors = ["Nathan Royer <nathan.royer.pro@gmail.com>"] | ||
| name = "arm_boards" | ||
| description = "Per-board AArch64 configuration" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
|
|
||
| [dependencies] | ||
| memory_structs = { path = "../memory_structs" } | ||
| cpu = { path = "../cpu" } | ||
|
|
||
| [features] | ||
| default = [ "qemu_virt" ] | ||
| qemu_virt = [] | ||
|
|
||
| [lib] | ||
| crate-type = ["rlib"] | ||
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 @@ | ||
| //! Default board config file. | ||
kevinaboos marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| //! | ||
| //! This will result in a compile-time error if used in an aarch64 build. | ||
|
|
||
| #[cfg(target_arch = "aarch64")] | ||
| compile_error!("Please select a board config feature in the arm_boards crate"); | ||
|
|
||
| pub const CPUS: usize = 0; | ||
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,35 @@ | ||
| //! Per-board definitions for AArch64 builds | ||
| //! | ||
| //! | Feature | CPU Cores | Interrupt Controller | Secondary Cores Startup Method | | ||
| //! | --- | --- | --- | --- | | ||
| //! | qemu_virt | 4 | GICv3 | PSCI | | ||
| //! | ||
|
|
||
| #![no_std] | ||
| #![feature(const_trait_impl)] | ||
|
|
||
| use memory_structs::PhysicalAddress; | ||
|
|
||
| #[derive(Debug, Copy, Clone)] | ||
| pub struct GicV3InterruptControllerConfig { | ||
| pub distributor_base_address: PhysicalAddress, | ||
| pub redistributor_base_addresses: [PhysicalAddress; board::CPUS], | ||
| } | ||
|
|
||
| #[derive(Debug, Copy, Clone)] | ||
| pub enum InterruptControllerConfig { | ||
| GicV3(GicV3InterruptControllerConfig), | ||
| } | ||
|
|
||
| /* | ||
| TODO: multicore_bringup: wake secondary cores based on this: | ||
| pub enum SecondaryCoresStartup { | ||
| Psci, | ||
| } | ||
| */ | ||
|
|
||
| // by default & on x86_64, the board.rs file is used | ||
| #[cfg_attr(all(target_arch = "aarch64", feature = "qemu_virt"), path = "qemu_virt.rs")] | ||
| mod board; | ||
|
|
||
| pub use board::*; |
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,36 @@ | ||
| //! AArch64 Board Config for the `virt` machine of Qemu | ||
NathanRoyer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| use super::{InterruptControllerConfig::{self, GicV3}, GicV3InterruptControllerConfig}; | ||
| use cpu::{CpuId, MpidrValue}; | ||
| use memory_structs::PhysicalAddress; | ||
|
|
||
| // local utility function to generate the CPU id from | ||
| // the affinity level 0 number of the cpu core | ||
| const fn cpu_id(aff0: u8) -> CpuId { | ||
| CpuId::from(MpidrValue::new(0, 0, 0, aff0)) | ||
| } | ||
NathanRoyer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| pub const CPUS: usize = 4; | ||
|
|
||
| pub const CPUIDS: [CpuId; CPUS] = [ | ||
| cpu_id(0), | ||
| cpu_id(1), | ||
| cpu_id(2), | ||
| cpu_id(3), | ||
| ]; | ||
|
|
||
| // local utility function to generate the redistributor base | ||
| // address from the affinity level 0 number of the cpu core | ||
| const fn redist(aff0: usize) -> PhysicalAddress { | ||
| PhysicalAddress::new_canonical(0x080A0000 + 0x20000 * aff0) | ||
| } | ||
|
|
||
| pub const INTERRUPT_CONTROLLER_CONFIG: InterruptControllerConfig = GicV3(GicV3InterruptControllerConfig { | ||
| distributor_base_address: PhysicalAddress::new_canonical(0x08000000), | ||
| redistributor_base_addresses: [ | ||
| redist(0), | ||
| redist(1), | ||
| redist(2), | ||
| redist(3), | ||
| ], | ||
| }); | ||
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
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
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.