On Mon, Jun 07, 2021 at 02:58:42PM +0100, Daniel P. Berrangé wrote: > This script is what is used to generate the docs data table in: > > docs/system/cpu-models-x86-abi.csv > > It can be useful to run if adding new CPU models / versions and > the csv needs updating. > > Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> > --- > scripts/cpu-x86-uarch-abi.py | 194 +++++++++++++++++++++++++++++++++++ > 1 file changed, 194 insertions(+) > create mode 100644 scripts/cpu-x86-uarch-abi.py
Sorry I messed up just before sending this when I deleted some code and incorrectly fixed up argv handling. Since you mentioned you've queued it, it needs two changes > > diff --git a/scripts/cpu-x86-uarch-abi.py b/scripts/cpu-x86-uarch-abi.py > new file mode 100644 > index 0000000000..08acc52a81 > --- /dev/null > +++ b/scripts/cpu-x86-uarch-abi.py > @@ -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: s/1/2/ > + 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] Delete this line since sys.argv[2] is not required > +shell = qmp.QEMUMonitorProtocol(sock) > +shell.connect() > + > +models = shell.cmd("query-cpu-definitions") Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|