devices: Add acpi tables to fw_cfg

The acpi tables are created in the same place the acpi tables would be
created for the regular bootflow, except here we add them to the
fw_cfg device to be measured by the fw and then the fw will put the
acpi tables into memory.

Signed-off-by: Alex Orozco <alexorozco@google.com>
This commit is contained in:
Alex Orozco
2025-03-24 20:12:08 +00:00
committed by Bo Chen
parent f0b69d56d0
commit 1f51e4525b
3 changed files with 274 additions and 4 deletions

View File

@@ -355,6 +355,10 @@ pub enum Error {
#[cfg(feature = "fw_cfg")]
#[error("Error creating e820 map")]
CreatingE820Map(#[source] io::Error),
#[cfg(feature = "fw_cfg")]
#[error("Error creating acpi tables")]
CreatingAcpiTables(#[source] io::Error),
}
pub type Result<T> = result::Result<T, Error>;
@@ -2361,10 +2365,21 @@ impl Vm {
} else {
VmState::Running
};
current_state.valid_transition(new_state)?;
#[cfg(feature = "fw_cfg")]
Self::populate_fw_cfg(&self.device_manager, &self.config)?;
{
Self::populate_fw_cfg(&self.device_manager, &self.config)?;
let tpm_enabled = self.config.lock().unwrap().tpm.is_some();
crate::acpi::create_acpi_tables_for_fw_cfg(
&self.device_manager,
&self.cpu_manager,
&self.memory_manager,
&self.numa_nodes,
tpm_enabled,
)?
}
// Do earlier to parallelise with loading kernel
#[cfg(target_arch = "x86_64")]