The dtb blob returned by load_device_tree() is in memory allocated
with g_malloc(). Free it accordingly once we have copied its
contents into the guest memory. To make this easy, we need also to
clean up the error handling in load_dtb() so that we consistently
handle errors in the same way (by printing a message and then
returning -1, rather than either plowing on or exiting immediately).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-id: 1371209256-11408-1-git-send-email-peter.maydell@linaro.org
* use dynamic cast whenever possible
* Change function names to some more meaningful prefix
* Change type names to a more meaningful one
* use new style device initialization
Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Message-id: 1369898943-1993-3-git-send-email-jcd@tribudubois.net
Reviewed-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
By calling qemu_devtree_dumpdtb near the end of load_dtb.
Signed-off-by: John Rigby <john.rigby@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
# By Kevin Wolf (22) and Fam Zheng (1)
# Via Stefan Hajnoczi
* stefanha/block: (23 commits)
vmdk: refuse to open higher version than supported
block: Always enable discard on the protocol level
qcow2: Batch discards
qcow2: Options to enable discard for freed clusters
qcow2: Add refcount update reason to all callers
Revert "block: Disable driver-specific options for 1.5"
ide: Clean up ide_exec_cmd()
ide: Convert SMART commands to ide_cmd_table handler
ide: Convert CF-ATA commands to ide_cmd_table handler
ide: Convert ATAPI commands to ide_cmd_table handler
ide: Convert SEEK to ide_cmd_table handler
ide: Convert FLUSH CACHE to ide_cmd_table handler
ide: Convert SET FEATURES to ide_cmd_table handler
ide: Convert CHECK POWER MDOE to ide_cmd_table handler
ide: Convert READ NATIVE MAX ADDRESS to ide_cmd_table handler
ide: Convert DMA read/write commands to ide_cmd_table handler
ide: Convert PIO read/write commands to ide_cmd_table handler
ide: Convert read/write multiple commands to ide_cmd_table handler
ide: Convert verify commands to ide_cmd_table handler
ide: Convert cmd_nop commands to ide_cmd_table handler
...
Message-id: 1372065035-19601-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
# By Andreas Färber (3) and others
# Via Gerd Hoffmann
* kraxel/usb.84:
usb: fix serial number for hid devices
usb: add serial bus property
usb-host-libusb: set USB_DEV_FLAG_IS_HOST
usb/host-libusb: Fix building with libusb git master code
usb/hcd-ehci: Add Faraday FUSBH200 support
usb/hcd-ehci: Replace PORTSC macros with variables
usb/hcd-ehci: Add Tegra2 SysBus EHCI device
usb/hcd-ehci: Split off instance_init from realize
usb/hcd-ehci-sysbus: Convert to QOM realize
# By Stefan Weil (5) and others
# Via Michael Tokarev
* mjt/trivial-patches:
configure: Add signed*signed check to [u]int128_t test
Makefile: pass include directives to dtc via CPPFLAGS, not CFLAGS
qapi: lack of two commas in dict
sd: pass bool parameter for sd_init
qemu-char: use bool in qemu_chr_open_socket and simplify code a bit
vnc: use booleans for vnc_connect, vnc_listen_read and vnc_display_add_client
block/nand: Formatting sweep
qxl: Fix QXLRam initialisation.
acl: acl_add can't insert before last list element, fix
configure: Fix "ERROR: ERROR: " for missing/incompatible DTC
audio: Replace static functions in header file by macros, remove GCC_ATTR
libcacard: Fix cppcheck warning and remove unneeded code
savevm: Fix potential memory leak
kvm: Fix potential resource leak (missing fclose)
qemu-img: Add missing GCC_FMT_ATTR
qemu-options: trivial fix for -mon args help
vl: reformat SDL ifdeffery a bit
Message-id: 1371893076-9643-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Refuse to open higher version for safety.
Although we try to be compatible with published VMDK spec, VMware has
newer version from ESXi 5.1 exported OVF/OVA, which we have no knowledge
what's changed in it. And it is very likely to have more new versions in
the future, so it's not safe to open them blindly.
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Turning on discard options in qcow2 doesn't help a lot when the discard
requests that it issues are thrown away by the raw-posix layer. This
patch always enables discard functionality on the protocol level so that
it's the image format's responsibility to send (or not) discard
requests. Requests sent by the guest will be allowed or ignored by the
top level BlockDriverState, which depends on the discard=... option like
before.
In particular, this means that even without specifying options, the
qcow2 default of discarding deleted snapshots actually takes effect now,
both for qemu and qemu-img.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This optimises the discard operation for freed clusters by batching
discard requests (both snapshot deletion and bdrv_discard end up
updating the refcounts cluster by cluster).
Note that we don't discard asynchronously, but keep s->lock held. This
is to avoid that a freed cluster is reallocated and written to while the
discard is still in flight.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Deleted snapshots are discarded in the image file by default, discard
requests take their default from the -drive discard=... option and other
places that free clusters must always be enabled explicitly.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This adds a refcount update reason to all callers of update_refcounts(),
so that a follow-up patch can use this information to decide whether
clusters that reach a refcount of 0 should be discarded in the image
file.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
All commands are now converted to ide_cmd_table handlers, so it can be
unconditional now and the old switch block can go.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
cmd_nop handles all commands that don't really do anything in our
implementation except setting status register flags.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
As a preparation for moving all IDE commands into their own function
like in the ATAPI code, introduce a 'handler' callback to ide_cmd_table.
Commands using this new infrastructure get some things handled
automatically:
* The BSY flag is set before calling the handler (in order to avoid bugs
like the one fixed in f68ec837) and reset on completion.
* The (obsolete) DSC flag in the status register is set on completion if
the command is flagged with SET_DSC in the command table
* An IRQ is triggered on completion.
* The error register and the ERR flag in the status register are cleared
before calling the handler and on completion it is asserted that
either none or both of them are set.
No commands are converted at this point.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
commit 7b074a22da changed the serial
number of hid devices. Add compat properties to keep the old serial
number for qemu 0.12 and older.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This patch adds a serial property for all usb devices, which can be
used to set the serial number of a usb device (as listed by lsusb -v)
to a specific value. Applies to emulated devices only.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
The next libusb release will deprecate libusb_get_port_path, and since
we compile with -Werror, this breaks the build.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Add Faraday FUSBH200 support, which is slightly different from EHCI spec.
(Or maybe simply a bad/wrong implementation...)
Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Replace PORTSC macros with variables which could then be
configured in ehci_xxxx_class_init(...)
Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This prepares an EHCI device for the Nvidia Tegra2 SoC family.
Values based on patch by Vincent Palatin and verified against TRM v01p.
Cc: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This makes the mem MemoryRegion available to derived instance_inits.
Keep the bus in realize for now since naming breaks in instance_init.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
The SysBus qdev initfn merely calls SysBusDeviceClass::init, so we can
replace it with a realizefn already. This avoids getting into any initfn
ambiguity with the upcoming Faraday EHCI implementation.
Rename internal usb_ehci_initfn() to usb_ehci_realize() to allow to
return Errors from common initialization code as well.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
clang 3.3 with -fsanitize=undefined will fail to link code containing an
int128_t * int128_t multiply (http://llvm.org/bugs/show_bug.cgi?id=16404)
so add this to our configure test for whether [u]int128_t are usable.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
The dtc submodule's makefile expects -I include directives to be
in CPPFLAGS, not CFLAGS. Getting this wrong meant that the include
directive would not be applied when generating the dependency .d
files. This in turn meant that we couldn't build libfdt when
doing an out of tree build with clang. (gcc's dependency output
is slightly different from clang in this situation so it happened
to work.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Local variables is_* should be bool by usage.
While at it, simplify the logic/code a bit.
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Some arguments to these functions are booleans - either by declaration,
or by actual usage, but sometimes value of 0 or 1 is passed for a bool,
and sometimes it is declared as int but a bool value, or true/false,
is passed to it instead. Clean it up a bit.
Cc: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Make this code closer to passing checkpatch. Mostly missing braces, but
a few rogue tabs in there as well.
Cc: qemu-trivial@nongnu.org
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>