mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
cpu_map: sync_qemu_cpu_i386: Factor out translation of vendors
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
d251129b36
commit
4d0b1549cc
@ -8,11 +8,6 @@ import re
|
|||||||
|
|
||||||
|
|
||||||
T = {
|
T = {
|
||||||
# translating qemu -> libvirt cpu vendor names
|
|
||||||
"CPUID_VENDOR_AMD": "AMD",
|
|
||||||
"CPUID_VENDOR_INTEL": "Intel",
|
|
||||||
"CPUID_VENDOR_HYGON": "Hygon",
|
|
||||||
|
|
||||||
# translating qemu -> libvirt cpu feature names
|
# translating qemu -> libvirt cpu feature names
|
||||||
"CPUID_6_EAX_ARAT": "arat",
|
"CPUID_6_EAX_ARAT": "arat",
|
||||||
"CPUID_7_0_EBX_ADX": "adx",
|
"CPUID_7_0_EBX_ADX": "adx",
|
||||||
@ -152,6 +147,20 @@ 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 readline_cont(f):
|
def readline_cont(f):
|
||||||
"""Read one logical line from a file `f` i.e. continues lines that end in
|
"""Read one logical line from a file `f` i.e. continues lines that end in
|
||||||
a backslash."""
|
a backslash."""
|
||||||
@ -264,7 +273,7 @@ def expand_model(model):
|
|||||||
|
|
||||||
result = {
|
result = {
|
||||||
"name": model.pop(".name"),
|
"name": model.pop(".name"),
|
||||||
"vendor": T[model.pop(".vendor")],
|
"vendor": translate_vendor(model.pop(".vendor")),
|
||||||
"features": set(),
|
"features": set(),
|
||||||
"extra": dict()}
|
"extra": dict()}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user