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>
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: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: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: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>
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>
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>
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>
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:
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>
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>
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>
Paolo Bonzini [Tue, 13 Dec 2011 12:43:52 +0000 (13:43 +0100)]
fix win32 build
On Windows, cpus.c needs access to the hThread. Add a Windows-specific
function to grab it. This requires changing the CPU threads to
joinable. There is no substantial change because the threads run
in an infinite loop.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Mon, 12 Dec 2011 20:29:36 +0000 (14:29 -0600)]
qdev: add explicitly named devices to the root complex
We first add a 'peripheral' container to the root device that we add user
created devices to. This provides all user created devices with a unique and
isolated namespace.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Mon, 12 Dec 2011 20:29:35 +0000 (14:29 -0600)]
qom: qom_{get, set} monitor commands (v2)
This allows clients to read and write device model properties through QMP. QAPI
doesn't support Visitor types yet and these commands are special in that they
don't work with fixed types.
I've added a documentation stub to qapi-schema.json so we can keep consistency
there.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Mon, 12 Dec 2011 20:29:32 +0000 (14:29 -0600)]
qom: add link properties (v2)
Links represent an ephemeral relationship between devices. They are meant to
replace the qdev concept of busses by allowing more informal relationships
between devices.
Links are fairly limited in their usefulness without implementing QOM-style
subclassing and interfaces.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Mon, 12 Dec 2011 20:29:30 +0000 (14:29 -0600)]
qdev: provide a path resolution (v2)
There are two types of supported paths--absolute paths and partial paths.
Absolute paths are derived from the root device and can follow child<> or
link<> properties. Since they can follow link<> properties, they can be
arbitrarily long. Absolute paths look like absolute filenames and are prefixed
with a leading slash.
Partial paths are look like relative filenames. They do not begin with a
prefix. The matching rules for partial paths are subtle but designed to make
specifying devices easy. At each level of the composition tree, the partial
path is matched as an absolute path. The first match is not returned. At
least two matches are searched for. A successful result is only returned if
only one match is founded. If more than one match is found, a flag is returned
to indicate that the match was ambiguous.
At the end of the day, partial path support means that if you create a device
called 'ide0', you can just say 'ide0' as the path name and it will Just Work.
If we internally create a device called 'i440fx', you can just say 'i440fx' and
it will Just Work and long as you don't do anything silly.
A management tool should probably always use absolute paths since then they
don't have to deal with the possibility of ambiguity.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Mon, 12 Dec 2011 20:29:28 +0000 (14:29 -0600)]
qom: introduce root device
This is based on Jan's suggestion for how to do unique naming. The root device
is the root of composition. All devices are reachable via child<> links from
this device.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Mon, 12 Dec 2011 20:29:27 +0000 (14:29 -0600)]
qom: register legacy properties as new style properties (v2)
Expose all legacy properties through the new QOM property mechanism. The qdev
property types are exposed through the 'legacy<>' namespace. They are always
visited as strings since they do their own string parsing.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Anthony Liguori [Mon, 12 Dec 2011 20:29:26 +0000 (14:29 -0600)]
qom: add new dynamic property infrastructure based on Visitors (v2)
qdev properties are settable only during construction and static to classes.
This isn't flexible enough for QOM.
This patch introduces a property interface for qdev that provides dynamic
properties that are tied to objects, instead of classes. These properties are
Visitor based instead of string based too.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Paolo Bonzini [Fri, 25 Nov 2011 11:06:22 +0000 (12:06 +0100)]
qiov: prevent double free or use-after-free
qemu_iovec_destroy does not clear the QEMUIOVector fully, and the data
could thus be used after free or freed again. While I do not know any
example in the tree, I observed this using virtio-scsi (and SCSI
scatter/gather) when canceling DMA requests.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Avi Kivity [Mon, 5 Dec 2011 17:20:12 +0000 (19:20 +0200)]
coroutine: switch per-thread free pool to a global pool
ucontext-based coroutines use a free pool to reduce allocations and
deallocations of coroutine objects. The pool is per-thread, presumably
to improve locality. However, as coroutines are usually allocated in
a vcpu thread and freed in the I/O thread, the pool accounting gets
screwed up and we end allocating and freeing a coroutine for every I/O
request. This is expensive since large objects are allocated via the
kernel, and are not cached by the C runtime.
Fix by switching to a global pool. This is safe since we're protected
by the global mutex.
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Wed, 7 Dec 2011 11:42:10 +0000 (12:42 +0100)]
qemu-img rebase: Fix for undersized backing files
Backing files may be smaller than the corresponding COW file. When
reading directly from the backing file, qemu-img rebase must consider
this and assume zero sectors after the end of backing files.
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Li Zhi Hui [Wed, 7 Dec 2011 09:25:48 +0000 (17:25 +0800)]
block/qcow2.c: call qcow2_free_snapshots in the function of qcow2_close
Signed-off-by: Li Zhi Hui <zhihuili@linux.vnet.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Paolo Bonzini [Mon, 14 Nov 2011 16:50:54 +0000 (17:50 +0100)]
block: avoid useless checks on acb->bh
Coverity is confused by this "if" and reports leaks on acb->bh.
The bottom half is always deleted before releasing the AIOCB,
in either bdrv_aio_cancel_em or bdrv_aio_bh_cb.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>