Skip to content

Instantly share code, notes, and snippets.

View ehabkost's full-sized avatar

Eduardo Habkost ehabkost

View GitHub Profile
@ehabkost
ehabkost / alltypes.tsv
Last active December 9, 2020 06:02
QOM type declaration parsing and conversion
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
au
/* Copyright (C) 2019 Red Hat Inc.
*
* Authors:
* Eduardo Habkost <ehabkost@redhat.com>
*
* 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
ehabkost / 2to3 selected output.txt
Created May 11, 2018 18:20
2to3 output on QEMU source tree
So, most of the 2to3 fixes give false positives, but some fixers give some useful pointers:
'2to3 -f print' gives us this:
scripts/analyse-9p-simpletrace.py
scripts/analyse-locks-simpletrace.py [*]
scripts/analyze-migration.py
scripts/device-crash-test
scripts/dump-guest-memory.py [*]
scripts/kvm/kvm_flightrecorder
Raw commands that generated some of the files:
(qemu-qmp is at:
https://github.com/ehabkost/misc-build-scripts/blob/master/qemu-qmp
)
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
[
{
"request": [
"version"
],
"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=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=24\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=24\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\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"
}
# This is an automatically-generated collection of command-lines that could crash QEMU
#
# It was generated by the script at:
# https://github.com/ehabkost/qemu-hacks/blob/work/device-crash-script/scripts/device-crash-test.py
#
# 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
@ehabkost
ehabkost / msrs.c
Last active December 16, 2015 15:27
#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 */
#define MCG_BANKS MAX_MCG_BANKS
/* Macros copied from other files: */
#define MAX_FIXED_COUNTERS 3
import re, sys
fieldre = re.compile(r'^ *\.([a-z0-9_]+) *= *(.*?),? *([^,]*?)\n', re.M)
def fixmachine(m):
print >>sys.stderr,"whole: %r" % (m.group(0))
name = m.group(2)
if name.endswith('_machine'):
name = name[:-len('_machine')]
fields = m.group(4)
print >>sys.stderr,"fields: %r" % (fields)
@ehabkost
ehabkost / gist:8716439
Created January 30, 2014 19:07
CPU model probing through QMP
https://github.com/ehabkost/qemu/tree/work/cpu-model-classes
You can run it as:
$ qemu-system-x86_64 -enable-kvm -machine none -monitor stdio -qmp unix:/tmp/qmp,server,nowait -nographic
Then:
$ ./scripts/qmp/qmp-shell /tmp/qmp
[...]
@ehabkost
ehabkost / failing config file
Created February 14, 2013 18:43
Config file where "nokvm" variants are all skipped
variants:
- unknown_qemu:
- rhel64:
- qemu13:
only unknown_qemu
variants:
- cpu.unset:
- cpu.set:
variants:
- 486: