Skip to content

Instantly share code, notes, and snippets.


Eduardo Habkost ehabkost

View GitHub Profile
ehabkost / alltypes.tsv
Last active Dec 9, 2020
QOM type declaration parsing and conversion
View alltypes.tsv
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 14 columns, instead of 1. in line 8.
filename variable_name name parent abstract interfaces instance_size instance_init instance_post_init instance_finalize class_size class_init class_base_init class_data
accel/accel.c accel_type TYPE_ACCEL TYPE_OBJECT sizeof(AccelState) sizeof(AccelClass)
accel/kvm/kvm-all.c kvm_accel_type TYPE_KVM_ACCEL TYPE_ACCEL sizeof(KVMState) kvm_accel_instance_init kvm_accel_class_init
accel/qtest.c qtest_accel_type TYPE_QTEST_ACCEL TYPE_ACCEL qtest_accel_class_init
accel/tcg/tcg-all.c tcg_accel_type TYPE_TCG_ACCEL TYPE_ACCEL sizeof(TCGState) tcg_accel_instance_init tcg_accel_class_init
accel/xen/xen-all.c xen_accel_type TYPE_XEN_ACCEL TYPE_ACCEL xen_accel_class_init
authz/base.c authz_info TYPE_QAUTHZ TYPE_OBJECT true sizeof(QAuthZ) sizeof(QAuthZClass)
authz/list.c qauthz_list_info TYPE_QAUTHZ_LIST TYPE_QAUTHZ (InterfaceInfo[]) { { TYPE_USER_CREATABLE }, { } } sizeof(QAuthZList) qauthz_list_finalize sizeof(QAuthZListClass) qauthz_list_class_init
View reverse_fprintf.c
/* Copyright (C) 2019 Red Hat Inc.
* Authors:
* Eduardo Habkost <>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
ehabkost / 2to3 selected output.txt
Created May 11, 2018
2to3 output on QEMU source tree
View 2to3 selected output.txt
So, most of the 2to3 fixes give false positives, but some fixers give some useful pointers:
'2to3 -f print' gives us this:
scripts/ [*]
scripts/ [*]
Raw commands that generated some of the files:
(qemu-qmp is at:
for d in *-softmmu/;do ../../scripts/qemu-qmp $b/qemu-system-* -machine none -display none -- qom-list-types > $d/qom-types.json;done
for d in *-softmmu/;do ../../scripts/qemu-qmp $d/qemu-system-* -machine none -display none -- qom-list-types > $d/qom-types.json;done
for d in *-softmmu;do (echo '{"execute":"qmp_capabilities"}';jq -c '.return[] | { execute: "query-device-type", arguments: { typename: .name } }' < $d/qom-types.json; echo '{"execute":"quit"}'; ) | $d/qemu-system-* -display none -qmp stdio;done
for d in *-softmmu;do (echo '{"execute":"qmp_capabilities"}';jq -c '.return[] | { execute: "query-device-type", arguments: { typename: .name } }' < $d/qom-types.json; echo '{"execute":"quit"}'; ) | $d/qemu-system-* -machine none -S -display none -qmp stdio;done
View qemu-2.8.0-compat-checker-output.json
"request": [
"result": {
"os-release": "NAME=Fedora\nVERSION=\"24 (Workstation Edition)\"\nID=fedora\nVERSION_ID=24\nPRETTY_NAME=\"Fedora 24 (Workstation Edition)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:24\"\nHOME_URL=\"\"\nBUG_REPORT_URL=\"\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=24\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=24\nPRIVACY_POLICY_URL=\nVARIANT=\"Workstation Edition\"\nVARIANT_ID=workstation\n",
"rpm-qf": "file /home/ehabkost/rh/proj/virt/qemu/v2.8.0-build/x86_64-softmmu/qemu-system-x86_64 is not owned by any package\n",
"help": "QEMU emulator version 2.8.0 (v2.9.0-rc1-83-g9caf9e64d6-dirty)\nCopyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers\n"
View crashes.txt
# This is an automatically-generated collection of command-lines that could crash QEMU
# It was generated by the script at:
# Using QEMU built from commit 940a8ce075e3408742a4edcabfd6c2a15e2539eb
# "exit code: -6" means abort()
# "exit code: -11" means Segmentation fault
ERROR: failed: machine=n810 binary=./aarch64-softmmu/qemu-system-aarch64 device=ast2400-a1 accel=tcg
View msrs.c
#include <stdio.h>
#define HV_X64_MSR_CRASH_CTL 0x40000105
#define MAX_MCG_BANKS 32 /* The limit in the Linux kernel */
#define MCE_BANKS_DEF 10 /* The default */
/* Macros copied from other files: */
import re, sys
fieldre = re.compile(r'^ *\.([a-z0-9_]+) *= *(.*?),? *([^,]*?)\n', re.M)
def fixmachine(m):
print >>sys.stderr,"whole: %r" % (
name =
if name.endswith('_machine'):
name = name[:-len('_machine')]
fields =
print >>sys.stderr,"fields: %r" % (fields)
ehabkost / gist:8716439
Created Jan 30, 2014
CPU model probing through QMP
View gist:8716439
You can run it as:
$ qemu-system-x86_64 -enable-kvm -machine none -monitor stdio -qmp unix:/tmp/qmp,server,nowait -nographic
$ ./scripts/qmp/qmp-shell /tmp/qmp
ehabkost / failing config file
Created Feb 14, 2013
Config file where "nokvm" variants are all skipped
View failing config file
- unknown_qemu:
- rhel64:
- qemu13:
only unknown_qemu
- cpu.unset:
- cpu.set:
- 486: