Paolo Bonzini [Fri, 7 Oct 2011 14:47:56 +0000 (16:47 +0200)]
qemu-nbd: add client pointer to NBDRequest
By attaching a client to an NBDRequest, we can avoid passing around the
socket descriptor and data buffer.
Also, we can now manage the reference count for the client in
nbd_request_get/put request instead of having to do it ourselved in
nbd_read. This simplifies things when coroutines are used.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Mon, 19 Sep 2011 12:33:23 +0000 (14:33 +0200)]
qemu-nbd: move client handling to nbd.c
This patch sets up the fd handler in nbd.c instead of qemu-nbd.c. It
introduces NBDClient, which wraps the arguments to nbd_trip in a single
structure, so that we can add a notifier to it. This way, qemu-nbd can
know about disconnections.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Mon, 12 Sep 2011 15:28:11 +0000 (17:28 +0200)]
qemu-nbd: use common main loop
Using a single main loop for sockets will help yielding from the socket
coroutine back to the main loop, and later reentering it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Mon, 12 Sep 2011 14:20:11 +0000 (16:20 +0200)]
link the main loop and its dependencies into the tools
Using the main loop code from QEMU enables tools to operate fully
asynchronously. Advantages include better Windows portability (for some
definition of portability) over glib's.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Mon, 19 Sep 2011 12:18:33 +0000 (14:18 +0200)]
qemu-nbd: introduce NBDRequest
Move the buffer from NBDExport to a new structure, so that it will be
possible to have multiple in-flight requests for the same export
(and for the same client too---we get that for free).
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Mon, 19 Sep 2011 12:03:37 +0000 (14:03 +0200)]
qemu-nbd: introduce NBDExport
Wrap the common parameters of nbd_trip and nbd_negotiate in a
single opaque struct.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Mon, 19 Sep 2011 13:07:54 +0000 (15:07 +0200)]
qemu-nbd: introduce nbd_do_receive_request
Group the receiving of a response and the associated data into a new function.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Mon, 19 Sep 2011 14:04:36 +0000 (16:04 +0200)]
qemu-nbd: more robust handling of invalid requests
Fail invalid requests with EINVAL instead of dropping them into
the void.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Mon, 19 Sep 2011 12:25:30 +0000 (14:25 +0200)]
qemu-nbd: introduce nbd_do_send_reply
Group the sending of a reply and the associated data into a new function.
Without corking, the caller would be forced to leave 12 free bytes at the
beginning of the data pointer. Not too ugly, but still ugly. :)
Using nbd_do_send_reply everywhere will help when the routine will set up
the write handler that re-enters the send coroutine.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Mon, 19 Sep 2011 11:48:43 +0000 (13:48 +0200)]
qemu-nbd: simplify nbd_trip
Use TCP_CORK to remove a violation of encapsulation, that would later
require nbd_trip to know too much about an NBD reply.
We could also switch to sendmsg (qemu_co_sendv) later, it is even
easier once coroutines are in.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Wed, 21 Sep 2011 10:36:48 +0000 (12:36 +0200)]
move corking functions to osdep.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Fri, 7 Oct 2011 12:35:58 +0000 (14:35 +0200)]
qemu-nbd: remove data_size argument to nbd_trip
The size of the buffer is in practice part of the protocol.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Mon, 19 Sep 2011 11:50:54 +0000 (13:50 +0200)]
qemu-nbd: remove offset argument to nbd_trip
The argument is write-only.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Chunyan Liu [Fri, 2 Dec 2011 15:27:54 +0000 (23:27 +0800)]
Update ioctl order in nbd_init() to detect EBUSY
Update ioctl(s) in nbd_init() to detect device busy early.
Current nbd_init() issues NBD_CLEAR_SOCKET before NBD_SET_SOCKET, if issuing
"qemu-nbd -c /dev/nbd0 disk.img" twice, the second time won't detect EBUSY in
nbd_init(), but in nbd_client will report EBUSY and do clear socket (the 1st
time command will be affacted too because of no socket any more.)
No change to previous version.
Signed-off-by: Chunyan Liu <cyliu@suse.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Fri, 21 Oct 2011 11:17:14 +0000 (13:17 +0200)]
nbd: add support for NBD_CMD_TRIM
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Fri, 21 Oct 2011 11:17:14 +0000 (13:17 +0200)]
nbd: add support for NBD_CMD_FLUSH
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Fri, 21 Oct 2011 11:16:28 +0000 (13:16 +0200)]
nbd: add support for NBD_CMD_FLAG_FUA
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Tue, 13 Sep 2011 15:27:45 +0000 (17:27 +0200)]
nbd: fix error handling in the server
bdrv_read and bdrv_write return negative errno values, not -1.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Sat, 10 Sep 2011 13:06:52 +0000 (15:06 +0200)]
nbd: allow multiple in-flight requests
Allow sending up to 16 requests, and drive the replies to the coroutine
that did the request. The code is written to be exactly the same as
before this patch when MAX_NBD_REQUESTS == 1 (modulo the extra mutex
and state).
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Sat, 10 Sep 2011 13:06:52 +0000 (15:06 +0200)]
nbd: split requests
qemu-nbd has a limit of slightly less than 1M per request. Work
around this in the nbd block driver.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Thu, 8 Sep 2011 12:28:59 +0000 (14:28 +0200)]
nbd: switch to asynchronous operation
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Thu, 8 Sep 2011 11:46:25 +0000 (13:46 +0200)]
sheepdog: move coroutine send/recv function to generic code
Outside coroutines, avoid busy waiting on EAGAIN by temporarily
making the socket blocking.
The API of qemu_recvv/qemu_sendv is slightly different from
do_readv/do_writev because they do not handle coroutines. It
returns the number of bytes written before encountering an
EAGAIN. The specificity of yielding on EAGAIN is entirely in
qemu-coroutine.c.
Reviewed-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Sat, 17 Sep 2011 14:27:59 +0000 (16:27 +0200)]
add qemu_send_full and qemu_recv_full
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Andrzej Zaborowski [Wed, 21 Dec 2011 04:04:21 +0000 (05:04 +0100)]
sd: Remember to reset .expecting_acmd on reset.
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Peter Maydell [Sun, 18 Dec 2011 20:38:00 +0000 (21:38 +0100)]
hw/sd.c: Clear status bits when read via response r6
Response format r6 includes a subset of the status bits;
clear the clear-on-read bits which are read by an r6 response.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Peter Maydell [Sun, 18 Dec 2011 20:37:59 +0000 (21:37 +0100)]
hw/sd.c: Correct handling of APP_CMD status bit
Fix some bugs in our implementation of the APP_CMD status bit:
* the response to an ACMD should have APP_CMD set, not cleared
* if an illegal ACMD is sent then the next command should be
handled as a normal command
This requires that we split "card is expecting an ACMD" from
the state of the APP_CMD status bit (the latter indicates
both "expecting ACMD" and "that was an ACMD").
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Peter Maydell [Sun, 18 Dec 2011 20:37:58 +0000 (21:37 +0100)]
hw/sd.c: Correct handling of type B SD status bits
Correct how we handle the type B ("cleared on valid command")
status bits. In particular, the CURRENT_STATE bits in a response
should be the state of the card when it received that command,
not the state when it received the preceding command. (This is
one of the issues noted in LP:597641.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Peter Maydell [Sun, 18 Dec 2011 20:37:57 +0000 (21:37 +0100)]
hw/sd.c: Set ILLEGAL_COMMAND for ACMDs in invalid state
App commands in an invalid state should set ILLEGAL_COMMAND, not
merely return a zero response.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Peter Maydell [Sun, 18 Dec 2011 20:37:56 +0000 (21:37 +0100)]
hw/sd.c: Handle CRC and locked-card errors in normal code path
Handle returning CRC and locked-card errors in the same code path
we use for other responses. This makes no difference in behaviour
but means that these error responses will be printed by the debug
logging code.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Peter Maydell [Sun, 18 Dec 2011 20:37:55 +0000 (21:37 +0100)]
hw/sd.c: Handle illegal commands in sd_do_command
Add an extra sd_illegal value to the sd_rsp_type_t enum so that
sd_app_command() and sd_normal_command() can tell sd_do_command()
that the command was illegal. This is needed so we can do things
like reset certain status bits only on receipt of a valid command.
For the moment, just use it to pull out the setting of the
ILLEGAL_COMMAND status bit into sd_do_command().
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Peter Maydell [Sun, 18 Dec 2011 20:37:54 +0000 (21:37 +0100)]
hw/sd.c: When setting ADDRESS_ERROR bit, don't clear everything else
Fix a typo that meant that ADDRESS_ERRORs setting or clearing write
protection would clear every other bit in the status register.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Peter Maydell [Sun, 18 Dec 2011 20:37:53 +0000 (21:37 +0100)]
hw/sd.c: On CRC error, set CRC error status bit rather than clearing it
If we fail to validate the CRC for an SD command we should be setting
COM_CRC_ERROR, not clearing it. (This bug actually has no effect currently
because sd_req_crc_validate() always returns success.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Peter Maydell [Sun, 18 Dec 2011 20:37:52 +0000 (21:37 +0100)]
hw/sd.c: Add comment regarding CARD_STATUS_* defines
Add a clarifying comment about what the CARD_STATUS_[ABC]
macros are defining.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Peter Maydell [Sun, 18 Dec 2011 20:37:51 +0000 (21:37 +0100)]
hw/sd.c: Fix the set of commands which are failed when card is locked
Fix bugs in the code determining whether to accept a command when the
SD card is locked. Most notably, we had the condition completely
reversed, so we would accept all the commands we should refuse and
refuse all the commands we should accept. Correct this by refactoring
the enormous if () clause into a separate function.
We had also missed ACMD42 off the list of commands which are accepted
in locked state: add it.
This is one of the two problems reported in LP:597641.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
Peter Maydell [Mon, 19 Dec 2011 20:33:59 +0000 (20:33 +0000)]
hw/sysbus.c: Remove unnecessary conditionals
Now that all sysbus MMIO regions are MemoryRegions, mmio[n].memory
is never NULL, and we can remove some unnecessary conditionals.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Alon Levy [Tue, 20 Dec 2011 11:41:04 +0000 (13:41 +0200)]
g_thread_init users: don't call it if glib >= 2.31
since commit
f9b29ca03 included in release 2.31 (docs below say 2.32 but
that is not correct) and onwards g_thread_init is deprecated and calling
it is not required:
http://developer.gnome.org/glib/unstable/glib-Deprecated-Thread-APIs.html#g-thread-init
g_thread_init has been deprecated since version 2.32 and should not be
used in newly-written code. This function is no longer necessary. The
GLib threading system is automatically initialized at the start of your
program.
Fixes bulid failure when warnings are treated as errors on fedora 17.
I only tested the change to vl.c, and copy pasted to the two other
locations (couldn't decide if a wrapper for calling g_thread_init is
uglier).
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Thu, 15 Dec 2011 21:10:01 +0000 (22:10 +0100)]
audio: remove unused parameter isa_pic
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Thu, 15 Dec 2011 21:10:00 +0000 (22:10 +0100)]
isa: always use provided ISA bus in isa_bus_irqs()
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Thu, 15 Dec 2011 21:09:59 +0000 (22:09 +0100)]
isa: always use provided ISA bus when creating an isa device
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Thu, 15 Dec 2011 21:09:58 +0000 (22:09 +0100)]
malta: give ISA bus to ISA methods
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Thu, 15 Dec 2011 21:09:57 +0000 (22:09 +0100)]
fulong2e: give ISA bus to ISA methods
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Thu, 15 Dec 2011 21:09:56 +0000 (22:09 +0100)]
sun4u: give ISA bus to ISA methods
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Thu, 15 Dec 2011 21:09:55 +0000 (22:09 +0100)]
alpha: give ISA bus to ISA methods
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Thu, 15 Dec 2011 21:09:54 +0000 (22:09 +0100)]
pc: give ISA bus to ISA methods
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Thu, 15 Dec 2011 21:09:53 +0000 (22:09 +0100)]
i8259: give ISA device to isa_register_ioport()
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Thu, 15 Dec 2011 21:09:52 +0000 (22:09 +0100)]
isa: move ISABus structure definition to header file
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Thu, 15 Dec 2011 21:09:51 +0000 (22:09 +0100)]
isa: give ISABus/ISADevice to isa_create(), isa_bus_irqs() and isa_get_irq() functions
NULL is a valid bus/device, so there is no change in behaviour.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Wed, 30 Nov 2011 20:35:38 +0000 (21:35 +0100)]
net: store guest timestamp in dump file instead of time since guest startup
Stored dates are no more 1970-01-01 (+ run time), but have a real meaning.
If someone wants to have comparable timestamps accross boots, it is
possible to start qemu with -rtc to give the startup date.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Hervé Poussineau [Wed, 30 Nov 2011 20:35:37 +0000 (21:35 +0100)]
net: truncate output file when using dump backend
This prevents data of a previous run to be seen in the new dump file.
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Tue, 20 Dec 2011 13:10:36 +0000 (14:10 +0100)]
i440fx: remove piix3 field
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Mon, 19 Dec 2011 22:37:46 +0000 (16:37 -0600)]
qdev: fix hotplug when no -device is specified
The peripheral[-anon] containers are initialized lazily but since they sit on
sysbus, they can not be created after realize. This was causing an abort() to
occur during hotplug if no -device option was used.
This was spotted by qemu-test::device-add.sh
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Benoît Canet [Fri, 16 Dec 2011 22:37:48 +0000 (23:37 +0100)]
sysbus: remove sysbus_init_mmio_cb2
This function is not longer in use so remove it.
Signed-off-by: Benoît Canet <benoit.canet@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Benoît Canet [Fri, 16 Dec 2011 22:37:47 +0000 (23:37 +0100)]
ppce500_pci: remove sysbus_init_mmio_cb2 usage
Expose only one container MemoryRegion to sysbus.
(Peter Maydell's idea)
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Benoît Canet <benoit.canet@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Benoît Canet [Fri, 16 Dec 2011 22:37:46 +0000 (23:37 +0100)]
sh_pci: remove sysbus_init_mmio_cb2 usage
The isa region is not exposed as a sysbus region because the iobr
register contains its address and use it to remap dynamically
the region. (Peter Maydell's idea)
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Benoît Canet <benoit.canet@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Sun, 18 Dec 2011 16:05:11 +0000 (17:05 +0100)]
qom: register qdev properties also as non-legacy properties
Push legacy properties into a "legacy-..." namespace, and make them
available with correct types too.
For now, all properties come in both variants. This need not be the
case for string properties. We will revisit this after -device is
changed to actually use the legacy properties.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Sun, 18 Dec 2011 16:05:10 +0000 (17:05 +0100)]
qom: distinguish "legacy" property type name from QOM type name
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Sun, 18 Dec 2011 16:05:09 +0000 (17:05 +0100)]
qom: introduce get/set methods for Property
This patch adds a visitor interface to Property. This way, QOM will be
able to expose Properties that access a fixed field in a struct without
exposing also the everything-is-a-string "feature" of qdev properties.
Whenever the printed representation in both QOM and qdev (which is
typically the case for device backends), parse/print code can be reused
via get_generic/set_generic. Dually, whenever multiple PropertyInfos
have the same representation in both the struct and the visitors the
code can be reused (for example among all of int32/uint32/hex32).
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Sun, 18 Dec 2011 16:05:08 +0000 (17:05 +0100)]
qom: introduce QERR_PROPERTY_VALUE_OUT_OF_RANGE
This will be used when reject invalid values for integer fields that
are less than 64-bits wide.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Sun, 18 Dec 2011 16:05:07 +0000 (17:05 +0100)]
qom: interpret the return value when setting legacy properties
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Sun, 18 Dec 2011 16:05:06 +0000 (17:05 +0100)]
qom: push permission checks up into qdev_property_add_legacy
qdev_property_get and qdev_property_set can generate permission
denied errors themselves. Do not duplicate this functionality in
qdev_get/set_legacy_property, and clean up excessive indentation.
Reviewed-by: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Sun, 18 Dec 2011 16:05:05 +0000 (17:05 +0100)]
qom: fix swapped parameters
Reviewed-by: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Sun, 18 Dec 2011 16:05:04 +0000 (17:05 +0100)]
qapi: protect against NULL QObject in qmp_input_get_object
A NULL qobj can occur when a parameter is fetched via qdict_get, but
the parameter is not in the command. By returning NULL, the caller can
choose whether to raise a missing parameter error, an invalid parameter
type error, or use a default value. For example, qom-set could can
use this to reset a property to its default value, though at this time
it will fail with "Invalid parameter type". In any case, anything is
better than crashing!
Reviewed-by: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Michael Ellerman [Mon, 19 Dec 2011 06:19:32 +0000 (17:19 +1100)]
Documentation: Move balloon option out of i386 only section
The balloon option is not i386 only, so move it into the standard
options section.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Michael Ellerman [Mon, 19 Dec 2011 06:19:31 +0000 (17:19 +1100)]
vl.c: In qemu -h output, only print options for the arch we are running as
Only print options in the help output that are accepted by our arch.
This is less confusing for users and also for other programs that
consume the help output.
The options affected are:
-g and -prom-env only displayed on PPC or SPARC
-win2k-hack, -rtc-td-hack, -no-fd-bootchk, -no-acpi, -no-hpet,
-acpitable, -smbios only displayed on i386
-semihosting only displayed on ARM, M68K or XTENSA
-old-param only displayed on ARM
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Michael Ellerman [Mon, 19 Dec 2011 06:19:30 +0000 (17:19 +1100)]
vl.c: Move option generation logic into a wrapper file
In vl.c and qemu-options.h we define macros and include qemu-options.def
in order to generate different content. Move the bulk of the def'ing and
undef'ing into a wrapper, this will make it cleaner when we add another
macro in the next patch.
AFAICS undefining GEN_DOCS services no purpose, but I've left it for now.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Mon, 19 Dec 2011 15:45:17 +0000 (09:45 -0600)]
Merge remote-tracking branch 'qemu-kvm/memory/exec-obsolete' into staging
Anthony Liguori [Mon, 19 Dec 2011 15:45:12 +0000 (09:45 -0600)]
Merge remote-tracking branch 'qemu-kvm/memory/xen' into staging
Avi Kivity [Thu, 15 Dec 2011 13:25:22 +0000 (15:25 +0200)]
memory: move obsolete exec.c functions to a private header
This will help avoid accidental usage.
Signed-off-by: Avi Kivity <avi@redhat.com>
Avi Kivity [Thu, 15 Dec 2011 13:23:03 +0000 (15:23 +0200)]
etraxfs_eth: drop bogus cpu_unregister_io_memory()
Leftover call to cpu_unregister_io_memory() can segfault on cleanup. Remove.
Signed-off-by: Avi Kivity <avi@redhat.com>
Avi Kivity [Sun, 18 Dec 2011 14:27:48 +0000 (16:27 +0200)]
xen: convert to memory API
Undo the private implementation of qemu_ram_alloc(); use the global one
(which calls right back into xen_ram_alloc()).
Signed-off-by: Avi Kivity <avi@redhat.com>
Avi Kivity [Sun, 18 Dec 2011 13:48:55 +0000 (15:48 +0200)]
memory, xen: pass MemoryRegion to xen_ram_alloc()
Currently xen_ram_alloc() relies on ram_addr, which is going away.
Give it something else to use as a cookie.
Signed-off-by: Avi Kivity <avi@redhat.com>
Anthony Liguori [Mon, 19 Dec 2011 15:12:25 +0000 (09:12 -0600)]
Merge remote-tracking branch 'qemu-kvm/memory/mutators' into staging
Conflicts:
memory.h
Anthony Liguori [Mon, 19 Dec 2011 15:10:49 +0000 (09:10 -0600)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Mon, 19 Dec 2011 14:50:47 +0000 (08:50 -0600)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Sun, 18 Dec 2011 19:07:03 +0000 (13:07 -0600)]
pc: fix event_idx compatibility for virtio devices
event_idx was introduced in 0.15 and must be disabled for all virtio-pci devices
(including virtio-balloon-pci).
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Stefan Weil [Sat, 17 Dec 2011 08:27:39 +0000 (09:27 +0100)]
configure: Improve Xen autodetection for hosts without Xen
With this patch, it only takes one test (instead of four)
to detect that there is no Xen support at all.
For most build hosts, this will reduce the time configure needs.
It will also reduce noisy output in config.log.
Build hosts with Xen now need up to five (instead of up to four)
tests. They get improved diagnostics when Xen support fails.
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Stefan Weil [Sat, 17 Dec 2011 08:27:38 +0000 (09:27 +0100)]
configure: Fix compiler warnings in config.log (statement without effect)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Stefan Weil [Sat, 17 Dec 2011 08:27:37 +0000 (09:27 +0100)]
configure: Fix compiler warning in config.log (value was never used)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Stefan Weil [Sat, 17 Dec 2011 08:27:36 +0000 (09:27 +0100)]
configure: Fix compiler warning in config.log (undefined NULL)
Avoid the warning when probing for xfs.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Stefan Weil [Sat, 17 Dec 2011 08:27:35 +0000 (09:27 +0100)]
configure: Fix compiler warnings in config.log (uninitialized variable)
warning: ‘fd’ is used uninitialized in this function
warning: ‘id’ is used uninitialized in this function
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Stefan Weil [Sat, 17 Dec 2011 08:27:34 +0000 (09:27 +0100)]
configure: Fix compiler warning in config.log (macro redefined)
warning: "_GNU_SOURCE" redefined
The macro is already defined on the command line.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Stefan Weil [Sat, 17 Dec 2011 08:27:33 +0000 (09:27 +0100)]
configure: Fix compiler warning in config.log (unused variable)
warning: unused variable ‘iov’
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Stefan Weil [Sat, 17 Dec 2011 08:27:32 +0000 (09:27 +0100)]
configure: Fix compiler warnings in config.log (null arguments)
warning: null argument where non-null required (argument 1)
warning: null argument where non-null required (argument 3)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Stefan Weil [Sat, 17 Dec 2011 16:46:02 +0000 (17:46 +0100)]
configure: Fix compiler warning in config.log (integer from pointer)
warning: return makes integer from pointer without a cast
v2: Removed type cast.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Stefan Weil [Sat, 17 Dec 2011 08:27:30 +0000 (09:27 +0100)]
configure: Fix compiler warnings in config.log (old-style function definition)
warning: function declaration isn’t a prototype
In function ‘foo’:
warning: old-style function definition
The function name was changed, too, to avoid an additional warning.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Stefan Weil [Sat, 17 Dec 2011 08:27:29 +0000 (09:27 +0100)]
configure: Fix compiler warnings in config.log (always return a value from main)
Fix several "warning: control reaches end of non-void function".
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Julian Pidancet [Sun, 18 Dec 2011 18:08:44 +0000 (18:08 +0000)]
Also create piix3 property when Xen is enabled
This recently added line in hw/pc_piix.c is causing a SEGV on a Xen
setup because the piix3 property is never created:
qdev_property_add_child(qdev_resolve_path("/i440fx/piix3", NULL),
"rtc", (DeviceState *)rtc_state, NULL);
Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Geoffrey Thomas [Sat, 17 Dec 2011 09:23:59 +0000 (04:23 -0500)]
slirp: Fix typo in net_slirp_hostfwd_remove
Report an error when err is nonzero, not when it is zero.
Signed-off-by: Geoffrey Thomas <geofft@ldpreload.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Anthony Liguori [Sun, 18 Dec 2011 18:59:12 +0000 (12:59 -0600)]
pc: add pc-0.15
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Michael Ellerman [Fri, 16 Dec 2011 00:20:20 +0000 (11:20 +1100)]
kvm: Print something before calling abort() if KVM_RUN fails
It's a little unfriendly to call abort() without printing any sort of
error message. So turn the DPRINTK() into an fprintf(stderr, ...).
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Peter Maydell [Thu, 15 Dec 2011 18:58:26 +0000 (18:58 +0000)]
stellaris: Calculate system clock period on reset
Calculate the system clock period on reset; otherwise it remains
set to the default value of zero and attempting to use it provokes
a hang. This is one of the issues noted in LP:696094.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Peter Maydell [Thu, 15 Dec 2011 18:28:52 +0000 (18:28 +0000)]
Makefile.target: Remove unnecessary dependency rules
Remove some dependency rules which aren't necessary (the automatically
generated .d files cover all these). These were leftovers from dyngen
days, when the object files also had a dependency on some generated
files.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Paolo Bonzini [Thu, 15 Dec 2011 14:11:16 +0000 (15:11 +0100)]
ide: drop argument to dma_buf_commit
The argument is unused and even wrong when the function is called
by ide_handle_rw_error. Drop it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Alex Rozenman [Tue, 13 Dec 2011 10:52:08 +0000 (12:52 +0200)]
phys_page_find_alloc: Use correct initial region_offset.
This fixes a common bug with initial region_offset value.
Usually, the pages are re-assigned afterwards, so the bug
has a very small effect on regular QEMU use flows.
Signed-off-by: Alex Rozenman <Alex_Rozenman@mentor.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Michael Roth [Thu, 8 Dec 2011 03:48:07 +0000 (21:48 -0600)]
network scripts: don't block SIGCHLD before forking
This patch fixes a bug where child processes of launch_script() can
misbehave due to SIGCHLD being blocked. In the case of `sudo`, this
causes a permanent hang.
Previously a SIGCHLD handler was added to reap fork_exec()'d zombie
processes by calling waitpid(-1, ...). This required other
fork()/waitpid() callers to temporarilly block SIGCHILD to avoid
having the final wait status being intercepted by the SIGCHLD
handler:
7c3370d4fe3fa6cda8655f109e4659afc8ca4269
Since then, the qemu_add_child_watch() interface was added to allow
registration of such processes and reap only from that specific set
of PIDs:
4d54ec7898bd951007cb6122d5315584bd41d0c4
As a result, we can now avoid blocking SIGCHLD in launch_script(), so
drop that behavior.
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Peter Maydell [Thu, 15 Dec 2011 13:33:54 +0000 (13:33 +0000)]
HACKING: clarify allocation/free recommendations
Clarify the allocation/free recommendations; this is mostly
just tidying up following the global-search-and-replace done
with the conversion to the GLib g_malloc and friends.
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Stefan Hajnoczi [Thu, 15 Dec 2011 10:05:18 +0000 (10:05 +0000)]
usb: fix usb_qdev_init() error handling again
Commit
f462141f18ffdd75847f6459ef83d90b831d12c0 introduced clean up code
when usb_qdev_init() fails. Unfortunately it calls .handle_destroy()
when .init() was never invoked or failed. This can lead to crashes when
.handle_destroy() tries to clean up things that were never initialized.
This patch is careful to undo only those steps that completed along the
usb_qdev_init() code path. It's not as pretty as the unified error
handling in
f462141f18ffdd75847f6459ef83d90b831d12c0 but it's necessary.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Andreas Färber [Wed, 30 Nov 2011 15:26:21 +0000 (16:26 +0100)]
exec.c: Fix subpage memory access to RAM MemoryRegion
Commit
95c318f5e1f88d7e5bcc6deac17330fd4806a2d3 (Fix segfault in mmio
subpage handling code.) prevented a segfault by making all subpage
registrations over an existing memory page perform an unassigned access.
Symptoms were writes not taking effect and reads returning zero.
Very small page sizes are not currently supported either,
so subpage memory areas cannot fully be avoided.
Therefore change the previous fix to use a new IO_MEM_SUBPAGE_RAM
instead of IO_MEM_UNASSIGNED. Suggested by Avi.
Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Avi Kivity <avi@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
michael@ozlabs.org [Tue, 13 Dec 2011 01:22:58 +0000 (12:22 +1100)]
vl.c: Print the actual program name in help output
In help() we do what boils down to:
printf("%s", "qemu");
This seems to be an artifact of
be995c27640a82c7056b6f53d02ec823570114e5
("removed unused code"), which removed some ifdef'ery that used to print
a different name depending on CONFIG_SOFTMMU.
Instead print the actual program name, originally from argv[0].
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
michael@ozlabs.org [Tue, 13 Dec 2011 01:22:57 +0000 (12:22 +1100)]
error: Add an accessor for progname
We'd like to get the progname for help output, so add an accessor.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Andreas F=E4rber <afaerber@suse.de>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>