mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
x86 queue, 2021-06-18
Features: * Add ratelimit for bus locks acquired in guest (Chenyi Qiang) Documentation: * SEV documentation updates (Tom Lendacky) * Add a table showing x86-64 ABI compatibility levels (Daniel P. Berrangé) Automated changes: * Update Linux headers to 5.13-rc4 (Eduardo Habkost) -----BEGIN PGP SIGNATURE----- iQJIBAABCAAyFiEEWjIv1avE09usz9GqKAeTb5hNxaYFAmDM+T4UHGVoYWJrb3N0 QHJlZGhhdC5jb20ACgkQKAeTb5hNxabUrQ/+PtiJjd1cW9nhA0kWu8dVGq3xXJb4 Nbma86tRPKBauTeQCLccXEvUjLqgFejeQlArhq4QKErLisXu4TDuQ+GeAfdR7h5P MTMSo0C665cT2/NbrwQizSPQdrNEgZAYRaDRafZLQTJ1TStzWDB1Vg79rzpWPcn0 76XjIfSdGZUa4B1OvjNvUFq/SXf+0hW75soCwRhDNh5tfzfyct0XCSRF/wTXqyR/ 7yxDtfTzUAvT+6l3qb8ky+wqUTIY58BgjbdIGhyAUr5/N8y5YystF41TUVoy772k pmCXHniMmgmhH7HVwGujtc6mPe5y1VFJVaA08Pzb7KwSfdO9F/3Gk3DHpKW8/whi tCGluBqz0qlyhsnP9wDRJb6BzCBl2hVqu50DL+uSNsJOSIW60LLMJV4ANlDYdDM3 s33S5NrM0DsRAjrtczPdvKPWwaVE4NB2bYX1I3yYGgflwzQYOjBmswM/UgymhlZk 5dxtF9CX2p+Vre6UoLDKum1DJDCcWjHouJAAqZzxxEko56yWgTUSzTcK4GVOlsAc qX4gJbFpOzDlSdpDTG/fcnQlCnwc1jxCzsB8Wy2KJiBif3Sa3Wh1s00Cp7oGNQt+ P/z2Fp1agl8u83bbvlIjZnsv0O2g5Ks4r5tBhXmqI36aiU26F/x39SUfp7/7OAUd CQBGBGXqpnOmUcE= =YWGX -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/ehabkost-gl/tags/x86-next-pull-request' into staging x86 queue, 2021-06-18 Features: * Add ratelimit for bus locks acquired in guest (Chenyi Qiang) Documentation: * SEV documentation updates (Tom Lendacky) * Add a table showing x86-64 ABI compatibility levels (Daniel P. Berrangé) Automated changes: * Update Linux headers to 5.13-rc4 (Eduardo Habkost) # gpg: Signature made Fri 18 Jun 2021 20:51:26 BST # gpg: using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6 # gpg: issuer "ehabkost@redhat.com" # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full] # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost-gl/tags/x86-next-pull-request: scripts: helper to generate x86_64 CPU ABI compat info docs: add a table showing x86-64 ABI compatibility levels docs/interop/firmware.json: Add SEV-ES support docs: Add SEV-ES documentation to amd-memory-encryption.txt doc: Fix some mistakes in the SEV documentation i386: Add ratelimit for bus locks acquired in guest Update Linux headers to 5.13-rc4 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
53f306f316
34 changed files with 3176 additions and 2075 deletions
194
scripts/cpu-x86-uarch-abi.py
Normal file
194
scripts/cpu-x86-uarch-abi.py
Normal file
|
@ -0,0 +1,194 @@
|
|||
#!/usr/bin/python3
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# A script to generate a CSV file showing the x86_64 ABI
|
||||
# compatibility levels for each CPU model.
|
||||
#
|
||||
|
||||
from qemu import qmp
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 1:
|
||||
print("syntax: %s QMP-SOCK\n\n" % __file__ +
|
||||
"Where QMP-SOCK points to a QEMU process such as\n\n" +
|
||||
" # qemu-system-x86_64 -qmp unix:/tmp/qmp,server,nowait " +
|
||||
"-display none -accel kvm", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# Mandatory CPUID features for each microarch ABI level
|
||||
levels = [
|
||||
[ # x86-64 baseline
|
||||
"cmov",
|
||||
"cx8",
|
||||
"fpu",
|
||||
"fxsr",
|
||||
"mmx",
|
||||
"syscall",
|
||||
"sse",
|
||||
"sse2",
|
||||
],
|
||||
[ # x86-64-v2
|
||||
"cx16",
|
||||
"lahf-lm",
|
||||
"popcnt",
|
||||
"pni",
|
||||
"sse4.1",
|
||||
"sse4.2",
|
||||
"ssse3",
|
||||
],
|
||||
[ # x86-64-v3
|
||||
"avx",
|
||||
"avx2",
|
||||
"bmi1",
|
||||
"bmi2",
|
||||
"f16c",
|
||||
"fma",
|
||||
"abm",
|
||||
"movbe",
|
||||
],
|
||||
[ # x86-64-v4
|
||||
"avx512f",
|
||||
"avx512bw",
|
||||
"avx512cd",
|
||||
"avx512dq",
|
||||
"avx512vl",
|
||||
],
|
||||
]
|
||||
|
||||
# Assumes externally launched process such as
|
||||
#
|
||||
# qemu-system-x86_64 -qmp unix:/tmp/qmp,server,nowait -display none -accel kvm
|
||||
#
|
||||
# Note different results will be obtained with TCG, as
|
||||
# TCG masks out certain features otherwise present in
|
||||
# the CPU model definitions, as does KVM.
|
||||
|
||||
|
||||
sock = sys.argv[1]
|
||||
cmd = sys.argv[2]
|
||||
shell = qmp.QEMUMonitorProtocol(sock)
|
||||
shell.connect()
|
||||
|
||||
models = shell.cmd("query-cpu-definitions")
|
||||
|
||||
# These QMP props don't correspond to CPUID fatures
|
||||
# so ignore them
|
||||
skip = [
|
||||
"family",
|
||||
"min-level",
|
||||
"min-xlevel",
|
||||
"vendor",
|
||||
"model",
|
||||
"model-id",
|
||||
"stepping",
|
||||
]
|
||||
|
||||
names = []
|
||||
|
||||
for model in models["return"]:
|
||||
if "alias-of" in model:
|
||||
continue
|
||||
names.append(model["name"])
|
||||
|
||||
models = {}
|
||||
|
||||
for name in sorted(names):
|
||||
cpu = shell.cmd("query-cpu-model-expansion",
|
||||
{ "type": "static",
|
||||
"model": { "name": name }})
|
||||
|
||||
got = {}
|
||||
for (feature, present) in cpu["return"]["model"]["props"].items():
|
||||
if present and feature not in skip:
|
||||
got[feature] = True
|
||||
|
||||
if name in ["host", "max", "base"]:
|
||||
continue
|
||||
|
||||
models[name] = {
|
||||
# Dict of all present features in this CPU model
|
||||
"features": got,
|
||||
|
||||
# Whether each x86-64 ABI level is satisfied
|
||||
"levels": [False, False, False, False],
|
||||
|
||||
# Number of extra CPUID features compared to the x86-64 ABI level
|
||||
"distance":[-1, -1, -1, -1],
|
||||
|
||||
# CPUID features present in model, but not in ABI level
|
||||
"delta":[[], [], [], []],
|
||||
|
||||
# CPUID features in ABI level but not present in model
|
||||
"missing": [[], [], [], []],
|
||||
}
|
||||
|
||||
|
||||
# Calculate whether the CPU models satisfy each ABI level
|
||||
for name in models.keys():
|
||||
for level in range(len(levels)):
|
||||
got = set(models[name]["features"])
|
||||
want = set(levels[level])
|
||||
missing = want - got
|
||||
match = True
|
||||
if len(missing) > 0:
|
||||
match = False
|
||||
models[name]["levels"][level] = match
|
||||
models[name]["missing"][level] = missing
|
||||
|
||||
# Cache list of CPU models satisfying each ABI level
|
||||
abi_models = [
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
]
|
||||
|
||||
for name in models.keys():
|
||||
for level in range(len(levels)):
|
||||
if models[name]["levels"][level]:
|
||||
abi_models[level].append(name)
|
||||
|
||||
|
||||
for level in range(len(abi_models)):
|
||||
# Find the union of features in all CPU models satisfying this ABI
|
||||
allfeatures = {}
|
||||
for name in abi_models[level]:
|
||||
for feat in models[name]["features"]:
|
||||
allfeatures[feat] = True
|
||||
|
||||
# Find the intersection of features in all CPU models satisfying this ABI
|
||||
commonfeatures = []
|
||||
for feat in allfeatures:
|
||||
present = True
|
||||
for name in models.keys():
|
||||
if not models[name]["levels"][level]:
|
||||
continue
|
||||
if feat not in models[name]["features"]:
|
||||
present = False
|
||||
if present:
|
||||
commonfeatures.append(feat)
|
||||
|
||||
# Determine how many extra features are present compared to the lowest
|
||||
# common denominator
|
||||
for name in models.keys():
|
||||
if not models[name]["levels"][level]:
|
||||
continue
|
||||
|
||||
delta = set(models[name]["features"].keys()) - set(commonfeatures)
|
||||
models[name]["distance"][level] = len(delta)
|
||||
models[name]["delta"][level] = delta
|
||||
|
||||
def print_uarch_abi_csv():
|
||||
print("# Automatically generated from '%s'" % __file__)
|
||||
print("Model,baseline,v2,v3,v4")
|
||||
for name in models.keys():
|
||||
print(name, end="")
|
||||
for level in range(len(levels)):
|
||||
if models[name]["levels"][level]:
|
||||
print(",✅", end="")
|
||||
else:
|
||||
print(",", end="")
|
||||
print()
|
||||
|
||||
print_uarch_abi_csv()
|
Loading…
Add table
Add a link
Reference in a new issue