arch_utils: add Hygon Dhyana CPU support

Add Hygon CPU vendor ID("HygonGenuine") detection and optimize arch to
"athlon" in x86 and "amd64" in x86_64.

Merges: https://pagure.io/pungi/pull-request/1196
Signed-off-by: fanjinke <fanjinke@hygon.cn>
This commit is contained in:
fanjinke 2019-05-21 18:20:11 +08:00 committed by Lubomír Sedlář
parent 187ce8df79
commit a74470c18d

View File

@ -193,6 +193,8 @@ def getCanonX86Arch(arch): # pragma: no cover
for line in _try_read_cpuinfo(): for line in _try_read_cpuinfo():
if line.startswith("vendor") and line.find("AuthenticAMD") != -1: if line.startswith("vendor") and line.find("AuthenticAMD") != -1:
return "athlon" return "athlon"
elif line.startswith("vendor") and line.find("HygonGenuine") != -1:
return "athlon"
# i686 doesn't guarantee cmov, but we depend on it # i686 doesn't guarantee cmov, but we depend on it
elif line.startswith("flags"): elif line.startswith("flags"):
if line.find("cmov") == -1: if line.find("cmov") == -1:
@ -282,6 +284,8 @@ def getCanonX86_64Arch(arch): # pragma: no cover
if vendor.find("Authentic AMD") != -1 or vendor.find("AuthenticAMD") != -1: if vendor.find("Authentic AMD") != -1 or vendor.find("AuthenticAMD") != -1:
return "amd64" return "amd64"
if vendor.find("HygonGenuine") != -1:
return "amd64"
if vendor.find("GenuineIntel") != -1: if vendor.find("GenuineIntel") != -1:
return "ia32e" return "ia32e"
return arch return arch