aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl3
-rw-r--r--scripts/qapi/commands.py18
-rw-r--r--scripts/qapi/common.py15
-rw-r--r--scripts/qapi/doc.py9
-rw-r--r--scripts/qapi/introspect.py83
-rwxr-xr-xscripts/qemu-binfmt-conf.sh37
-rwxr-xr-xscripts/replay-dump.py308
-rwxr-xr-xscripts/update-linux-headers.sh10
8 files changed, 418 insertions, 65 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d1fe79bcc4..57daae05ea 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1447,9 +1447,10 @@ sub process {
# check we are in a valid source file if not then ignore this hunk
next if ($realfile !~ /$SrcFile/);
-#90 column limit
+#90 column limit; exempt URLs, if no other words on line
if ($line =~ /^\+/ &&
!($line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) &&
+ !($rawline =~ /^[^[:alnum:]]*https?:\S*$/) &&
$length > 80)
{
if ($length > 90) {
diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py
index 21a7e0dbe6..0c5da3a54d 100644
--- a/scripts/qapi/commands.py
+++ b/scripts/qapi/commands.py
@@ -193,10 +193,18 @@ out:
return ret
-def gen_register_command(name, success_response):
- options = 'QCO_NO_OPTIONS'
+def gen_register_command(name, success_response, allow_oob):
+ options = []
+
if not success_response:
- options = 'QCO_NO_SUCCESS_RESP'
+ options += ['QCO_NO_SUCCESS_RESP']
+ if allow_oob:
+ options += ['QCO_ALLOW_OOB']
+
+ if not options:
+ options = ['QCO_NO_OPTIONS']
+
+ options = " | ".join(options)
ret = mcgen('''
qmp_register_command(cmds, "%(name)s",
@@ -268,7 +276,7 @@ void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds);
genc.add(gen_registry(self._regy, self._prefix))
def visit_command(self, name, info, arg_type, ret_type,
- gen, success_response, boxed):
+ gen, success_response, boxed, allow_oob):
if not gen:
return
self._genh.add(gen_command_decl(name, arg_type, boxed, ret_type))
@@ -277,7 +285,7 @@ void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds);
self._genc.add(gen_marshal_output(ret_type))
self._genh.add(gen_marshal_decl(name))
self._genc.add(gen_marshal(name, arg_type, boxed, ret_type))
- self._regy += gen_register_command(name, success_response)
+ self._regy += gen_register_command(name, success_response, allow_oob)
def gen_commands(schema, output_dir, prefix):
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index 97e9060b67..2c05e3c284 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -921,7 +921,8 @@ def check_exprs(exprs):
elif 'command' in expr:
meta = 'command'
check_keys(expr_elem, 'command', [],
- ['data', 'returns', 'gen', 'success-response', 'boxed'])
+ ['data', 'returns', 'gen', 'success-response',
+ 'boxed', 'allow-oob'])
elif 'event' in expr:
meta = 'event'
check_keys(expr_elem, 'event', [], ['data', 'boxed'])
@@ -1044,7 +1045,7 @@ class QAPISchemaVisitor(object):
pass
def visit_command(self, name, info, arg_type, ret_type,
- gen, success_response, boxed):
+ gen, success_response, boxed, allow_oob):
pass
def visit_event(self, name, info, arg_type, boxed):
@@ -1421,7 +1422,7 @@ class QAPISchemaAlternateType(QAPISchemaType):
class QAPISchemaCommand(QAPISchemaEntity):
def __init__(self, name, info, doc, arg_type, ret_type,
- gen, success_response, boxed):
+ gen, success_response, boxed, allow_oob):
QAPISchemaEntity.__init__(self, name, info, doc)
assert not arg_type or isinstance(arg_type, str)
assert not ret_type or isinstance(ret_type, str)
@@ -1432,6 +1433,7 @@ class QAPISchemaCommand(QAPISchemaEntity):
self.gen = gen
self.success_response = success_response
self.boxed = boxed
+ self.allow_oob = allow_oob
def check(self, schema):
if self._arg_type_name:
@@ -1455,7 +1457,8 @@ class QAPISchemaCommand(QAPISchemaEntity):
def visit(self, visitor):
visitor.visit_command(self.name, self.info,
self.arg_type, self.ret_type,
- self.gen, self.success_response, self.boxed)
+ self.gen, self.success_response,
+ self.boxed, self.allow_oob)
class QAPISchemaEvent(QAPISchemaEntity):
@@ -1674,6 +1677,7 @@ class QAPISchema(object):
gen = expr.get('gen', True)
success_response = expr.get('success-response', True)
boxed = expr.get('boxed', False)
+ allow_oob = expr.get('allow-oob', False)
if isinstance(data, OrderedDict):
data = self._make_implicit_object_type(
name, info, doc, 'arg', self._make_members(data, info))
@@ -1681,7 +1685,8 @@ class QAPISchema(object):
assert len(rets) == 1
rets = self._make_array_type(rets[0], info)
self._def_entity(QAPISchemaCommand(name, info, doc, data, rets,
- gen, success_response, boxed))
+ gen, success_response,
+ boxed, allow_oob))
def _def_event(self, expr, info, doc):
name = expr['event']
diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py
index 0ea68bf813..9b312b2c51 100644
--- a/scripts/qapi/doc.py
+++ b/scripts/qapi/doc.py
@@ -134,10 +134,9 @@ def texi_enum_value(value):
def texi_member(member, suffix=''):
"""Format a table of members item for an object type member"""
typ = member.type.doc_type()
- return '@item @code{%s%s%s}%s%s\n' % (
- member.name,
- ': ' if typ else '',
- typ if typ else '',
+ membertype = ': ' + typ if typ else ''
+ return '@item @code{%s%s}%s%s\n' % (
+ member.name, membertype,
' (optional)' if member.optional else '',
suffix)
@@ -228,7 +227,7 @@ class QAPISchemaGenDocVisitor(qapi.common.QAPISchemaVisitor):
body=texi_entity(doc, 'Members')))
def visit_command(self, name, info, arg_type, ret_type,
- gen, success_response, boxed):
+ gen, success_response, boxed, allow_oob):
doc = self.cur_doc
if boxed:
body = texi_body(doc)
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index f66c397fb0..f9e67e8227 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -13,26 +13,38 @@ See the COPYING file in the top-level directory.
from qapi.common import *
-# Caveman's json.dumps() replacement (we're stuck at Python 2.4)
-# TODO try to use json.dumps() once we get unstuck
-def to_json(obj, level=0):
+def to_qlit(obj, level=0, suppress_first_indent=False):
+
+ def indent(level):
+ return level * 4 * ' '
+
+ ret = ''
+ if not suppress_first_indent:
+ ret += indent(level)
if obj is None:
- ret = 'null'
+ ret += 'QLIT_QNULL'
elif isinstance(obj, str):
- ret = '"' + obj.replace('"', r'\"') + '"'
+ ret += 'QLIT_QSTR(' + to_c_string(obj) + ')'
elif isinstance(obj, list):
- elts = [to_json(elt, level + 1)
+ elts = [to_qlit(elt, level + 1)
for elt in obj]
- ret = '[' + ', '.join(elts) + ']'
+ elts.append(indent(level + 1) + "{}")
+ ret += 'QLIT_QLIST(((QLitObject[]) {\n'
+ ret += ',\n'.join(elts) + '\n'
+ ret += indent(level) + '}))'
elif isinstance(obj, dict):
- elts = ['"%s": %s' % (key.replace('"', r'\"'),
- to_json(obj[key], level + 1))
- for key in sorted(obj.keys())]
- ret = '{' + ', '.join(elts) + '}'
+ elts = []
+ for key, value in sorted(obj.items()):
+ elts.append(indent(level + 1) + '{ %s, %s }' %
+ (to_c_string(key), to_qlit(value, level + 1, True)))
+ elts.append(indent(level + 1) + '{}')
+ ret += 'QLIT_QDICT(((QLitDictEntry[]) {\n'
+ ret += ',\n'.join(elts) + '\n'
+ ret += indent(level) + '}))'
+ elif isinstance(obj, bool):
+ ret += 'QLIT_QBOOL(%s)' % ('true' if obj else 'false')
else:
assert False # not implemented
- if level == 1:
- ret = '\n' + ret
return ret
@@ -48,7 +60,7 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor):
' * QAPI/QMP schema introspection', __doc__)
self._unmask = unmask
self._schema = None
- self._jsons = []
+ self._qlits = []
self._used_types = []
self._name_map = {}
self._genc.add(mcgen('''
@@ -63,27 +75,27 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor):
def visit_end(self):
# visit the types that are actually used
- jsons = self._jsons
- self._jsons = []
+ qlits = self._qlits
+ self._qlits = []
for typ in self._used_types:
typ.visit(self)
# generate C
# TODO can generate awfully long lines
- jsons.extend(self._jsons)
- name = c_name(self._prefix, protect=False) + 'qmp_schema_json'
+ qlits.extend(self._qlits)
+ name = c_name(self._prefix, protect=False) + 'qmp_schema_qlit'
self._genh.add(mcgen('''
-extern const char %(c_name)s[];
+#include "qapi/qmp/qlit.h"
+
+extern const QLitObject %(c_name)s;
''',
c_name=c_name(name)))
- lines = to_json(jsons).split('\n')
- c_string = '\n '.join([to_c_string(line) for line in lines])
self._genc.add(mcgen('''
-const char %(c_name)s[] = %(c_string)s;
+const QLitObject %(c_name)s = %(c_string)s;
''',
c_name=c_name(name),
- c_string=c_string))
+ c_string=to_qlit(qlits)))
self._schema = None
- self._jsons = []
+ self._qlits = []
self._used_types = []
self._name_map = {}
@@ -117,12 +129,12 @@ const char %(c_name)s[] = %(c_string)s;
return '[' + self._use_type(typ.element_type) + ']'
return self._name(typ.name)
- def _gen_json(self, name, mtype, obj):
+ def _gen_qlit(self, name, mtype, obj):
if mtype not in ('command', 'event', 'builtin', 'array'):
name = self._name(name)
obj['name'] = name
obj['meta-type'] = mtype
- self._jsons.append(obj)
+ self._qlits.append(obj)
def _gen_member(self, member):
ret = {'name': member.name, 'type': self._use_type(member.type)}
@@ -138,38 +150,39 @@ const char %(c_name)s[] = %(c_string)s;
return {'case': variant.name, 'type': self._use_type(variant.type)}
def visit_builtin_type(self, name, info, json_type):
- self._gen_json(name, 'builtin', {'json-type': json_type})
+ self._gen_qlit(name, 'builtin', {'json-type': json_type})
def visit_enum_type(self, name, info, values, prefix):
- self._gen_json(name, 'enum', {'values': values})
+ self._gen_qlit(name, 'enum', {'values': values})
def visit_array_type(self, name, info, element_type):
element = self._use_type(element_type)
- self._gen_json('[' + element + ']', 'array', {'element-type': element})
+ self._gen_qlit('[' + element + ']', 'array', {'element-type': element})
def visit_object_type_flat(self, name, info, members, variants):
obj = {'members': [self._gen_member(m) for m in members]}
if variants:
obj.update(self._gen_variants(variants.tag_member.name,
variants.variants))
- self._gen_json(name, 'object', obj)
+ self._gen_qlit(name, 'object', obj)
def visit_alternate_type(self, name, info, variants):
- self._gen_json(name, 'alternate',
+ self._gen_qlit(name, 'alternate',
{'members': [{'type': self._use_type(m.type)}
for m in variants.variants]})
def visit_command(self, name, info, arg_type, ret_type,
- gen, success_response, boxed):
+ gen, success_response, boxed, allow_oob):
arg_type = arg_type or self._schema.the_empty_object_type
ret_type = ret_type or self._schema.the_empty_object_type
- self._gen_json(name, 'command',
+ self._gen_qlit(name, 'command',
{'arg-type': self._use_type(arg_type),
- 'ret-type': self._use_type(ret_type)})
+ 'ret-type': self._use_type(ret_type),
+ 'allow-oob': allow_oob})
def visit_event(self, name, info, arg_type, boxed):
arg_type = arg_type or self._schema.the_empty_object_type
- self._gen_json(name, 'event', {'arg-type': self._use_type(arg_type)})
+ self._gen_qlit(name, 'event', {'arg-type': self._use_type(arg_type)})
def gen_introspect(schema, output_dir, prefix, opt_unmask):
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index bdb21bdd58..f39ad344fc 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -1,10 +1,10 @@
#!/bin/sh
-# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390/HPPA
+# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390/HPPA/Xtensa
# program execution by the kernel
qemu_target_list="i386 i486 alpha arm armeb sparc32plus ppc ppc64 ppc64le m68k \
mips mipsel mipsn32 mipsn32el mips64 mips64el \
-sh4 sh4eb s390x aarch64 aarch64_be hppa riscv32 riscv64"
+sh4 sh4eb s390x aarch64 aarch64_be hppa riscv32 riscv64 xtensa xtensaeb"
i386_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00'
i386_mask='\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
@@ -108,6 +108,14 @@ riscv64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
riscv64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
riscv64_family=riscv
+xtensa_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e\x00'
+xtensa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
+xtensa_family=xtensa
+
+xtensaeb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e'
+xtensaeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
+xtensaeb_family=xtensaeb
+
qemu_get_family() {
cpu=${HOST_ARCH:-$(uname -m)}
case "$cpu" in
@@ -154,7 +162,8 @@ Usage: qemu-binfmt-conf.sh [--qemu-path PATH][--debian][--systemd CPU]
instead generate update-binfmts templates
--systemd: don't write into /proc,
instead generate file for systemd-binfmt.service
- for the given CPU
+ for the given CPU. If CPU is "ALL", generate a
+ file for all known cpus
--exportdir: define where to write configuration files
(default: $SYSTEMDDIR or $DEBIANDIR)
--credential: if yes, credential and security tokens are
@@ -301,18 +310,20 @@ while true ; do
EXPORTDIR=${EXPORTDIR:-$SYSTEMDDIR}
shift
# check given cpu is in the supported CPU list
- for cpu in ${qemu_target_list} ; do
+ if [ "$1" != "ALL" ] ; then
+ for cpu in ${qemu_target_list} ; do
+ if [ "$cpu" = "$1" ] ; then
+ break
+ fi
+ done
+
if [ "$cpu" = "$1" ] ; then
- break
+ qemu_target_list="$1"
+ else
+ echo "ERROR: unknown CPU \"$1\"" 1>&2
+ usage
+ exit 1
fi
- done
-
- if [ "$cpu" = "$1" ] ; then
- qemu_target_list="$1"
- else
- echo "ERROR: unknown CPU \"$1\"" 1>&2
- usage
- exit 1
fi
;;
-Q|--qemu-path)
diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py
new file mode 100755
index 0000000000..e274086277
--- /dev/null
+++ b/scripts/replay-dump.py
@@ -0,0 +1,308 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Dump the contents of a recorded execution stream
+#
+# Copyright (c) 2017 Alex Bennée <alex.bennee@linaro.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
+import argparse
+import struct
+from collections import namedtuple
+
+# This mirrors some of the global replay state which some of the
+# stream loading refers to. Some decoders may read the next event so
+# we need handle that case. Calling reuse_event will ensure the next
+# event is read from the cache rather than advancing the file.
+
+class ReplayState(object):
+ def __init__(self):
+ self.event = -1
+ self.event_count = 0
+ self.already_read = False
+ self.current_checkpoint = 0
+ self.checkpoint = 0
+
+ def set_event(self, ev):
+ self.event = ev
+ self.event_count += 1
+
+ def get_event(self):
+ self.already_read = False
+ return self.event
+
+ def reuse_event(self, ev):
+ self.event = ev
+ self.already_read = True
+
+ def set_checkpoint(self):
+ self.checkpoint = self.event - self.checkpoint_start
+
+ def get_checkpoint(self):
+ return self.checkpoint
+
+replay_state = ReplayState()
+
+# Simple read functions that mirror replay-internal.c
+# The file-stream is big-endian and manually written out a byte at a time.
+
+def read_byte(fin):
+ "Read a single byte"
+ return struct.unpack('>B', fin.read(1))[0]
+
+def read_event(fin):
+ "Read a single byte event, but save some state"
+ if replay_state.already_read:
+ return replay_state.get_event()
+ else:
+ replay_state.set_event(read_byte(fin))
+ return replay_state.event
+
+def read_word(fin):
+ "Read a 16 bit word"
+ return struct.unpack('>H', fin.read(2))[0]
+
+def read_dword(fin):
+ "Read a 32 bit word"
+ return struct.unpack('>I', fin.read(4))[0]
+
+def read_qword(fin):
+ "Read a 64 bit word"
+ return struct.unpack('>Q', fin.read(8))[0]
+
+# Generic decoder structure
+Decoder = namedtuple("Decoder", "eid name fn")
+
+def call_decode(table, index, dumpfile):
+ "Search decode table for next step"
+ decoder = next((d for d in table if d.eid == index), None)
+ if not decoder:
+ print "Could not decode index: %d" % (index)
+ print "Entry is: %s" % (decoder)
+ print "Decode Table is:\n%s" % (table)
+ return False
+ else:
+ return decoder.fn(decoder.eid, decoder.name, dumpfile)
+
+# Print event
+def print_event(eid, name, string=None, event_count=None):
+ "Print event with count"
+ if not event_count:
+ event_count = replay_state.event_count
+
+ if string:
+ print "%d:%s(%d) %s" % (event_count, name, eid, string)
+ else:
+ print "%d:%s(%d)" % (event_count, name, eid)
+
+
+# Decoders for each event type
+
+def decode_unimp(eid, name, _unused_dumpfile):
+ "Unimplimented decoder, will trigger exit"
+ print "%s not handled - will now stop" % (name)
+ return False
+
+# Checkpoint decoder
+def swallow_async_qword(eid, name, dumpfile):
+ "Swallow a qword of data without looking at it"
+ step_id = read_qword(dumpfile)
+ print " %s(%d) @ %d" % (name, eid, step_id)
+ return True
+
+async_decode_table = [ Decoder(0, "REPLAY_ASYNC_EVENT_BH", swallow_async_qword),
+ Decoder(1, "REPLAY_ASYNC_INPUT", decode_unimp),
+ Decoder(2, "REPLAY_ASYNC_INPUT_SYNC", decode_unimp),
+ Decoder(3, "REPLAY_ASYNC_CHAR_READ", decode_unimp),
+ Decoder(4, "REPLAY_ASYNC_EVENT_BLOCK", decode_unimp),
+ Decoder(5, "REPLAY_ASYNC_EVENT_NET", decode_unimp),
+]
+# See replay_read_events/replay_read_event
+def decode_async(eid, name, dumpfile):
+ """Decode an ASYNC event"""
+
+ print_event(eid, name)
+
+ async_event_kind = read_byte(dumpfile)
+ async_event_checkpoint = read_byte(dumpfile)
+
+ if async_event_checkpoint != replay_state.current_checkpoint:
+ print " mismatch between checkpoint %d and async data %d" % (
+ replay_state.current_checkpoint, async_event_checkpoint)
+ return True
+
+ return call_decode(async_decode_table, async_event_kind, dumpfile)
+
+
+def decode_instruction(eid, name, dumpfile):
+ ins_diff = read_dword(dumpfile)
+ print_event(eid, name, "0x%x" % (ins_diff))
+ return True
+
+def decode_audio_out(eid, name, dumpfile):
+ audio_data = read_dword(dumpfile)
+ print_event(eid, name, "%d" % (audio_data))
+ return True
+
+def decode_checkpoint(eid, name, dumpfile):
+ """Decode a checkpoint.
+
+ Checkpoints contain a series of async events with their own specific data.
+ """
+ replay_state.set_checkpoint()
+ # save event count as we peek ahead
+ event_number = replay_state.event_count
+ next_event = read_event(dumpfile)
+
+ # if the next event is EVENT_ASYNC there are a bunch of
+ # async events to read, otherwise we are done
+ if next_event != 3:
+ print_event(eid, name, "no additional data", event_number)
+ else:
+ print_event(eid, name, "more data follows", event_number)
+
+ replay_state.reuse_event(next_event)
+ return True
+
+def decode_checkpoint_init(eid, name, dumpfile):
+ print_event(eid, name)
+ return True
+
+def decode_interrupt(eid, name, dumpfile):
+ print_event(eid, name)
+ return True
+
+def decode_clock(eid, name, dumpfile):
+ clock_data = read_qword(dumpfile)
+ print_event(eid, name, "0x%x" % (clock_data))
+ return True
+
+
+# pre-MTTCG merge
+v5_event_table = [Decoder(0, "EVENT_INSTRUCTION", decode_instruction),
+ Decoder(1, "EVENT_INTERRUPT", decode_interrupt),
+ Decoder(2, "EVENT_EXCEPTION", decode_unimp),
+ Decoder(3, "EVENT_ASYNC", decode_async),
+ Decoder(4, "EVENT_SHUTDOWN", decode_unimp),
+ Decoder(5, "EVENT_CHAR_WRITE", decode_unimp),
+ Decoder(6, "EVENT_CHAR_READ_ALL", decode_unimp),
+ Decoder(7, "EVENT_CHAR_READ_ALL_ERROR", decode_unimp),
+ Decoder(8, "EVENT_CLOCK_HOST", decode_clock),
+ Decoder(9, "EVENT_CLOCK_VIRTUAL_RT", decode_clock),
+ Decoder(10, "EVENT_CP_CLOCK_WARP_START", decode_checkpoint),
+ Decoder(11, "EVENT_CP_CLOCK_WARP_ACCOUNT", decode_checkpoint),
+ Decoder(12, "EVENT_CP_RESET_REQUESTED", decode_checkpoint),
+ Decoder(13, "EVENT_CP_SUSPEND_REQUESTED", decode_checkpoint),
+ Decoder(14, "EVENT_CP_CLOCK_VIRTUAL", decode_checkpoint),
+ Decoder(15, "EVENT_CP_CLOCK_HOST", decode_checkpoint),
+ Decoder(16, "EVENT_CP_CLOCK_VIRTUAL_RT", decode_checkpoint),
+ Decoder(17, "EVENT_CP_INIT", decode_checkpoint_init),
+ Decoder(18, "EVENT_CP_RESET", decode_checkpoint),
+]
+
+# post-MTTCG merge, AUDIO support added
+v6_event_table = [Decoder(0, "EVENT_INSTRUCTION", decode_instruction),
+ Decoder(1, "EVENT_INTERRUPT", decode_interrupt),
+ Decoder(2, "EVENT_EXCEPTION", decode_unimp),
+ Decoder(3, "EVENT_ASYNC", decode_async),
+ Decoder(4, "EVENT_SHUTDOWN", decode_unimp),
+ Decoder(5, "EVENT_CHAR_WRITE", decode_unimp),
+ Decoder(6, "EVENT_CHAR_READ_ALL", decode_unimp),
+ Decoder(7, "EVENT_CHAR_READ_ALL_ERROR", decode_unimp),
+ Decoder(8, "EVENT_AUDIO_OUT", decode_audio_out),
+ Decoder(9, "EVENT_AUDIO_IN", decode_unimp),
+ Decoder(10, "EVENT_CLOCK_HOST", decode_clock),
+ Decoder(11, "EVENT_CLOCK_VIRTUAL_RT", decode_clock),
+ Decoder(12, "EVENT_CP_CLOCK_WARP_START", decode_checkpoint),
+ Decoder(13, "EVENT_CP_CLOCK_WARP_ACCOUNT", decode_checkpoint),
+ Decoder(14, "EVENT_CP_RESET_REQUESTED", decode_checkpoint),
+ Decoder(15, "EVENT_CP_SUSPEND_REQUESTED", decode_checkpoint),
+ Decoder(16, "EVENT_CP_CLOCK_VIRTUAL", decode_checkpoint),
+ Decoder(17, "EVENT_CP_CLOCK_HOST", decode_checkpoint),
+ Decoder(18, "EVENT_CP_CLOCK_VIRTUAL_RT", decode_checkpoint),
+ Decoder(19, "EVENT_CP_INIT", decode_checkpoint_init),
+ Decoder(20, "EVENT_CP_RESET", decode_checkpoint),
+]
+
+# Shutdown cause added
+v7_event_table = [Decoder(0, "EVENT_INSTRUCTION", decode_instruction),
+ Decoder(1, "EVENT_INTERRUPT", decode_interrupt),
+ Decoder(2, "EVENT_EXCEPTION", decode_unimp),
+ Decoder(3, "EVENT_ASYNC", decode_async),
+ Decoder(4, "EVENT_SHUTDOWN", decode_unimp),
+ Decoder(5, "EVENT_SHUTDOWN_HOST_ERR", decode_unimp),
+ Decoder(6, "EVENT_SHUTDOWN_HOST_QMP", decode_unimp),
+ Decoder(7, "EVENT_SHUTDOWN_HOST_SIGNAL", decode_unimp),
+ Decoder(8, "EVENT_SHUTDOWN_HOST_UI", decode_unimp),
+ Decoder(9, "EVENT_SHUTDOWN_GUEST_SHUTDOWN", decode_unimp),
+ Decoder(10, "EVENT_SHUTDOWN_GUEST_RESET", decode_unimp),
+ Decoder(11, "EVENT_SHUTDOWN_GUEST_PANIC", decode_unimp),
+ Decoder(12, "EVENT_SHUTDOWN___MAX", decode_unimp),
+ Decoder(13, "EVENT_CHAR_WRITE", decode_unimp),
+ Decoder(14, "EVENT_CHAR_READ_ALL", decode_unimp),
+ Decoder(15, "EVENT_CHAR_READ_ALL_ERROR", decode_unimp),
+ Decoder(16, "EVENT_AUDIO_OUT", decode_audio_out),
+ Decoder(17, "EVENT_AUDIO_IN", decode_unimp),
+ Decoder(18, "EVENT_CLOCK_HOST", decode_clock),
+ Decoder(19, "EVENT_CLOCK_VIRTUAL_RT", decode_clock),
+ Decoder(20, "EVENT_CP_CLOCK_WARP_START", decode_checkpoint),
+ Decoder(21, "EVENT_CP_CLOCK_WARP_ACCOUNT", decode_checkpoint),
+ Decoder(22, "EVENT_CP_RESET_REQUESTED", decode_checkpoint),
+ Decoder(23, "EVENT_CP_SUSPEND_REQUESTED", decode_checkpoint),
+ Decoder(24, "EVENT_CP_CLOCK_VIRTUAL", decode_checkpoint),
+ Decoder(25, "EVENT_CP_CLOCK_HOST", decode_checkpoint),
+ Decoder(26, "EVENT_CP_CLOCK_VIRTUAL_RT", decode_checkpoint),
+ Decoder(27, "EVENT_CP_INIT", decode_checkpoint_init),
+ Decoder(28, "EVENT_CP_RESET", decode_checkpoint),
+]
+
+def parse_arguments():
+ "Grab arguments for script"
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-f", "--file", help='record/replay dump to read from',
+ required=True)
+ return parser.parse_args()
+
+def decode_file(filename):
+ "Decode a record/replay dump"
+ dumpfile = open(filename, "rb")
+
+ # read and throwaway the header
+ version = read_dword(dumpfile)
+ junk = read_qword(dumpfile)
+
+ print "HEADER: version 0x%x" % (version)
+
+ if version == 0xe02007:
+ event_decode_table = v7_event_table
+ replay_state.checkpoint_start = 12
+ elif version == 0xe02006:
+ event_decode_table = v6_event_table
+ replay_state.checkpoint_start = 12
+ else:
+ event_decode_table = v5_event_table
+ replay_state.checkpoint_start = 10
+
+ try:
+ decode_ok = True
+ while decode_ok:
+ event = read_event(dumpfile)
+ decode_ok = call_decode(event_decode_table, event, dumpfile)
+ finally:
+ dumpfile.close()
+
+if __name__ == "__main__":
+ args = parse_arguments()
+ decode_file(args.file)
diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index d18e2f1ffa..5b1d8dcdf4 100755
--- a/scripts/update-linux-headers.sh
+++ b/scripts/update-linux-headers.sh
@@ -39,6 +39,7 @@ cp_portable() {
-e 'input-event-codes' \
-e 'sys/' \
-e 'pvrdma_verbs' \
+ -e 'drm.h' \
-e 'limits' \
-e 'linux/kernel' \
-e 'linux/sysinfo' \
@@ -59,6 +60,8 @@ cp_portable() {
-e 's/__bitwise//' \
-e 's/__attribute__((packed))/QEMU_PACKED/' \
-e 's/__inline__/inline/' \
+ -e 's/__BITS_PER_LONG/HOST_LONG_BITS/' \
+ -e '/\"drm.h\"/d' \
-e '/sys\/ioctl.h/d' \
-e 's/SW_MAX/SW_MAX_/' \
-e 's/atomic_t/int/' \
@@ -106,6 +109,8 @@ for arch in $ARCHLIST; do
mkdir -p "$output/include/standard-headers/asm-$arch"
if [ $arch = s390 ]; then
cp_portable "$tmpdir/include/asm/virtio-ccw.h" "$output/include/standard-headers/asm-s390/"
+ cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-s390/"
+ cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-s390/"
fi
if [ $arch = arm ]; then
cp "$tmpdir/include/asm/unistd-eabi.h" "$output/linux-headers/asm-arm/"
@@ -125,7 +130,7 @@ done
rm -rf "$output/linux-headers/linux"
mkdir -p "$output/linux-headers/linux"
for header in kvm.h kvm_para.h vfio.h vfio_ccw.h vhost.h \
- psci.h userfaultfd.h; do
+ psci.h psp-sev.h userfaultfd.h; do
cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux"
done
rm -rf "$output/linux-headers/asm-generic"
@@ -158,6 +163,9 @@ for i in "$tmpdir"/include/linux/*virtio*.h "$tmpdir/include/linux/input.h" \
"$tmpdir/include/linux/sysinfo.h"; do
cp_portable "$i" "$output/include/standard-headers/linux"
done
+mkdir -p "$output/include/standard-headers/drm"
+cp_portable "$tmpdir/include/drm/drm_fourcc.h" \
+ "$output/include/standard-headers/drm"
rm -rf "$output/include/standard-headers/drivers/infiniband/hw/vmw_pvrdma"
mkdir -p "$output/include/standard-headers/drivers/infiniband/hw/vmw_pvrdma"