Mark McLoughlin [Wed, 25 Nov 2009 18:49:25 +0000 (18:49 +0000)]
net: convert usb-net to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:24 +0000 (18:49 +0000)]
net: convert stellaris to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:23 +0000 (18:49 +0000)]
net: convert smc91c111 to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:22 +0000 (18:49 +0000)]
net: convert musicpal to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:21 +0000 (18:49 +0000)]
net: convert mipsnet to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:20 +0000 (18:49 +0000)]
net: convert mcf_fec to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:19 +0000 (18:49 +0000)]
net: convert LAN9118 to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:18 +0000 (18:49 +0000)]
net: convert etrax to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:17 +0000 (18:49 +0000)]
net: convert dp8393x to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:16 +0000 (18:49 +0000)]
net: convert eepro100 to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:15 +0000 (18:49 +0000)]
net: convert pcnet to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:14 +0000 (18:49 +0000)]
net: convert ne2000 to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:13 +0000 (18:49 +0000)]
net: convert rtl8139 to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:12 +0000 (18:49 +0000)]
net: convert e1000 to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:11 +0000 (18:49 +0000)]
net: convert virtio to NICState
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:10 +0000 (18:49 +0000)]
net: introduce NICState and qemu_new_nic()
Common state for all NICs.
The opaque member will replace the opaque member in VLANClientState
since only NICs need it.
The conf member will allow us to iterate over NICs, access the MAC
addr for the NIC and send a packet from each NIC in qemu_announce_self().
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:09 +0000 (18:49 +0000)]
net: convert dump to NetClientInfo
aliguori: fix uninitialized use of pcap_len
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:08 +0000 (18:49 +0000)]
net: convert socket to NetClientInfo
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:07 +0000 (18:49 +0000)]
net: convert vde to NetClientInfo
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:06 +0000 (18:49 +0000)]
net: convert slirp to NetClientInfo
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:05 +0000 (18:49 +0000)]
net: convert tap-win32 to NetClientInfo
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:04 +0000 (18:49 +0000)]
net: convert tap to NetClientInfo
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:03 +0000 (18:49 +0000)]
qdev: move DO_UPCAST() into osdep.h
Nothing qdev specific about this, make it available throughtout.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:02 +0000 (18:49 +0000)]
net: introduce qemu_new_net_client()
A replacement for qemu_new_vlan_client(), using NetClientInfo to
replace most arguments.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:01 +0000 (18:49 +0000)]
net: introduce NetClientInfo
This structure holds data which is common to all instances of a given
net client type/model.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:49:00 +0000 (18:49 +0000)]
net: remove NICInfo::private
Was used by hot-unplug, but not anymore.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:48:59 +0000 (18:48 +0000)]
net: remove NICInfo::vc
Since
1cc33683, this field is not set for most devices, so just
remove it and its remaining few uses.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:48:58 +0000 (18:48 +0000)]
net: clean up includes in net.c
This is probably a little drastic, but the includes in this file are
now totally out of control when compared with what includes are
actually needed.
This may break the build on e.g. *BSD, but it will be easily fixed by
re-instating an include.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:48:57 +0000 (18:48 +0000)]
net: move dump backend code from net.c to net/dump.c
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:48:56 +0000 (18:48 +0000)]
net: move socket backend code from net.c to net/socket.c
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:48:55 +0000 (18:48 +0000)]
net: move vde code from net.c to net/vde.c
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin [Wed, 25 Nov 2009 18:48:54 +0000 (18:48 +0000)]
net: move slirp code from net.c to net/slirp.c
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juan Quintela [Wed, 2 Dec 2009 10:49:42 +0000 (11:49 +0100)]
ac97: port to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juan Quintela [Wed, 2 Dec 2009 10:49:41 +0000 (11:49 +0100)]
ac97: up savevm version and remove active from state
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juan Quintela [Wed, 2 Dec 2009 10:49:40 +0000 (11:49 +0100)]
ac97: recalculate active after loadvm
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juan Quintela [Wed, 2 Dec 2009 10:49:39 +0000 (11:49 +0100)]
ac97: sizeof needs %zd
This change makes DEBUG_AC97 to compile again
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juan Quintela [Wed, 2 Dec 2009 10:49:38 +0000 (11:49 +0100)]
gus: port to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juan Quintela [Wed, 2 Dec 2009 10:49:37 +0000 (11:49 +0100)]
c4231a: port to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juan Quintela [Wed, 2 Dec 2009 10:49:36 +0000 (11:49 +0100)]
es1370: port to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juan Quintela [Wed, 2 Dec 2009 10:49:35 +0000 (11:49 +0100)]
sb16: port to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juan Quintela [Wed, 2 Dec 2009 10:49:34 +0000 (11:49 +0100)]
audio: port to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juan Quintela [Wed, 2 Dec 2009 10:49:33 +0000 (11:49 +0100)]
audio: fix compilation of DEBUG_PLIVE
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:59:10 +0000 (22:59 -0200)]
QMP: Introduce vm-info
A Python script which uses qmp.py to print some simple VM info.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:59:09 +0000 (22:59 -0200)]
QMP: Introduce qmp-shell
This is a very simple shell written in Python for demonstration
purposes.
Unfortunately it's a bit awkward right now, as the user has
to specify the arguments names and the printed data can be
a raw dictionary or list, like the following example:
(QEMU) pci_add pci_addr=auto type=nic
{u'slot': 5, u'bus': 0, u'domain': 0, u'function': 0}
(QEMU)
It's worth to note that the shell is broken into two files.
One is the shell itself, the other is the QMP class which
handles the communication with QEMU.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:59:08 +0000 (22:59 -0200)]
QMP: Introduce qmp-events.txt
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:59:07 +0000 (22:59 -0200)]
QMP: Introduce specification
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:59:06 +0000 (22:59 -0200)]
QMP: Introduce README file
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:59:05 +0000 (22:59 -0200)]
QMP: Disable monitor print functions
We still have handlers which will call monitor print functions
in several places. Usually to report errors.
If they do this when we are in control mode, we will be emitting
garbage to our clients.
To avoid this problem, this commit adds a way to disable those
functions. If any of them is called when in control mode, we will
emit a generic error.
Although this is far from the perfect solution, it guarantees
that only JSON is sent to Clients.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:59:04 +0000 (22:59 -0200)]
QMP: Introduce basic asynchronous events
Debug, shutdown, reset, powerdown and stop are all basic events,
as they are very simple they can be added in the same commit.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:59:03 +0000 (22:59 -0200)]
QMP: Asynchronous events infrastructure
Asynchronous events are generated with a call to
monitor_protocol_event().
This function builds the right data-type and emit the event
right away. The emitted data is always a JSON object and its
format is as follows:
{ "event": json-string,
"timestamp": { "seconds": json-number, "microseconds": json-number },
"data": json-value }
This design is based on ideas by Amit Shah <amit.shah@redhat.com>.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:59:02 +0000 (22:59 -0200)]
QMP: Allow 'query-' commands
The 'info' command makes sense for the user protocol, but for QMP
it doesn't, as its return data is not well defined. That is, it
can return anything.
To fix this Avi proposes having 'query-' commands when in protocol
mode. For example, 'info balloon' would become 'query-balloon'.
The right way of supporting this would probably be to move all
info handlers to qemu-monitor.hx, add a flags field to mon_cmd_t
to identify them and then modify do_info() to do its search based
on that flag.
Unfortunately, this would require a big change in the Monitor.
To make things simpler for now, this commit takes a different
approach: a check for commands starting with "query-" is added to
toplevel QMP code, if it's true we setup things so that do_info()
is called with the appropriate arguments.
This is a hack, but is a temporary one and guarantees that query-
commands will work from the first day.
Also note that 'info' is not allowed in protocol mode.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:59:01 +0000 (22:59 -0200)]
QMP: Input support
The JSON stream parser is used to do QMP input. When there
are enough characters to be parsed it calls Monitor's
handle_qmp_command() function to handle the input.
This function's job is to check if the input is correct and
call the appropriate handler. In other words, it does for QMP
what handle_user_command() does for the user protocol.
This means that handle_qmp_command() also has to parse the
(ugly) "args_type" format to able to get the arguments names
and types expected by the handler.
The format to input commands in QMP is as follows:
{ "execute": json-string,
"id": json-value, "arguments": json-object }
Please, note that this commit also adds "id" support.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:59:00 +0000 (22:59 -0200)]
QMP: do_info() checks
This commit adds specific QMP checks to do_info(), so that
it behaves as expected in QMP mode.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:58:59 +0000 (22:58 -0200)]
QMP: Output support
In the new Monitor output is always performed by only two
functions: do_info() and monitor_call_handler().
To support QMP output, we modify those functions to check if we
are in control mode. If so, we call monitor_protocol_emitter()
to emit QMP output, otherwise we do regular output.
QMP has two types of responses to issued commands: success and
error. The outputed data is always a JSON object.
Success responses have the following format:
{ "return": json-value, "id": json-value }
Error responses have the following format:
{ "error": { "class": json-string,
"desc": json-string,
"data": json-value } "id": json-value }
Please, note that the "id" key is part of the input code, and
thus is not added in this commit.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:58:58 +0000 (22:58 -0200)]
QMP: Initial support
This commit adds initial QMP support in QEMU. It's important
to notice that most QMP code will be part of the Monitor.
Input will be read by monitor_control_read(). Currently it
does nothing but next patches will add proper input support.
The function monitor_json_emitter(), as its name implies, is
used by the Monitor to emit JSON output. In this commit it's
used by monitor_control_event() to print our greeting message.
Finally, control mode support is also added to monitor_init(),
allowing QMP to be really enabled.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:58:57 +0000 (22:58 -0200)]
QError: Add errors needed by QMP
Only QERR_QMP_BAD_INPUT_OBJECT is QMP specific, the others can
be used in different contexts by other subsystems.
Please, note that QERR_JSON_PARSING signals any parsing error
from the json parser. We will need it until the parser gets
updated to use QError.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:58:56 +0000 (22:58 -0200)]
monitor: Introduce 'info commands'
List QMP available commands. Only valid in control mode, where
has to be used as 'query-commands.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:58:55 +0000 (22:58 -0200)]
monitor: Rename monitor_handle_command()
As this series will add a new kind of Monitor command, it's better
to rename monitor_handle_command() to what it really is:
handle_user_command().
This will avoid confusion.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:58:54 +0000 (22:58 -0200)]
monitor: Introduce monitor_find_command()
This commit moves the loop which searches for the command
entry corresponding to a command name to its own function.
It will be used by QMP code as well.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:58:53 +0000 (22:58 -0200)]
monitor: Introduce monitor_call_handler()
This commit moves the code which calls Monitor handlers to
its own function, as it will be used by QMP code as well.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:58:52 +0000 (22:58 -0200)]
monitor: Command-line flag to enable control mode
This commit adds a flag called 'control' to the '-monitor'
command-line option. This flag enables control mode.
The syntax is:
qemu [...] -monitor control,<device>
Where <device> is a chardev (excluding 'vc', for obvious reasons).
For example:
$ qemu [...] -monitor control,tcp:localhost:4444,server
Will run QEMU in control mode, waiting for a client TCP connection
on localhost port 4444.
NOTE: I've tried using QemuOpts for this, but turns out that it
will try to parse the device part, which should be untouched.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Fri, 27 Nov 2009 00:58:51 +0000 (22:58 -0200)]
monitor: Introduce MONITOR_USE_CONTROL flag
This flag will be set when Monitor enters "control mode", in
which the output will be defined by the QEMU Monitor Protocol.
This also introduces a macro to check if the flag is set.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:36 +0000 (23:05 -0200)]
monitor: do_info_balloon(): Use QError
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:35 +0000 (23:05 -0200)]
QError: Add QERR_KVM_MISSING_CAP
New class for KVM unavailable features errors.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:34 +0000 (23:05 -0200)]
QError: Add QERR_DEVICE_NOT_ACTIVE
New class for device not active errors.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:33 +0000 (23:05 -0200)]
qdev: Use QError for 'device not found' error
Please, note that we will lose the "Try -device '?' for a list"
hint as it's qdev specific.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:32 +0000 (23:05 -0200)]
QError: Add QERR_DEVICE_NOT_FOUND
New class for device not found errors.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:31 +0000 (23:05 -0200)]
monitor: QError support
This commit adds QError support in the Monitor.
A QError member is added to the Monitor struct. This new member
stores error information and is also used to check if an error
has occurred when the called handler returns.
Additionally, a new macro called qemu_error_new() is introduced.
It builds on top of the QemuErrorSink API and should be used in
place of qemu_error().
When all conversion to qemu_error_new() is done, qemu_error() can
be turned private.
Basically, Monitor's error flow is something like this:
1. An error occurs in the handler, it calls qemu_error_new()
2. qemu_error_new() builds a new QError object and stores it in
the Monitor struct
3. The handler returns
4. Top level Monitor code checks the Monitor struct and calls
qerror_print() to print the error
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:30 +0000 (23:05 -0200)]
Introduce QError
QError is a high-level data type which represents an exception
in QEMU, it stores the following error information:
- class Error class name (eg. "ServiceUnavailable")
- description A detailed error description, which can contain
references to run-time error data
- filename The file name of where the error occurred
- line number The exact line number of the error
- function The function name of where the error occurred
- run-time data Any run-time error data
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:29 +0000 (23:05 -0200)]
utests: Add qstring_from_substr() unit-test
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:28 +0000 (23:05 -0200)]
utests: Add qstring_append_chr() unit-test
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:27 +0000 (23:05 -0200)]
QString: Introduce qstring_from_substr()
Note that we can now write qstring_from_str() as a wrapper.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:26 +0000 (23:05 -0200)]
QString: Introduce qstring_append_int()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:25 +0000 (23:05 -0200)]
QString: Introduce qstring_append_chr()
It appends a C char to a QString.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Luiz Capitulino [Thu, 19 Nov 2009 01:05:24 +0000 (23:05 -0200)]
QJSON: Introduce qobject_from_jsonv()
It accepts a va_list and will be used by QError. Also simplifies
the code a little, as the other qobject_from_() functions can
use it.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Juha Riihimäki [Mon, 8 Jun 2009 06:27:19 +0000 (09:27 +0300)]
fix I2C slave addressing
With the recent device handling changes the I2C slave addressing code
was broken. With current code, if a slave with the correct address is
not found on the bus the last scanned slave on the bus will be
addressed. This is wrong. Please find attached a patch to fix it.
Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Acked-by: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Gerd Hoffmann [Tue, 17 Nov 2009 10:28:41 +0000 (11:28 +0100)]
Fix qdev property type definition for isa serial/parallel devices
Use the correct qdev property type for these devices.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jean-Christophe DUBOIS [Sun, 15 Nov 2009 18:18:20 +0000 (19:18 +0100)]
Fix qemu_malloc/qemu_free use in rtl8139.c
rtl8139.c is using malloc()/free() instead of qemu_malloc()/qemu_free().
Fix it.
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jean-Christophe DUBOIS [Sun, 15 Nov 2009 18:18:19 +0000 (19:18 +0100)]
Fix free use in xen_backend.c
xen_backend.c is using qemu_free() instead of free().
Fix it.
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jean-Christophe DUBOIS [Sun, 15 Nov 2009 18:18:18 +0000 (19:18 +0100)]
Fix qemu_free use in scsi-generic.c
scsi-generic.c is using free() instead of qemu_free().
Fix it.
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jean-Christophe DUBOIS [Sun, 15 Nov 2009 18:18:17 +0000 (19:18 +0100)]
Fix qemu_free use in nseries.c
nseries.c is using free() instead of qemu_free().
Fix it.
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jean-Christophe DUBOIS [Sun, 15 Nov 2009 18:18:16 +0000 (19:18 +0100)]
Fix qemu_free use in bt-l2cap.c
bt-l2cap.c is using free() instead of qemu_free().
Fix it.
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jean-Christophe DUBOIS [Sun, 15 Nov 2009 18:18:15 +0000 (19:18 +0100)]
Fix qemu_free use in nand.c
nand.c is using free() instead of qemu_free().
Fix it.
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jean-Christophe DUBOIS [Sun, 15 Nov 2009 18:18:14 +0000 (19:18 +0100)]
Fix qemu_free use in baum.c
baum.c is using free() instead of qemu_free().
Fix it.
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jean-Christophe DUBOIS [Sun, 15 Nov 2009 18:18:13 +0000 (19:18 +0100)]
Fix qemu_free use in acpi.c
acpi.c is using free() instead of qemu_free().
Fix it.
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Michael S. Tsirkin [Wed, 11 Nov 2009 12:33:54 +0000 (14:33 +0200)]
pci: move apb specific stuff to apb_pci.c
pci code had a TODO to move apb specific
pci bridge initialization to apb_pci.
Implement this and remove the TODO.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Michael S. Tsirkin [Wed, 11 Nov 2009 11:50:09 +0000 (13:50 +0200)]
configure: use correct cflags in compiler checks
linux-user build on fedora 11 breaks because fallocate
is broken on that system if -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
are specified, which is what QEMU uses.
We do have a configure check to catch this and disable fallocate,
however, it turns out that default QEMU_CFLAGS/LDFLAGS were assigned in
script *after* all compiler checks: so during checks we were not running
compiler with same flags that we used for build later.
Fix this by moving QEMU_CFLAGS to before compiler checks, and using
comple_prog when checking for fallocate. This also fixes the fact that
we do some compiler checks while assigning the flags, right below a
comment that says "no cc tests beyond this point".
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Stefan Weil [Mon, 16 Nov 2009 20:11:38 +0000 (21:11 +0100)]
vga-pci: Fix access to linear framebuffer
Anthony Liguori's patch fixes the problems with
vga display in graphical mode and SeaBIOS.
I only adapted some values for vga-pci.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Stefan Weil [Thu, 12 Nov 2009 18:08:56 +0000 (19:08 +0100)]
Makefile: Remove unneeded prerequisites
Thanks to
f527c57935e22b56952d1ed1af36070b682ecf70
(fix parallel build), these prerequisites
are redundant now and can be removed.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Tue, 1 Dec 2009 17:54:39 +0000 (11:54 -0600)]
Merge commit 'mst/for_anthony' into mst
Michael S. Tsirkin [Wed, 25 Nov 2009 10:24:14 +0000 (12:24 +0200)]
msix: clear pending bit of an unused vector
PCI spec states:
if a masked vector has its Pending bit set, and the associated
underlying interrupt events are somehow satisfied (usually by software
though the exact manner is function-specific), the function must clear
the Pending bit, to avoid sending a spurious interrupt message later
when software unmasks the vector.
In our case this happens if vector becomes unused.
Clear pending bit in this case.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Wed, 25 Nov 2009 10:00:10 +0000 (12:00 +0200)]
msix: fix reset value for enable bit
On reset, we currently clear all bits in msix control register *except*
enable bit. This is wrong: the spec says we should clear writeable
bits: function mask and enable bit.
Correct this.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Wed, 25 Nov 2009 09:41:48 +0000 (11:41 +0200)]
msix: fix mask bit state after reset
PCI spec states that mask bit must be 1 after reset.
Make it so.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Tue, 24 Nov 2009 14:45:35 +0000 (16:45 +0200)]
virtio: do not reset msix state on soft reset
msix state is managed by OS, not the
driver, so it's wrong to touch it
on io from driver.
Mark all vectors unused instead.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Tue, 24 Nov 2009 14:44:15 +0000 (16:44 +0200)]
msix: add helper to unuse all msix entries
will be used by virtio on soft reset
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Thu, 12 Nov 2009 11:54:31 +0000 (13:54 +0200)]
pci: convert goto into scope in bridge_filter
goto into scope is evil. rearrange pci_bridge_filter
so that we always go to end of function on error.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>
Isaku Yamahata [Thu, 12 Nov 2009 05:58:47 +0000 (14:58 +0900)]
pci: pci bridge related clean up.
- fix bridge prefetchable memory accesser to check 64bit or not.
- use pcibus_t consistently instead mixing pcibus_t and uint64_t.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Thu, 12 Nov 2009 05:58:46 +0000 (14:58 +0900)]
pci: fix pci_config_get_io_base().
fix typo in pci_config_get_io_base().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Isaku Yamahata [Thu, 12 Nov 2009 05:58:45 +0000 (14:58 +0900)]
pci: remove magic number, 256 in pci.c
This patch replaces magic number, 256, with ARRAY_SIZE().
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Michael S. Tsirkin [Thu, 12 Nov 2009 11:47:17 +0000 (13:47 +0200)]
pci: split up up pci_update mappings
Split bar address math into a separate function.
In particular, this gets rid of an ugly forward goto
into scope that we have there.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Isaku Yamahata <yamahata@valinux.co.jp>