Skip to content

Support generic-timer (and EL2) on Armv7-A#141

Open
jonathanpallant wants to merge 2 commits intomainfrom
timer-on-v7a
Open

Support generic-timer (and EL2) on Armv7-A#141
jonathanpallant wants to merge 2 commits intomainfrom
timer-on-v7a

Conversation

@jonathanpallant
Copy link
Copy Markdown
Contributor

Fixes #140 by adding generic timer support for Armv7-A.

  • Unfortunately this means testing on Cortex-A15, because Cortex-A8 doesn't have the Timer Extension
  • Unfortunately Cortex-A15 has virtualisation support and boots at EL2
  • So I had to make Armv7-A use the same EL2-capable boot code as Armv8-R
  • And that mean moving a bunch of registers out of the registers::armv8r module and into a new registers::hyp module available on Armv7-A and Armv8-R

Requires we change the emulated CPU from Cortex-A8 to Cortex-A15, as
Cortex-A8 doesn't have the timer extensions.

That in turn meant we booted into EL2, so we needed to bounce ourselves
into EL1 that the examples were expecting. And that meant making a bunch
of Hyp registers available on Armv7-A and Armv8-R, and changing the
Armv7-A start-up routine to be the Armv8-R routine.
@jonathanpallant
Copy link
Copy Markdown
Contributor Author

rebased on main

Copy link
Copy Markdown

@wt wt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code changes look fine.

With regard to the cpu switch for qemu, is there no value to keeping the tests on that qemu target so that we have both? I just want to make sure we aren't losing any meaningful test coverage.


pub mod cache;

#[cfg(any(test, doc, arm_architecture = "v8-r", arm_architecture = "v7-a"))]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this one the same order as the others above, with the lower number architecture first?

use aarch32_cpu::register::{cpsr::ProcessorMode, Cpsr};

#[cfg(arm_architecture = "v8-r")]
#[cfg(any(arm_architecture = "v8-r", arm_architecture = "v7-a"))]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order again.

#[cfg(all(target_arch = "arm", not(arm_architecture = "v8-r")))]
#[cfg(all(
target_arch = "arm",
not(any(arm_architecture = "v8-r", arm_architecture = "v7-a"))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order again.

//
// We boot into EL2, set up a stack pointer, and run `kmain` in EL1.
#[cfg(arm_architecture = "v8-r")]
#[cfg(any(arm_architecture = "v8-r", arm_architecture = "v7-a"))]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

order again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Public generic_timer for armv7a.

2 participants