cpu-gather: Move simple model extraction to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Tim Wiederhake 2020-12-15 17:24:57 +01:00 committed by Michal Privoznik
parent afbb7af3ca
commit 92a989b9d4
2 changed files with 60 additions and 13 deletions

View File

@ -115,6 +115,63 @@ def gather_static_model(args):
return None
def gather_full_model(args, static_model):
if static_model:
return []
else:
return call_qemu(args.path_to_qemu, [
{
"execute": "qom-get",
"arguments":
{
"path": "/machine/unattached/device[0]",
"property": "feature-words"
},
"id": "feature-words"
},
{
"execute": "qom-get",
"arguments":
{
"path": "/machine/unattached/device[0]",
"property": "family"
},
"id": "family"
},
{
"execute": "qom-get",
"arguments":
{
"path": "/machine/unattached/device[0]",
"property": "model"
},
"id": "model"
},
{
"execute": "qom-get",
"arguments":
{
"path": "/machine/unattached/device[0]",
"property": "stepping"
},
"id": "stepping"
},
{
"execute": "qom-get",
"arguments":
{
"path": "/machine/unattached/device[0]",
"property": "model-id"
},
"id": "model-id"
},
{
"execute": "query-cpu-definitions",
"id": "definitions"
}
])
def main():
parser = argparse.ArgumentParser(description="Gather cpu test data")
parser.add_argument(
@ -161,6 +218,9 @@ def main():
print(" 0x{:x}: 0x{:016x}\n".format(int(key), value))
static_model = gather_static_model(args)
model = gather_full_model(args, static_model)
for o in model:
print(json.dumps(o))
print(end="", flush=True)
os.environ["CPU_GATHER_PY"] = "true"

View File

@ -5,13 +5,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then
exit 1
fi
qom_get()
{
path='/machine/unattached/device[0]'
echo '{"execute":"qom-get","arguments":{"path":"'$path'",' \
'"property":"'$1'"},"id":"'$1'"}'
}
model_expansion()
{
mode=$1
@ -26,12 +19,6 @@ $qemu -machine accel=kvm -cpu host -nodefaults -nographic -qmp stdio <<EOF
$(
if [ "x$model" != x ]; then
model_expansion full "$model"
else
qom_get feature-words
qom_get family
qom_get model
qom_get stepping
qom_get model-id
fi
)
{"execute":"query-cpu-definitions","id":"definitions"}