diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -772,6 +772,18 @@ identify_cpu(0); identify_hypervisor_smbios(); + /* + * If the SMBIOS method doesn't work, we can still check if we booted + * into EL1 on an EL2-capable CPU. + */ + if (boot_el == CURRENTEL_EL_EL1) { + /* Check if EL2 is implemented. */ + uint64_t pfr0; + pfr0 = READ_SPECIALREG(id_aa64pfr0_el1); + if (ID_AA64PFR0_EL2_VAL(pfr0) != ID_AA64PFR0_EL2_NONE) + vm_guest = VM_GUEST_VM; + } + update_special_regs(0); /* Set the pcpu data, this is needed by pmap_bootstrap */