mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 22:15:21 +00:00
cpu_map: sync_qemu_cpu_i386: Factor out translation of features
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
4d0b1549cc
commit
8292597da6
@ -7,7 +7,22 @@ import os
|
||||
import re
|
||||
|
||||
|
||||
T = {
|
||||
def translate_vendor(name):
|
||||
T = {
|
||||
"CPUID_VENDOR_AMD": "AMD",
|
||||
"CPUID_VENDOR_INTEL": "Intel",
|
||||
"CPUID_VENDOR_HYGON": "Hygon",
|
||||
}
|
||||
|
||||
if name in T:
|
||||
return T[name]
|
||||
|
||||
print("warning: Unknown vendor '{}'".format(name))
|
||||
return name
|
||||
|
||||
|
||||
def translate_feature(name):
|
||||
T = {
|
||||
# translating qemu -> libvirt cpu feature names
|
||||
"CPUID_6_EAX_ARAT": "arat",
|
||||
"CPUID_7_0_EBX_ADX": "adx",
|
||||
@ -144,20 +159,12 @@ T = {
|
||||
# set to "no auto enable" by qemu
|
||||
"CPUID_EXT3_TOPOEXT": None,
|
||||
"MSR_VMX_BASIC_DUAL_MONITOR": None,
|
||||
}
|
||||
|
||||
|
||||
def translate_vendor(name):
|
||||
T = {
|
||||
"CPUID_VENDOR_AMD": "AMD",
|
||||
"CPUID_VENDOR_INTEL": "Intel",
|
||||
"CPUID_VENDOR_HYGON": "Hygon",
|
||||
}
|
||||
|
||||
if name in T:
|
||||
return T[name]
|
||||
|
||||
print("warning: Unknown vendor '{}'".format(name))
|
||||
print("warning: Unknown feature '{}'".format(name))
|
||||
return name
|
||||
|
||||
|
||||
@ -286,7 +293,7 @@ def expand_model(model):
|
||||
for feature in v.split():
|
||||
if feature.startswith("VMX_") or feature.startswith("MSR_VMX_"):
|
||||
continue
|
||||
translated = T.get(feature, feature)
|
||||
translated = translate_feature(feature)
|
||||
if translated:
|
||||
result["features"].add(translated)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user