Skip to content

Commit

Permalink
Create ACPI CPU information from IGVM parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Lange <jlange@microsoft.com>
  • Loading branch information
msft-jlange committed Dec 4, 2023
1 parent 3f4e345 commit f678413
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl<'a> SvsmConfig<'a> {
pub fn load_cpu_info(&self) -> Result<Vec<ACPICPUInfo>, SvsmError> {
match self {
SvsmConfig::FirmwareConfig(fw_cfg) => load_acpi_cpu_info(fw_cfg),
&SvsmConfig::IgvmConfig(_) => todo!(),
SvsmConfig::IgvmConfig(igvm_params) => igvm_params.load_cpu_info(),
}
}
pub fn should_launch_fw(&self) -> bool {
Expand Down
13 changes: 13 additions & 0 deletions src/igvm_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

extern crate alloc;

use crate::acpi::tables::ACPICPUInfo;
use crate::address::{PhysAddr, VirtAddr};
use crate::error::SvsmError;
use crate::error::SvsmError::Firmware;
Expand Down Expand Up @@ -112,4 +113,16 @@ impl IgvmParams<'_> {

Ok(regions)
}

pub fn load_cpu_info(&self) -> Result<Vec<ACPICPUInfo>, SvsmError> {
let mut cpus: Vec<ACPICPUInfo> = Vec::new();
for i in 0..self.igvm_param_page.cpu_count {
let cpu = ACPICPUInfo {
apic_id: i,
enabled: true,
};
cpus.push(cpu);
}
Ok(cpus)
}
}

0 comments on commit f678413

Please sign in to comment.