Skip to content

Commit

Permalink
Assert that the GIC distributor is allowed to pick a core that is asl…
Browse files Browse the repository at this point in the history
…eep for "1 of N" interrupts during distributor initialization
  • Loading branch information
NathanRoyer committed Mar 31, 2023
1 parent b80282d commit 21b819b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kernel/gic/src/gic/dist_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ mod offset {
// enable group 1
const CTLR_ENGRP1: u32 = 0b10;

// enable 1 of N wakeup functionality
const CTLR_E1NWF: u32 = 1 << 7;

// Affinity Routing Enable, Non-secure state.
const CTLR_ARE_NS: u32 = 1 << 5;

Expand All @@ -63,14 +66,16 @@ fn assert_cpu_bounds(target: &TargetCpu) {
}

/// Initializes the distributor by enabling forwarding
/// of group 1 interrupts
/// of group 1 interrupts and allowing the GIC to pick
/// a core that is asleep for "1 of N" interrupts.
///
/// Return value: whether or not affinity routing is
/// currently enabled for both secure and non-secure
/// states.
pub fn init(registers: &mut GicRegisters) -> Enabled {
let mut reg = registers.read_volatile(offset::CTLR);
reg |= CTLR_ENGRP1;
reg |= CTLR_E1NWF;
registers.write_volatile(offset::CTLR, reg);

// Return value: whether or not affinity routing is
Expand Down

0 comments on commit 21b819b

Please sign in to comment.