Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,50 @@ jobs:
export PATH=/opt/qemu/bin:$PATH
just test-qemu-v8r

# Run some SMP programs in QEMU 9 for Armv8-R
# These tests build with nightly as pinned by the rust-toolchain.toml file, because they include Tier 3 targets
test-qemu-v8r-smp:
runs-on: ubuntu-24.04
needs: [build-all]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Just
uses: taiki-e/install-action@just
- name: Install Dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install libpixman-1-0 libfdt1 libglib2.0-0t64
- name: Install custom QEMU into /opt
run: |
curl -sSL https://github.com/jonathanpallant/qemu9-for-ubuntu-2404/releases/download/qemu-9.2.3%2Bbuild0/qemu-9.2.3-ubuntu-24.04.tar.gz | sudo tar xvzf - -C /
- name: Run tests in QEMU
run: |
export PATH=/opt/qemu/bin:$PATH
just test-qemu-v8r-smp

# Run some EL2 programs in QEMU 9 for Armv8-R
# These tests build with nightly as pinned by the rust-toolchain.toml file, because they include Tier 3 targets
test-qemu-v8r-el2:
runs-on: ubuntu-24.04
needs: [build-all]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Just
uses: taiki-e/install-action@just
- name: Install Dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install libpixman-1-0 libfdt1 libglib2.0-0t64
- name: Install custom QEMU into /opt
run: |
curl -sSL https://github.com/jonathanpallant/qemu9-for-ubuntu-2404/releases/download/qemu-9.2.3%2Bbuild0/qemu-9.2.3-ubuntu-24.04.tar.gz | sudo tar xvzf - -C /
- name: Run tests in QEMU
run: |
export PATH=/opt/qemu/bin:$PATH
just test-qemu-v8r-el2

# Gather all the above QEMU jobs together for the purposes of getting an overall pass-fail
test-qemu-all:
runs-on: ubuntu-24.04
Expand All @@ -417,6 +461,8 @@ jobs:
test-qemu-v7a,
test-qemu-v7r,
test-qemu-v8r,
test-qemu-v8r-smp,
test-qemu-v8r-el2,
]
steps:
- run: /bin/true
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ examples/mps3-an536/target
examples/mps3-an536/target-d32
examples/mps3-an536-smp/target
examples/mps3-an536-smp/target-d32
examples/mps3-an536-el2/target
examples/mps3-an536-el2/target-d32
examples/versatileab/target
examples/versatileab/target-d32
Cargo.lock
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"examples/versatileab/Cargo.toml",
"examples/mps3-an536/Cargo.toml",
"examples/mps3-an536-smp/Cargo.toml",
"examples/mps3-an536-el2/Cargo.toml"
]
}
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ exclude = [
"examples/versatileab",
"examples/mps3-an536",
"examples/mps3-an536-smp",
"examples/mps3-an536-el2",
]
members = [
"aarch32-cpu",
Expand Down
24 changes: 19 additions & 5 deletions aarch32-cpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,25 @@ serde = ["dep:serde", "arbitrary-int/serde"]
check-asm = []

[package.metadata.docs.rs]
# This is a list of supported Tier 2 targets, as of latest stable
targets = [
"armv7r-none-eabihf",
"armv7r-none-eabi",
"armv7a-none-eabihf",
"armebv7r-none-eabi",
"armebv7r-none-eabihf",
"armv4t-none-eabi",
"armv5te-none-eabi",
"armv6-none-eabi",
"armv6-none-eabihf",
"armv7a-none-eabi",
"armv8r-none-eabihf"
"armv7a-none-eabihf",
"armv7r-none-eabi",
"armv7r-none-eabihf",
"armv8r-none-eabihf",
"thumbv4t-none-eabi",
"thumbv5te-none-eabi",
"thumbv6-none-eabi",
"thumbv7a-none-eabi",
"thumbv7a-none-eabihf",
"thumbv7r-none-eabi",
"thumbv7r-none-eabihf",
"thumbv8r-none-eabihf",
]
cargo-args = ["-Z", "build-std"]
1 change: 1 addition & 0 deletions aarch32-cpu/src/asmv4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ pub fn core_id() -> u32 {
r & 0x00FF_FFFF
}

/// LLVM intrinsic for memory barriers
#[no_mangle]
pub extern "C" fn __sync_synchronize() {
// we don't have a barrier instruction - the linux kernel just uses an empty inline asm block
Expand Down
2 changes: 2 additions & 0 deletions aarch32-cpu/src/cache.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Helper functions for dealing with CPU cache

use arbitrary_int::u3;

use crate::register::{Dccimvac, Dccisw, Dccmvac, Dccsw, Dcimvac, Dcisw, SysRegWrite};
Expand Down
7 changes: 6 additions & 1 deletion aarch32-cpu/src/generic_timer/el0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::register;

/// Represents our Generic Timer when we are running at EL0.
/// Represents our Generic Physical Timer when we are running at EL0.
///
/// Note that for most of these APIs to work, EL0 needs to have been granted
/// access using methods like
Expand Down Expand Up @@ -75,6 +75,11 @@ impl super::GenericTimer for El0PhysicalTimer {
}
}

/// Represents our Generic Virtual Timer when we are running at EL0.
///
/// Note that for most of these APIs to work, EL0 needs to have been granted
/// access using methods like
/// [El1VirtualTimer::el0_access_virtual_counter](crate::generic_timer::El1VirtualTimer::el0_access_virtual_counter).
pub struct El0VirtualTimer();

impl El0VirtualTimer {
Expand Down
4 changes: 2 additions & 2 deletions aarch32-cpu/src/generic_timer/el2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::{El1PhysicalTimer, El1VirtualTimer, GenericTimer};
pub struct El2PhysicalTimer(El1PhysicalTimer);

impl El2PhysicalTimer {
/// Create an EL1 Generic Timer handle
/// Create an EL2 Physical Timer handle
///
/// # Safety
///
Expand Down Expand Up @@ -79,7 +79,7 @@ impl GenericTimer for El2PhysicalTimer {
pub struct El2VirtualTimer(El1VirtualTimer);

impl El2VirtualTimer {
/// Create an EL1 Generic Timer handle
/// Create an EL2 Generic Timer handle
///
/// # Safety
///
Expand Down
15 changes: 11 additions & 4 deletions aarch32-cpu/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
//! CPU/peripheral support for Arm AArch32
#![no_std]
#![deny(missing_docs)]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(clippy::missing_safety_doc)]
#![deny(clippy::unnecessary_safety_comment)]
#![deny(clippy::unnecessary_safety_doc)]

mod critical_section;

Expand All @@ -23,18 +28,20 @@ pub mod asm;

pub mod cache;
pub mod interrupt;
pub mod mmu;
pub mod register;
#[cfg(target_arch = "arm")]
pub mod stacks;

#[cfg(any(test, doc, arm_architecture = "v7-r"))]
#[cfg(any(test, arm_profile = "a", arm_profile = "legacy"))]
pub mod mmu;

#[cfg(any(test, arm_architecture = "v7-r"))]
pub mod pmsav7;

#[cfg(any(test, doc, arm_architecture = "v8-r"))]
#[cfg(any(test, arm_architecture = "v8-r"))]
pub mod generic_timer;

#[cfg(any(test, doc, arm_architecture = "v8-r"))]
#[cfg(any(test, arm_architecture = "v8-r"))]
pub mod pmsav8;

/// Generate an SVC call with no parameters.
Expand Down
Loading
Loading