Re: [Qemu-devel] storing machine data in qcow images?

2018-05-28 Thread Kevin Wolf
Am 28.05.2018 um 23:25 hat Richard W.M. Jones geschrieben: > On Mon, May 28, 2018 at 10:20:54PM +0100, Richard W.M. Jones wrote: > > On Mon, May 28, 2018 at 08:38:33PM +0200, Kevin Wolf wrote: > > > Just accessing the image file within a tar archive is possible and we > > > could write a block driv

[Qemu-devel] [PATCH 6/6] slirp/ncsi: add checksum support

2018-05-28 Thread Cédric Le Goater
The checksum field of a NC-SI packet contains a value that may be included in each command and response. The verification is optional but the Linux driver does so when a non-zero value is provided. Let's extend the model to compute the checksum value and exercise a little more the Linux driver. Se

[Qemu-devel] [PATCH 5/6] slirp/ncsi: add a "Get Parameter" response

2018-05-28 Thread Cédric Le Goater
This is a minimum response to exercise the kernel. Signed-off-by: Cédric Le Goater --- slirp/ncsi.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/slirp/ncsi.c b/slirp/ncsi.c index 02d0e9def3e8..f00253641ea4 100644 --- a/slirp/ncsi.c +++ b/slirp/ncsi.

[Qemu-devel] [PATCH 1/6] ftgmac100: compute maximum frame size depending on the protocol

2018-05-28 Thread Cédric Le Goater
The maximum frame size includes the CRC and depends if a VLAN tag is inserted or not. Adjust the frame size limit in the transmit handler using on the FTGMAC100State buffer size and in the receive handler use the packet protocol. Signed-off-by: Cédric Le Goater --- include/hw/net/ftgmac100.h |

[Qemu-devel] [PATCH 4/6] slirp/ncsi: fix "Get Version ID" payload length

2018-05-28 Thread Cédric Le Goater
Signed-off-by: Cédric Le Goater --- slirp/ncsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slirp/ncsi.c b/slirp/ncsi.c index d12ba3e494b0..02d0e9def3e8 100644 --- a/slirp/ncsi.c +++ b/slirp/ncsi.c @@ -60,7 +60,7 @@ static const struct ncsi_rsp_handler { { NCSI_P

[Qemu-devel] [PATCH 0/6] ftgmac100 and NC-SI enhancements for the Aspeed SoC

2018-05-28 Thread Cédric Le Goater
Hello, Here is a couple of enhancements and fixes for the ftgmac100 NIC used on the Aspeed SoC. It includes VLAN and multicast support. Following is an assorted set of changes for the NC-SI backend also used on the Aspeed SoC when soldered on OpenPOWER boards. These fix a few problems found when

[Qemu-devel] [PATCH 3/6] net/ftgmac100: fix multicast hash routine

2018-05-28 Thread Cédric Le Goater
Based on the multicast hash calculation of the FTGMAC100 Linux driver. Signed-off-by: Cédric Le Goater --- hw/net/ftgmac100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c index 50af1222464a..fd7699b1c05e 100644 --- a/hw/net/ftgma

[Qemu-devel] [PATCH 2/6] ftgmac100: add IEEE 802.1Q VLAN support

2018-05-28 Thread Cédric Le Goater
The ftgmac100 NIC supports VLAN tag insertion and the MAC engine also has a control to remove VLAN tags from received packets. The VLAN control bits and VLAN tag information are contained in the second word of the transmit and receive descriptors. The Insert VLAN bit and the VLAN Tag available bit

[Qemu-devel] [PATCH v7 08/10] iscsi: Implement copy offloading

2018-05-28 Thread Fam Zheng
Issue EXTENDED COPY (LID1) command to implement the copy_range API. The parameter data construction code is modified from libiscsi's iscsi-dd.c. Signed-off-by: Fam Zheng Reviewed-by: Stefan Hajnoczi --- block/iscsi.c| 219 +++ include/scs

[Qemu-devel] [PATCH v7 05/10] file-posix: Implement bdrv_co_copy_range

2018-05-28 Thread Fam Zheng
With copy_file_range(2), we can implement the bdrv_co_copy_range semantics. Signed-off-by: Fam Zheng Reviewed-by: Stefan Hajnoczi --- block/file-posix.c | 96 +++-- include/block/raw-aio.h | 10 -- 2 files changed, 101 insertions(+), 5 deleti

[Qemu-devel] [PATCH v7 06/10] iscsi: Query and save device designator when opening

2018-05-28 Thread Fam Zheng
The device designator data returned in INQUIRY command will be useful to fill in source/target fields during copy offloading. Do this when connecting to the target and save the data for later use. Signed-off-by: Fam Zheng Reviewed-by: Stefan Hajnoczi --- block/iscsi.c| 41 ++

[Qemu-devel] [PATCH v7 10/10] qemu-img: Convert with copy offloading

2018-05-28 Thread Fam Zheng
The new blk_co_copy_range interface offers a more efficient way in the case of network based storage. Make use of it to allow faster convert operation. Since copy offloading cannot do zero detection ('-S') and compression (-c), only try it when these options are not used. Signed-off-by: Fam Zheng

[Qemu-devel] [PATCH v7 02/10] raw: Check byte range uniformly

2018-05-28 Thread Fam Zheng
We don't verify the request range against s->size in the I/O callbacks except for raw_co_pwritev. This is inconsistent (especially for raw_co_pwrite_zeroes and raw_co_pdiscard), so fix them, in the meanwhile make the helper reusable by the coming new callbacks. Note that in most cases the block la

[Qemu-devel] [PATCH v7 04/10] qcow2: Implement copy offloading

2018-05-28 Thread Fam Zheng
The two callbacks are implemented quite similarly to the read/write functions: bdrv_co_copy_range_from maps for read and calls into bs->file or bs->backing depending on the allocation status; bdrv_co_copy_range_to maps for write and calls into bs->file. Reviewed-by: Stefan Hajnoczi Signed-off-by:

[Qemu-devel] [PATCH v7 07/10] iscsi: Create and use iscsi_co_wait_for_task

2018-05-28 Thread Fam Zheng
This loop is repeated a growing number times. Make a helper. Signed-off-by: Fam Zheng Reviewed-by: Stefan Hajnoczi Reviewed-by: Eric Blake --- block/iscsi.c | 54 +- 1 file changed, 17 insertions(+), 37 deletions(-) diff --git a/block/iscsi.

[Qemu-devel] [PATCH v7 09/10] block-backend: Add blk_co_copy_range

2018-05-28 Thread Fam Zheng
It's a BlockBackend wrapper of the BDS interface. Signed-off-by: Fam Zheng Reviewed-by: Stefan Hajnoczi --- block/block-backend.c | 18 ++ include/sysemu/block-backend.h | 4 2 files changed, 22 insertions(+) diff --git a/block/block-backend.c b/block/block-backe

[Qemu-devel] [PATCH v9 7/7] monitor: add lock to protect mon_fdsets

2018-05-28 Thread Peter Xu
Introduce a new global big lock for mon_fdsets. Take it where needed. The monitor_fdset_get_fd() handling is a bit tricky: now we need to call qemu_mutex_unlock() which might pollute errno, so we need to make sure the correct errno be passed up to the callers. To make things simpler, we let moni

[Qemu-devel] [PATCH v9 5/7] monitor: remove event_clock_type

2018-05-28 Thread Peter Xu
Instead, use a dynamic function to detect which clock we'll use. The problem is that the old code will let monitor initialization depends on qtest_enabled(). After this change, we don't have such a dependency any more. Suggested-by: Markus Armbruster Signed-off-by: Peter Xu --- monitor.c | 21

[Qemu-devel] [PATCH v7 03/10] raw: Implement copy offloading

2018-05-28 Thread Fam Zheng
Just pass down to ->file. Signed-off-by: Fam Zheng Reviewed-by: Stefan Hajnoczi --- block/raw-format.c | 32 1 file changed, 32 insertions(+) diff --git a/block/raw-format.c b/block/raw-format.c index b69a0674b3..f2e468df6f 100644 --- a/block/raw-format.c +++ b

[Qemu-devel] [PATCH v7 00/10] qemu-img convert with copy offloading

2018-05-28 Thread Fam Zheng
v7: Fix qcow2. v6: Pick up rev-by from Stefan and Eric. Tweak patch 2 commit message. v5: - Fix raw offset/bytes check for read. [Eric] - Fix qcow2_handle_l2meta. [Stefan] - Add coroutine_fn whereever appropriate. [Stefan] v4: - Fix raw offset and size. [Eric] - iscsi: Drop unnec

[Qemu-devel] [PATCH v7 01/10] block: Introduce API for copy offloading

2018-05-28 Thread Fam Zheng
Introduce the bdrv_co_copy_range() API for copy offloading. Block drivers implementing this API support efficient copy operations that avoid reading each block from the source device and writing it to the destination devices. Examples of copy offload primitives are SCSI EXTENDED COPY and Linux co

[Qemu-devel] [PATCH v9 4/7] monitor: fix comment for monitor_lock

2018-05-28 Thread Peter Xu
Fix typo in d622cb5879c. Meanwhile move these variables close to each other. monitor_qapi_event_state can be declared static, add that. Reported-by: Markus Armbruster Signed-off-by: Peter Xu --- monitor.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/monitor.c b/m

[Qemu-devel] [PATCH v9 6/7] monitor: move init global earlier

2018-05-28 Thread Peter Xu
Before this patch, monitor fd helpers might be called even earlier than monitor_init_globals(). This can be problematic. After previous work, now monitor_init_globals() does not depend on accelerator initialization any more. Call it earlier (before CLI parsing; that's where the monitor APIs migh

[Qemu-devel] [PATCH v9 0/7] monitor: let Monitor be thread safe

2018-05-28 Thread Peter Xu
v9: - two more patches to implement Markus's idea to init monitor earlier (which are patch 5 & 6) - touch up patch 7 to init the fdset lock in monitor_init_globals() v8: - some wording changes according to previous comments [Markus] - return -ENOENT too in stubs/fdset.c:monitor_fdset_get_fd() [S

[Qemu-devel] [PATCH v9 3/7] monitor: more comments on lock-free elements

2018-05-28 Thread Peter Xu
Add some explicit comments for both Readline and cpu_set/cpu_get helpers that they do not need the mon_lock protection. Signed-off-by: Peter Xu --- monitor.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/monitor.c b/monitor.c index d6c3c08932..f23178951e 100644

[Qemu-devel] [PATCH v9 2/7] monitor: protect mon->fds with mon_lock

2018-05-28 Thread Peter Xu
mon->fds were protected by BQL. Now protect it by mon_lock so that it can even be used in monitor iothread. Reviewed-by: Stefan Hajnoczi Reviewed-by: Markus Armbruster Signed-off-by: Peter Xu --- monitor.c | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --g

[Qemu-devel] [PATCH v9 1/7] monitor: rename out_lock to mon_lock

2018-05-28 Thread Peter Xu
The out_lock is protecting a few Monitor fields. In the future the monitor code will start to run in multiple threads. We are going to turn it into a bigger lock to protect not only the out buffer but also most of the rest. Since at it, rearrange the Monitor struct a bit. Reviewed-by: Stefan Ha

Re: [Qemu-devel] [PATCH v7 4/4] monitor: add lock to protect mon_fdsets

2018-05-28 Thread Peter Xu
On Mon, May 28, 2018 at 05:19:08PM +0200, Markus Armbruster wrote: [...] > >> > >> > + * Meanwhile it can also be used even at the end of main. Let's keep > >> > + * it initialized for the whole lifecycle of QEMU. > >> > + */ > >> > >> Awkward question, since our main() is such a tangled mess,

[Qemu-devel] [PATCH] pc-bios/s390-ccw: define loadparm length

2018-05-28 Thread Collin Walling
Loadparm is defined by the s390 architecture to be 8 bytes in length. Let's define this size in the s390-ccw bios. Suggested-by: Laszlo Ersek Signed-off-by: Collin Walling --- pc-bios/s390-ccw/iplb.h | 4 +++- pc-bios/s390-ccw/main.c | 8 pc-bios/s390-ccw/sclp.c | 2 +- pc-bios/s390-cc

Re: [Qemu-devel] [PATCH v2] aspeed_scu: Implement RNG register

2018-05-28 Thread Joel Stanley
On 29 May 2018 at 01:37, Philippe Mathieu-Daudé wrote: > Hi Joel, > > On 05/28/2018 12:22 PM, Joel Stanley wrote: >> The ASPEED SoCs contain a single register that returns random data when >> read. This models that register so that guests can use it. >> >> The random number data register has a cor

[Qemu-devel] [PATCH v3] aspeed_scu: Implement RNG register

2018-05-28 Thread Joel Stanley
The ASPEED SoCs contain a single register that returns random data when read. This models that register so that guests can use it. The random number data register has a corresponding control register, however it returns data regardless of the state of the enabled bit, so the model follows this beh

Re: [Qemu-devel] [PATCH v6 04/10] qcow2: Implement copy offloading

2018-05-28 Thread Fam Zheng
On Mon, 05/28 11:36, Fam Zheng wrote: > The two callbacks are implemented quite similarly to the read/write > functions: bdrv_co_copy_range_from maps for read and calls into bs->file > or bs->backing depending on the allocation status; bdrv_co_copy_range_to > maps for write and calls into bs->file.

[Qemu-devel] [PATCH v2] ARM: ACPI: Fix use-after-free due to memory realloc

2018-05-28 Thread Shannon Zhao
acpi_data_push uses g_array_set_size to resize the memory size. If there is no enough contiguous memory, the address will be changed. So previous pointer could not be used any more. It must update the pointer and use the new one. Reviewed-by: Eric Auger Reviewed-by: Philippe Mathieu-Daudé Signed

[Qemu-devel] [PATCH] memory: bug 1720969: Make operations using MemoryRegionIoeventfd struct pass by pointer.

2018-05-28 Thread Tristan Burgess
This changes the functions memory_region_ioeventfd_equal, memory_region_ioeventfd_before, and their callers, to pass the MemoryRegionIoeventfd struct via pointer, instead of directly passing the struct. This saves on stack space and is considered safe practice. Signed-off-by: Tristan Burgess --

[Qemu-devel] [PATCH] socket: dont't free msgfds if error equals EAGAIN

2018-05-28 Thread linzhecheng
Signed-off-by: linzhecheng diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 159e69c3b1..17519ec589 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -134,8 +134,8 @@ static int tcp_chr_write(Chardev *chr, const uint8_t *buf, int len)

[Qemu-devel] [Bug 1773753] Re: virsh start after virsh managed save hangs and vm goes to paused state with qemu version v2.12.0-813-g5a5c383b13-dirty on powerpc

2018-05-28 Thread Satheesh Rajendran
** Summary changed: - virsh managed save fails with qemu version v2.12.0-813-g5a5c383b13-dirty on powerpc + virsh start after virsh managed save hangs and vm goes to paused state with qemu version v2.12.0-813-g5a5c383b13-dirty on powerpc ** Summary changed: - virsh start after virsh managed sa

[Qemu-devel] [PATCH v2] vhost-blk: turn on pre-defined RO feature bit

2018-05-28 Thread Changpeng Liu
Read only feature shouldn't be negotiable, because if the backend device reported Read only feature supported, QEMU host driver shouldn't change backend's RO attribute. While here, also enable the vhost-user-blk test utility to test RO feature. Signed-off-by: Changpeng Liu --- contrib/vhost-user

Re: [Qemu-devel] [PATCH v4 15/21] hw/block/nvme: Include "qemu/cutils.h" directly in the source file

2018-05-28 Thread Philippe Mathieu-Daudé
On 05/28/2018 08:27 PM, Philippe Mathieu-Daudé wrote: I forgot to add this commit description: "block/nvme.h" does not require any declaration of "qemu/cutils.h". Simplify dependencies by directly include it in the source file where the declarations are used. > Signed-off-by: Philippe Math

Re: [Qemu-devel] [PATCH v4 01/21] vfio: Include "exec/address-spaces.h" directly in the source file

2018-05-28 Thread Philippe Mathieu-Daudé
On 05/28/2018 09:06 PM, Michael S. Tsirkin wrote: > On Mon, May 28, 2018 at 05:48:05PM -0600, Alex Williamson wrote: >> On Mon, 28 May 2018 20:26:59 -0300 >> Philippe Mathieu-Daudé wrote: >> >> -ENOCOMMITLOG Oops sorry Alex, I meant to add some, but missed this while rebasing. >> Why? Tangible

Re: [Qemu-devel] [PATCH v4 00/21] Includes cleanup

2018-05-28 Thread Michael S. Tsirkin
On Mon, May 28, 2018 at 08:26:58PM -0300, Philippe Mathieu-Daudé wrote: > Hi, > > I split the previous series "Use the BYTE-based definitions when useful", > this is the first generic part, only headers cleanup, which is big enough. > > Many patches, but "12 insertions(+), 145 deletions(-)" \o/

Re: [Qemu-devel] [PATCH v4 01/21] vfio: Include "exec/address-spaces.h" directly in the source file

2018-05-28 Thread Michael S. Tsirkin
On Mon, May 28, 2018 at 05:48:05PM -0600, Alex Williamson wrote: > On Mon, 28 May 2018 20:26:59 -0300 > Philippe Mathieu-Daudé wrote: > > -ENOCOMMITLOG > > Why? Tangible benefit. Looks like noise. Thanks, > > Alex I agree it should have a commit log, but .c files should be self-sufficient n

[Qemu-devel] [PATCH v4 12/21] hw: Do not include "sysemu/block-backend.h" if it is not necessary

2018-05-28 Thread Philippe Mathieu-Daudé
Remove those unneeded includes to speed up the compilation process a little bit. (Continue 7eceff5b5a1fa cleanup) Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/collie.c | 1 - hw/arm/gumstix.c | 1 - hw/arm/mainstone.c | 1

[Qemu-devel] [PATCH v4 08/21] target/hppa: Include "qemu/log.h" to use qemu_log()

2018-05-28 Thread Philippe Mathieu-Daudé
Since his inception in 61766fe9e2d, this file uses the qemu_log() API from "qemu/log.h". Include it to allow further includes cleanup. Signed-off-by: Philippe Mathieu-Daudé --- target/hppa/int_helper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/hppa/int_helper.c b/target/hppa/in

[Qemu-devel] [PATCH v4 21/21] hw: Clean "hw/devices.h" includes

2018-05-28 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé --- This starts the slow process of getting rid of devices.h... --- include/hw/devices.h | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/hw/devices.h b/include/hw/devices.h index 861ddea8af..0e27feb0c2 100644 --- a/include/h

[Qemu-devel] [PATCH v4 14/21] hw: Do not include "sysemu/blockdev.h" if it is not necessary

2018-05-28 Thread Philippe Mathieu-Daudé
Remove those unneeded includes to speed up the compilation process a little bit. Code change produced with: $ git grep '#include "sysemu/blockdev.h"' | \ cut -d: -f-1 | \ xargs egrep -L "(BlockInterfaceType|DriveInfo|drive_get|blk_legacy_dinfo|blockdev_mark_auto_del)" | \

[Qemu-devel] [PATCH v4 20/21] hw/ide: Remove unused include

2018-05-28 Thread Philippe Mathieu-Daudé
There is no need to include pci.h in this file. (Continue f23c81073a cleanup). Signed-off-by: Philippe Mathieu-Daudé --- hw/ide/core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index 866c659498..cc9ca28c33 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -

[Qemu-devel] [PATCH v4 17/21] hw/misc/sga: Use the correct ISA include

2018-05-28 Thread Philippe Mathieu-Daudé
The SGA BIOS loader is an ISA device, it does not require the PCI header. Signed-off-by: Philippe Mathieu-Daudé --- hw/misc/sga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/sga.c b/hw/misc/sga.c index 97fd63f176..4a22a52a60 100644 --- a/hw/misc/sga.c +++ b/hw/mis

[Qemu-devel] [PATCH v4 19/21] hw/i386/pc: Remove unused include

2018-05-28 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d768930d02..8b0803cb83 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -64,7 +64,6 @@ #include "hw/acpi/acpi.h" #include "hw/acpi/cpu_hotplug.h" #include

Re: [Qemu-devel] [PATCH v4 01/21] vfio: Include "exec/address-spaces.h" directly in the source file

2018-05-28 Thread Alex Williamson
On Mon, 28 May 2018 20:26:59 -0300 Philippe Mathieu-Daudé wrote: -ENOCOMMITLOG Why? Tangible benefit. Looks like noise. Thanks, Alex > Signed-off-by: Philippe Mathieu-Daudé > --- > include/hw/vfio/vfio-common.h | 1 - > hw/vfio/ccw.c | 1 + > hw/vfio/platform.c

[Qemu-devel] [PATCH v4 18/21] hw/hppa: Remove unused include

2018-05-28 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé --- hw/hppa/hppa_sys.h | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/hppa/hppa_sys.h b/hw/hppa/hppa_sys.h index a182d1f34e..3f6c145120 100644 --- a/hw/hppa/hppa_sys.h +++ b/hw/hppa/hppa_sys.h @@ -3,7 +3,6 @@ #ifndef HW_HPPA_SYS_H #define HW_HPPA_SYS

[Qemu-devel] [PATCH v4 15/21] hw/block/nvme: Include "qemu/cutils.h" directly in the source file

2018-05-28 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- hw/block/nvme.h | 1 - hw/block/nvme.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/nvme.h b/hw/block/nvme.h index 8f3981121d..cabcf20c32 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -1,6

[Qemu-devel] [PATCH v4 09/21] target: Do not include "exec/exec-all.h" if it is not necessary

2018-05-28 Thread Philippe Mathieu-Daudé
Code change produced with: $ git grep '#include "exec/exec-all.h"' | \ cut -d: -f-1 | \ xargs egrep -L "(cpu_address_space_init|cpu_loop_|tlb_|tb_|GETPC|singlestep|TranslationBlock)" | \ xargs sed -i.bak '/#include "exec\/exec-all.h"/d' Signed-off-by: Philippe Mathieu-Daudé

[Qemu-devel] [PATCH v4 10/21] hw: Do not include "exec/ioport.h" if it is not necessary

2018-05-28 Thread Philippe Mathieu-Daudé
Code change produced with: $ git grep '#include "exec/ioport.h"' hw | \ cut -d: -f-1 | \ xargs egrep -Li "(portio|cpu_(in|out).\()" | \ xargs sed -i.bak '/#include "exec\/ioport.h"/d' Signed-off-by: Philippe Mathieu-Daudé --- hw/acpi/pcihp.c | 1 - hw/acpi/piix4.c | 1 - 2

[Qemu-devel] [PATCH v4 13/21] hw: Do not include "sysemu/blockdev.h" if it is not necessary

2018-05-28 Thread Philippe Mathieu-Daudé
The header "hw/boards.h" already includes "sysemu/blockdev.h". Code change produced with: $ git grep '#include "sysemu/blockdev.h"' hw | \ cut -d: -f-1 | \ xargs fgrep -l '#include "hw/boards.h"' | \ xargs sed -i.bak '/#include "sysemu\/blockdev.h"/d' Signed-off-by: Philipp

[Qemu-devel] [PATCH v4 07/21] target/ppc: Include "exec/exec-all.h" which provides tlb_flush()

2018-05-28 Thread Philippe Mathieu-Daudé
Since it inception this include uses tlb_flush() declared in "exec/exec-all.h". Include the other header to allow further includes cleanup. Signed-off-by: Philippe Mathieu-Daudé --- target/ppc/helper_regs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/target/ppc/helper_regs.h b/target/ppc

[Qemu-devel] [PATCH v4 06/21] target/xtensa: Include "qemu/timer.h" to use NANOSECONDS_PER_SECOND

2018-05-28 Thread Philippe Mathieu-Daudé
Since d0ce7e9cfc the dc232b structure uses the NANOSECONDS_PER_SECOND definition from "qemu/timer.h". Include it to allow further includes cleanup. Signed-off-by: Philippe Mathieu-Daudé --- target/xtensa/core-dc232b.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/xtensa/core-dc232b

[Qemu-devel] [PATCH v4 16/21] hw/misc/mips_itu: Cleanup includes

2018-05-28 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé --- include/hw/misc/mips_itu.h | 2 ++ hw/misc/mips_itu.c | 5 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/hw/misc/mips_itu.h b/include/hw/misc/mips_itu.h index b3a4532036..030eb4ac62 100644 --- a/include/hw/misc/mips_

[Qemu-devel] [PATCH v4 03/21] target: Do not include "exec/address-spaces.h" if it is not necessary

2018-05-28 Thread Philippe Mathieu-Daudé
Code change produced with: $ git grep '#include "exec/address-spaces.h"' target | \ cut -d: -f-1 | \ xargs egrep -L "(get_system_|address_space_)" | \ xargs sed -i.bak '/#include "exec\/address-spaces.h"/d' Signed-off-by: Philippe Mathieu-Daudé --- target/i386/hvf/x86_task.

[Qemu-devel] [PATCH v4 11/21] hw: Do not include "exec/address-spaces.h" if it is not necessary

2018-05-28 Thread Philippe Mathieu-Daudé
Code change produced with: $ git grep '#include "exec/address-spaces.h"' hw include/hw | \ cut -d: -f-1 | \ xargs egrep -L "(get_system_|address_space_)" | \ xargs sed -i.bak '/#include "exec\/address-spaces.h"/d' Signed-off-by: Philippe Mathieu-Daudé --- include/hw/arm/all

[Qemu-devel] [PATCH v4 05/21] target/i386: Do not include "exec/ioport.h" if it is not necessary

2018-05-28 Thread Philippe Mathieu-Daudé
Code change produced with: $ git grep '#include "exec/ioport.h"' target | \ cut -d: -f-1 | \ xargs egrep -Li "(portio|cpu_(in|out).\()" | \ xargs sed -i.bak '/#include "exec\/ioport.h"/d' Signed-off-by: Philippe Mathieu-Daudé --- target/i386/hax-all.c | 1 - target/i38

[Qemu-devel] [PATCH v4 04/21] memory: Do not include "exec/ioport.h" if it is not necessary

2018-05-28 Thread Philippe Mathieu-Daudé
Code change produced with: $ git grep '#include "exec/ioport.h"' memory.c | \ cut -d: -f-1 | \ xargs egrep -Li "(portio|cpu_(in|out).\()" | \ xargs sed -i.bak '/#include "exec\/ioport.h"/d' Signed-off-by: Philippe Mathieu-Daudé --- memory.c | 1 - 1 file changed, 1 deletion

[Qemu-devel] [PATCH v4 00/21] Includes cleanup

2018-05-28 Thread Philippe Mathieu-Daudé
Hi, I split the previous series "Use the BYTE-based definitions when useful", this is the first generic part, only headers cleanup, which is big enough. Many patches, but "12 insertions(+), 145 deletions(-)" \o/ v3 was: http://lists.nongnu.org/archive/html/qemu-devel/2018-04/msg02049.html Phili

[Qemu-devel] [PATCH v4 01/21] vfio: Include "exec/address-spaces.h" directly in the source file

2018-05-28 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé --- include/hw/vfio/vfio-common.h | 1 - hw/vfio/ccw.c | 1 + hw/vfio/platform.c| 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index d9360148e6..82

[Qemu-devel] [PATCH v4 02/21] accel: Do not include "exec/address-spaces.h" if it is not necessary

2018-05-28 Thread Philippe Mathieu-Daudé
Code change produced with: $ git grep '#include "exec/address-spaces.h"' accel | \ cut -d: -f-1 | \ xargs egrep -L "(get_system_|address_space_)" | \ xargs sed -i.bak '/#include "exec\/address-spaces.h"/d' Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec.c | 1 -

Re: [Qemu-devel] storing machine data in qcow images?

2018-05-28 Thread Richard W.M. Jones
On Mon, May 28, 2018 at 08:38:33PM +0200, Kevin Wolf wrote: > Just accessing the image file within a tar archive is possible and we > could write a block driver for that (I actually think we should do > this), but it restricts you because certain operations like resizing > aren't really possible in

Re: [Qemu-devel] storing machine data in qcow images?

2018-05-28 Thread Richard W.M. Jones
On Mon, May 28, 2018 at 10:20:54PM +0100, Richard W.M. Jones wrote: > On Mon, May 28, 2018 at 08:38:33PM +0200, Kevin Wolf wrote: > > Just accessing the image file within a tar archive is possible and we > > could write a block driver for that (I actually think we should do > > this), but it restri

Re: [Qemu-devel] [PATCH] linux-user: SPARC "rd %tick" can be used by user application

2018-05-28 Thread Philippe Mathieu-Daudé
On 05/28/2018 04:48 PM, Laurent Vivier wrote: > we have the same problem decribed in 7d6b1daedd > ("linux-user, ppc: mftbl can be used by user application") > for ppc in the case of sparc. > > When we use an application trying to resolve a name, it hangs in > > 0xff5dd40c: rd %tick,

Re: [Qemu-devel] [Qemu-ppc] [PATCH] target/ppc: Use proper logging function for possible guest errors

2018-05-28 Thread Greg Kurz
On Mon, 28 May 2018 20:11:19 +0200 Thomas Huth wrote: > fprintf() and qemu_log_separate() are frowned upon these days for printing > logging information in QEMU. Accessing the wrong SPRs indicates wrong guest > behaviour in most cases, and we've got a proper way to log such situations, > which is

[Qemu-devel] [PATCH] linux-user: SPARC "rd %tick" can be used by user application

2018-05-28 Thread Laurent Vivier
we have the same problem decribed in 7d6b1daedd ("linux-user, ppc: mftbl can be used by user application") for ppc in the case of sparc. When we use an application trying to resolve a name, it hangs in 0xff5dd40c: rd %tick, %o5 0xff5dd410: srlx %o5, 0x20, %o4 0x000

Re: [Qemu-devel] storing machine data in qcow images?

2018-05-28 Thread Kevin Wolf
Am 28.05.2018 um 20:44 hat Max Reitz geschrieben: > On 2018-05-28 20:38, Kevin Wolf wrote: > > Am 28.05.2018 um 20:30 hat Richard W.M. Jones geschrieben: > >> On Mon, May 28, 2018 at 08:10:32PM +0200, Max Reitz wrote: > >>> As someone who is just naive and doesn't see the big picture, I don't > >>>

Re: [Qemu-devel] [PATCH v1] xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors

2018-05-28 Thread Philippe Mathieu-Daudé
On 05/28/2018 03:58 PM, Edgar E. Iglesias wrote: > On Mon, May 28, 2018 at 08:48:59PM +0200, Francisco Iglesias wrote: >> Coverity found that the string return by 'object_get_canonical_path' was not >> being freed at two locations in the model (CID 1391294 and CID 1391293) and >> also that a memset

Re: [Qemu-devel] [PATCH v1] xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors

2018-05-28 Thread Edgar E. Iglesias
On Mon, May 28, 2018 at 08:48:59PM +0200, Francisco Iglesias wrote: > Coverity found that the string return by 'object_get_canonical_path' was not > being freed at two locations in the model (CID 1391294 and CID 1391293) and > also that a memset was being called with a value greater than the max of

[Qemu-devel] [PATCH v2] linux-user: Remove extra mapping

2018-05-28 Thread Steve Mcpolin
When a guest mmap()'d a file, a transient MAP_ANONYMOUS mapping was created, which required the kernel to reserve this memory, then subsequently released by applying a mapping with just the requested flags and fd. This transient mapping causes spurious failures when the available memory is smaller

Re: [Qemu-devel] storing machine data in qcow images?

2018-05-28 Thread Max Reitz
On 2018-05-28 20:38, Kevin Wolf wrote: > Am 28.05.2018 um 20:30 hat Richard W.M. Jones geschrieben: >> On Mon, May 28, 2018 at 08:10:32PM +0200, Max Reitz wrote: >>> As someone who is just naive and doesn't see the big picture, I don't >>> see what's wrong with using a tar file that contains the im

Re: [Qemu-devel] [Qemu-trivial] [PATCH] target/ppc: Use proper logging function for possible guest errors

2018-05-28 Thread Philippe Mathieu-Daudé
On 05/28/2018 03:11 PM, Thomas Huth wrote: > fprintf() and qemu_log_separate() are frowned upon these days for printing > logging information in QEMU. Accessing the wrong SPRs indicates wrong guest > behaviour in most cases, and we've got a proper way to log such situations, > which is the qemu_log

[Qemu-devel] [PATCH v1] xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors

2018-05-28 Thread Francisco Iglesias
Coverity found that the string return by 'object_get_canonical_path' was not being freed at two locations in the model (CID 1391294 and CID 1391293) and also that a memset was being called with a value greater than the max of a byte on the second argument (CID 1391286). This patch corrects this by

Re: [Qemu-devel] storing machine data in qcow images?

2018-05-28 Thread Richard W.M. Jones
On Mon, May 28, 2018 at 08:10:32PM +0200, Max Reitz wrote: > As someone who is just naive and doesn't see the big picture, I don't > see what's wrong with using a tar file that contains the image and > additional data. FWIW an OVA file is exactly this: an uncompressed tar file containing disk imag

Re: [Qemu-devel] storing machine data in qcow images?

2018-05-28 Thread Max Reitz
On 2018-05-24 13:32, Richard W.M. Jones wrote: > I read the whole thread and the fundamental problem is that you're > mixing layers. Let qcow2 be a disk image format, and let management > layers deal with metadata and how to run qemu. > > What's going to happen when you have (eg) an OVA file cont

Re: [Qemu-devel] storing machine data in qcow images?

2018-05-28 Thread Kevin Wolf
Am 28.05.2018 um 20:30 hat Richard W.M. Jones geschrieben: > On Mon, May 28, 2018 at 08:10:32PM +0200, Max Reitz wrote: > > As someone who is just naive and doesn't see the big picture, I don't > > see what's wrong with using a tar file that contains the image and > > additional data. > > FWIW an

[Qemu-devel] [PATCH] target/ppc: Use proper logging function for possible guest errors

2018-05-28 Thread Thomas Huth
fprintf() and qemu_log_separate() are frowned upon these days for printing logging information in QEMU. Accessing the wrong SPRs indicates wrong guest behaviour in most cases, and we've got a proper way to log such situations, which is the qemu_log_mask(LOG_GUEST_ERROR, ...) function. So use this f

Re: [Qemu-devel] [RFC v2 5/6] hw/arm: ACPI SRAT changes to accommodate non-contiguous mem

2018-05-28 Thread Andrew Jones
On Wed, May 16, 2018 at 04:20:25PM +0100, Shameer Kolothum wrote: > This is in preparation for the next patch where initial ram is split > into a non-pluggable chunk and a pc-dimm modeled mem if the vaild > iova regions are non-contiguous. > > Signed-off-by: Shameer Kolothum > --- > hw/arm/virt

Re: [Qemu-devel] [RFC v2 2/6] hw/arm/virt: Enable dynamic generation of guest RAM memory regions

2018-05-28 Thread Andrew Jones
On Wed, May 16, 2018 at 04:20:22PM +0100, Shameer Kolothum wrote: > Register ram_memory_region_init notifier to allocate memory region > from system memory. > > Signed-off-by: Zhu Yijun > Signed-off-by: Shameer Kolothum > --- > hw/arm/virt.c | 28 ++-- > include/

Re: [Qemu-devel] [Qemu-arm] [PATCH] ARM: ACPI: Fix use-after-free due to memory realloc

2018-05-28 Thread Philippe Mathieu-Daudé
On 05/28/2018 05:42 AM, Shannon Zhao wrote: > acpi_data_push uses g_array_set_size to resize the memory size. If there > is no enough contiguous memory, the address will be changed. So previous > pointer could not be used any more. It must update the pointer and use > the new one. > > Signed-off-b

Re: [Qemu-devel] [PATCH v2] aspeed_scu: Implement RNG register

2018-05-28 Thread Philippe Mathieu-Daudé
Hi Joel, On 05/28/2018 12:22 PM, Joel Stanley wrote: > The ASPEED SoCs contain a single register that returns random data when > read. This models that register so that guests can use it. > > The random number data register has a corresponding control register, > data returns a different number r

Re: [Qemu-devel] [PATCH v2] Remove unwanted crlf conversion in serial

2018-05-28 Thread Paolo Bonzini
On 23/05/2018 21:50, Patryk Olszewski wrote: > This patch fixes bug in serial that made it almost impossible for guest > to communicate with devices through host's serial. > > OPOST flag in c_oflag enables output processing letting other flags in > c_oflag take effect. Usually in c_oflag ONLCR fla

Re: [Qemu-devel] [PATCH v2] Remove unwanted crlf conversion in serial

2018-05-28 Thread Paolo Bonzini
On 24/05/2018 07:36, Thomas Huth wrote: > On 23.05.2018 21:50, Patryk Olszewski wrote: >> This patch fixes bug in serial that made it almost impossible for guest >> to communicate with devices through host's serial. >> >> OPOST flag in c_oflag enables output processing letting other flags in >> c_o

Re: [Qemu-devel] [PATCH 4/4] spapr: introduce a new IRQ backend using fixed IRQ number ranges

2018-05-28 Thread Cédric Le Goater
On 05/28/2018 05:18 PM, Greg Kurz wrote: > On Fri, 18 May 2018 18:44:05 +0200 > Cédric Le Goater wrote: > >> The proposed layout of the IRQ number space is organized as follow : >> >>RANGES DEVICES >> >>0x - 0x0FFFReserved for future use (IPI = 2) >>0x1000 - 0x1000

Re: [Qemu-devel] [PATCH v4 0/4] qdev: remove DeviceClass::init/exit()

2018-05-28 Thread Philippe Mathieu-Daudé
On 05/28/2018 12:39 PM, Paolo Bonzini wrote: > On 28/05/2018 16:45, Markus Armbruster wrote: >> This lovely series got stuck after v3, so I took the liberty to respin >> it. >> >> v4: >> * PATCH 1+2 unchanged >> * PATCH 3+4 reshuffled a bit, missing documentation updates supplied > > At long last!

Re: [Qemu-devel] [PATCH v4 0/4] qdev: remove DeviceClass::init/exit()

2018-05-28 Thread Paolo Bonzini
On 28/05/2018 16:45, Markus Armbruster wrote: > This lovely series got stuck after v3, so I took the liberty to respin > it. > > v4: > * PATCH 1+2 unchanged > * PATCH 3+4 reshuffled a bit, missing documentation updates supplied At long last! Queued,t hanks. Paolo

Re: [Qemu-devel] [PATCH v2] aspeed_scu: Implement RNG register

2018-05-28 Thread Cédric Le Goater
On 05/28/2018 05:22 PM, Joel Stanley wrote: > The ASPEED SoCs contain a single register that returns random data when > read. This models that register so that guests can use it. > > The random number data register has a corresponding control register, > data returns a different number regardless

Re: [Qemu-devel] [RFC PATCH] mmio-exec: Make device return MemoryRegion rather than host pointer

2018-05-28 Thread Cédric Le Goater
On 05/28/2018 07:22 AM, Cédric Le Goater wrote: > On 04/26/2018 05:09 PM, Peter Maydell wrote: >> Our current interface for allowing a device to support execution from >> MMIO regions has the device return a pointer into host memory >> containing the contents to be used for execution. Unfortunatel

[Qemu-devel] [PATCH v2] aspeed_scu: Implement RNG register

2018-05-28 Thread Joel Stanley
The ASPEED SoCs contain a single register that returns random data when read. This models that register so that guests can use it. The random number data register has a corresponding control register, data returns a different number regardless of the state of the enabled bit, so the model follows

Re: [Qemu-devel] [PATCH v7 4/4] monitor: add lock to protect mon_fdsets

2018-05-28 Thread Markus Armbruster
Peter Xu writes: > On Thu, May 24, 2018 at 11:03:55AM +0200, Markus Armbruster wrote: >> Peter Xu writes: >> >> > Similar to previous patch, but introduce a new global big lock for >> > mon_fdsets. Take it where needed. >> >> The previous patch is "monitor: more comments on lock-free >> fleid

Re: [Qemu-devel] [PATCH 4/4] spapr: introduce a new IRQ backend using fixed IRQ number ranges

2018-05-28 Thread Greg Kurz
On Fri, 18 May 2018 18:44:05 +0200 Cédric Le Goater wrote: > The proposed layout of the IRQ number space is organized as follow : > >RANGES DEVICES > >0x - 0x0FFFReserved for future use (IPI = 2) >0x1000 - 0x10001 EPOW >0x1001 - 0x10011 HOTPLUG >0

[Qemu-devel] [PATCH] qcow2: Fix Coverity warning when calculating the refcount cache size

2018-05-28 Thread Alberto Garcia
MIN_REFCOUNT_CACHE_SIZE is 4 and the cluster size is guaranteed to be at most 2MB, so the minimum refcount cache size (in bytes) is always going to fit in a 32-bit integer. Coverity doesn't know that, and since we're storing the result in a uint64_t (*refcount_cache_size) it thinks that we need th

Re: [Qemu-devel] [PATCH] aspeed_scu: Implement RNG register

2018-05-28 Thread Cédric Le Goater
On 05/28/2018 04:29 PM, Joel Stanley wrote: > On 28 May 2018 at 23:33, Joel Stanley wrote: >> On 28 May 2018 at 23:17, Cédric Le Goater wrote: >>> Hello Joel, >>> >>> On 05/28/2018 02:46 PM, Joel Stanley wrote: The ASPEED SoCs contain a single register that returns random data when read

[Qemu-devel] [PATCH v4 2/4] hw/i2c: Use DeviceClass::realize instead of I2CSlaveClass::init

2018-05-28 Thread Markus Armbruster
From: Philippe Mathieu-Daudé I2CSlaveClass::init is no more used, remove it. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20180419212727.26095-3-f4...@amsat.org> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- hw/audio/wm8750.c | 8 +++- hw/display/ssd030

[Qemu-devel] [PATCH v4 4/4] qdev: Remove DeviceClass::init() and ::exit()

2018-05-28 Thread Markus Armbruster
From: Philippe Mathieu-Daudé Since no devices use it, we can safely remove it. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20180419212727.26095-5-f4...@amsat.org> Reviewed-by: Markus Armbruster [Removal of DeviceClass::init() moved from previous patch, missing documentation updates supp

[Qemu-devel] [PATCH v4 1/4] hw/i2c/smbus: Use DeviceClass::realize instead of SMBusDeviceClass::init

2018-05-28 Thread Markus Armbruster
From: Philippe Mathieu-Daudé SMBusDeviceClass::init is no more used, remove it. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20180419212727.26095-2-f4...@amsat.org> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- hw/i2c/smbus.c | 9 - hw/i2c/smbus_ee

[Qemu-devel] [PATCH v4 3/4] qdev: Simplify the SysBusDeviceClass::init path

2018-05-28 Thread Markus Armbruster
From: Philippe Mathieu-Daudé Instead of using SysBusDeviceClass::realize -> DeviceClass::realize -> DeviceClass::init -> sysbus_device_init -> SysBusDeviceClass::init Simplify the path by directly calling SysBusDeviceClass::init in SysBusDeviceClass::realize:

  1   2   >