Re: [Qemu-devel] [Qemu-trivial] [PATCH] libcacard: g_malloc cleanups
08.05.2014 19:54, Michael Tokarev wrote: > This patch replaces g_malloc() in libcacard into g_new() > or g_new0() where appropriate (removing some init-to-zero > surrounding code), g_malloc+memcpy into g_memdup() and the > like. Applied to trivial-patches qeue, thanks! /mjt
Re: [Qemu-devel] [Qemu-trivial] [PATCH] arch_init: Simplify code for load_xbzrle()
10.05.2014 16:51, Chen Gang wrote: > For xbzrle_decode_buffer(), when decoding contents will exceed writing > buffer, it will return -1, so need not check the return value whether > large than writing buffer. > > And when failure occurs within load_xbzrle(), it always return -1 > without any resources which need release. > > So can remove the related checking statements, and also can remove 'rc' > and 'ret' local variables, Just one comment below. > @@ -933,18 +932,13 @@ static int load_xbzrle(QEMUFile *f, ram_addr_t addr, > void *host) > qemu_get_buffer(f, xbzrle_decoded_buf, xh_len); > > /* decode RLE */ > -ret = xbzrle_decode_buffer(xbzrle_decoded_buf, xh_len, host, > - TARGET_PAGE_SIZE); > -if (ret == -1) { > +if (xbzrle_decode_buffer(xbzrle_decoded_buf, xh_len, host, > + TARGET_PAGE_SIZE) == -1) { Can we compare like '< 0' here, not like '== -1' ? Are there any other possible return values from xbzrle_decode_buffer() which are less than zero but non-error? To me, anything less than zero is always error (unless it is one of the possible non-error values, like offset for example which can be negative). Especially having in mind that in the future, some function may extend its error return to include the actual error code (like -errno), in which case code which compares with -1 will not work anymore. Is it okay to me to apply this with s/== -1/< 0/ ? Thanks, /mjt
Re: [Qemu-devel] [Qemu-trivial] [PATCH] iohandler.c: Properly initialize sigaction struct
16.05.2014 17:00, Peter Maydell wrote: > The code in qemu_init_child_watch() wasn't clearing the 'struct > sigaction' before passing it to sigaction(); this meant that we > would block a random set of signals while executing the SIGCHLD > handler. Initialize properly by using memset() on the struct, > as we do in similar cases elsewhere Applied to -trivial, thank you! /mjt
Re: [Qemu-devel] [Qemu-trivial] [PATCH 1/2] nbd: Close socket on negotiation failure.
13.05.2014 03:35, Hani Benhabiles wrote: > Otherwise, the nbd client may hang waiting for the server response. Applied to -trivial, thanks! /mjt
Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/2] nbd: Miscellaneous typo fixes.
Applied to -trivial, thanks! /mjt
[Qemu-devel] [PATCH] w32: Fix regression caused by new g_poll implementation
Commit 5a007547df76446ab891df93ebc55749716609bf tried to fix a performance degradation caused by bad handling of small timeouts in the original implementation of g_poll. Since that commit, hard disk I/O no longer works. Instead of rewriting the g_poll implementation, this patch simply copies the original code (released under LGPL) from latest glib and only modifies it where needed (see comments in the code). URL of the original code: https://git.gnome.org/browse/glib/tree/glib/gpoll.c Signed-off-by: Stefan Weil --- Hello Peter, please apply this patch directly (regression fix) after it was reviewed. I tested the patch on Linux with wine32 and wine64 (both behave here like native Windows: qemu-system-i386 hangs when reading the hard disk in BIOS without the patch). Still missing: compilation test with MinGW instead of MinGW-w64 (my Linux cross build only supports MinGW-w64). Thanks, Stefan PS. An additional patch could remove the g_poll_fixed hack and simply implement g_poll here. util/oslib-win32.c | 231 ++-- 1 file changed, 152 insertions(+), 79 deletions(-) diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 3077df3..d04dc8f 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -138,7 +138,7 @@ int inet_aton(const char *cp, struct in_addr *ia) { uint32_t addr = inet_addr(cp); if (addr == 0x) { - return 0; +return 0; } ia->s_addr = addr; return 1; @@ -256,113 +256,186 @@ char *qemu_get_exec_dir(void) } /* - * g_poll has a problem on Windows when using - * timeouts < 10ms, in glib/gpoll.c: + * The original implementation of g_poll from glib has a problem on Windows + * when using timeouts < 10 ms. * - * // If not, and we have a significant timeout, poll again with - * // timeout then. Note that this will return indication for only - * // one event, or only for messages. We ignore timeouts less than - * // ten milliseconds as they are mostly pointless on Windows, the - * // MsgWaitForMultipleObjectsEx() call will timeout right away - * // anyway. + * Whenever g_poll is called with timeout < 10 ms, it does a quick poll instead + * of wait. This causes significant performance degradation of QEMU. * - * if (retval == 0 && (timeout == INFINITE || timeout >= 10)) - * retval = poll_rest (poll_msgs, handles, nhandles, fds, nfds, timeout); - * - * So whenever g_poll is called with timeout < 10ms it does - * a quick poll instead of wait, this causes significant performance - * degradation of QEMU, thus we should use WaitForMultipleObjectsEx - * directly + * The following code is a copy of the original code from glib/gpoll.c + * (glib commit 20f4d1820b8d4d0fc4447188e33efffd6d4a88d8 from 2014-02-19). + * Some debug code was removed and the code was reformatted. + * All other code modifications are marked with 'QEMU'. */ -gint g_poll_fixed(GPollFD *fds, guint nfds, gint timeout) + +static int poll_rest(gboolean poll_msgs, HANDLE *handles, gint nhandles, + GPollFD *fds, guint nfds, gint timeout) { -guint i; -HANDLE handles[MAXIMUM_WAIT_OBJECTS]; -gint nhandles = 0; -int num_completed = 0; +DWORD ready; +GPollFD *f; +int recursed_result; -for (i = 0; i < nfds; i++) { -gint j; +if (poll_msgs) { +/* Wait for either messages or handles + * -> Use MsgWaitForMultipleObjectsEx + */ +ready = MsgWaitForMultipleObjectsEx(nhandles, handles, timeout, +QS_ALLINPUT, MWMO_ALERTABLE); -if (fds[i].fd <= 0) { -continue; +if (ready == WAIT_FAILED) { +gchar *emsg = g_win32_error_message(GetLastError()); +g_warning("MsgWaitForMultipleObjectsEx failed: %s", emsg); +g_free(emsg); } - -/* don't add same handle several times +} else if (nhandles == 0) { +/* No handles to wait for, just the timeout */ +if (timeout == INFINITE) { +ready = WAIT_FAILED; +} else { +SleepEx(timeout, TRUE); +ready = WAIT_TIMEOUT; +} +} else { +/* Wait for just handles + * -> Use WaitForMultipleObjectsEx */ -for (j = 0; j < nhandles; j++) { -if (handles[j] == (HANDLE)fds[i].fd) { -break; -} +ready = +WaitForMultipleObjectsEx(nhandles, handles, FALSE, timeout, TRUE); +if (ready == WAIT_FAILED) { +gchar *emsg = g_win32_error_message(GetLastError()); +g_warning("WaitForMultipleObjectsEx failed: %s", emsg); +g_free(emsg); } +} -if (j == nhandles) { -if (nhandles == MAXIMUM_WAIT_OBJECTS) { -fprintf(stderr, "Too many handles to wait for!\n"); -break; -} else { -handles[nhandles++] = (HANDLE)fds[i].fd; +if (re
Re: [Qemu-devel] [PATCH v2] Add remove_boot_device_path() function for hot-unplug device
On 05/15/2014 11:07 PM, Michael S. Tsirkin wrote: On Wed, Apr 16, 2014 at 10:20:57PM +0800, Jun Li wrote: Add remove_boot_device_path() function to remove bootindex when hot-unplug a device. This patch fixed virtio-blk/virtio-net/scsi-disk/scsi-generic device. So it has fixed bug1086603, ref: https://bugzilla.redhat.com/show_bug.cgi?id=1086603 Make some changes based on Andreas's good suggestion. Signed-off-by: Jun Li --- hw/block/virtio-blk.c | 1 + hw/net/virtio-net.c | 1 + hw/scsi/scsi-disk.c | 6 -- hw/scsi/scsi-generic.c | 3 +++ include/sysemu/sysemu.h | 2 ++ vl.c| 16 6 files changed, 27 insertions(+), 2 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 8a568e5..ecdd266 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -752,6 +752,7 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp) unregister_savevm(dev, "virtio-blk", s); blockdev_mark_auto_del(s->bs); virtio_cleanup(vdev); +remove_boot_device_path(s->conf->bootindex, dev, "/disk@0,0"); } static Property virtio_blk_properties[] = { diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 33bd233..520c029 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1633,6 +1633,7 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp) g_free(n->vqs); qemu_del_nic(n->nic); virtio_cleanup(vdev); +remove_boot_device_path(n->nic_conf.bootindex, dev, "/ethernet-phy@0"); } static void virtio_net_instance_init(Object *obj) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 48a28ae..bb2176a 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2150,12 +2150,14 @@ static void scsi_disk_reset(DeviceState *dev) s->tray_open = 0; } -static void scsi_destroy(SCSIDevice *dev) +static void scsi_destroy(SCSIDevice *sdev) { -SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev); +SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, sdev); +DeviceState *dev = DEVICE(sdev); scsi_device_purge_requests(&s->qdev, SENSE_CODE(NO_SENSE)); blockdev_mark_auto_del(s->qdev.conf.bs); +remove_boot_device_path(s->qdev.conf.bootindex, dev, NULL); } static void scsi_disk_resize_cb(void *opaque) diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 8d92e0d..2531a44 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -388,8 +388,11 @@ static void scsi_generic_reset(DeviceState *dev) static void scsi_destroy(SCSIDevice *s) { +DeviceState *dev = DEVICE(s); + scsi_device_purge_requests(s, SENSE_CODE(NO_SENSE)); blockdev_mark_auto_del(s->conf.bs); +remove_boot_device_path(s->conf.bootindex, dev, NULL); } static int scsi_generic_initfn(SCSIDevice *s) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index ba5c7f8..f7ad1e2 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -193,6 +193,8 @@ void rtc_change_mon_event(struct tm *tm); void add_boot_device_path(int32_t bootindex, DeviceState *dev, const char *suffix); +void remove_boot_device_path(int32_t bootindex, DeviceState *dev, + const char *suffix); char *get_boot_devices_list(size_t *size, bool ignore_suffixes); DeviceState *get_boot_device(uint32_t position); diff --git a/vl.c b/vl.c index 9975e5a..1713c68 100644 --- a/vl.c +++ b/vl.c @@ -1184,6 +1184,22 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev, QTAILQ_INSERT_TAIL(&fw_boot_order, node, link); } +void remove_boot_device_path(int32_t bootindex, DeviceState *dev, + const char *suffix) Why do we need suffix here? It seems unused. Hi Michael, I just want to keep the same as function "add_boot_device_path". Such as: void add_boot_device_path(int32_t bootindex, DeviceState *dev, const char *suffix) I also find another function has define mon, but not be used in this function. Such as: ---file vl.c--- do_usb_del(Monitor *mon, const QDict *qdict) { const char *devname = qdict_get_str(qdict, "devname"); if (usb_device_del(devname) < 0) { error_report("could not delete USB device '%s'", devname); } } Best Regards, Jun Li +{ +FWBootEntry *node, *next_node; + +if (bootindex == -1) { +return; +} + +QTAILQ_FOREACH_SAFE(node, &fw_boot_order, link, next_node) +if (node->bootindex == bootindex) { +QTAILQ_REMOVE(&fw_boot_order, node, link); +return; +} +} + DeviceState *get_boot_device(uint32_t position) { uint32_t counter = 0; -- 1.8.3.1
Re: [Qemu-devel] [PATCH v3] snapshot: fixed bdrv_get_full_backing_filename can not get correct full_backing_filename
On 05/14/2014 09:05 PM, Fam Zheng wrote: On Wed, 05/14 14:40, Stefan Hajnoczi wrote: On Sun, May 11, 2014 at 12:35:57AM +0800, Jun Li wrote: From: Jun Li This patch fixed the following bug: https://bugzilla.redhat.com/show_bug.cgi?id=1084302 . path_combine can not calculate the correct full path name for backing_file. Such as: create a snapshot chain: sn2->sn1->$BASE_IMG backing file is : /home/wookpecker/img.qcow2 sn1 : /home/woodpecker/tmp/sn1 sn2 : /home/woodpecker/tmp/sn2 when create sn2, path_combine can not got a correct path for $BASE_IMG. In this patch, will check the backing_filename is a symlink or not firstly, then return the full(absolute) path via realpath. Signed-off-by: Jun Li --- block.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) Please fix your patch email submission process so it doesn't send the same patch multiple times. ok , thx. You've done this several times in the past. It makes patch review more difficult than it needs to be for reviewers. If I have to compare several emails and figure out which patch is the right one before reviewing I'm inclined not to review at all. ok, thank you very much. This is indeed very confusing. (I've showed Jun the configuration I have to send patches.) If you hit enter too quickly or forgot something, it's OK to try again, but using distinct subjects is important and makes it easier for us to know what's happening. If, by mistake the subjects you send are the same, please reply yourself to the list, saying "please ignore this one", so we know which to look at. ok, got it. Thx. Fam Thanks Fam and Stefan, I have configured my msmtp(via gmail) successfully. As I specify the wrong smtpserver with smtp.gmail.com before, now the gmail smtpserver is smtp.googlemail.com. Best Regards, Jun Li
Re: [Qemu-devel] [PATCH v2] qcow2: Patch for shrinking qcow2 disk image
On 05/15/2014 08:36 AM, Max Reitz wrote: On 09.05.2014 17:20, Jun Li wrote: As the realization of raw shrinking, so when do qcow2 shrinking, do not *when doing check l1 entries. When resize to size1(size1 < "disk size"), the custemer *customer Sorry ~ :-) knows this will destory the data. So no need to check the l1 entries which is used or not. I'd somehow like to disagree, but you're correct. raw-posix truncates the file regardless of whether there is data or not as well. Maybe we should later add support for reporting potential data loss and asking the user what to do (I'm thinking of some "force" or "accept_loss" boolean for bdrv_truncate()). ok, I will try to realize it in the update version of patch. This is v2 of the original patch. thx. This should not be part of the commit message, but rather follow the "---" under your Signed-off-by. sorry, thx, :-) Signed-off-by: Jun Li --- block/qcow2-cluster.c | 17 - block/qcow2-snapshot.c | 2 +- block/qcow2.c | 10 ++ block/qcow2.h | 4 ++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 76d2bcf..8fbbf7f 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -29,8 +29,8 @@ #include "block/qcow2.h" #include "trace.h" -int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size, -bool exact_size) +int qcow2_truncate_l1_table(BlockDriverState *bs, uint64_t min_size, +bool exact_size) { BDRVQcowState *s = bs->opaque; int new_l1_size2, ret, i; @@ -39,8 +39,9 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size, int64_t new_l1_table_offset, new_l1_size; uint8_t data[12]; -if (min_size <= s->l1_size) +if (min_size == s->l1_size) { return 0; +} /* Do a sanity check on min_size before trying to calculate new_l1_size * (this prevents overflows during the while loop for the calculation of @@ -73,7 +74,13 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size, new_l1_size2 = sizeof(uint64_t) * new_l1_size; new_l1_table = g_malloc0(align_offset(new_l1_size2, 512)); -memcpy(new_l1_table, s->l1_table, s->l1_size * sizeof(uint64_t)); + +/* shrinking or growing l1 table */ +if (min_size < s->l1_size) { +memcpy(new_l1_table, s->l1_table, new_l1_size2); +} else { +memcpy(new_l1_table, s->l1_table, s->l1_size * sizeof(uint64_t)); +} /* write new table (align to cluster) */ BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_ALLOC_TABLE); So, as far as I understand the new logic of qcow2_truncate_l1_table(), it will always grow the table unless exact_size == true, in which case it may be shrunk as well. This should probably be reflected in the if condition ("if (exact_size ? min_size == s->l1_size : min_size <= s->l1_size)" or something like that). But on the other hand, I don't like a function which suggests being usable for both shrinking and growing, which then can be used for shrinking only in a special case (exact_size == true). You should at least add a comment which states that this function is generally intended for growing the L1 table with min_size being the new minimal size, but may also be used for shrinking if exact_size is true. ok, checking... Apart from that, if you're shrinking the L1 table, you should in my opinion free all clusters referenced from the truncated area. It is true that it's the user's responsibility to make sure no data is lost, but if you just shrink the L1 table without doing anything about the lost data references, clusters will be leaked. This can easily be fixed by qemu-img check, but there are two problems with that: First, data should be leaked only if it cannot be avoided. It can easily be repaired, but unless there are errors during some operation, that should not be necessary. Second, qemu-img check actually does not work for all image sizes that qemu itself supports. This is even more reason to avoid leaks: Normally, it can easily be repaired, but sometimes, it cannot. ok, thx~ Agree to free all clusters referenced from the truncated area. Checking... Will realize this in v3 of patch. @@ -558,7 +565,7 @@ static int get_cluster_table(BlockDriverState *bs, uint64_t offset, l1_index = offset >> (s->l2_bits + s->cluster_bits); if (l1_index >= s->l1_size) { -ret = qcow2_grow_l1_table(bs, l1_index + 1, false); +ret = qcow2_truncate_l1_table(bs, l1_index + 1, false); if (ret < 0) { return ret; } diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index 0aa9def..6ba460e 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c @@ -483,7 +483,7 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id) * L1 table of the snapshot. If the snapsho
[Qemu-devel] [PATCH] configure: Automatically select GTK+ 3.0 if GTK+ 2.0 is unavailable
The configure option --with-gtkabi=3.0 is still supported, but no longer needed when GTK+-2.0 is missing. When no GTK+ ABI is selected by the user, configure first tries 2.0, then 3.0. For some platforms (e.g. Windows) newer binaries of GTK+ are only available for GTK+ 3.0. Now building on these platforms is a little bit easier. Signed-off-by: Stefan Weil --- configure | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 605a0ec..678a106 100755 --- a/configure +++ b/configure @@ -317,7 +317,7 @@ glusterfs_discard="no" glusterfs_zerofill="no" virtio_blk_data_plane="" gtk="" -gtkabi="2.0" +gtkabi="" vte="" tpm="no" libssh2="" @@ -1970,6 +1970,18 @@ fi ## # GTK probe +if test "$gtkabi" = ""; then +# The GTK ABI was not specified explicitly, so try whether 2.0 is available. +# Use 3.0 as a fallback if that is available. +if $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then +gtkabi=2.0 +elif $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then +gtkabi=3.0 +else +gtkabi=2.0 +fi +fi + if test "$gtk" != "no"; then gtkpackage="gtk+-$gtkabi" if test "$gtkabi" = "3.0" ; then @@ -1983,7 +1995,7 @@ if test "$gtk" != "no"; then libs_softmmu="$gtk_libs $libs_softmmu" gtk="yes" elif test "$gtk" = "yes"; then -feature_not_found "gtk" "Install gtk2 or gtk3 (requires --with-gtkabi=3.0 option to configure) devel" +feature_not_found "gtk" "Install gtk2 or gtk3 devel" else gtk="no" fi @@ -2006,7 +2018,11 @@ if test "$vte" != "no"; then libs_softmmu="$vte_libs $libs_softmmu" vte="yes" elif test "$vte" = "yes"; then -feature_not_found "vte" "Install libvte or libvte-2.90 (requires --with-gtkabi=3.0 option to configure) devel" +if test "$gtkabi" = "3.0"; then +feature_not_found "vte" "Install libvte-2.90 devel" +else +feature_not_found "vte" "Install libvte devel" +fi else vte="no" fi -- 1.7.10.4
Re: [Qemu-devel] [PATCH 1/2] target-mips: pass CPUMIPSState to gen_mfc0/mtc0/dmfc0/dmtc0
On 05/16/2014 11:13 AM, Petar Jovanovic wrote: > > -static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel) > +static void gen_mfc0(CPUMIPSState *env, DisasContext *ctx, > + You should not be passing around env within the translator, at all. You should be able to get everything you need from ctx->hflags or ctx->insn_flags. If there's something missing from ctx, then we'll talk about additional changes. r~
Re: [Qemu-devel] [PATCH 2/2] target-mips: implement UserLocal Register
On 05/16/2014 11:13 AM, Petar Jovanovic wrote: > +target_ulong helper_rdhwr_ul(CPUMIPSState *env) > +{ > +if ((env->hflags & MIPS_HFLAG_CP0) || > +(env->CP0_HWREna & (1 << 29))) { > +return env->CP0_UserLocal; > +} else { > +helper_raise_exception(env, EXCP_RI); > +} > + > +return 0; > +} > + You shouldn't need a helper at all. We're supposed to check all of these sorts of permissions at translation time, so you should be able to issue a load or an exception directly from the translator. > +if (env->CP0_Config3 & (1 << CP0C3_ULRI)) { What is this check, and why isn't it present in ctx->hflags? > +tcg_gen_ld_tl(arg, cpu_env, > + offsetof(CPUMIPSState, CP0_UserLocal)); > +tcg_gen_ext32s_tl(arg, arg); One operation: tcg_gen_ld32s_tl. > #else > -/* XXX: Some CPUs implement this in hardware. > - Not supported yet. */ > +save_cpu_state(ctx, 1); > +gen_helper_rdhwr_ul(t0, cpu_env); > +gen_store_gpr(t0, rt); > +break; > #endif > This should be at least partially merged with the user-only tls_value code. r~
Re: [Qemu-devel] [PULL 0/1] virtio update
On Thu, May 15, 2014 at 06:35:05PM +0100, Peter Maydell wrote: > On 15 May 2014 17:33, Michael S. Tsirkin wrote: > > On Thu, May 15, 2014 at 05:32:05PM +0100, Peter Maydell wrote: > >> On 14 May 2014 04:53, Michael S. Tsirkin wrote: > >> > > >> > Resending: same as previous pull request but with numbers in the subject. > >> > Sorry about the noise. > >> > > >> > > >> > The following changes since commit > >> > 06b4f00d53637f2c16a62c2cbaa30bffb045cf88: > >> > > >> > Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into > >> > staging (2014-05-09 15:46:34 +0100) > >> > > >> > are available in the git repository at: > >> > > >> > > >> > git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git for_upstream > >> > > >> > for you to fetch changes up to 937251408051e0489f78e4db3c92e045b147b38b: > >> > > >> > virtio: allow mapping up to max queue size (2014-05-12 12:07:21 +0300) > >> > >> My apply-pullreq script complains: > >> merge: remotes/mst/for_upstream - not something we can merge > >> > >> did you mean "tags/for_upstream" ? > >> > >> thanks > >> -- PMM > > > > Yes: git used to get this right but it looks like it's broken in git > > master. > > hashes match and it's signed properly ... > > want me to resend? > > That's OK, I just wanted to check the tag name. (I notice this > kind of mismatch because I just copy-paste the url-and-branchname > onto my commandline. Also if we were ever to implement some kind > of automatic testing of pull-request-emails the automated script > would notice :-)) > > Applied, thanks. > > -- PMM Note for git 2.0 users (once that's out): you must use tags/ for your pull requests, otherwise people using older clients will fail to pull from you. -- MST
Re: [Qemu-devel] [PATCH RFC 1/8] virtio: add subsections to the migration stream
On Thu, May 15, 2014 at 09:04:49AM +0200, Greg Kurz wrote: > On Thu, 15 May 2014 12:16:35 +0530 > Amit Shah wrote: > > On (Thu) 15 May 2014 [09:23:51], Michael S. Tsirkin wrote: > > > On Thu, May 15, 2014 at 11:34:25AM +0530, Amit Shah wrote: > > > > On (Wed) 14 May 2014 [17:41:38], Greg Kurz wrote: > > > > > There is a need to add some more fields to VirtIODevice that should be > > > > > migrated (broken status, endianness). The problem is that we do not > > > > > want to break compatibility while adding a new feature... This issue > > > > > has > > > > > been addressed in the generic VMState code with the use of optional > > > > > subsections. As a *temporary* alternative to port the whole virtio > > > > > migration code to VMState, this patch mimics a similar subsectionning > > > > > ability for virtio. > > > > BTW Greg, do you plan on working on vmstate for virtio? > > > > Yes. > > > > > > Since each virtio device is streamed in its own section, the idea is > > > > > to > > > > > stream subsections between the end of the device section and the start > > > > > of the next sections. This allows an older QEMU to complain and exit > > > > > when fed with subsections: > > > > > > > > > > Unknown savevm section type 5 > > > > > Error -22 while loading VM state > > > > > > > > Please make this configurable -- either via configure or device > > > > properties. That avoids having to break existing configurations that > > > > work without this patch. > > > > > > > > > All users of virtio_load()/virtio_save() need to be patched because > > > > > the > > > > > subsections are streamed AFTER the device itself. > > > > > > > > Since all have the same fixup, I'm wondering if a new section can be > > > > added to the virtio-bus itself, which gets propagated to all devices > > > > upon load in the dest. > > > > > > This calls for a way for devices to inherit properties from the bus, > > > which doesn't exist ATM. > > > Fine but let's not hold up this patchset because of this. > > > > No, only suggestion is to add a migration section in the bus, and then > > it's easier to do this in the post-migrate functions for each device > > -- so only one new section gets introduced instead of all devices > > being modified to send a new subsection. > > > > The main problem I see is that virtio sucks: as you see in patch 8, we have > to be careful not to call vring or virtqueue stuff before the device knows > its endianness or it breaks... I see. I think it's all not a big deal. People here suggested many ways to deal with it, but IMHO the only thing that does matter is the functionality. Functionality-wise I think the only two things that were mentioned were - decent chance that migration to a wrong machine version fails gracefully - migrate in a compatible way with correct legacy machine version > I need to study how the virtio-bus gets > migrated to ensure the endian section is streamed before the devices. > > > Amit > > > > Thanks. > > -- > Gregory Kurz kurzg...@fr.ibm.com > gk...@linux.vnet.ibm.com > Software Engineer @ IBM/Meiosys http://www.ibm.com > Tel +33 (0)562 165 496 > > "Anarchy is about taking complete responsibility for yourself." > Alan Moore.
[Qemu-devel] [PATCHv5 1/3] util: add qemu_iovec_is_zero
Signed-off-by: Peter Lieven --- include/qemu-common.h |1 + util/iov.c| 21 + 2 files changed, 22 insertions(+) diff --git a/include/qemu-common.h b/include/qemu-common.h index 3f3fd60..66ceceb 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -318,6 +318,7 @@ void qemu_iovec_concat(QEMUIOVector *dst, void qemu_iovec_concat_iov(QEMUIOVector *dst, struct iovec *src_iov, unsigned int src_cnt, size_t soffset, size_t sbytes); +bool qemu_iovec_is_zero(QEMUIOVector *qiov); void qemu_iovec_destroy(QEMUIOVector *qiov); void qemu_iovec_reset(QEMUIOVector *qiov); size_t qemu_iovec_to_buf(QEMUIOVector *qiov, size_t offset, diff --git a/util/iov.c b/util/iov.c index 6569b5a..622db81 100644 --- a/util/iov.c +++ b/util/iov.c @@ -335,6 +335,27 @@ void qemu_iovec_concat(QEMUIOVector *dst, qemu_iovec_concat_iov(dst, src->iov, src->niov, soffset, sbytes); } +/* + * check if the contents of the iovecs are all zero + */ +bool qemu_iovec_is_zero(QEMUIOVector *qiov) +{ +int i; +for (i = 0; i < qiov->niov; i++) { +size_t offs = QEMU_ALIGN_DOWN(qiov->iov[i].iov_len, 4 * sizeof(long)); +uint8_t *ptr = qiov->iov[i].iov_base; +if (offs && !buffer_is_zero(qiov->iov[i].iov_base, offs)) { +return false; +} +for (; offs < qiov->iov[i].iov_len; offs++) { +if (ptr[offs]) { +return false; +} +} +} +return true; +} + void qemu_iovec_destroy(QEMUIOVector *qiov) { assert(qiov->nalloc != -1); -- 1.7.9.5
[Qemu-devel] [PATCHv5 3/3] block: optimize zero writes with bdrv_write_zeroes
this patch tries to optimize zero write requests by automatically using bdrv_write_zeroes if it is supported by the format. This significantly speeds up file system initialization and should speed zero write test used to test backend storage performance. I ran the following 2 tests on my internal SSD with a 50G QCOW2 container and on an attached iSCSI storage. a) mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/vdX QCOW2 [off] [on] [unmap] - runtime: 14secs1.1secs 1.1secs filesize: 937M 18M 18M iSCSI [off] [on] [unmap] runtime: 9.3s 0.9s 0.9s b) dd if=/dev/zero of=/dev/vdX bs=1M oflag=direct QCOW2 [off] [on] [unmap] - runtime: 246secs 18secs 18secs filesize: 51G 192K 192K throughput:203M/s2.3G/s 2.3G/s iSCSI*[off] [on] [unmap] runtime: 8mins 45secs 33secs throughput:106M/s1.2G/s 1.6G/s allocated: 100% 100% 0% * The storage was connected via an 1Gbit interface. It seems to internally handle writing zeroes via WRITESAME16 very fast. Signed-off-by: Peter Lieven --- block.c |9 block/qapi.c |1 + blockdev.c| 24 + hmp.c |5 + include/block/block_int.h |1 + qapi-schema.json | 52 - qemu-options.hx |6 ++ qmp-commands.hx |3 +++ 8 files changed, 86 insertions(+), 15 deletions(-) diff --git a/block.c b/block.c index c90c71a..0aafe67 100644 --- a/block.c +++ b/block.c @@ -3248,6 +3248,15 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs, ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req); +if (!ret && bs->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF && +!(flags & BDRV_REQ_ZERO_WRITE) && drv->bdrv_co_write_zeroes && +qemu_iovec_is_zero(qiov)) { +flags |= BDRV_REQ_ZERO_WRITE; +if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP) { +flags |= BDRV_REQ_MAY_UNMAP; +} +} + if (ret < 0) { /* Do nothing, write notifier decided to fail this request */ } else if (flags & BDRV_REQ_ZERO_WRITE) { diff --git a/block/qapi.c b/block/qapi.c index af11445..75f44f1 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -50,6 +50,7 @@ BlockDeviceInfo *bdrv_block_device_info(BlockDriverState *bs) } info->backing_file_depth = bdrv_get_backing_file_depth(bs); +info->detect_zeroes = bs->detect_zeroes; if (bs->io_limits_enabled) { ThrottleConfig cfg; diff --git a/blockdev.c b/blockdev.c index 8358aa2..5ec55fa 100644 --- a/blockdev.c +++ b/blockdev.c @@ -341,6 +341,7 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts, QemuOpts *opts; const char *id; bool has_driver_specific_opts; +BlockdevDetectZeroesOptions detect_zeroes; BlockDriver *drv = NULL; /* Check common options by copying from bs_opts to opts, all other options @@ -469,6 +470,24 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts, } } +detect_zeroes = +parse_enum_option(BlockdevDetectZeroesOptions_lookup, + qemu_opt_get(opts, "detect-zeroes"), + BLOCKDEV_DETECT_ZEROES_OPTIONS_MAX, + BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF, + &error); +if (error) { +error_propagate(errp, error); +goto early_err; +} + +if (detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP && +!(bdrv_flags & BDRV_O_UNMAP)) { +error_setg(errp, "setting detect-zeroes to unmap is not allowed " + "without setting discard operation to unmap"); +goto early_err; +} + /* init */ dinfo = g_malloc0(sizeof(*dinfo)); dinfo->id = g_strdup(qemu_opts_id(opts)); @@ -479,6 +498,7 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts, } dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0; dinfo->bdrv->read_only = ro; +dinfo->bdrv->detect_zeroes = detect_zeroes; dinfo->refcount = 1; if (serial != NULL) { dinfo->serial = g_strdup(serial); @@ -2472,6 +2492,10 @@ QemuOptsList qemu_common_drive_opts = { .name = "copy-on-read", .type = QEMU_OPT_BOOL, .help = "copy read data from backing file into image file", +},{ +.name = "detect-zeroes", +.type = QEMU_OPT_STRING, +.help = "try to optimize zero writes (off, on, unmap)", }, { /* end of list */ } }, diff --git a/hmp.c b/hmp.c index 5c4d612..ff506f3 100644 --- a/hmp.c +++ b/hmp.c @@ -341,6 +341,11 @@ void hmp_info_block(Monitor *mon, const QDict *qdict)
[Qemu-devel] [PATCHv5 2/3] blockdev: add a function to parse enum ids from strings
this adds a generic function to recover the enum id of a parameter given as a string. Signed-off-by: Peter Lieven --- blockdev.c | 17 + 1 file changed, 17 insertions(+) diff --git a/blockdev.c b/blockdev.c index 7810e9f..8358aa2 100644 --- a/blockdev.c +++ b/blockdev.c @@ -288,6 +288,23 @@ static int parse_block_error_action(const char *buf, bool is_read, Error **errp) } } +static inline int parse_enum_option(const char *lookup[], const char *buf, int max, + int def, Error **errp) +{ +int i; +if (!buf) { +return def; +} +for (i = 0; i < max; i++) { +if (!strcmp(buf, lookup[i])) { +return i; +} +} +error_setg(errp, "invalid parameter value: %s", + buf); +return def; +} + static bool check_throttle_config(ThrottleConfig *cfg, Error **errp) { if (throttle_conflicting(cfg)) { -- 1.7.9.5
[Qemu-devel] [PATCHv5 0/3] block: optimize zero writes with bdrv_write_zeroes
this series tries to optimize zero write requests by automatically using bdrv_write_zeroes if it is supported by the format. More details can be found in the commit message to patch 3. Changes: v4->v5: - split patch into 3 separate patches [Kevin, Eric] - use QEMU_ALIGN_DOWN in qemu_iovec_is_zero [Kevin] - remove check for bs->file from the "pretty long condition" [Kevin] - added possible values for discard-zeroes to QemuOptsList [Eric] - fail if detect-zeroes = unmap is choosen without discard = unmap [Kevin] - show detect-zeroes mode always in hmp if enabled [Kevin] v3->v4: - use QAPI generated enum and lookup table [Kevin] - added more details about the options in the comments of the qapi-schema [Eric] - changed the type of detect_zeroes from str to BlockdevDetectZeroesOptions. I left the name as is because it is consistent with e.g. BlockdevDiscardOptions or BlockdevAioOptions [Eric] - changed the parse function in blockdev_init to be generic usable for other enum parameters v2->v3: - moved parameter parsing to blockdev_init - added per device detect_zeroes status to hmp (info block -v) and qmp (query-block) [Eric] - added support to enable detect-zeroes also for hot added devices [Eric] - added missing entry to qemu_common_drive_opts - fixed description of qemu_iovec_is_zero [Fam] v1->v2: - added tests to commit message (Markus) RFCv2->v1: - fixed paramter parsing strncmp -> strcmp (Eric) - fixed typo (choosen->chosen) (Eric) - added second example to commit msg RFCv1->RFCv2: - add detect-zeroes=off|on|unmap knob to drive cmdline parameter - call zero detection only for format (bs->file != NULL) Peter Lieven (3): util: add qemu_iovec_is_zero blockdev: add a function to parse enum ids from strings block: optimize zero writes with bdrv_write_zeroes block.c |9 block/qapi.c |1 + blockdev.c| 41 +++ hmp.c |5 + include/block/block_int.h |1 + include/qemu-common.h |1 + qapi-schema.json | 52 - qemu-options.hx |6 ++ qmp-commands.hx |3 +++ util/iov.c| 21 ++ 10 files changed, 125 insertions(+), 15 deletions(-) -- 1.7.9.5
[Qemu-devel] [PATCH v3 00/16] Convert debug printfs to QEMU_DPRINTF
Add QEMU_DPRINTF to substitute debug printfs and use the same format through the codebase. Marc Marí (16): include/qemu-common.h: Add QEMU_DPRINTF macro x86: Convert debug printfs to QEMU_DPRINTF s390: Convert debug printfs to QEMU_DPRINTF scsi: Convert debug printfs to QEMU_DPRINTF highbank: Convert debug printfs to QEMU_DPRINTF xilinx: Convert debug printfs to QEMU_DPRINTF spapr: Convert debug printfs to QEMU_DPRINTF stellaris: Convert debug printfs to QEMU_DPRINTF i82374: Convert debug printfs to QEMU_DPRINTF i8257: Convert debug printfs to QEMU_DPRINTF rc4030: Convert debug printfs to QEMU_DPRINTF sd: Convert debug printfs to QEMU_DPRINTF isa: Convert debug printfs to QEMU_DPRINTF lan9118: Convert debug printfs to QEMU_DPRINTF pci-host: Convert debug printfs to QEMU_DPRINTF common: Convert debug printfs to QEMU_DPRINTF hw/dma/i82374.c| 31 --- hw/dma/i8257.c | 14 -- hw/dma/rc4030.c| 29 +++-- hw/i386/kvm/pci-assign.c | 11 ++- hw/i386/multiboot.c|7 +-- hw/isa/vt82c686.c | 12 hw/net/cadence_gem.c | 24 hw/net/lan9118.c | 29 +++-- hw/net/spapr_llan.c|6 -- hw/net/stellaris_enet.c| 21 ++--- hw/net/xgmac.c | 27 +++ hw/pci-host/bonito.c | 13 + hw/pci-host/ppce500.c | 21 + hw/s390x/s390-virtio-bus.c |9 + hw/s390x/s390-virtio.c |9 + hw/scsi/lsi53c895a.c | 22 +- hw/scsi/scsi-generic.c | 14 +++--- hw/scsi/spapr_vscsi.c |9 + hw/sd/sd.c |8 +--- hw/sd/ssi-sd.c | 19 --- include/qemu-common.h |7 +++ migration-rdma.c | 31 +-- page_cache.c | 11 +++ target-i386/kvm.c |9 + target-s390x/helper.c | 23 +++ target-s390x/kvm.c |9 + xen-hvm.c |9 + xen-mapcache.c |9 + 28 files changed, 266 insertions(+), 177 deletions(-) -- 1.7.10.4
[Qemu-devel] [PATCH v3 02/16] x86: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. Signed-off-by: Marc Marí --- hw/i386/kvm/pci-assign.c | 11 ++- hw/i386/multiboot.c |7 +-- target-i386/kvm.c|9 + xen-hvm.c|9 + xen-mapcache.c |9 + 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index de33657..21330a9 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -51,14 +51,15 @@ //#define DEVICE_ASSIGNMENT_DEBUG #ifdef DEVICE_ASSIGNMENT_DEBUG -#define DEBUG(fmt, ...) \ -do { \ -fprintf(stderr, "%s: " fmt, __func__ , __VA_ARGS__); \ -} while (0) +#define DEVICE_ASSIGNMENT_DEBUG_ENABLED 1 #else -#define DEBUG(fmt, ...) +#define DEVICE_ASSIGNMENT_DEBUG_ENABLED 0 #endif +#define DEBUG(fmt, ...) \ +QEMU_DPRINTF(DEVICE_ASSIGNMENT_DEBUG_ENABLED, \ +"pci_assign", fmt, ## __VA_ARGS__) + typedef struct PCIRegion { int type; /* Memory or port I/O */ int valid; diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c index 985ca1e..cd04339 100644 --- a/hw/i386/multiboot.c +++ b/hw/i386/multiboot.c @@ -33,11 +33,14 @@ //#define DEBUG_MULTIBOOT #ifdef DEBUG_MULTIBOOT -#define mb_debug(a...) fprintf(stderr, ## a) +#define DEBUG_MULTIBOOT_ENABLED 1 #else -#define mb_debug(a...) +#define DEBUG_MULTIBOOT_ENABLED 0 #endif +#define mb_debug(...) \ +QEMU_DPRINTF(DEBUG_MULTIBOOT_ENABLED, "i386 multiboot", __VA_ARGS__) + #define MULTIBOOT_STRUCT_ADDR 0x9000 #if MULTIBOOT_STRUCT_ADDR > 0xf diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 0d894ef..53098ad 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -39,13 +39,14 @@ //#define DEBUG_KVM #ifdef DEBUG_KVM -#define DPRINTF(fmt, ...) \ -do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_KVM_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ -do { } while (0) +#define DEBUG_KVM_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_KVM_ENABLED, "i386 kvm", fmt, ## __VA_ARGS__) + #define MSR_KVM_WALL_CLOCK 0x11 #define MSR_KVM_SYSTEM_TIME 0x12 diff --git a/xen-hvm.c b/xen-hvm.c index a64486c..a0d0bf1 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -29,13 +29,14 @@ //#define DEBUG_XEN_HVM #ifdef DEBUG_XEN_HVM -#define DPRINTF(fmt, ...) \ -do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_XEN_HVM_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ -do { } while (0) +#define DEBUG_XEN_HVM_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_XEN_HVM_ENABLED, "xen", fmt, ## __VA_ARGS__) + static MemoryRegion ram_memory, ram_640k, ram_lo, ram_hi; static MemoryRegion *framebuffer; static bool xen_in_migration; diff --git a/xen-mapcache.c b/xen-mapcache.c index eda914a..c6a72c5 100644 --- a/xen-mapcache.c +++ b/xen-mapcache.c @@ -26,13 +26,14 @@ //#define MAPCACHE_DEBUG #ifdef MAPCACHE_DEBUG -# define DPRINTF(fmt, ...) do { \ -fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \ -} while (0) +#define MAPCACHE_DEBUG_ENABLED 1 #else -# define DPRINTF(fmt, ...) do { } while (0) +#define MAPCACHE_DEBUG_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(MAPCACHE_DEBUG_ENABLED, "xen_mapcache", fmt, ## __VA_ARGS__) + #if defined(__i386__) # define MCACHE_BUCKET_SHIFT 16 # define MCACHE_MAX_SIZE (1UL<<31) /* 2GB Cap */ -- 1.7.10.4
[Qemu-devel] [PATCH v3 10/16] i8257: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. As the debug printf is always put in code, some formats had to be changed to avoid warnings treated as errors at compile time. Signed-off-by: Marc Marí --- hw/dma/i8257.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c index 4490372..b4e0535 100644 --- a/hw/dma/i8257.c +++ b/hw/dma/i8257.c @@ -27,15 +27,16 @@ /* #define DEBUG_DMA */ -#define dolog(...) fprintf (stderr, "dma: " __VA_ARGS__) #ifdef DEBUG_DMA -#define linfo(...) fprintf (stderr, "dma: " __VA_ARGS__) -#define ldebug(...) fprintf (stderr, "dma: " __VA_ARGS__) +#define DEBUG_DMA_ENABLED 1 #else -#define linfo(...) -#define ldebug(...) +#define DEBUG_DMA_ENABLED 0 #endif +#define dolog(...) QEMU_DPRINTF(1, "dma", __VA_ARGS__) +#define linfo(...) QEMU_DPRINTF(DEBUG_DMA_ENABLED, "dma", __VA_ARGS__); +#define ldebug linfo + struct dma_regs { int now[2]; uint16_t base[2]; @@ -301,7 +302,8 @@ static uint64_t read_cont(void *opaque, hwaddr nport, unsigned size) break; } -ldebug ("read_cont: nport %#06x, iport %#04x val %#x\n", nport, iport, val); +ldebug ("read_cont: nport %#06" PRIx64 ", iport %#04x val %#x\n", +nport, iport, val); return val; } -- 1.7.10.4
[Qemu-devel] [PATCH v3 03/16] s390: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. Signed-off-by: Marc Marí --- hw/s390x/s390-virtio-bus.c |9 + hw/s390x/s390-virtio.c |9 + target-s390x/helper.c | 23 +++ target-s390x/kvm.c |9 + 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index 9c71afa..2a1799e 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -38,13 +38,14 @@ /* #define DEBUG_S390 */ #ifdef DEBUG_S390 -#define DPRINTF(fmt, ...) \ -do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_S390_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ -do { } while (0) +#define DEBUG_S390_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_S390_ENABLED, "s390 virtio bus", fmt, ## __VA_ARGS__) + #define VIRTIO_EXT_CODE 0x2603 static void virtio_s390_bus_new(VirtioBusState *bus, size_t bus_size, diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c index aef2003..b69afb4 100644 --- a/hw/s390x/s390-virtio.c +++ b/hw/s390x/s390-virtio.c @@ -42,13 +42,14 @@ //#define DEBUG_S390 #ifdef DEBUG_S390 -#define DPRINTF(fmt, ...) \ -do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_S390_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ -do { } while (0) +#define DEBUG_S390_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_S390_ENABLED, "s390 virtio", fmt, ## __VA_ARGS__) + #define MAX_BLK_DEVS10 #define ZIPL_FILENAME "s390-zipl.rom" diff --git a/target-s390x/helper.c b/target-s390x/helper.c index 7c76fc1..c2aa568 100644 --- a/target-s390x/helper.c +++ b/target-s390x/helper.c @@ -30,19 +30,26 @@ //#define DEBUG_S390_STDOUT #ifdef DEBUG_S390 -#ifdef DEBUG_S390_STDOUT -#define DPRINTF(fmt, ...) \ -do { fprintf(stderr, fmt, ## __VA_ARGS__); \ - qemu_log(fmt, ##__VA_ARGS__); } while (0) +#define DEBUG_S390_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ -do { qemu_log(fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_S390_ENABLED 0 #endif + +#ifdef DEBUG_S390_STDOUT +#define DEBUG_S390_STDOUT_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ -do { } while (0) +#define DEBUG_S390_STDOUT_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +do { \ +if(DEBUG_S390_ENABLED) { \ +qemu_log(fmt, ##__VA_ARGS__); \ +QEMU_DPRINTF(DEBUG_S390_STDOUT_ENABLED, "s390x helper", \ +fmt, ## __VA_ARGS__); \ +} \ +} while (0) + #ifdef DEBUG_S390_PTE #define PTE_DPRINTF DPRINTF #else diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index 56179af..63c46c4 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -41,13 +41,14 @@ /* #define DEBUG_KVM */ #ifdef DEBUG_KVM -#define DPRINTF(fmt, ...) \ -do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_KVM_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ -do { } while (0) +#define DEBUG_KVM_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_KVM_ENABLED, "s390 kvm", fmt, ## __VA_ARGS__) + #define IPA0_DIAG 0x8300 #define IPA0_SIGP 0xae00 #define IPA0_B2 0xb200 -- 1.7.10.4
[Qemu-devel] [PATCH v3 01/16] include/qemu-common.h: Add QEMU_DPRINTF macro
Create this macro to let debug macros to have the same format through the codebase and use regular ifs instead of ifdef. Signed-off-by: Marc Marí --- include/qemu-common.h |7 +++ 1 file changed, 7 insertions(+) diff --git a/include/qemu-common.h b/include/qemu-common.h index 3f3fd60..acdcf08 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -463,3 +463,10 @@ int parse_debug_env(const char *name, int max, int initial); const char *qemu_ether_ntoa(const MACAddr *mac); #endif + +#define QEMU_DPRINTF(cond,pfx,fmt,...) \ +do { \ +if (cond) { \ +fprintf(stderr, pfx": %s:"fmt, __func__, ## __VA_ARGS__); \ +} \ + } while (0) -- 1.7.10.4
[Qemu-devel] [PATCH v3 07/16] spapr: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. Signed-off-by: Marc Marí Acked-by: Alexander Graf --- hw/net/spapr_llan.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c index c47..1639f4b 100644 --- a/hw/net/spapr_llan.c +++ b/hw/net/spapr_llan.c @@ -39,11 +39,13 @@ /*#define DEBUG*/ #ifdef DEBUG -#define DPRINTF(fmt...) do { fprintf(stderr, fmt); } while (0) +#define DEBUG_ENABLED 1 #else -#define DPRINTF(fmt...) +#define DEBUG_ENABLED 0 #endif +#define DPRINTF(fmt...) QEMU_DPRINTF(DEBUG_ENABLED, "spapr_llan", fmt) + /* * Virtual LAN device */ -- 1.7.10.4
[Qemu-devel] [PATCH v3 12/16] sd: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. Signed-off-by: Marc Marí --- hw/sd/sd.c |8 +--- hw/sd/ssi-sd.c | 19 --- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 4502ad1..46ad8f4 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -37,12 +37,14 @@ //#define DEBUG_SD 1 #ifdef DEBUG_SD -#define DPRINTF(fmt, ...) \ -do { fprintf(stderr, "SD: " fmt , ## __VA_ARGS__); } while (0) +#define DEBUG_SD_ENABLED 1 #else -#define DPRINTF(fmt, ...) do {} while(0) +#define DEBUG_SD_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_SD_ENABLED, "SD", fmt, ## __VA_ARGS__) + #define ACMD41_ENQUIRY_MASK 0x00ff typedef enum { diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c index b012e57..cd6fc7b 100644 --- a/hw/sd/ssi-sd.c +++ b/hw/sd/ssi-sd.c @@ -17,16 +17,21 @@ //#define DEBUG_SSI_SD 1 #ifdef DEBUG_SSI_SD -#define DPRINTF(fmt, ...) \ -do { printf("ssi_sd: " fmt , ## __VA_ARGS__); } while (0) -#define BADF(fmt, ...) \ -do { fprintf(stderr, "ssi_sd: error: " fmt , ## __VA_ARGS__); exit(1);} while (0) +#define DEBUG_SSI_SD_ENABLED 1 #else -#define DPRINTF(fmt, ...) do {} while(0) -#define BADF(fmt, ...) \ -do { fprintf(stderr, "ssi_sd: error: " fmt , ## __VA_ARGS__);} while (0) +#define DEBUG_SSI_SD_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_SSI_SD_ENABLED, "ssi_sd", fmt, ## __VA_ARGS__) +#define BADF(fmt, ...) \ +do { \ +QEMU_DPRINTF(1, "ssi_sd error", fmt, ## __VA_ARGS__); \ +if(DEBUG_SSI_SD_ENABLED) { \ +exit(1); \ +} \ +} while (0) + typedef enum { SSI_SD_CMD, SSI_SD_CMDARG, -- 1.7.10.4
[Qemu-devel] [PATCH v3 05/16] highbank: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. Remove header and __func__ in debug printfs, to avoid duplicated messages. Signed-off-by: Marc Marí --- hw/net/xgmac.c | 27 +++ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/hw/net/xgmac.c b/hw/net/xgmac.c index aeffcb5..4db93d1 100644 --- a/hw/net/xgmac.c +++ b/hw/net/xgmac.c @@ -30,14 +30,17 @@ #include "net/net.h" #include "net/checksum.h" +//#define DEBUG_XGMAC + #ifdef DEBUG_XGMAC -#define DEBUGF_BRK(message, args...) do { \ - fprintf(stderr, (message), ## args); \ - } while (0) +#define DEBUG_XGMAC_ENABLED 1 #else -#define DEBUGF_BRK(message, args...) do { } while (0) +#define DEBUG_XGMAC_ENABLED 0 #endif +#define DEBUGF_BRK(message, args...) \ +QEMU_DPRINTF(DEBUG_XGMAC_ENABLED, "xgmag", message, ## args) + #define XGMAC_CONTROL 0x /* MAC Configuration */ #define XGMAC_FRAME_FILTER 0x0001 /* MAC Frame Filter */ #define XGMAC_FLOW_CTRL 0x0006 /* MAC Flow Control */ @@ -218,20 +221,20 @@ static void xgmac_enet_send(XgmacState *s) len = (bd.buffer1_size & 0xfff) + (bd.buffer2_size & 0xfff); if ((bd.buffer1_size & 0xfff) > 2048) { -DEBUGF_BRK("qemu:%s:ERROR...ERROR...ERROR... -- " +DEBUGF_BRK("ERROR...ERROR...ERROR... -- " "xgmac buffer 1 len on send > 2048 (0x%x)\n", - __func__, bd.buffer1_size & 0xfff); + bd.buffer1_size & 0xfff); } if ((bd.buffer2_size & 0xfff) != 0) { -DEBUGF_BRK("qemu:%s:ERROR...ERROR...ERROR... -- " +DEBUGF_BRK("ERROR...ERROR...ERROR... -- " "xgmac buffer 2 len on send != 0 (0x%x)\n", -__func__, bd.buffer2_size & 0xfff); +bd.buffer2_size & 0xfff); } if (len >= sizeof(frame)) { -DEBUGF_BRK("qemu:%s: buffer overflow %d read into %zu " -"buffer\n" , __func__, len, sizeof(frame)); -DEBUGF_BRK("qemu:%s: buffer1.size=%d; buffer2.size=%d\n", -__func__, bd.buffer1_size, bd.buffer2_size); +DEBUGF_BRK("buffer overflow %d read into %zu " +"buffer\n" , len, sizeof(frame)); +DEBUGF_BRK("buffer1.size=%d; buffer2.size=%d\n", +bd.buffer1_size, bd.buffer2_size); } cpu_physical_memory_read(bd.buffer1_addr, ptr, len); -- 1.7.10.4
[Qemu-devel] [PATCH v3 04/16] scsi: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. As the debug printf is always put in code, some warnings appeared because of non-existing (old) variables, which were removed. Signed-off-by: Marc Marí --- hw/scsi/lsi53c895a.c | 22 +- hw/scsi/scsi-generic.c | 14 +++--- hw/scsi/spapr_vscsi.c |9 + 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index cb30414..1efc905 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -24,16 +24,21 @@ //#define DEBUG_LSI_REG #ifdef DEBUG_LSI -#define DPRINTF(fmt, ...) \ -do { printf("lsi_scsi: " fmt , ## __VA_ARGS__); } while (0) -#define BADF(fmt, ...) \ -do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__); exit(1);} while (0) +#define DEBUG_LSI_ENABLED 1 #else -#define DPRINTF(fmt, ...) do {} while(0) -#define BADF(fmt, ...) \ -do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__);} while (0) +#define DEBUG_LSI_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_LSI_ENABLED, "lsi_scsi", fmt, ## __VA_ARGS__) +#define BADF(fmt, ...) \ +do { \ +QEMU_DPRINTF(1, "lsi_scsi error", fmt, ## __VA_ARGS__); \ +if(DEBUG_LSI_ENABLED) { \ +exit(1); \ +} \ +} while (0) + #define LSI_MAX_DEVS 7 #define LSI_SCNTL0_TRG0x01 @@ -1261,12 +1266,11 @@ again: uint8_t data8; int reg; int operator; -#ifdef DEBUG_LSI + static const char *opcode_names[3] = {"Write", "Read", "Read-Modify-Write"}; static const char *operator_names[8] = {"MOV", "SHL", "OR", "XOR", "AND", "SHR", "ADD", "ADC"}; -#endif reg = ((insn >> 16) & 0x7f) | (insn & 0x80); data8 = (insn >> 8) & 0xff; diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 8d92e0d..6362860 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -21,14 +21,15 @@ //#define DEBUG_SCSI #ifdef DEBUG_SCSI -#define DPRINTF(fmt, ...) \ -do { printf("scsi-generic: " fmt , ## __VA_ARGS__); } while (0) +#define DEBUG_SCSI_ENABLED 1 #else -#define DPRINTF(fmt, ...) do {} while(0) +#define DEBUG_SCSI_ENABLED 0 #endif -#define BADF(fmt, ...) \ -do { fprintf(stderr, "scsi-generic: " fmt , ## __VA_ARGS__); } while (0) +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_SCSI_ENABLED, "scsi-generic", fmt, ## __VA_ARGS__) +#define BADF(fmt, ...) \ +QEMU_DPRINTF(1, "scsi-generic", fmt, ## __VA_ARGS__) #include #include @@ -303,8 +304,7 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *cmd) SCSIDevice *s = r->req.dev; int ret; -DPRINTF("Command: lun=%d tag=0x%x len %zd data=0x%02x", lun, tag, -r->req.cmd.xfer, cmd[0]); +DPRINTF("Command: len %zd data=0x%02x", r->req.cmd.xfer, cmd[0]); #ifdef DEBUG_SCSI { diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index d4ada4f..6406d39 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -45,13 +45,14 @@ /*#define DEBUG_VSCSI*/ #ifdef DEBUG_VSCSI -#define DPRINTF(fmt, ...) \ -do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_VSCSI_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ -do { } while (0) +#define DEBUG_VSCSI_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_VSCSI_ENABLED, "spapr_vscsi", fmt, ## __VA_ARGS__) + /* * Virtual SCSI device */ -- 1.7.10.4
[Qemu-devel] [PATCH v3 09/16] i82374: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. As the QEMU_DPRINTF already writes the function name, remove the __func__ to avoid writing the function name two times. Signed-off-by: Marc Marí --- hw/dma/i82374.c | 31 --- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c index b8ad2e6..0d9d09b 100644 --- a/hw/dma/i82374.c +++ b/hw/dma/i82374.c @@ -27,14 +27,15 @@ //#define DEBUG_I82374 #ifdef DEBUG_I82374 -#define DPRINTF(fmt, ...) \ -do { fprintf(stderr, "i82374: " fmt , ## __VA_ARGS__); } while (0) +#define DEBUG_I82374_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ -do {} while (0) +#define DEBUG_I82374_ENABLED 0 #endif + +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_I82374_ENABLED, "i82374", fmt, ## __VA_ARGS__) #define BADF(fmt, ...) \ -do { fprintf(stderr, "i82374 ERROR: " fmt , ## __VA_ARGS__); } while (0) +QEMU_DPRINTF(1, "i82374 ERROR", fmt, ## __VA_ARGS__) typedef struct I82374State { uint8_t commands[8]; @@ -56,19 +57,19 @@ static uint32_t i82374_read_isr(void *opaque, uint32_t nport) { uint32_t val = 0; -BADF("%s: %08x\n", __func__, nport); +BADF("%08x\n", nport); -DPRINTF("%s: %08x=%08x\n", __func__, nport, val); +DPRINTF("%08x=%08x\n", nport, val); return val; } static void i82374_write_command(void *opaque, uint32_t nport, uint32_t data) { -DPRINTF("%s: %08x=%08x\n", __func__, nport, data); +DPRINTF("%08x=%08x\n", nport, data); if (data != 0x42) { /* Not Stop S/G command */ -BADF("%s: %08x=%08x\n", __func__, nport, data); +BADF("%08x=%08x\n", nport, data); } } @@ -76,26 +77,26 @@ static uint32_t i82374_read_status(void *opaque, uint32_t nport) { uint32_t val = 0; -BADF("%s: %08x\n", __func__, nport); +BADF("%08x\n", nport); -DPRINTF("%s: %08x=%08x\n", __func__, nport, val); +DPRINTF("%08x=%08x\n", nport, val); return val; } static void i82374_write_descriptor(void *opaque, uint32_t nport, uint32_t data) { -DPRINTF("%s: %08x=%08x\n", __func__, nport, data); +DPRINTF("%08x=%08x\n", nport, data); -BADF("%s: %08x=%08x\n", __func__, nport, data); +BADF("%08x=%08x\n", nport, data); } static uint32_t i82374_read_descriptor(void *opaque, uint32_t nport) { uint32_t val = 0; -BADF("%s: %08x\n", __func__, nport); +BADF("%08x\n", nport); -DPRINTF("%s: %08x=%08x\n", __func__, nport, val); +DPRINTF("%08x=%08x\n", nport, val); return val; } -- 1.7.10.4
[Qemu-devel] [PATCH v3 08/16] stellaris: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. Signed-off-by: Marc Marí --- hw/net/stellaris_enet.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/hw/net/stellaris_enet.c b/hw/net/stellaris_enet.c index c9ee5d3..ea2b150 100644 --- a/hw/net/stellaris_enet.c +++ b/hw/net/stellaris_enet.c @@ -13,16 +13,23 @@ //#define DEBUG_STELLARIS_ENET 1 #ifdef DEBUG_STELLARIS_ENET -#define DPRINTF(fmt, ...) \ -do { printf("stellaris_enet: " fmt , ## __VA_ARGS__); } while (0) -#define BADF(fmt, ...) \ -do { fprintf(stderr, "stellaris_enet: error: " fmt , ## __VA_ARGS__); exit(1);} while (0) +#define DEBUG_STELLARIS_ENET_ENABLED 1 #else -#define DPRINTF(fmt, ...) do {} while(0) -#define BADF(fmt, ...) \ -do { fprintf(stderr, "stellaris_enet: error: " fmt , ## __VA_ARGS__);} while (0) +#define DEBUG_STELLARIS_ENET_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_STELLARIS_ENET_ENABLED, \ +"stellaris_enet", fmt, ## __VA_ARGS__) + +#define BADF(fmt, ...) \ +do { \ +QEMU_DPRINTF(1, "stellaris_enet error", fmt, ## __VA_ARGS__); \ +if (DEBUG_STELLARIS_ENET_ENABLED) { \ +exit(1); \ +}\ +} while (0) + #define SE_INT_RX 0x01 #define SE_INT_TXER 0x02 #define SE_INT_TXEMP0x04 -- 1.7.10.4
[Qemu-devel] [PATCH v3 06/16] xilinx: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. As QEMU_DPRINTF adds a header to the message, when the message is not in a new line, printf has to be used. Signed-off-by: Marc Marí --- hw/net/cadence_gem.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index 47e7038..32e940b 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -28,15 +28,17 @@ #include "net/net.h" #include "net/checksum.h" +//#define CADENCE_GEM_ERR_DEBUG + #ifdef CADENCE_GEM_ERR_DEBUG -#define DB_PRINT(...) do { \ -fprintf(stderr, ": %s: ", __func__); \ -fprintf(stderr, ## __VA_ARGS__); \ -} while (0); +#define CADENCE_GEM_ERR_DEBUG_ENABLED 1 #else -#define DB_PRINT(...) +#define CADENCE_GEM_ERR_DEBUG_ENABLED 0 #endif +#define DB_PRINT(...) \ +QEMU_DPRINTF(CADENCE_GEM_ERR_DEBUG_ENABLED, "cadence_gem", __VA_ARGS__) + #define GEM_NWCTRL(0x/4) /* Network Control reg */ #define GEM_NWCFG (0x0004/4) /* Network Config reg */ #define GEM_NWSTATUS (0x0008/4) /* Network Status reg */ @@ -1195,7 +1197,9 @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val, break; } -DB_PRINT("newval: 0x%08x\n", s->regs[offset]); +if(CADENCE_GEM_ERR_DEBUG_ENABLED) { +fprintf(stderr, "newval: 0x%08x\n", s->regs[offset]); +} } static const MemoryRegionOps gem_ops = { @@ -1208,13 +1212,17 @@ static void gem_cleanup(NetClientState *nc) { GemState *s = qemu_get_nic_opaque(nc); -DB_PRINT("\n"); +if(CADENCE_GEM_ERR_DEBUG_ENABLED) { +fprintf(stderr, "\n"); +} s->nic = NULL; } static void gem_set_link(NetClientState *nc) { -DB_PRINT("\n"); +if(CADENCE_GEM_ERR_DEBUG_ENABLED) { +fprintf(stderr, "\n"); +} phy_update_link(qemu_get_nic_opaque(nc)); } -- 1.7.10.4
[Qemu-devel] [PATCH v3 14/16] lan9118: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. As the debug printf is always put in code, some formats had to be changed to avoid warnings treated as errors at compile time. Signed-off-by: Marc Marí --- hw/net/lan9118.c | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index e528290..1781b16 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -21,16 +21,23 @@ //#define DEBUG_LAN9118 #ifdef DEBUG_LAN9118 -#define DPRINTF(fmt, ...) \ -do { printf("lan9118: " fmt , ## __VA_ARGS__); } while (0) -#define BADF(fmt, ...) \ -do { hw_error("lan9118: error: " fmt , ## __VA_ARGS__);} while (0) +#define DEBUG_LAN9118_ENABLED 1 #else -#define DPRINTF(fmt, ...) do {} while(0) -#define BADF(fmt, ...) \ -do { fprintf(stderr, "lan9118: error: " fmt , ## __VA_ARGS__);} while (0) +#define DEBUG_LAN9118_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_LAN9118_ENABLED, "lan9118", fmt, ## __VA_ARGS__) + +#define BADF(fmt, ...) \ +do { \ +if(DEBUG_LAN9118_ENABLED) { \ +hw_error("lan9118: error: " fmt , ## __VA_ARGS__); \ +} else { \ +fprintf(stderr, "lan9118: error: " fmt , ## __VA_ARGS__); \ +} \ +} while (0) + #define CSR_ID_REV 0x50 #define CSR_IRQ_CFG 0x54 #define CSR_INT_STS 0x58 @@ -1031,7 +1038,7 @@ static void lan9118_writel(void *opaque, hwaddr offset, s->int_sts |= val & SW_INT; break; case CSR_FIFO_INT: -DPRINTF("FIFO INT levels %08x\n", val); +DPRINTF("FIFO INT levels %08" PRIx64 "\n", val); s->fifo_int = val; break; case CSR_RX_CFG: @@ -1112,9 +1119,11 @@ static void lan9118_writel(void *opaque, hwaddr offset, if (val & 0x8000) { if (val & 0x4000) { s->mac_data = do_mac_read(s, val & 0xf); -DPRINTF("MAC read %d = 0x%08x\n", val & 0xf, s->mac_data); +DPRINTF("MAC read %" PRId64 " = 0x%08x\n", +(val & 0xf), s->mac_data); } else { -DPRINTF("MAC write %d = 0x%08x\n", val & 0xf, s->mac_data); +DPRINTF("MAC write %" PRId64 " = 0x%08x\n", +(val & 0xf), s->mac_data); do_mac_write(s, val & 0xf, s->mac_data); } } -- 1.7.10.4
[Qemu-devel] [PATCH v3 13/16] isa: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. As the debug printf is always put in code, some formats had to be changed to avoid warnings treated as errors at compile time.. Signed-off-by: Marc Marí --- hw/isa/vt82c686.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 1a93afd..710c1c8 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -29,11 +29,14 @@ //#define DEBUG_VT82C686B #ifdef DEBUG_VT82C686B -#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__) +#define DEBUG_VT82C686B_ENABLED 1 #else -#define DPRINTF(fmt, ...) +#define DEBUG_VT82C686B_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_VT82C686B_ENABLED, "vt82c686", fmt, ## __VA_ARGS__) + typedef struct SuperIOConfig { uint8_t config[0xff]; @@ -53,7 +56,8 @@ static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data, int can_write; SuperIOConfig *superio_conf = opaque; -DPRINTF("superio_ioport_writeb address 0x%x val 0x%x\n", addr, data); +DPRINTF("superio_ioport_writeb address 0x%" PRIx64 " val 0x%" PRIx64 "\n", +addr, data); if (addr == 0x3f0) { superio_conf->index = data & 0xff; } else { @@ -99,7 +103,7 @@ static uint64_t superio_ioport_readb(void *opaque, hwaddr addr, unsigned size) { SuperIOConfig *superio_conf = opaque; -DPRINTF("superio_ioport_readb address 0x%x\n", addr); +DPRINTF("superio_ioport_readb address 0x%" PRIx64 "\n", addr); return (superio_conf->config[superio_conf->index]); } -- 1.7.10.4
[Qemu-devel] [PATCH v3 16/16] common: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. Signed-off-by: Marc Marí --- migration-rdma.c | 31 +-- page_cache.c | 11 +++ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/migration-rdma.c b/migration-rdma.c index eeb4302..606ee7c 100644 --- a/migration-rdma.c +++ b/migration-rdma.c @@ -32,36 +32,39 @@ //#define DEBUG_RDMA_REALLY_VERBOSE #ifdef DEBUG_RDMA -#define DPRINTF(fmt, ...) \ -do { printf("rdma: " fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_RDMA_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ -do { } while (0) +#define DEBUG_RDMA_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_RDMA_ENABLED, "rdma", fmt, ## __VA_ARGS__) + #ifdef DEBUG_RDMA_VERBOSE -#define DDPRINTF(fmt, ...) \ -do { printf("rdma: " fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_RDMA_VERBOSE_ENABLED 1 #else -#define DDPRINTF(fmt, ...) \ -do { } while (0) +#define DEBUG_RDMA_VERBOSE_ENABLED 0 #endif +#define DDPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_RDMA_VERBOSE_ENABLED, "rdma", fmt, ## __VA_ARGS__) + #ifdef DEBUG_RDMA_REALLY_VERBOSE -#define DDDPRINTF(fmt, ...) \ -do { printf("rdma: " fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_RDMA_REALLY_VERBOSE_ENABLED 1 #else -#define DDDPRINTF(fmt, ...) \ -do { } while (0) +#define DEBUG_RDMA_REALLY_VERBOSE_ENABLED 0 #endif +#define DDDPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_RDMA_REALLY_VERBOSE_ENABLED, "rdma", fmt, ## __VA_ARGS__) + /* * Print and error on both the Monitor and the Log file. */ #define ERROR(errp, fmt, ...) \ do { \ -fprintf(stderr, "RDMA ERROR: " fmt "\n", ## __VA_ARGS__); \ -if (errp && (*(errp) == NULL)) { \ +QEMU_DPRINTF(1, "RDMA ERROR", fmt"\n", ## __VA_ARGS__); \ +if (errp && !*errp) { \ error_setg(errp, "RDMA ERROR: " fmt, ## __VA_ARGS__); \ } \ } while (0) diff --git a/page_cache.c b/page_cache.c index b033681..be206a4 100644 --- a/page_cache.c +++ b/page_cache.c @@ -25,14 +25,17 @@ #include "qemu-common.h" #include "migration/page_cache.h" +//#define DEBUG_CACHE 1 + #ifdef DEBUG_CACHE -#define DPRINTF(fmt, ...) \ -do { fprintf(stdout, "cache: " fmt, ## __VA_ARGS__); } while (0) +#define DEBUG_CACHE_ENABLED 1 #else -#define DPRINTF(fmt, ...) \ -do { } while (0) +#define DEBUG_CACHE_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_CACHE_ENABLED, "cache", fmt, ## __VA_ARGS__) + typedef struct CacheItem CacheItem; struct CacheItem { -- 1.7.10.4
[Qemu-devel] [PATCH v3 11/16] rc4030: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. Change the output of debug messages from stdout to stderr. Remove header in debug printfs, as QEMU_DPRINTF already adds it. Signed-off-by: Marc Marí --- hw/dma/rc4030.c | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c index af26632..54885cc 100644 --- a/hw/dma/rc4030.c +++ b/hw/dma/rc4030.c @@ -32,17 +32,18 @@ //#define DEBUG_RC4030 //#define DEBUG_RC4030_DMA -#ifdef DEBUG_RC4030 -#define DPRINTF(fmt, ...) \ -do { printf("rc4030: " fmt , ## __VA_ARGS__); } while (0) static const char* irq_names[] = { "parallel", "floppy", "sound", "video", "network", "scsi", "keyboard", "mouse", "serial0", "serial1" }; +#ifdef DEBUG_RC4030 +#define DEBUG_RC4030_ENABLED 1 #else -#define DPRINTF(fmt, ...) +#define DEBUG_RC4030_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_RC4030_ENABLED, "rc4030", fmt, ## __VA_ARGS__) #define RC4030_ERROR(fmt, ...) \ -do { fprintf(stderr, "rc4030 ERROR: %s: " fmt, __func__ , ## __VA_ARGS__); } while (0) +QEMU_DPRINTF(1, "rc4030 ERROR", fmt, ## __VA_ARGS__) // /* rc4030 emulation */ @@ -442,13 +443,13 @@ static void update_jazz_irq(rc4030State *s) DPRINTF("pending irqs:"); for (irq = 0; irq < ARRAY_SIZE(irq_names); irq++) { if (s->isr_jazz & (1 << irq)) { -printf(" %s", irq_names[irq]); +fprintf(stderr, " %s", irq_names[irq]); if (!(s->imr_jazz & (1 << irq))) { -printf("(ignored)"); +fprintf(stderr, "(ignored)"); } } } -printf("\n"); +fprintf(stderr, "\n"); } #endif @@ -741,7 +742,7 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri #ifdef DEBUG_RC4030_DMA { int i, j; -printf("rc4030 dma: Copying %d bytes %s host %p\n", +DPRINTF("Copying %d bytes %s host %p\n", len, is_write ? "from" : "to", buf); for (i = 0; i < len; i += 16) { int n = 16; @@ -749,13 +750,13 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri n = len - i; } for (j = 0; j < n; j++) -printf("%02x ", buf[i + j]); +fprintf(stderr, "%02x ", buf[i + j]); while (j++ < 16) -printf(" "); -printf("| "); +fprintf(stderr, " "); +fprintf(stderr , "| "); for (j = 0; j < n; j++) -printf("%c", isprint(buf[i + j]) ? buf[i + j] : '.'); -printf("\n"); +fprintf(stderr, "%c", isprint(buf[i + j]) ? buf[i + j] : '.'); +fprintf(stderr, "\n"); } } #endif -- 1.7.10.4
[Qemu-devel] [PATCH v3 15/16] pci-host: Convert debug printfs to QEMU_DPRINTF
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. As the debug printf is always put in code, some formats had to be changed to avoid warnings treated as errors at compile time. As QEMU_DPRINTF already puts the function name as the header, __func__ was removed from debug printfs. Signed-off-by: Marc Marí --- hw/pci-host/bonito.c | 13 + hw/pci-host/ppce500.c | 21 + 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 56292ad..814b6d8 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -50,11 +50,14 @@ //#define DEBUG_BONITO #ifdef DEBUG_BONITO -#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__) +#define DEBUG_BONITO_ENABLED 1 #else -#define DPRINTF(fmt, ...) +#define DEBUG_BONITO_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ +QEMU_DPRINTF(DEBUG_BONITO_ENABLED, "bonito", fmt, ## __VA_ARGS__) + /* from linux soure code. include/asm-mips/mips-boards/bonito64.h*/ #define BONITO_BOOT_BASE0x1fc0 #define BONITO_BOOT_SIZE0x0010 @@ -235,7 +238,8 @@ static void bonito_writel(void *opaque, hwaddr addr, saddr = (addr - BONITO_REGBASE) >> 2; -DPRINTF("bonito_writel "TARGET_FMT_plx" val %x saddr %x\n", addr, val, saddr); +DPRINTF("bonito_writel "TARGET_FMT_plx" val %" PRIx64 " saddr %x\n", +addr, val, saddr); switch (saddr) { case BONITO_BONPONCFG: case BONITO_IODEVCFG: @@ -322,7 +326,8 @@ static void bonito_pciconf_writel(void *opaque, hwaddr addr, PCIBonitoState *s = opaque; PCIDevice *d = PCI_DEVICE(s); -DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %x\n", addr, val); +DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %" PRIx64 "\n", +addr, val); d->config_write(d, addr, val, 4); } diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c index c80b7cb..ff250ce 100644 --- a/hw/pci-host/ppce500.c +++ b/hw/pci-host/ppce500.c @@ -21,12 +21,17 @@ #include "qemu/bswap.h" #include "hw/pci-host/ppce500.h" +//#define DEBUG_PCI + #ifdef DEBUG_PCI -#define pci_debug(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__) +#define DEBUG_PCI_ENABLED 1 #else -#define pci_debug(fmt, ...) +#define DEBUG_PCI_ENABLED 0 #endif +#define pci_debug(fmt, ...) \ +QEMU_DPRINTF(DEBUG_PCI_ENABLED, "ppce500", fmt, ## __VA_ARGS__) + #define PCIE500_CFGADDR 0x0 #define PCIE500_CFGDATA 0x4 #define PCIE500_REG_BASE 0xC00 @@ -174,7 +179,7 @@ static uint64_t pci_reg_read4(void *opaque, hwaddr addr, break; } -pci_debug("%s: win:%lx(addr:" TARGET_FMT_plx ") -> value:%x\n", __func__, +pci_debug("win:%lx(addr:" TARGET_FMT_plx ") -> value:%x\n", win, addr, value); return value; } @@ -188,8 +193,8 @@ static void pci_reg_write4(void *opaque, hwaddr addr, win = addr & 0xfe0; -pci_debug("%s: value:%x -> win:%lx(addr:" TARGET_FMT_plx ")\n", - __func__, (unsigned)value, win, addr); +pci_debug("value:%" PRIx64 " -> win:%lx(addr:" TARGET_FMT_plx ")\n", + value, win, addr); switch (win) { case PPCE500_PCI_OW1: @@ -259,8 +264,8 @@ static int mpc85xx_pci_map_irq(PCIDevice *pci_dev, int irq_num) ret = ppce500_pci_map_irq_slot(devno, irq_num); -pci_debug("%s: devfn %x irq %d -> %d devno:%x\n", __func__, - pci_dev->devfn, irq_num, ret, devno); +pci_debug("devfn %x irq %d -> %d devno:%x\n", +pci_dev->devfn, irq_num, ret, devno); return ret; } @@ -269,7 +274,7 @@ static void mpc85xx_pci_set_irq(void *opaque, int irq_num, int level) { qemu_irq *pic = opaque; -pci_debug("%s: PCI irq %d, level:%d\n", __func__, irq_num, level); +pci_debug("PCI irq %d, level:%d\n", irq_num, level); qemu_set_irq(pic[irq_num], level); } -- 1.7.10.4
[Qemu-devel] OS X compile fix
At the recommendation of Mark Cave-Ayland, I'm sending this patch in to remedy a long-time Mac OS X compile issue. The offsets are a way off in this diff, but it still works. -peter --- block/raw-posix.c.orig 2012-12-03 11:37:05.0 -0800 +++ block/raw-posix.c 2012-12-03 18:24:47.0 -0800 @@ -914,11 +914,11 @@ size = 0; } if (size == 0) #endif #if defined(__APPLE__) && defined(__MACH__) -size = LONG_LONG_MAX; +size = LLONG_MAX; #else size = lseek(fd, 0LL, SEEK_END); #endif #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) switch(s->type) {
Re: [Qemu-devel] [PATCH v2] hw/display/pxa2xx_lcd: Fix 16bpp+alpha and 18bpp+alpha palette formats
On Fri, May 16, 2014 at 7:51 PM, Peter Maydell wrote: > The pxa2xx palette entry "16bpp plus transparency" format is > xxxTR000GG00B000, and "18bpp plus transparency" is > xxxTRR00GG00BB00. > > Correct errors in the code for reading these and converting > them to the internal format. In particular, the buggy code > was attempting to mask out bit 24 of a uint16_t, which > Coverity spotted as an error. > > Signed-off-by: Peter Maydell Reviewed-by: Peter Crosthwaite > --- > This is the remaining uncommitted patch from the set of 8 random > coverity fixes I sent a little while back. > Changes v1->v2: > * use correct mask/shift for R component in 16bpp+transparency > * we need to add 4 to the src ptr, not 2, for the 16bpp+transparency >format, since each palette entry is 32 bits > > hw/display/pxa2xx_lcd.c | 16 > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/hw/display/pxa2xx_lcd.c b/hw/display/pxa2xx_lcd.c > index 80edb70..611fb17 100644 > --- a/hw/display/pxa2xx_lcd.c > +++ b/hw/display/pxa2xx_lcd.c > @@ -620,24 +620,24 @@ static void pxa2xx_palette_parse(PXA2xxLCDState *s, int > ch, int bpp) > src += 2; > break; > case 1: /* 16 bpp plus transparency */ > -alpha = *(uint16_t *) src & (1 << 24); > +alpha = *(uint32_t *) src & (1 << 24); > if (s->control[0] & LCCR0_CMS) > -r = g = b = *(uint16_t *) src & 0xff; > +r = g = b = *(uint32_t *) src & 0xff; > else { > -r = (*(uint16_t *) src & 0xf800) >> 8; > -g = (*(uint16_t *) src & 0x07e0) >> 3; > -b = (*(uint16_t *) src & 0x001f) << 3; > +r = (*(uint32_t *) src & 0xf8) >> 16; > +g = (*(uint32_t *) src & 0x00fc00) >> 8; > +b = (*(uint32_t *) src & 0xf8); > } > -src += 2; > +src += 4; > break; > case 2: /* 18 bpp plus transparency */ > alpha = *(uint32_t *) src & (1 << 24); > if (s->control[0] & LCCR0_CMS) > r = g = b = *(uint32_t *) src & 0xff; > else { > -r = (*(uint32_t *) src & 0xf8) >> 16; > +r = (*(uint32_t *) src & 0xfc) >> 16; > g = (*(uint32_t *) src & 0x00fc00) >> 8; > -b = (*(uint32_t *) src & 0xf8); > +b = (*(uint32_t *) src & 0xfc); > } > src += 4; > break; > -- > 1.9.2 > >
Re: [Qemu-devel] [PATCH qom-next 0/4] qom: HMP commands to replace info qtree
On Fri, May 9, 2014 at 12:21 AM, Andreas Färber wrote: > Hello, > > The main patch of this series is an HMP command "info qom-composition", qom-composition is a mouthful. Can it be shortened? Although I suggest alternative that obsoletes it anyways further down. > which displays the machine composition tree. This names all devices, > including those missing in "info qtree" for lack of bus. > > To make it more like "info qtree" bus-wise, we could extend it to display > link<> properties as well. > > Properties of devices can be listed with "qom-list", like in QMP. > So this has some ease-of-use challenges. "info qom-comp" doesnt give you copy-pastable full canonical paths, yet you need to have a full path to get the options of a particular device. Some possibilities to make this more usable might include: 1: Full canonical paths in your output rather than indentation. Probably costs readability. 2: More flexibility in the information provided by qom-comp. 3: Tab autocomplete of args to functions like qom-list (probably rather hard) > Based on a suggestion from Paolo, I went on to implement "qom-get" and > "qom-set" for reading and setting them, not basing on their QMP counterparts > but reimplementing them to circumvent the complicated QObject -> string > conversion Hani tried [1]. > > As I replied there, I think we can have both views - with and without > properties. My question is, should they be differently named commands? > Or an argument to the command? Elaborating idea #2 a bit, I think qom-composition as it stands, is a little bit "all or nothing". Should it perhaps accept an argument (much like qom-list) and then it shows the composition tree starting from that node? Once you add a with-properties mode the output for each node, the output is going to be similar to qom-list for each subnode. To that end can all the problems be solved with only a single qom-list command where: 1: We add a recursive mode to qom-list where instead of showing a child link prop we show qom-list output of that child (indentation++). 2: We allow filtering property types for qom-list output (all, none, only links etc). This allows you to do tree views or either entire machine. or a subsystem (or just a single device), with or without property information solving all display-of-information desires. Depending on how sophisticated idea #2 is implemented you could also do you qom-composition-with-just-links output. > Should it go into qdev-monitor.c alongside > the old qdev HMP commands or into hmp.c? Is it okay to not base HMP commands > on their QMP counterparts, or is there any other visitor-based solution? > > Built on top of my pending qom-tree script [2] but shouldn't depend on it. > I still consider that useful, but not resending it since it didn't change. > > Regards, > Andreas > > [1] http://patchwork.ozlabs.org/patch/343136/ > [2] http://patchwork.ozlabs.org/patch/317224/ > > $ ./x86_64-softmmu/qemu-system-x86_64 -S -display none -monitor stdio > QEMU 2.0.50 monitor - type 'help' for more information > (qemu) info qom-composition > /machine (pc-i440fx-2.1-machine) > /peripheral-anon (container) > /peripheral (container) > /unattached (container) > /sysbus (System) > /device[0] (qemu64-x86_64-cpu) > /apic (apic) > /device[1] (kvmvapic) > /device[2] (i440FX) > /device[3] (PIIX3) > /isa.0 (ISA) > /device[4] (isa-i8259) > /device[5] (isa-i8259) > /device[6] (cirrus-vga) > /device[7] (hpet) > /device[8] (mc146818rtc) > /device[9] (isa-pit) > /device[10] (isa-pcspk) > /device[11] (isa-serial) > /device[12] (isa-parallel) > /device[13] (i8042) > /device[14] (vmport) > /device[15] (vmmouse) > /device[16] (port92) > /device[17] (isa-fdc) > /device[18] (e1000) > /device[19] (piix3-ide) > /ide.0 (IDE) > /ide.1 (IDE) > /device[20] (ide-cd) > /device[21] (PIIX4_PM) > /i2c (i2c-bus) Quite a tangential problem (and way out of scope of this series), but should I2C devices be parented to their bus? I know TYPE_BUS is evil, but TYPE_I2C_BUS probably need to stay even after full de-BUSification (probably just reparented to TYPE_DEVICE). Then all the actual I2C devices are children of that i2c-bus DEVICE. I2C bus itself implements non-trivial functionality (much unlike sysbus). > /device[22] (smbus-eeprom) > /device[23] (smbus-eeprom) > /device[24] (smbus-eeprom) > /device[25] (smbus-eeprom) > /device[26] (smbus-eeprom) > /device[27] (smbus-eeprom) > /device[28] (smbus-eeprom) > /device[29] (smbus-eeprom) > /icc-bridge (icc-bridge) > /icc (icc-bus) > /fw_cfg (fw_cfg) > /i440fx (i440FX-pcihost) > /pci.0 (PCI) > /ioapic (ioapic) > (qemu) qom-list > / > (qemu) qom-list / > backend (child) > machine (child) > type (string) > (qemu) qom-list /machine > i440fx (child) > fw_cfg (child) > icc-bridge (child) > unattached (child) > peripheral (child) > periphe
Re: [Qemu-devel] [Bug 1320360] [NEW] usb passthrough not working anymore
Hi, From qemu-1.7 release version, the old usb-host(host-linux.c) had been removed, re-implemented by libusbx. So you should build qemu with --enable-libusb, then you can use usb pass-through capacity. BTW, Gerd, should we enable libusb by default now? Thanks. Best regards, -Gonglei > -Original Message- > From: qemu-devel-bounces+arei.gonglei=huawei@nongnu.org > [mailto:qemu-devel-bounces+arei.gonglei=huawei@nongnu.org] On > Behalf Of Martin R?h > Sent: Saturday, May 17, 2014 3:35 AM > To: qemu-devel@nongnu.org > Subject: [Qemu-devel] [Bug 1320360] [NEW] usb passthrough not working > anymore > > Public bug reported: > > Hi, > > I'm using qemu 2.0.0 with opensuse 13.1 x84_64 bit as host and window7 > as guest. Til qemu version 1.6.2 USB passthrough works perfectly, but > starting with qemu 2.0.0 passthrough stop working. I can still add the > usb device but when I start the guest following message appears: > > "unable to execute QEMU command 'device_add': 'usb-host' is not a valid > device model name" > > Then the guest will not start. > > I try it with different usb devices (iphone, stick, hdd), always the > same error. > > Are there any news / hints about this ? > > Regards > > Martin > > ** Affects: qemu > Importance: Undecided > Status: New > > -- > You received this bug notification because you are a member of qemu- > devel-ml, which is subscribed to QEMU. > https://bugs.launchpad.net/bugs/1320360 > > Title: > usb passthrough not working anymore > > Status in QEMU: > New > > Bug description: > Hi, > > I'm using qemu 2.0.0 with opensuse 13.1 x84_64 bit as host and window7 > as guest. Til qemu version 1.6.2 USB passthrough works perfectly, but > starting with qemu 2.0.0 passthrough stop working. I can still add the > usb device but when I start the guest following message appears: > > "unable to execute QEMU command 'device_add': 'usb-host' is not a > valid device model name" > > Then the guest will not start. > > I try it with different usb devices (iphone, stick, hdd), always the > same error. > > Are there any news / hints about this ? > > Regards > > Martin > > To manage notifications about this bug go to: > https://bugs.launchpad.net/qemu/+bug/1320360/+subscriptions