Skip to content

Commit 214e62a

Browse files
committed
arch/aarch64: only write SMBIOS with a firmware
When booting a firmware, RAM starts at 0x4000_0000, while when doing a direct kernel boot RAM starts at 0x8000_0000. Only write SMBIOS in the former case. Signed-off-by: Sergio Lopez <slp@redhat.com>
1 parent 6ca12f0 commit 214e62a

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/arch/src/aarch64/mod.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,19 @@ pub fn arch_memory_regions(
8484
}
8585

8686
/// Configures the system and should be called once per vm before starting vcpu threads.
87-
/// For aarch64, we only setup the FDT.
88-
///
89-
/// # Arguments
90-
///
91-
/// * `guest_mem` - The memory to be used by the guest.
92-
/// * `cmdline_cstring` - The kernel commandline.
93-
/// * `vcpu_mpidr` - Array of MPIDR register values per vcpu.
94-
/// * `device_info` - A hashmap containing the attached devices for building FDT device nodes.
95-
/// * `gic_device` - The GIC device.
96-
/// * `initrd` - Information about an optional initrd.
87+
/// For aarch64, we only setup SMBIOS.
9788
#[allow(clippy::too_many_arguments)]
9889
pub fn configure_system(
99-
_guest_mem: &GuestMemoryMmap,
100-
_smbios_oem_strings: &Option<Vec<String>>,
90+
guest_mem: &GuestMemoryMmap,
91+
mem_info: &ArchMemoryInfo,
92+
smbios_oem_strings: &Option<Vec<String>>,
10193
) -> super::Result<()> {
102-
smbios::setup_smbios(_guest_mem, layout::SMBIOS_START, _smbios_oem_strings)
103-
.map_err(Error::Smbios)?;
94+
// When booting EFI, RAM starts at 0x4000_0000, while when doing a direct kernel
95+
// boot RAM starts at 0x8000_0000. Only write SMBIOS in the former case.
96+
if mem_info.ram_start_addr < layout::SMBIOS_START {
97+
smbios::setup_smbios(guest_mem, layout::SMBIOS_START, smbios_oem_strings)
98+
.map_err(Error::Smbios)?;
99+
}
104100

105101
Ok(())
106102
}

src/vmm/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,12 @@ impl Vmm {
309309

310310
#[cfg(target_arch = "aarch64")]
311311
{
312-
arch::aarch64::configure_system(&self.guest_memory, _smbios_oem_strings)
313-
.map_err(Error::ConfigureSystem)?;
312+
arch::aarch64::configure_system(
313+
&self.guest_memory,
314+
&self.arch_memory_info,
315+
_smbios_oem_strings,
316+
)
317+
.map_err(Error::ConfigureSystem)?;
314318
}
315319

316320
#[cfg(target_arch = "riscv64")]

0 commit comments

Comments
 (0)