Skip to content

Commit

Permalink
cpu/smp: Launch APs using tasks
Browse files Browse the repository at this point in the history
Launch the AP request loop using a task instead of
calling it directly from the entry point. This prepares
each AP for allowing additional tasks to be created and
scheduled.

Signed-off-by: Roy Hopkins <rhopkins@suse.de>
  • Loading branch information
roy-hopkins committed Jul 13, 2023
1 parent a40a753 commit 71ffda5
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/cpu/smp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
extern crate alloc;

use crate::acpi::tables::ACPICPUInfo;
use crate::cpu::percpu::{this_cpu_mut, PerCpu};
use crate::cpu::percpu::{this_cpu, this_cpu_mut, PerCpu};
use crate::cpu::vmsa::init_svsm_vmsa;
use crate::requests::request_loop;
use crate::task::{create_task, TASK_FLAG_SHARE_PT};

fn start_cpu(apic_id: u32) {
unsafe {
Expand Down Expand Up @@ -66,8 +67,17 @@ fn start_ap() {
// Set CPU online so that BSP can proceed
this_cpu_mut().set_online();

// Loop for now
request_loop();
// Create the task making sure the task only runs on this new AP
create_task(
ap_request_loop,
TASK_FLAG_SHARE_PT,
Some(this_cpu().get_apic_id()),
)
.expect("Failed to create AP initial task");
}

#[no_mangle]
pub extern "C" fn ap_request_loop() {
request_loop();
panic!("Returned from request_loop!");
}

0 comments on commit 71ffda5

Please sign in to comment.