staticbool __init hyperv_detect_via_acpi(void)
{ if (acpi_disabled) returnfalse; /* * Hypervisor ID is only available in ACPI v6+, and the * structure layout was extended in v6 to accommodate that * new field. * * At the very minimum, this check makes sure not to read * past the FADT structure. * * It is also needed to catch running in some unknown * non-Hyper-V environment that has ACPI 5.x or less. * In such a case, it can't be Hyper-V.
*/ if (acpi_gbl_FADT.header.revision < 6) returnfalse; return strncmp((char *)&acpi_gbl_FADT.hypervisor_id, "MsHyperV", 8) == 0;
}
/* * Allow for a kernel built with CONFIG_HYPERV to be running in * a non-Hyper-V environment. * * In such cases, do nothing and return success.
*/ if (!hyperv_detect_via_acpi() && !hyperv_detect_via_smccc()) return 0;
/* Setup the guest ID */
guest_id = hv_generate_guest_id(LINUX_VERSION_CODE);
hv_set_vpreg(HV_REGISTER_GUEST_OS_ID, guest_id);
/* Get the features and hints from Hyper-V */
hv_get_vpreg_128(HV_REGISTER_PRIVILEGES_AND_FEATURES_INFO, &result);
ms_hyperv.features = result.as32.a;
ms_hyperv.priv_high = result.as32.b;
ms_hyperv.misc_features = result.as32.c;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.