Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Gerd Hoffmann
Hi, > It would be much nicer to do the wrapper the other way round, i.e. > setting properties before the device is realized would update a > configuration struct and realize would then call .create() with that > struct. To me, this sounds much harder, though also a more useful state. Well, in s

Re: [PATCH] hw/block: m25p80: Fix fast read for SST flashes

2020-12-02 Thread Alistair Francis
On Wed, Dec 2, 2020 at 3:09 PM Bin Meng wrote: > > Hi Alistair, > > On Thu, Dec 3, 2020 at 3:52 AM Alistair Francis wrote: > > > > On Sun, Nov 29, 2020 at 6:55 PM Bin Meng wrote: > > > > > > From: Bin Meng > > > > > > SST flashes require a dummy byte after the address bits. > > > > > > Signed-o

Re: [PATCH] hw/block: m25p80: Fix fast read for SST flashes

2020-12-02 Thread Bin Meng
Hi Alistair, On Thu, Dec 3, 2020 at 3:52 AM Alistair Francis wrote: > > On Sun, Nov 29, 2020 at 6:55 PM Bin Meng wrote: > > > > From: Bin Meng > > > > SST flashes require a dummy byte after the address bits. > > > > Signed-off-by: Bin Meng > > I couldn't find a datasheet that says this... But

Re: [PATCH] hw/block: m25p80: Fix fast read for SST flashes

2020-12-02 Thread Alistair Francis
On Sun, Nov 29, 2020 at 6:55 PM Bin Meng wrote: > > From: Bin Meng > > SST flashes require a dummy byte after the address bits. > > Signed-off-by: Bin Meng I couldn't find a datasheet that says this... But the actual code change looks fine, so: Acked-by: Alistair Francis Alistair > --- > >

Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Eduardo Habkost
On Wed, Dec 02, 2020 at 06:35:06PM +0100, Kevin Wolf wrote: > Am 02.12.2020 um 17:05 hat Eduardo Habkost geschrieben: > > > > Looks nice as end goal. Then, these are a few questions I would > > > > have about the transition plan: > > > > > > > > Would it require changing both device implementatio

[PATCH v13 10/10] block: apply COR-filter to block-stream jobs

2020-12-02 Thread Andrey Shinkevich via
This patch completes the series with the COR-filter applied to block-stream operations. Adding the filter makes it possible for copied regions to be discarded in backing files during the block-stream job, what will reduce the disk overuse. The COR-filter insertion incurs changes in the test case 24

[PATCH v13 03/10] copy-on-read: add filter drop function

2020-12-02 Thread Andrey Shinkevich via
Provide API for the COR-filter removal. Also, drop the filter child permissions for an inactive state when the filter node is being removed. To insert the filter, the block generic layer function bdrv_insert_node() can be used. The new function bdrv_cor_filter_drop() may be considered as an interme

[PATCH v13 01/10] copy-on-read: support preadv/pwritev_part functions

2020-12-02 Thread Andrey Shinkevich via
Add support for the recently introduced functions bdrv_co_preadv_part() and bdrv_co_pwritev_part() to the COR-filter driver. Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/copy-on-read.c | 28 1 file changed, 16 insertions(+), 1

[PATCH v13 02/10] block: add API function to insert a node

2020-12-02 Thread Andrey Shinkevich via
Provide API for insertion a node to backing chain. Suggested-by: Max Reitz Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy --- block.c | 25 + include/block/block.h | 2 ++ 2 files changed, 27 insertions(+) diff --git a/block.c

[PATCH v13 06/10] iotests: add #310 to test bottom node in COR driver

2020-12-02 Thread Andrey Shinkevich via
The test case #310 is similar to #216 by Max Reitz. The difference is that the test #310 involves a bottom node to the COR filter driver. Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/310 | 114 +

[PATCH v13 09/10] stream: skip filters when writing backing file name to QCOW2 header

2020-12-02 Thread Andrey Shinkevich via
Avoid writing a filter JSON file name and a filter format name to QCOW2 image when the backing file is being changed after the block stream job. It can occur due to a concurrent commit job on the same backing chain. A user is still able to assign the 'backing-file' parameter for a block-stream job

[PATCH v13 07/10] block: include supported_read_flags into BDS structure

2020-12-02 Thread Andrey Shinkevich via
Add the new member supported_read_flags to the BlockDriverState structure. It will control the flags set for copy-on-read operations. Make the block generic layer evaluate supported read flags before they go to a block driver. Suggested-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Andrey Shink

[PATCH v13 00/10] Apply COR-filter to the block-stream permanently

2020-12-02 Thread Andrey Shinkevich via
The previous version 12 was discussed in the email thread: Message-Id: <1603390423-980205-1-git-send-email-andrey.shinkev...@virtuozzo.com> v13: 02: The bdrv_remove_node() was dropped. 05: Three patches with fixes were merged into one. 06: Minor changes based on Vladimir's suggestions. 08:

[PATCH v13 05/10] qapi: create BlockdevOptionsCor structure for COR driver

2020-12-02 Thread Andrey Shinkevich via
Create the BlockdevOptionsCor structure for COR driver specific options splitting it off form the BlockdevOptionsGenericFormat. The only option 'bottom' node in the structure denotes an image file that limits the COR operations in the backing chain. We are going to use the COR-filter for a block-st

[PATCH v13 08/10] copy-on-read: skip non-guest reads if no copy needed

2020-12-02 Thread Andrey Shinkevich via
If the flag BDRV_REQ_PREFETCH was set, skip idling read/write operations in COR-driver. It can be taken into account for the COR-algorithms optimization. That check is being made during the block stream job by the moment. Add the BDRV_REQ_PREFETCH flag to the supported_read_flags of the COR-filter

[PATCH v13 04/10] qapi: add filter-node-name to block-stream

2020-12-02 Thread Andrey Shinkevich via
Provide the possibility to pass the 'filter-node-name' parameter to the block-stream job as it is done for the commit block job. Signed-off-by: Andrey Shinkevich Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/monitor/block-hmp-cmds.c | 4 ++-- block/stream.c | 4 +++- block

Re: [PATCH v12 14/14] block: apply COR-filter to block-stream jobs

2020-12-02 Thread Andrey Shinkevich
On 27.10.2020 21:24, Andrey Shinkevich wrote: On 27.10.2020 20:57, Vladimir Sementsov-Ogievskiy wrote: 27.10.2020 20:48, Andrey Shinkevich wrote: On 27.10.2020 19:13, Vladimir Sementsov-Ogievskiy wrote: 22.10.2020 21:13, Andrey Shinkevich wrote: This patch completes the series with the CO

Re: Plans to bring QMP 'x-blockdev-reopen' out of experimental?

2020-12-02 Thread Kevin Wolf
Am 02.12.2020 um 17:40 hat Alberto Garcia geschrieben: > On Wed 02 Dec 2020 05:28:08 PM CET, Kevin Wolf wrote: > > >> So x-blockdev-reopen sees that we want to replace the current > >> bs->file ("hd0-file") with a new one ("throttle0"). The problem here > >> is that throttle0 has hd0-file as its c

Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Kevin Wolf
Am 02.12.2020 um 17:05 hat Eduardo Habkost geschrieben: > > > Looks nice as end goal. Then, these are a few questions I would > > > have about the transition plan: > > > > > > Would it require changing both device implementation and device > > > users in lockstep? Should we have a compatibility

Re: Plans to bring QMP 'x-blockdev-reopen' out of experimental?

2020-12-02 Thread Alberto Garcia
On Wed 02 Dec 2020 05:28:08 PM CET, Kevin Wolf wrote: >> So x-blockdev-reopen sees that we want to replace the current >> bs->file ("hd0-file") with a new one ("throttle0"). The problem here >> is that throttle0 has hd0-file as its child, so when we check the >> permissions on throttle0 (and its c

Re: Plans to bring QMP 'x-blockdev-reopen' out of experimental?

2020-12-02 Thread Kevin Wolf
Am 02.12.2020 um 17:12 hat Alberto Garcia geschrieben: > On Tue 20 Oct 2020 10:23:33 AM CEST, Kevin Wolf wrote: > >> I forgot to add, we still don't support changing bs->file with this > >> command, so I guess that would be one blocker? > >> > >> There's no other way of inserting filter nodes, or

Re: Plans to bring QMP 'x-blockdev-reopen' out of experimental?

2020-12-02 Thread Alberto Garcia
On Tue 20 Oct 2020 10:23:33 AM CEST, Kevin Wolf wrote: >> I forgot to add, we still don't support changing bs->file with this >> command, so I guess that would be one blocker? >> >> There's no other way of inserting filter nodes, or is there? > > Not that I'm aware of. > > So yes, changing bs->fil

Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Eduardo Habkost
On Wed, Dec 02, 2020 at 04:17:13PM +0100, Kevin Wolf wrote: > Am 02.12.2020 um 14:54 hat Eduardo Habkost geschrieben: > > On Wed, Dec 02, 2020 at 02:26:44PM +0100, Paolo Bonzini wrote: > > > On 02/12/20 13:51, Eduardo Habkost wrote: > > > > > > I'm liking the direction this is taking. However, I w

Re: [PATCH v2 4/4] block/export: avoid g_return_val_if() input validation

2020-12-02 Thread Philippe Mathieu-Daudé
On 12/2/20 4:26 PM, Stefan Hajnoczi wrote: > Do not validate input with g_return_val_if(). This API is intended for > checking programming errors and is compiled out with -DG_DISABLE_CHECKS. > > Use an explicit if statement for input validation so it cannot > accidentally be compiled out. > > Sug

Re: [PATCH v2 1/4] contrib/vhost-user-blk: avoid g_return_val_if() input validation

2020-12-02 Thread Philippe Mathieu-Daudé
On 12/2/20 4:26 PM, Stefan Hajnoczi wrote: > Do not validate input with g_return_val_if(). This API is intended for > checking programming errors and is compiled out with -DG_DISABLE_CHECKS. > > Use an explicit if statement for input validation so it cannot > accidentally be compiled out. > > Sug

Re: [PATCH v2 1/4] contrib/vhost-user-blk: avoid g_return_val_if() input validation

2020-12-02 Thread Raphael Norwitz
On Wed, Dec 2, 2020 at 10:27 AM Stefan Hajnoczi wrote: > > Do not validate input with g_return_val_if(). This API is intended for > checking programming errors and is compiled out with -DG_DISABLE_CHECKS. > > Use an explicit if statement for input validation so it cannot > accidentally be compiled

Re: [PATCH v2 4/4] block/export: avoid g_return_val_if() input validation

2020-12-02 Thread Marc-André Lureau
On Wed, Dec 2, 2020 at 7:27 PM Stefan Hajnoczi wrote: > Do not validate input with g_return_val_if(). This API is intended for > checking programming errors and is compiled out with -DG_DISABLE_CHECKS. > > Use an explicit if statement for input validation so it cannot > accidentally be compiled o

Re: [PATCH v2 3/4] contrib/vhost-user-input: avoid g_return_val_if() input validation

2020-12-02 Thread Marc-André Lureau
On Wed, Dec 2, 2020 at 7:27 PM Stefan Hajnoczi wrote: > Do not validate input with g_return_val_if(). This API is intended for > checking programming errors and is compiled out with -DG_DISABLE_CHECKS. > > Use an explicit if statement for input validation so it cannot > accidentally be compiled o

Re: [PATCH v2 2/4] contrib/vhost-user-gpu: avoid g_return_val_if() input validation

2020-12-02 Thread Marc-André Lureau
On Wed, Dec 2, 2020 at 7:27 PM Stefan Hajnoczi wrote: > Do not validate input with g_return_val_if(). This API is intended for > checking programming errors and is compiled out with -DG_DISABLE_CHECKS. > > Use an explicit if statement for input validation so it cannot > accidentally be compiled o

Re: [PATCH v2 1/4] contrib/vhost-user-blk: avoid g_return_val_if() input validation

2020-12-02 Thread Marc-André Lureau
On Wed, Dec 2, 2020 at 7:26 PM Stefan Hajnoczi wrote: > Do not validate input with g_return_val_if(). This API is intended for > checking programming errors and is compiled out with -DG_DISABLE_CHECKS. > > Use an explicit if statement for input validation so it cannot > accidentally be compiled o

Re: [raw] Guest stuck during live live-migration

2020-12-02 Thread Kevin Wolf
Am 02.12.2020 um 16:09 hat Quentin Grolleau geschrieben: > Do you think that, applying this patch ( replacing by "#if 0" there : > https://github.com/qemu/qemu/blob/master/block/file-posix.c#L2601 ), > could affect for any reason the customer data ? > > As we are on full NVME and 10G networks it s

[PATCH v2 3/4] contrib/vhost-user-input: avoid g_return_val_if() input validation

2020-12-02 Thread Stefan Hajnoczi
Do not validate input with g_return_val_if(). This API is intended for checking programming errors and is compiled out with -DG_DISABLE_CHECKS. Use an explicit if statement for input validation so it cannot accidentally be compiled out. Suggested-by: Markus Armbruster Signed-off-by: Stefan Hajno

[PATCH v2 2/4] contrib/vhost-user-gpu: avoid g_return_val_if() input validation

2020-12-02 Thread Stefan Hajnoczi
Do not validate input with g_return_val_if(). This API is intended for checking programming errors and is compiled out with -DG_DISABLE_CHECKS. Use an explicit if statement for input validation so it cannot accidentally be compiled out. Suggested-by: Markus Armbruster Signed-off-by: Stefan Hajno

[PATCH v2 4/4] block/export: avoid g_return_val_if() input validation

2020-12-02 Thread Stefan Hajnoczi
Do not validate input with g_return_val_if(). This API is intended for checking programming errors and is compiled out with -DG_DISABLE_CHECKS. Use an explicit if statement for input validation so it cannot accidentally be compiled out. Suggested-by: Markus Armbruster Signed-off-by: Stefan Hajno

[PATCH v2 1/4] contrib/vhost-user-blk: avoid g_return_val_if() input validation

2020-12-02 Thread Stefan Hajnoczi
Do not validate input with g_return_val_if(). This API is intended for checking programming errors and is compiled out with -DG_DISABLE_CHECKS. Use an explicit if statement for input validation so it cannot accidentally be compiled out. Suggested-by: Markus Armbruster Signed-off-by: Stefan Hajno

[PATCH v2 0/4] vhost-user: avoid g_return_val_if() in get/set_config()

2020-12-02 Thread Stefan Hajnoczi
v2: * Print errors [Marc-André] Markus Armbruster pointed out that g_return_val_if() is meant for programming errors. It must not be used for input validation since it can be compiled out. Use explicit if statements instead. This patch series converts vhost-user device backends that use g_return

Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Kevin Wolf
Am 02.12.2020 um 14:54 hat Eduardo Habkost geschrieben: > On Wed, Dec 02, 2020 at 02:26:44PM +0100, Paolo Bonzini wrote: > > On 02/12/20 13:51, Eduardo Habkost wrote: > > > > > I'm liking the direction this is taking. However, I would still > > > > > like to have a clearer and feasible plan that w

RE: [raw] Guest stuck during live live-migration

2020-12-02 Thread Quentin Grolleau
Do you think that, applying this patch ( replacing by "#if 0" there : https://github.com/qemu/qemu/blob/master/block/file-posix.c#L2601 ), could affect for any reason the customer data ? As we are on full NVME and 10G networks it should fix our vm which completely freeze. Quentin ___

Re: [PATCH 0/4] vhost-user: avoid g_return_val_if() in get/set_config()

2020-12-02 Thread Stefan Hajnoczi
On Wed, Nov 18, 2020 at 07:21:15PM +0400, Marc-André Lureau wrote: > Hi > > On Wed, Nov 18, 2020 at 1:17 PM Stefan Hajnoczi wrote: > > > Markus Armbruster pointed out that g_return_val_if() is meant for > > programming > > errors. It must not be used for input validation since it can be compiled

[PATCH] hw/block: m25p80: Implement AAI-WP command support for SST flashes

2020-12-02 Thread Bin Meng
From: Xuzhou Cheng Auto Address Increment (AAI) Word-Program is a special command of SST flashes. AAI-WP allows multiple bytes of data to be programmed without re-issuing the next sequential address location. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng --- hw/block/m25p80.c | 17

Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Eduardo Habkost
On Wed, Dec 02, 2020 at 02:26:44PM +0100, Paolo Bonzini wrote: > On 02/12/20 13:51, Eduardo Habkost wrote: > > > > I'm liking the direction this is taking. However, I would still > > > > like to have a clearer and feasible plan that would work for > > > > -device, -machine, and -cpu. > > > > > >

Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Paolo Bonzini
On 02/12/20 13:51, Eduardo Habkost wrote: I'm liking the direction this is taking. However, I would still like to have a clearer and feasible plan that would work for -device, -machine, and -cpu. -cpu is not a problem since it's generally created with a static configuration (now done with glob

Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Eduardo Habkost
On Wed, Dec 02, 2020 at 10:30:11AM +0100, Paolo Bonzini wrote: > On 01/12/20 23:08, Eduardo Habkost wrote: > > > Properties are only a useful concept if they have a use. If > > > -object/object_add/object-add can do the same job without properties, > > > properties are not needed anymore. > > > >

Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Paolo Bonzini
On 02/12/20 11:27, Kevin Wolf wrote: Declaring read-only QOM properties is trivial. Trivial sounds like it's something the computer should be doing. Possibly, but not necessarily. There's always a cost to automatic code generation. If things are _too_ trivial and easy to get right, the cos

Re: [PATCH v11 2/7] block/nbd.c: Add yank feature

2020-12-02 Thread Lukas Straub
On Wed, 2 Dec 2020 15:18:48 +0300 Vladimir Sementsov-Ogievskiy wrote: > 15.11.2020 14:36, Lukas Straub wrote: > > Register a yank function which shuts down the socket and sets > > s->state = NBD_CLIENT_QUIT. This is the same behaviour as if an > > error occured. > > > > Signed-off-by: Lukas Stra

Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Paolo Bonzini
On 02/12/20 11:38, Kevin Wolf wrote: Am 02.12.2020 um 10:30 hat Paolo Bonzini geschrieben: On 01/12/20 23:08, Eduardo Habkost wrote: Properties are only a useful concept if they have a use. If -object/object_add/object-add can do the same job without properties, properties are not needed anymo

Re: [PATCH v11 2/7] block/nbd.c: Add yank feature

2020-12-02 Thread Vladimir Sementsov-Ogievskiy
15.11.2020 14:36, Lukas Straub wrote: Register a yank function which shuts down the socket and sets s->state = NBD_CLIENT_QUIT. This is the same behaviour as if an error occured. Signed-off-by: Lukas Straub Acked-by: Stefan Hajnoczi Hi! Could I ask, what's the reason for qatomic_load_acquire a

Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Kevin Wolf
Am 02.12.2020 um 10:30 hat Paolo Bonzini geschrieben: > On 01/12/20 23:08, Eduardo Habkost wrote: > > > Properties are only a useful concept if they have a use. If > > > -object/object_add/object-add can do the same job without properties, > > > properties are not needed anymore. > > > > Do you m

[PATCH 20/28] qemu-nbd: use keyval for -object parsing

2020-12-02 Thread Paolo Bonzini
Enable creation of object with non-scalar properties. Signed-off-by: Paolo Bonzini --- qemu-nbd.c | 42 +- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index a7075c5419..b4bd21a21e 100644 --- a/qemu-nbd.c +++ b/qe

Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Kevin Wolf
Am 01.12.2020 um 22:23 hat Paolo Bonzini geschrieben: > On 01/12/20 20:35, Kevin Wolf wrote: > > Am 01.12.2020 um 18:16 hat Paolo Bonzini geschrieben: > > I don't think this is actually a new things. We already have types and > > commands declared with things like 'if': 'defined(TARGET_S390X)'. > >

[PATCH 23/28] storage-daemon: do not register the "object" group with QemuOpts

2020-12-02 Thread Paolo Bonzini
Since qsd uses keyval instead of -object, do not bother registering qemu_object_opts. It used to be necessary for object-del; that requirement is not there anymore since emulators have switched to keyval. Signed-off-by: Paolo Bonzini --- storage-daemon/qemu-storage-daemon.c | 10 -- 1 f

[PATCH 28/28] vl: switch -accel parsing to keyval

2020-12-02 Thread Paolo Bonzini
Switch from QemuOpts to keyval. This enables compound options for accelerators. Signed-off-by: Paolo Bonzini --- accel/accel.c | 6 ++ include/sysemu/accel.h | 1 + softmmu/vl.c | 134 ++--- 3 files changed, 67 insertions(+), 74 deletio

[PATCH 26/28] vl: switch -M parsing to keyval

2020-12-02 Thread Paolo Bonzini
Switch from QemuOpts to keyval. This enables non-scalar machine properties. Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 296 +++ 1 file changed, 132 insertions(+), 164 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index a942ce2004..5a

Re: [PATCH 00/18] qapi/qom: QAPIfy object-add

2020-12-02 Thread Paolo Bonzini
On 01/12/20 23:08, Eduardo Habkost wrote: Properties are only a useful concept if they have a use. If -object/object_add/object-add can do the same job without properties, properties are not needed anymore. Do you mean "not needed for -object anymore"? Properties are still used by internal C

[PATCH 27/28] qemu-option: remove now-dead code

2020-12-02 Thread Paolo Bonzini
-M was the sole user of qemu_opts_set and qemu_opts_set_defaults, remove them and the arguments that they used. Signed-off-by: Paolo Bonzini --- include/qemu/option.h | 3 --- tests/test-qemu-opts.c | 35 - util/qemu-option.c | 51 +--

[PATCH 14/28] qemu-config: add error propagation to qemu_config_parse

2020-12-02 Thread Paolo Bonzini
This enables some simplification of vl.c via error_fatal. Signed-off-by: Paolo Bonzini --- block/blkdebug.c | 3 +-- include/qemu/config-file.h | 4 ++-- softmmu/vl.c | 30 -- util/qemu-config.c | 20 ++-- 4 files chan

[PATCH 24/28] qom: export more functions for use with non-UserCreatable objects

2020-12-02 Thread Paolo Bonzini
Machines and accelerators are not user-creatable but they share similar parsing machinery. Export functions that will be used with -machine and -accel in softmmu/vl.c. Signed-off-by: Paolo Bonzini --- include/qom/object.h| 21 + qom/object_interfaces.c | 51 +

[PATCH 22/28] qemu: use keyval for -object parsing

2020-12-02 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- include/qom/object_interfaces.h | 65 +--- qom/object_interfaces.c | 75 - softmmu/vl.c| 75 + 3 files changed, 48 insertions(+), 167 deletions(-)

[PATCH 11/28] qom: use qemu_printf to print help for user-creatable objects

2020-12-02 Thread Paolo Bonzini
This is needed when we add help support for object_add. Signed-off-by: Paolo Bonzini --- qom/object_interfaces.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index ed896fe764..34edc3d1d8 100644 --- a/qom/objec

[PATCH 04/28] qemu-option: move help handling to get_opt_name_value

2020-12-02 Thread Paolo Bonzini
Right now, help options are parsed normally and then checked specially in opt_validate, but only if coming from qemu_opts_parse_noisily. has_help_option does the check on its own. opt_validate() has two callers: qemu_opt_set(), which passes null and is therefore unaffected, and opts_do_parse(), w

[PATCH 06/28] keyval: accept escaped commas in implied option

2020-12-02 Thread Paolo Bonzini
This is used with the weirdly-named device "SUNFD,fdtwo": $ qemu-system-sparc -device SUNW,,fdtwo,help SUNW,fdtwo options: drive=- Node name or ID of a block device to use as a backend fallback= - FDC drive type, 144/288/120/none/auto (default: "144") ... Therefore,

[PATCH 02/28] qemu-option: pass QemuOptsList to opts_accepts_any

2020-12-02 Thread Paolo Bonzini
A QemuOptsList can be of one of two kinds: either it is pre-validated, or it accepts any key and validation happens somewhere else (typically in a Visitor or against a list of QOM properties). opts_accepts_any returns true if a QemuOpts instance was created from a QemuOptsList of the latter kind,

[PATCH 15/28] qemu-option: support accept-any QemuOptsList in qemu_opts_absorb_qdict

2020-12-02 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- util/qemu-option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/qemu-option.c b/util/qemu-option.c index 40564a12eb..afba08d92e 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -1052,7 +1052,8 @@ bool qemu_opts_absorb_qdict

[PATCH 12/28] hmp: special case help options for object_add

2020-12-02 Thread Paolo Bonzini
Fix "object_add help" and "object_add TYPE,help". Signed-off-by: Paolo Bonzini --- include/qom/object_interfaces.h | 9 - monitor/hmp-cmds.c | 22 -- qom/object_interfaces.c | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git

[PATCH 13/28] remove -writeconfig

2020-12-02 Thread Paolo Bonzini
Like -set and -readconfig, it would not really be too hard to extend -writeconfig to parsing mechanisms other than QemuOpts. However, the uses of -writeconfig are substantially more limited, as it is generally easier to write the configuration by hand in the first place. In addition, -writeconfig

[PATCH 21/28] qemu-img: use keyval for -object parsing

2020-12-02 Thread Paolo Bonzini
Enable creation of object with non-scalar properties. Signed-off-by: Paolo Bonzini --- qemu-img.c | 258 +++-- 1 file changed, 52 insertions(+), 206 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 8bdea40b58..a91bbba4c6 100644 --- a/qemu-i

[PATCH 10/28] hmp: replace "O" parser with keyval

2020-12-02 Thread Paolo Bonzini
HMP is using QemuOpts to parse free-form commands device_add, netdev_add and object_add. However, none of these need QemuOpts for validation (these three QemuOptsLists are all of the catch-all kind), and keyval is already able to parse into QDict. So use keyval directly, avoiding the detour from

[PATCH 19/28] qemu-io: use keyval for -object parsing

2020-12-02 Thread Paolo Bonzini
Enable creation of object with non-scalar properties. Signed-off-by: Paolo Bonzini --- qemu-io.c | 42 +- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index ac88d8bd40..306086f767 100644 --- a/qemu-io.c +++ b/qemu-i

[PATCH 17/28] vl: plumb keyval-based options into -set and -readconfig

2020-12-02 Thread Paolo Bonzini
Add generic machinery to support parsing command line options with keyval in -set and -readconfig, choosing between QDict and QemuOpts as the underlying data structure. The keyval_merge function is slightly heavyweight as a way to do qemu_set_option for QDict-based options, but it will be put to f

[PATCH 16/28] qemu-config: parse configuration files to a QDict

2020-12-02 Thread Paolo Bonzini
Change the parser to put the values into a QDict and pass them to a callback. qemu_config_parse's QemuOpts creation is itself turned into a callback function. Signed-off-by: Paolo Bonzini --- include/qemu/config-file.h | 6 ++- softmmu/vl.c | 4 +- util/qemu-config.c | 9

[PATCH 00/28] qemu-option, keyval, vl: switch -object/-M/-accel to keyval parsing

2020-12-02 Thread Paolo Bonzini
This series switches -object, -M and -accel from QemuOpts to keyval. Monitor commands device_add and netdev_add are also switched to keyval, though -device and -netdev for now are not. Along the way, the syntax of keyval and QemuOpts becomes more consistent and support for keyval-based options is

[PATCH 09/28] keyval: introduce keyval_parse_into

2020-12-02 Thread Paolo Bonzini
Allow parsing multiple keyval sequences into the same dictionary. Signed-off-by: Paolo Bonzini --- include/qemu/option.h | 2 ++ util/keyval.c | 39 --- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/include/qemu/option.h b/include/qe

[PATCH 07/28] keyval: simplify keyval_parse_one

2020-12-02 Thread Paolo Bonzini
Now that the key is NULL terminated, we can remove some of the contortions that were done to operate on possibly '='-terminated strings in keyval_parse_one. Signed-off-by: Paolo Bonzini --- util/keyval.c | 27 ++- 1 file changed, 10 insertions(+), 17 deletions(-) diff --

[PATCH 18/28] qom: do not modify QDict argument in user_creatable_add_dict

2020-12-02 Thread Paolo Bonzini
-object will process its QDicts in two steps, first for the "early" objects and then for the "late" objects. If qom-type is removed by the "early" pass, the late pass fails. So just create a shallow copy of the QDict in user_creatable_add_dict. Signed-off-by: Paolo Bonzini --- include/qom/obje

[PATCH 05/28] qemu-option: warn for short-form boolean options

2020-12-02 Thread Paolo Bonzini
Options such as "server" or "nowait", that are commonly found in -chardev, are sugar for "server=on" and "wait=off". This is quite surprising and also does not have any notion of typing attached. It is even possible to do "-device e1000,noid" and get a device with "id=off". Deprecate it and prin

[PATCH 01/28] qemu-option: simplify search for end of key

2020-12-02 Thread Paolo Bonzini
Use strcspn to find an equal or comma value, and pass the result directly to get_opt_name to avoid another strchr. Signed-off-by: Paolo Bonzini --- util/qemu-option.c | 35 +-- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/util/qemu-option.c b/ut

[PATCH 03/28] qemu-option: clean up id vs. list->merge_lists

2020-12-02 Thread Paolo Bonzini
Looking at all merge-lists QemuOptsList, here is how they access their QemuOpts: reopen_opts in qemu-io-cmds.c ("qemu-img reopen -o") qemu_opts_find(&reopen_opts, NULL) empty_opts in qemu-io.c ("qemu-io open -o") qemu_opts_find(&empty_opts, NULL) qemu_rtc_opts ("-rtc") qe

[PATCH 25/28] vl: rename local variable in configure_accelerators

2020-12-02 Thread Paolo Bonzini
Silly patch extracted from the next one, which is already big enough. Because there are already local variables named "accel", we will name the global vl.c variable for "-M accel" accelerators instead. Rename it already in configure_accelerators to be ready. Signed-off-by: Paolo Bonzini --- so

[PATCH 08/28] tests: convert check-qom-proplist to keyval

2020-12-02 Thread Paolo Bonzini
The command-line creation test is using QemuOpts. Switch it to keyval, since all the -object command line options will follow qemu-storage-daemon and do the same. Signed-off-by: Paolo Bonzini --- tests/check-qom-proplist.c | 58 +- 1 file changed, 38 insertio