Пример #1
0
def native_check():
    cpu_ids = get_online_cpu_ids()
    cpu_id = cpu_ids.pop(0)
    leaf_1 = parse_cpuid(1, 0, cpu_id)
    if leaf_1.hypervisor != 0:
        logging.warning(f"Board inspector is running inside a Virtual Machine (VM). Running ACRN inside a VM is only" \
        "supported under KVM/QEMU. Unexpected results may occur when deviating from that combination.")
Пример #2
0
def native_check():
    cpu_ids = get_online_cpu_ids()
    cpu_id = cpu_ids.pop(0)
    leaf_1 = parse_cpuid(1, 0, cpu_id)
    if leaf_1.hypervisor != 0:
        logging.error("Board inspector is running inside an unsupported Virtual Machine (VM). " \
        "Only KVM or QEMU is supported. Unexpected results may occur.")
Пример #3
0
def extract_topology(processors_node):
    cpu_ids = get_online_cpu_ids()
    for cpu_id in cpu_ids:
        subleaf = 0
        last_shift = 0
        last_node = None

        leaf_0 = parse_cpuid(0, 0, cpu_id)
        if leaf_0.max_leaf >= 0x1f:
            topo_leaf = 0x1f
        else:
            topo_leaf = 0xb

        while True:
            leaf_topo = parse_cpuid(topo_leaf, subleaf, cpu_id)
            if leaf_topo.level_type == 0:
                if last_node.tag != "package":
                    n, _ = get_or_create_parent(processors_node, "die", "0")
                    n.append(last_node)
                    last_node = n
                processors_node.append(last_node)
                break

            topo_level = level_types[leaf_topo.level_type]
            topo_id = hex(leaf_topo.x2apic_id >> last_shift)
            n, created = get_or_create_parent(processors_node, topo_level,
                                              topo_id)

            if last_node is None:
                leaf_1 = parse_cpuid(1, 0, cpu_id)
                family_id = hex(leaf_1.display_family)
                model_id = hex(leaf_1.display_model)
                if leaf_0.max_leaf >= 0x1a:
                    leaf_1a = parse_cpuid(0x1a, 0, cpu_id)
                    core_type = leaf_1a.core_type
                    native_model_id = hex(leaf_1a.native_model_id)
                else:
                    core_type = ""
                    native_model_id = ""

                add_child(n, "cpu_id", text=str(cpu_id))
                add_child(n, "apic_id", text=hex(leaf_1.initial_apic_id))
                add_child(n, "x2apic_id", text=hex(leaf_topo.x2apic_id))
                add_child(n, "family_id", text=family_id)
                add_child(n, "model_id", text=model_id)
                add_child(n, "stepping_id", text=hex(leaf_1.stepping))
                add_child(n, "core_type", text=core_type)
                add_child(n, "native_model_id", text=native_model_id)

                extract_model(processors_node, cpu_id, family_id, model_id,
                              core_type, native_model_id)
            else:
                n.append(last_node)

            if not created:
                break

            last_node = n
            last_shift = leaf_topo.num_bit_shift
            subleaf += 1