Skip to content
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

Timer, GIC, IRQ support for aarch64 #727

Merged
merged 123 commits into from
Feb 27, 2023

Conversation

NathanRoyer
Copy link
Member

@NathanRoyer NathanRoyer commented Dec 13, 2022

This PR will help us discuss the support of these features for aarch64:

  • ARMv8 Generic Timer
  • ARMv8 Generic Interrupt Controller (GIC)
  • the use of these devices in the context of interrupt management & handling via the interrupts crate (and maybe more crates)

@NathanRoyer NathanRoyer marked this pull request as ready for review December 19, 2022 16:11
Copy link
Member

@kevinaboos kevinaboos left a comment

Choose a reason for hiding this comment

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

Avoid using "magic" numbers as much as possible; instead, you should define consts for things like affinity bitmaps and bitshifts.

Kindly add higher-level comments to each module and each function so we know what the module is for and what the function generally does. It's a bit hard to understand things with all of the acronyms; ideally the code (with comments) should be self-explanatory, such that the reader wouldn't have to fully know all details of the aarch64 interrupt spec to understand what the code is doing.
For example, someone reading the file gic/src/dist.rs or cpu2 or cpu3 probably wouldn't know what it's for unless they were already intimately familiar with aarch64 spec terminology.

aarch64/kernel/gic/src/lib.rs Outdated Show resolved Hide resolved
aarch64/kernel/gic/src/lib.rs Outdated Show resolved Hide resolved
aarch64/kernel/gic/src/lib.rs Outdated Show resolved Hide resolved
aarch64/kernel/gic/src/lib.rs Outdated Show resolved Hide resolved
aarch64/kernel/gic/src/lib.rs Outdated Show resolved Hide resolved
aarch64/kernel/gic/src/lib.rs Outdated Show resolved Hide resolved
aarch64/kernel/gic/src/cpu3.rs Outdated Show resolved Hide resolved
aarch64/kernel/gic/src/cpu3.rs Outdated Show resolved Hide resolved
aarch64/kernel/gic/src/dist.rs Outdated Show resolved Hide resolved
aarch64/kernel/gic/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Member

@kevinaboos kevinaboos 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 latter half of kernel/interrupts/src/aarch64/mod.rs should be moved into an "exception"-related crate or module, since they're not strictly about interrupt handling; they're mostly early/default exception handlers.

kernel/gic/src/mod.rs Outdated Show resolved Hide resolved
kernel/gic/src/mod.rs Outdated Show resolved Hide resolved
kernel/gic/src/mod.rs Outdated Show resolved Hide resolved
kernel/interrupts/src/aarch64/mod.rs Outdated Show resolved Hide resolved
kernel/interrupts/src/aarch64/table.s Outdated Show resolved Hide resolved
kernel/interrupts/src/aarch64/mod.rs Outdated Show resolved Hide resolved
kernel/interrupts/src/aarch64/mod.rs Show resolved Hide resolved
kernel/interrupts/src/aarch64/mod.rs Outdated Show resolved Hide resolved
kernel/interrupts/src/aarch64/mod.rs Outdated Show resolved Hide resolved
kernel/interrupts/src/aarch64/mod.rs Outdated Show resolved Hide resolved
@kevinaboos kevinaboos merged commit 22a88a0 into theseus-os:theseus_main Feb 27, 2023
github-actions bot pushed a commit that referenced this pull request Feb 27, 2023
* Adds basic support for handling interrupts on aarch64.

* Supports ARMv8 Generic Interrupt Controller (GIC),
  both versions 2 and 3, but is currently hardcoded for v3
  which is selected in QEMU by our Makefile.
  Also supports GIC distributor and redistributor interfaces.

* Only uses/supports (non-secure) Group 1 interrupts (IRQs),
  secure-mode Group 1 interrupts or Group 0 interrupts (e.g., FIQs).

* Uses the existing interface on x86_64 as a model for
  accessing the GIC and registering/deregistering interrupts,
  though the interface is a bit ad-hoc and not yet complete. 22a88a0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants