[Qemu-devel] [PATCH] tap: close fd conditionally when error occured

2018-01-11 Thread Jay Zhou
If netdev_add tap,id=net0,vhost=on failed in net_init_tap_one(), the followed up device_add virtio-net-pci,netdev=net0 will fail too, prints: TUNSETOFFLOAD ioctl() failed: Bad file descriptor TUNSETOFFLOAD ioctl() failed: Bad file descriptor The reason is that the fd of tap is closed when err

Re: [Qemu-devel] [RESEND PATCH for-2.12 0/2] ACPI/unit-test: Add a testcase

2018-01-11 Thread Dou Liyang
At 01/12/2018 03:23 PM, Dou Liyang wrote: [...] BTW, I used "make TEST_ACPI_REBUILD_AML=1 check" to create the DSDT file. Is it correct? This sounds correct to me.  Igor, can you confirm? It's will rebuild/update reference tables. I'm for merging it early and tracking/fixing issue Peter s

Re: [Qemu-devel] [RESEND PATCH for-2.12 0/2] ACPI/unit-test: Add a testcase

2018-01-11 Thread Dou Liyang
[...] BTW, I used "make TEST_ACPI_REBUILD_AML=1 check" to create the DSDT file. Is it correct? This sounds correct to me. Igor, can you confirm? It's will rebuild/update reference tables. I'm for merging it early and tracking/fixing issue Peter saw during this dev cycle. Send an ack th

Re: [Qemu-devel] [RFC PATCH v3 30/30] replay: don't process async events when warping the clock

2018-01-11 Thread Pavel Dovgalyuk
> From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > Bonzini > On 11/01/2018 09:27, Pavel Dovgalyuk wrote: > > Virtual clock is wapred from iothread and vcpu thread. When the hardware > > events associated with warp checkpoint, then interrupt delivering may be > > non-determ

Re: [Qemu-devel] [RFC v6 25/27] docs: update QMP documents for OOB commands

2018-01-11 Thread Peter Xu
On Tue, Jan 09, 2018 at 02:52:25PM +, Stefan Hajnoczi wrote: > On Tue, Dec 19, 2017 at 04:45:55PM +0800, Peter Xu wrote: > > +To add OOB execution support for a command, we need to make sure the > > +command handler satisfies at least the following: > > It would help to rephrase this in the im

Re: [Qemu-devel] vhost-user graceful connect/disconnect

2018-01-11 Thread Wei Wang
On 01/09/2018 12:09 AM, Stefan Hajnoczi wrote: On Mon, Jan 08, 2018 at 07:22:37PM +0800, Wei Wang wrote: On 01/05/2018 11:49 PM, Stefan Hajnoczi wrote: On Thu, Jan 04, 2018 at 07:15:38PM +0800, Wei Wang wrote: On 01/04/2018 06:47 PM, Stefan Hajnoczi wrote: On Thu, Dec 21, 2017 at 06:01:29AM -

Re: [Qemu-devel] [RFC v6 22/27] qmp: isolate responses into io thread

2018-01-11 Thread Peter Xu
On Tue, Jan 09, 2018 at 02:24:35PM +, Stefan Hajnoczi wrote: > On Tue, Dec 19, 2017 at 04:45:52PM +0800, Peter Xu wrote: > > +static void monitor_qmp_bh_responder(void *opaque) > > +{ > > +QMPResponse response; > > + > > +while (true) { > > +response = monitor_qmp_response_pop_o

Re: [Qemu-devel] [PATCH] net: Allow netdevs to be used with 'hostfwd_add' and 'hostfwd_remove'

2018-01-11 Thread Fam Zheng
On Fri, 01/12 07:23, Thomas Huth wrote: > On 11.01.2018 21:41, no-re...@patchew.org wrote: > > Hi, > > > > This series failed build test on ppc host. Please find the details below. > [...] > > Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 > > Submodule 'dtc' (git://git.qemu-project.org/dtc.git

Re: [Qemu-devel] vhost-pci and virtio-vhost-user

2018-01-11 Thread Wei Wang
On 01/11/2018 05:56 PM, Stefan Hajnoczi wrote: On Thu, Jan 11, 2018 at 6:31 AM, Wei Wang wrote: On 01/11/2018 12:14 AM, Stefan Hajnoczi wrote: 2) requires the driver to join the vhost-user negotiation. The driver must participate in vhost-user negotiation. The vhost-pci patches try to avoid

Re: [Qemu-devel] [RFC v6 21/27] qmp: support out-of-band (oob) execution

2018-01-11 Thread Peter Xu
On Tue, Jan 09, 2018 at 02:08:10PM +, Stefan Hajnoczi wrote: > On Tue, Dec 19, 2017 at 04:45:51PM +0800, Peter Xu wrote: > > diff --git a/monitor.c b/monitor.c > > index b571866659..505db439d8 100644 > > --- a/monitor.c > > +++ b/monitor.c > > @@ -1090,6 +1090,44 @@ static void qmp_caps_apply(M

Re: [Qemu-devel] [PATCH] net: Allow netdevs to be used with 'hostfwd_add' and 'hostfwd_remove'

2018-01-11 Thread Thomas Huth
On 11.01.2018 21:41, no-re...@patchew.org wrote: > Hi, > > This series failed build test on ppc host. Please find the details below. [...] > Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 > Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc' > Submodule 'pixman' (git:

Re: [Qemu-devel] [RFC v6 20/27] qmp: export qmp_dispatch_check_obj and allow "id"

2018-01-11 Thread Peter Xu
On Tue, Jan 09, 2018 at 01:45:28PM +, Stefan Hajnoczi wrote: > On Tue, Dec 19, 2017 at 04:45:50PM +0800, Peter Xu wrote: > > We need this for earlier check for OOB, before reaching > > do_qmp_dispatch(). Meanwhile, a small touch-up to allow "id" field, > > after all we allow that for sure in t

Re: [Qemu-devel] [RFC PATCH v3 29/30] replay: improve replay performance

2018-01-11 Thread Pavel Dovgalyuk
> From: Paolo Bonzini [mailto:pbonz...@redhat.com] > On 11/01/2018 14:12, Pavel Dovgalyuk wrote: > >> From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > >> Bonzini > >> On 11/01/2018 09:27, Pavel Dovgalyuk wrote: > >>> +} else { > >>> +qemu_notify_event()

Re: [Qemu-devel] [RFC PATCH v3 03/30] This patch adds a condition before overwriting exception_index fields.

2018-01-11 Thread Pavel Dovgalyuk
> From: Paolo Bonzini [mailto:pbonz...@redhat.com] > On 11/01/2018 09:25, Pavel Dovgalyuk wrote: > > It is needed when exception_index is already set to some meaningful value. > > > > Signed-off-by: Pavel Dovgalyuk > > Signed-off-by: Paolo Bonzini > > --- > > accel/tcg/cpu-exec.c |5 - >

Re: [Qemu-devel] [RFC v6 17/27] qmp: add new event "command-dropped"

2018-01-11 Thread Peter Xu
On Tue, Jan 09, 2018 at 01:20:20PM +, Stefan Hajnoczi wrote: > On Tue, Dec 19, 2017 at 04:45:47PM +0800, Peter Xu wrote: > > This event will be emitted if one QMP command is dropped. Along, > > declare an enum for the reasons. > > > > Signed-off-by: Peter Xu > > --- > > qapi-schema.json | 3

Re: [Qemu-devel] [RFC v6 16/27] monitor: separate QMP parser and dispatcher

2018-01-11 Thread Peter Xu
On Mon, Jan 08, 2018 at 05:09:16PM +, Stefan Hajnoczi wrote: > On Tue, Dec 19, 2017 at 04:45:46PM +0800, Peter Xu wrote: > > Originally QMP goes throw these steps: > > s/throw/through/ > > > > > JSON Parser --> QMP Dispatcher --> Respond > > /|\(2)(3) | > >

[Qemu-devel] [QEMU-PPC] [PATCH 3/3] target/ppc: Add H-Call H_GET_CPU_CHARACTERISTICS

2018-01-11 Thread Suraj Jitindar Singh
The new H-Call H_GET_CPU_CHARACTERISTICS is used by the guest to query behaviours and available characteristics of the cpu. Implement the handler for this new H-Call which formulates its response based on the setting of the new capabilities added in the previous patch. --- hw/ppc/spapr_hcall.c

[Qemu-devel] [QEMU-PPC] [PATCH 1/3] hw/ppc/spapr_caps: Rework spapr_caps to use uint8 internal representation

2018-01-11 Thread Suraj Jitindar Singh
Currently spapr_caps are tied to boolean values (on or off). This patch reworks the caps so that they can have any uint8 value. This allows more capabilities with various values to be represented in the same way internally. Capabilities are numbered in ascending order. The internal representation o

[Qemu-devel] [QEMU-PPC] [PATCH 0/3] target/ppc: Rework spapr_caps

2018-01-11 Thread Suraj Jitindar Singh
The following patch series reworks the implementation of spapr_caps to allow for a increased number of possible values in the internal representation. It also adds 3 new tristate capabilities. A new H-Call is implemented which a guest will use to query the requirement for and availability of wor

[Qemu-devel] [QEMU-PPC] [PATCH 2/3] hw/spapr/spapr_caps: Add new caps safe_[cache/bounds_check/indirect_branch]

2018-01-11 Thread Suraj Jitindar Singh
This patch adds three new capabilities: cap-cfpc -> safe_cache cap-sbbc -> safe_bounds_check cap-ibs -> safe_indirect_branch Each capability is tristate with the possible values "broken", "workaround" or "fixed". Add generic getter and setter functions for this new capability type. Add these new

Re: [Qemu-devel] vhost-pci and virtio-vhost-user

2018-01-11 Thread Yang, Zhiyong
Hi Jason, > -Original Message- > From: Qemu-devel [mailto:qemu-devel- > bounces+zhiyong.yang=intel@nongnu.org] On Behalf Of Jason Wang > Sent: Friday, January 12, 2018 11:33 AM > To: Stefan Hajnoczi > Cc: Wang, Wei W ; qemu-devel@nongnu.org > Subject: Re: [Qemu-devel] vhost-pci and vi

Re: [Qemu-devel] [RFC v6 18/27] monitor: send event when command queue full

2018-01-11 Thread Peter Xu
On Tue, Jan 09, 2018 at 01:42:08PM +, Stefan Hajnoczi wrote: > On Tue, Dec 19, 2017 at 04:45:48PM +0800, Peter Xu wrote: > > @@ -4071,6 +4073,9 @@ static void handle_qmp_command(JSONMessageParser > > *parser, GQueue *tokens) > > req_obj->req = req; > > req_obj->need_resume = false; >

Re: [Qemu-devel] [RFC v6 15/27] monitor: let suspend/resume work even with QMPs

2018-01-11 Thread Peter Xu
On Mon, Jan 08, 2018 at 04:49:36PM +, Stefan Hajnoczi wrote: > On Mon, Dec 25, 2017 at 11:26:13AM +0800, Peter Xu wrote: > > On Thu, Dec 21, 2017 at 07:27:38PM +0800, Fam Zheng wrote: > > > On Tue, 12/19 16:45, Peter Xu wrote: > > > > One thing to mention is that for QMPs that are using IOThrea

[Qemu-devel] [Bug 1086782] Re: HPET time drift windows 7 64bits guest

2018-01-11 Thread Launchpad Bug Tracker
[Expired for QEMU because there has been no activity for 60 days.] ** Changed in: qemu Status: Incomplete => Expired -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1086782 Title: HPET time d

Re: [Qemu-devel] [RFC v6 11/27] qmp: introduce QMPCapability

2018-01-11 Thread Peter Xu
On Thu, Jan 11, 2018 at 05:07:11PM -0600, Eric Blake wrote: > On 12/19/2017 02:45 AM, Peter Xu wrote: > > There was no QMP capabilities defined. Define the first "oob" as > > s/was/were/ Fixed. Just to confirm: is "There was no QMP capability" also correct? > > > capability to allow out-of-ba

Re: [Qemu-devel] [PATCH 1/1] spapr: Check SMT based on KVM_CAP_PPC_SMT_POSSIBLE

2018-01-11 Thread David Gibson
On Fri, Jan 12, 2018 at 01:16:22AM +1100, David Gibson wrote: > On Fri, Jan 05, 2018 at 10:47:22PM -0200, Jose Ricardo Ziviani wrote: > > Power9 supports 4 HW threads/core but it's possible to emulate > > doorbells to implement virtual SMT. KVM has the KVM_CAP_PPC_SMT_POSSIBLE > > which returns a b

Re: [Qemu-devel] [PATCH v2 2/2] hostmem-file: add 'sync' option

2018-01-11 Thread Haozhong Zhang
On 01/11/18 20:06 +, Dr. David Alan Gilbert wrote: > * Haozhong Zhang (haozhong.zh...@intel.com) wrote: > > This option controls whether QEMU mmap(2) the memory backend file with > > MAP_SYNC flag, which can fully guarantee the guest write persistence > > to the backend, if MAP_SYNC flag is sup

Re: [Qemu-devel] vhost-pci and virtio-vhost-user

2018-01-11 Thread Jason Wang
On 2018年01月11日 23:23, Stefan Hajnoczi wrote: On Thu, Jan 11, 2018 at 06:57:03PM +0800, Jason Wang wrote: On 2018年01月11日 00:14, Stefan Hajnoczi wrote: Hi Wei, I wanted to summarize the differences between the vhost-pci and virtio-vhost-user approaches because previous discussions may have bee

Re: [Qemu-devel] [RFC v6 10/27] monitor: allow to use IO thread for parsing

2018-01-11 Thread Peter Xu
On Fri, Jan 05, 2018 at 05:22:26PM +, Stefan Hajnoczi wrote: > On Tue, Dec 19, 2017 at 04:45:40PM +0800, Peter Xu wrote: > > if (monitor_is_qmp(mon)) { > > -qemu_chr_fe_set_handlers(&mon->chr, monitor_can_read, > > monitor_qmp_read, > > - monitor_qm

Re: [Qemu-devel] [RFC v6 10/27] monitor: allow to use IO thread for parsing

2018-01-11 Thread Peter Xu
On Tue, Jan 09, 2018 at 05:37:39PM -0600, Eric Blake wrote: > On 12/19/2017 02:45 AM, Peter Xu wrote: > > Grammar in the subject: > > "allow to $VERB" is not idiomatic English; correct is either "allow > ${VERB}ing" or "allow $SUBJECT to $VERB". Concretely, s/to use/using/ > > > For each Monito

Re: [Qemu-devel] [PATCH v4 9/9] qapi: Add NVMe driver options to the schema

2018-01-11 Thread Fam Zheng
On Wed, 01/10 08:41, Eric Blake wrote: > On 01/10/2018 03:18 AM, Fam Zheng wrote: > > Signed-off-by: Fam Zheng > > --- > > qapi/block-core.json | 16 +++- > > 1 file changed, 15 insertions(+), 1 deletion(-) > > > > diff --git a/qapi/block-core.json b/qapi/block-core.json > > index e9

Re: [Qemu-devel] [PATCH v4 3/9] block: Add VFIO based NVMe driver

2018-01-11 Thread Fam Zheng
On Wed, 01/10 08:44, Eric Blake wrote: > On 01/10/2018 03:18 AM, Fam Zheng wrote: > > This is a new protocol driver that exclusively opens a host NVMe > > controller through VFIO. It achieves better latency than linux-aio by > > completely bypassing host kernel vfs/block layer. > > > > > +static

Re: [Qemu-devel] [PATCH v4 3/9] block: Add VFIO based NVMe driver

2018-01-11 Thread Fam Zheng
On Wed, 01/10 18:33, Stefan Hajnoczi wrote: > > +ret = event_notifier_init(&s->irq_notifier, 0); > > +if (ret) { > > +error_setg(errp, "Failed to init event notifier"); > > +return ret; > > dma_map_lock should be destroyed. CoMutexes are initialized by memset so I don't th

Re: [Qemu-devel] [PATCH v3 03/21] RISC-V CPU Core Definition

2018-01-11 Thread Palmer Dabbelt
On Thu, 11 Jan 2018 09:55:36 PST (-0800), Michael Clark wrote: On Fri, Jan 12, 2018 at 3:37 AM, Richard Henderson < richard.hender...@linaro.org> wrote: On 01/10/2018 06:21 PM, Michael Clark wrote: > +static inline void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc, > +

[Qemu-devel] [resend][PATCH] qga: unset frozen state if no mount points are frozen

2018-01-11 Thread Chen Hanxiao
From: Chen Hanxiao If we set mountpoints to qmp_guest_fsfreeze_freeze_list, we may got nothing to freeze as all mountpoints are not valid. Call ga_unset_frozen in this senario. Cc: Michael Roth Signed-off-by: Chen Hanxiao --- Rebase on master qga/commands-posix.c | 6 ++ 1 file changed,

[Qemu-devel] [PATCH v6 2/3] vhost: fix memslot limit check

2018-01-11 Thread Jay Zhou
Since used_memslots will be updated to the actual value after registering memory listener for the first time, move the memslots limit checking to the right place. Reviewed-by: Igor Mammedov Signed-off-by: Jay Zhou --- hw/virtio/vhost.c | 19 --- 1 file changed, 12 insertions(+),

[Qemu-devel] [PATCH v6 1/3] vhost: remove assertion to prevent crash

2018-01-11 Thread Jay Zhou
QEMU will assert on vhost-user backed virtio device hotplug if QEMU is using more RAM regions than VHOST_MEMORY_MAX_NREGIONS (for example if it were started with a lot of DIMM devices). Fix it by returning error instead of asserting and let callers of vhost_set_mem_table() handle error condition g

[Qemu-devel] [PATCH v6 0/3] vhost: two fixes and used_memslots refactoring

2018-01-11 Thread Jay Zhou
Jay Zhou (3): vhost: remove assertion to prevent crash vhost: fix memslot limit check vhost: used_memslots refactoring hw/virtio/vhost-backend.c | 15 +++- hw/virtio/vhost-user.c| 74 +++ hw/virtio/vhost.c | 30

[Qemu-devel] [PATCH v6 3/3] vhost: used_memslots refactoring

2018-01-11 Thread Jay Zhou
Used_memslots is shared by vhost kernel and user, it is equal to dev->mem->nregions, which is correct for vhost kernel, but not for vhost user, the latter one uses memory regions that have file descriptor. E.g. a VM has a vhost-user NIC and 8(vhost user memslot upper limit) memory slots, it will be

Re: [Qemu-devel] [QEMU-PPC] [RFC 1/3] hw/ppc/spapr_caps: Rework spapr_caps to use uint8 internal representation

2018-01-11 Thread Suraj Jitindar Singh
On Wed, 2018-01-10 at 15:13 +1100, David Gibson wrote: > On Tue, Jan 09, 2018 at 08:21:01PM +1100, Suraj Jitindar Singh wrote: > > Currently spapr_caps are tied to boolean values (on or off). This > > patch > > reworks the caps so that they can have any value between 0 and 127, > > inclusive. This

Re: [Qemu-devel] [PATCH] spapr: Correct compatibility mode setting for hotplugged CPUs

2018-01-11 Thread David Gibson
On Thu, Jan 11, 2018 at 01:24:30PM +0100, Greg Kurz wrote: > On Fri, 5 Jan 2018 14:07:29 +1100 > David Gibson wrote: > > > On Thu, Jan 04, 2018 at 06:47:18PM +0100, Greg Kurz wrote: > > > On Thu, 4 Jan 2018 15:24:05 +1100 > > > David Gibson wrote: > > > > > > > Currently the pseries machine

Re: [Qemu-devel] [PATCH v4 2/9] util: Introduce vfio helpers

2018-01-11 Thread Fam Zheng
On Wed, 01/10 13:09, Alex Williamson wrote: > On Wed, 10 Jan 2018 17:18:39 +0800 > Fam Zheng wrote: > > > This is a library to manage the host vfio interface, which could be used > > to implement userspace device driver code in QEMU such as NVMe or net > > controllers. > > > > Signed-off-by: Fam

Re: [Qemu-devel] [PATCH v5 0/4] vhost: two fixes and used_memslots refactoring

2018-01-11 Thread Zhoujian (jay)
> -Original Message- > From: Michael S. Tsirkin [mailto:m...@redhat.com] > Sent: Friday, January 12, 2018 3:56 AM > To: Zhoujian (jay) > Cc: Igor Mammedov ; qemu-devel@nongnu.org; Huangweidong > (C) ; wangxin (U) ; > Gonglei (Arei) ; Liuzhe (Ahriy, Euler) > > Subject: Re: [PATCH v5 0/4]

Re: [Qemu-devel] [PATCH v4 2/9] util: Introduce vfio helpers

2018-01-11 Thread Fam Zheng
On Wed, 01/10 16:52, Stefan Hajnoczi wrote: > On Wed, Jan 10, 2018 at 05:18:39PM +0800, Fam Zheng wrote: > > +/* Map [host, host + size) area into a contiguous IOVA address space, and > > store > > + * the result in @iova if not NULL. The caller need to make sure the area > > is > > + * aligned t

[Qemu-devel] [PATCHv3] linux-user: Add getcpu() support

2018-01-11 Thread Samuel Thibault
Signed-off-by: Samuel Thibault --- Difference between v1 and v2: handle failure of put_user_u32 with goto efault; Difference between v2 and v3: handle failure of sys_getcpu system call --- linux-user/syscall.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/linux-user/sy

Re: [Qemu-devel] Call for GSoC & Outreachy 2018 mentors & project ideas

2018-01-11 Thread Alistair Francis
On Wed, Jan 10, 2018 at 4:52 AM, Stefan Hajnoczi wrote: > On Tue, Jan 9, 2018 at 9:45 PM, Alistair Francis wrote: >> Can anyone who has done this before chime in. >> >> What do you think about getting someone to cleanup and improve the GDB >> support in QEMU? Would that be the right difficulty of

Re: [Qemu-devel] [RFC v6 11/27] qmp: introduce QMPCapability

2018-01-11 Thread Eric Blake
On 12/19/2017 02:45 AM, Peter Xu wrote: > There was no QMP capabilities defined. Define the first "oob" as s/was/were/ > capability to allow out-of-band messages. > > Also, touch up qmp-test.c to test the new bits. > > Signed-off-by: Peter Xu > --- > monitor.c| 10 -- > qapi-

Re: [Qemu-devel] [PATCH v4 01/51] qlit: use QType instead of int

2018-01-11 Thread Eric Blake
On 01/11/2018 03:32 PM, Marc-André Lureau wrote: > Suggested-by: Markus Armbruster > Signed-off-by: Marc-André Lureau > --- > include/qapi/qmp/qlit.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Reviewed-by: Eric Blake > diff --git a/include/qapi/qmp/qlit.h b/include/qapi/qmp/ql

[Qemu-devel] [PATCH v4 47/51] target.json: add a note about query-cpu* not being s390x-specific

2018-01-11 Thread Marc-André Lureau
Signed-off-by: Marc-André Lureau Acked-by: Cornelia Huck --- qapi/target.json | 6 ++ 1 file changed, 6 insertions(+) diff --git a/qapi/target.json b/qapi/target.json index 776f2da5e1..ca463a0854 100644 --- a/qapi/target.json +++ b/qapi/target.json @@ -79,6 +79,9 @@ # an unknown c

[Qemu-devel] [PATCH v4 43/51] build-sys: move qmp-introspect per target

2018-01-11 Thread Marc-André Lureau
The following patches are going to introduce per-target #ifdef in the schemas. The introspection data is statically generated once, and must thus be built per-target to reflect target-specific configuration. Drop "do_test_visitor_in_qmp_introspect(&qmp_schema_qlit)" since the schema is no longer

[Qemu-devel] [PATCH v4 42/51] qapi: add a 'unit' pragma

2018-01-11 Thread Marc-André Lureau
Add a pragma that allows to tag the following expressions in the schema with a unit name. By default, an expression has no unit name. See the docs/devel/qapi-code-gen.txt for more details. Signed-off-by: Marc-André Lureau --- scripts/qapi.py| 22 +++--

[Qemu-devel] [PATCH v4 39/51] qapi: add conditions to REPLICATION type/commands on the schema

2018-01-11 Thread Marc-André Lureau
Add #if defined(CONFIG_REPLICATION) in generated code, and adjust the code accordingly. Made conditional: * xen-set-replication, query-xen-replication-status, xen-colo-do-checkpoint Before the patch, we first register the commands unconditionally in generated code (requires a stub), then c

[Qemu-devel] [PATCH v4 38/51] qapi: add conditions to SPICE type/commands/events on the schema

2018-01-11 Thread Marc-André Lureau
Add #if defined(CONFIG_SPICE) in generated code, and adjust the qmp/hmp code accordingly. query-qmp-schema no longer reports the command/events etc as available when disabled at compile time. Commands made conditional: * query-spice Before the patch, the command for !CONFIG_SPICE is unregiste

[Qemu-devel] [PATCH v4 35/51] qapi2texi: add 'If:' condition to struct members

2018-01-11 Thread Marc-André Lureau
Signed-off-by: Marc-André Lureau --- scripts/qapi2texi.py| 4 +++- tests/qapi-schema/doc-good.json | 3 ++- tests/qapi-schema/doc-good.out | 1 + tests/qapi-schema/doc-good.texi | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/qapi2texi.py b/scripts/qapi

[Qemu-devel] [PATCH v4 31/51] qapi: add #if conditions to generated code

2018-01-11 Thread Marc-André Lureau
Wrap generated enum/struct members and code with #if/#endif, using the .ifcond members added in the previous patches. Some types generate both enum and struct members for example, so a step-by-step is unnecessarily complicated to deal with (it would easily generate invalid intermediary code). Sig

[Qemu-devel] [PATCH v4 29/51] qapi: add 'if' on union members

2018-01-11 Thread Marc-André Lureau
Add 'if' key to union members: { 'union': 'TestIfUnion', 'data': 'mem': { 'type': 'str', 'if': 'COND'} } Generated code is not changed by this patch but with "qapi: add #if conditions to generated code". Signed-off-by: Marc-André Lureau --- scripts/qapi.py | 17

[Qemu-devel] [PATCH v4 51/51] qapi: remove qmp_unregister_command()

2018-01-11 Thread Marc-André Lureau
This command is no longer needed after the schema is made conditional. Signed-off-by: Marc-André Lureau --- include/qapi/qmp/dispatch.h | 1 - qapi/qmp-registry.c | 8 2 files changed, 9 deletions(-) diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index 2

[Qemu-devel] [PATCH v4 40/51] qapi-commands: don't initialize command list in qmp_init_marshall()

2018-01-11 Thread Marc-André Lureau
This will let the caller add several list of commands coming from different schemas (the following patches split the schemas for common and arch-specific parts). Signed-off-by: Marc-André Lureau --- scripts/qapi-commands.py | 2 -- monitor.c | 1 + qga/main.c| 1

[Qemu-devel] [PATCH v4 28/51] qapi: add an error in case a discriminator is conditionnal

2018-01-11 Thread Marc-André Lureau
Making a discriminator conditonal doesn't make much sense. Instead, the union could be made conditional. Signed-off-by: Marc-André Lureau --- scripts/qapi.py | 11 +-- tests/Makefile.include | 1 + .../qapi-schema/

[Qemu-devel] [PATCH v4 44/51] build-sys: add a target schema

2018-01-11 Thread Marc-André Lureau
This schema is going to contain target-specific commands/events & types, that can be conditionnally guarded with poisoned defines. And new rules to compile the schema generated files per-target, using the 'target' unit name filter. This new schema is now the top-level schema to generate the docum

[Qemu-devel] [PATCH v4 48/51] qapi: make query-gic-capabilities depend on TARGET_ARM

2018-01-11 Thread Marc-André Lureau
Signed-off-by: Marc-André Lureau --- qapi-schema.json | 43 --- qapi/target.json | 45 + monitor.c| 11 --- target/arm/monitor.c | 2 +- 4 files changed, 46 insertions(+), 55 deletions

[Qemu-devel] [PATCH v4 19/51] qapi: change enum visitor to take QAPISchemaMember

2018-01-11 Thread Marc-André Lureau
This will allow to add and access more properties associated with enum values/members, like the associated 'if' condition. We may want to have a specialized type QAPISchemaEnumMember, for now this will do. Suggested-by: Markus Armbruster Signed-off-by: Marc-André Lureau --- scripts/qapi.py

[Qemu-devel] [PATCH v4 18/51] qapi: rename QAPISchemaEnumType.values to .members

2018-01-11 Thread Marc-André Lureau
Rename QAPISchemaEnumType.values and related variables to members. Makes sense ever since commit 93bda4dd4 changed .values from list of string to list of QAPISchemaMember. Obvious no-op. Signed-off-by: Marc-André Lureau --- scripts/qapi.py| 36 ++--

[Qemu-devel] [PATCH v4 37/51] qapi: add conditions to VNC type/commands/events on the schema

2018-01-11 Thread Marc-André Lureau
Add #if defined(CONFIG_VNC) in generated code, and adjust the qmp/hmp code accordingly. query-qmp-schema no longer reports the command/events etc as available when disabled at compile. Commands made conditional: * query-vnc, query-vnc-servers, change-vnc-password Before the patch, the command

[Qemu-devel] [PATCH v4 16/51] qapi-types: add #if conditions to types & visitors

2018-01-11 Thread Marc-André Lureau
Types & visitors are coupled and must be handled together to avoid temporary build regression. Wrap generated types/visitor code with #if/#endif using the ifcond_decorator & helpers. Signed-off-by: Marc-André Lureau --- scripts/qapi-types.py | 18 ++ scripts/qapi-visit.py | 5 +

[Qemu-devel] [PATCH v4 50/51] qapi: make query-cpu-definitions depend on specific targets

2018-01-11 Thread Marc-André Lureau
It depends on TARGET_PPC || TARGET_ARM || TARGET_I386 || TARGET_S390X. Signed-off-by: Marc-André Lureau Reviewed-by: Eduardo Habkost Acked-by: Cornelia Huck --- qapi-schema.json| 10 -- qapi/target.json| 12 include/sysemu/arch_init.h | 1 - monit

[Qemu-devel] [PATCH v4 33/51] qapi2texi: add 'If:' section to generated documentation

2018-01-11 Thread Marc-André Lureau
The documentation is generated only once, and doesn't know C pre-conditions. Add 'If:' sections for top-level entities. Signed-off-by: Marc-André Lureau --- scripts/qapi2texi.py| 23 +-- tests/qapi-schema/doc-good.json | 2 +- tests/qapi-schema/doc-good.out | 1

[Qemu-devel] [PATCH v4 49/51] qapi: make query-cpu-model-expansion depend on s390 or x86

2018-01-11 Thread Marc-André Lureau
Signed-off-by: Marc-André Lureau Reviewed-by: Eduardo Habkost Acked-by: Cornelia Huck --- qapi-schema.json | 38 - qapi/target.json | 39 ++ include/sysemu/arch_init.h | 3 --

[Qemu-devel] [PATCH v4 15/51] qapi-types: refactor variants handling

2018-01-11 Thread Marc-André Lureau
Generate variants objects outside gen_object(). This will allow to easily wrap gen_object() with ifcond_decorator in the following patch. gen_variants_objects() calls gen_object() for each variants, so it remains guarded for each generated variant object. self._gen_type_cleanup(name) is factored

[Qemu-devel] [PATCH v4 36/51] qapi2texi: add condition to variants

2018-01-11 Thread Marc-André Lureau
Signed-off-by: Marc-André Lureau --- scripts/qapi2texi.py| 5 +++-- tests/qapi-schema/doc-good.json | 4 ++-- tests/qapi-schema/doc-good.out | 3 +++ tests/qapi-schema/doc-good.texi | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/qapi2texi.py b/scrip

[Qemu-devel] [PATCH v4 14/51] qapi-event: add #if conditions to events

2018-01-11 Thread Marc-André Lureau
Wrap generated code with #if/#endif using the ifcond_decorator. Signed-off-by: Marc-André Lureau --- scripts/qapi-event.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py index dda496e824..bef301dfe9 100644 --- a/scripts/qapi-event.py +++ b/scr

[Qemu-devel] [PATCH v4 46/51] qapi: make s390 commands depend on TARGET_S390X

2018-01-11 Thread Marc-André Lureau
Signed-off-by: Marc-André Lureau Acked-by: Cornelia Huck --- qapi-schema.json| 101 --- qapi/target.json| 104 include/sysemu/arch_init.h | 7 --- hw/s390x/s390-skeys.c

[Qemu-devel] [PATCH v4 34/51] qapi2texi: add 'If:' condition to enum values

2018-01-11 Thread Marc-André Lureau
Signed-off-by: Marc-André Lureau --- scripts/qapi2texi.py| 5 - tests/qapi-schema/doc-good.json | 4 +++- tests/qapi-schema/doc-good.out | 1 + tests/qapi-schema/doc-good.texi | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/qapi2texi.py b/scripts/q

[Qemu-devel] [PATCH v4 09/51] qapi: mcgen() shouldn't indent # lines

2018-01-11 Thread Marc-André Lureau
Skip preprocessor lines when adding indentation, since that would likely result in invalid code. Signed-off-by: Marc-André Lureau --- scripts/qapi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index ffb4fb58e0..3d33ed7d76 100644 ---

[Qemu-devel] [PATCH v4 11/51] qapi-introspect: modify to_qlit() to append ', ' on level > 0

2018-01-11 Thread Marc-André Lureau
The following patch is going to break list entries with #if/#endif, so they should have the trailing ',' as suffix. Signed-off-by: Marc-André Lureau Reviewed-by: Markus Armbruster --- scripts/qapi-introspect.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/qapi-

[Qemu-devel] [PATCH v4 45/51] qapi: make rtc-reset-reinjection depend on TARGET_I386

2018-01-11 Thread Marc-André Lureau
Move rtc-reset-reinjection in target.json and make it conditional on TARGET_I386. Signed-off-by: Marc-André Lureau --- qapi-schema.json | 18 -- qapi/target.json | 19 +++ hw/timer/mc146818rtc.c | 2 +- monitor.c | 10 -- 4 files

[Qemu-devel] [PATCH v4 30/51] qapi: add 'if' to alternate members

2018-01-11 Thread Marc-André Lureau
Add 'if' key to alternate members: { 'alternate': 'TestIfAlternate', 'data': { 'alt': { 'type': 'TestStruct', 'if': 'COND' } } } Generated code is not changed by this patch but with "qapi: add #if conditions to generated code". Signed-off-by: Marc-André Lureau --- scripts/qapi.py

[Qemu-devel] [PATCH v4 27/51] qapi: add 'if' to implicit struct members

2018-01-11 Thread Marc-André Lureau
Generated code is not changed by this patch, but with "qapi: add #if conditions to generated code" patch. Signed-off-by: Marc-André Lureau --- scripts/qapi.py | 14 +++--- tests/qapi-schema/qapi-schema-test.json | 12 +--- tests/qapi-schema/qapi-schema-tes

[Qemu-devel] [PATCH v4 08/51] qapi: add 'ifcond' to visitor methods

2018-01-11 Thread Marc-André Lureau
Modify the test visitor to check correct passing of values. Signed-off-by: Marc-André Lureau Reviewed-by: Markus Armbruster --- scripts/qapi.py| 31 +-- scripts/qapi-commands.py | 2 +- scripts/qapi-event.py |

[Qemu-devel] [PATCH v4 25/51] qapi: rename allow_dict to allow_implicit

2018-01-11 Thread Marc-André Lureau
This makes it a bit clearer what is the intent of the dictionnary for the check_type() function, since there was some confusion on a previous iteration of this series. Suggested-by: Markus Armbruster Signed-off-by: Marc-André Lureau --- scripts/qapi.py | 12 ++-- 1 file changed, 6 inser

[Qemu-devel] [PATCH v4 26/51] qapi: add a dictionary form with 'type' key for members

2018-01-11 Thread Marc-André Lureau
Wherever a struct/union/alternate/command/event member with NAME: TYPE form is accepted, desugar it to a NAME: { 'type': TYPE } form. This will allow to add new member details, such as 'if' in the following patch to introduce conditionals, or 'default' for default values etc. Signed-off-by: Marc-

[Qemu-devel] [PATCH v4 41/51] qapi: add -i/--include filename.h

2018-01-11 Thread Marc-André Lureau
Add a new option to add user-specified #include lines in the generated headers. This will help to split a schema, where one generated header will depend on another. Fix some pycodestyle on the way. Signed-off-by: Marc-André Lureau --- scripts/qapi.py| 15 ++- scripts/qap

[Qemu-devel] [PATCH v4 06/51] qapi: pass 'if' condition into QAPISchemaEntity objects

2018-01-11 Thread Marc-André Lureau
Built-in objects remain unconditional. Explicitly defined objects use the condition specified in the schema. Implicitly defined objects inherit their condition from their users. For most of them, there is exactly one user, so the condition to use is obvious. The exception is the wrapped type's

[Qemu-devel] [PATCH v4 21/51] qapi: factor out check_known_keys()

2018-01-11 Thread Marc-André Lureau
The following patches are going to need similar checks from various code path. This refactoring will report all conflicting keys (instead of the first one encountered). Modify unknown-expr-key to check plural form. Signed-off-by: Marc-André Lureau --- scripts/qapi.py | 2

[Qemu-devel] [PATCH v4 24/51] qapi-event: add 'if' condition to implicit event enum

2018-01-11 Thread Marc-André Lureau
Add condition to QAPIEvent enum members based on the event 'if'. Generated code is not changed by this patch, but with "qapi: add #if conditions to generated code" patch. There is no coverage of this change in qapi-schema-test.out since the event_names enum is an implicit type created by qapi-eve

[Qemu-devel] [PATCH v4 04/51] qapi2texi: minor python code simplification

2018-01-11 Thread Marc-André Lureau
Signed-off-by: Marc-André Lureau Reviewed-by: Markus Armbruster --- scripts/qapi2texi.py | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py index 92e2af2cd6..0a08fbaf7b 100755 --- a/scripts/qapi2texi.py +++ b/scripts/qapi2texi.p

[Qemu-devel] [PATCH v4 32/51] docs: document schema configuration

2018-01-11 Thread Marc-André Lureau
Signed-off-by: Marc-André Lureau --- docs/devel/qapi-code-gen.txt | 38 ++ 1 file changed, 38 insertions(+) diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index f58d62686a..479b755609 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/do

[Qemu-devel] [PATCH v4 17/51] qapi: do not define enumeration value explicitely

2018-01-11 Thread Marc-André Lureau
The C standard has the initial value at 0 and the subsequent values incremented by 1. No need to set this explicitely. This will prevent from artificial "gaps" when compiling out some enum values and having unnecessarily large MAX values & enums arrays. Signed-off-by: Marc-André Lureau --- scri

[Qemu-devel] [PATCH v4 22/51] qapi: add a dictionnary form with 'name' key for enum members

2018-01-11 Thread Marc-André Lureau
Desugar the enum NAME form to { 'name': NAME }. This will allow to add new enum members, such as 'if' in the following patch. Signed-off-by: Marc-André Lureau --- scripts/qapi.py| 49 ++ tests/Makefile.include |

[Qemu-devel] [PATCH v4 01/51] qlit: use QType instead of int

2018-01-11 Thread Marc-André Lureau
Suggested-by: Markus Armbruster Signed-off-by: Marc-André Lureau --- include/qapi/qmp/qlit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qapi/qmp/qlit.h b/include/qapi/qmp/qlit.h index b18406bce9..0c6809ef3c 100644 --- a/include/qapi/qmp/qlit.h +++ b/include/qapi/

[Qemu-devel] [PATCH v4 23/51] qapi: add 'if' to enum members

2018-01-11 Thread Marc-André Lureau
QAPISchemaMember gains .ifcond for enum members: inherited classes, such as QAPISchemaObjectTypeMember, will thus have an ifcond member after this (those different types will also use the .ifcond to store the condition and generate conditional code in the following patches). Generated code is not

[Qemu-devel] [PATCH v4 13/51] qapi-commands: add #if conditions to commands

2018-01-11 Thread Marc-André Lureau
Wrap generated code with #if/#endif using the ifcond_decorator. Signed-off-by: Marc-André Lureau --- scripts/qapi-commands.py | 2 ++ tests/test-qmp-commands.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py index 669a

[Qemu-devel] [PATCH v4 07/51] qapi: leave the ifcond attribute undefined until check()

2018-01-11 Thread Marc-André Lureau
We commonly initialize attributes to None in .init(), then set their real value in .check(). Accessing the attribute before .check() yields None. If we're lucky, the code that accesses the attribute prematurely chokes on None. It won't for .ifcond, because None is a legitimate value. Leave the

[Qemu-devel] [PATCH v4 12/51] qapi-introspect: add preprocessor conditions to generated QLit

2018-01-11 Thread Marc-André Lureau
The generator will take (obj, condition) tuples to wrap generated QLit objects for 'obj' with #if/#endif conditions. This commit adds 'ifcond' condition to top-level QLit objects. See generated tests/test-qmp-introspect.c. Example diff after this patch: --- before 2018-01-08 11:55:24.757083

Re: [Qemu-devel] [PATCH v3 26/50] qapi: add 'if' on union variants

2018-01-11 Thread Marc-André Lureau
Hi On Mon, Dec 11, 2017 at 11:36 AM, Markus Armbruster wrote: > Marc-André Lureau writes: > >> Signed-off-by: Marc-André Lureau >> --- >> scripts/qapi.py | 15 ++- >> tests/qapi-schema/qapi-schema-test.json | 7 ++- >> tests/qapi-schema/qapi-schema-test

[Qemu-devel] [PATCH v4 20/51] tests: modify visit_enum_type() in test-qapi to print members

2018-01-11 Thread Marc-André Lureau
Use a common self._print_members() to print enum members details. Signed-off-by: Marc-André Lureau --- tests/qapi-schema/comments.out | 14 +++-- tests/qapi-schema/doc-bad-section.out| 13 +++-- tests/qapi-schema/doc-good.out | 17 +-- tests/qapi-schema/em

[Qemu-devel] [PATCH v4 03/51] qapi: generate a literal qobject for introspection

2018-01-11 Thread Marc-André Lureau
Replace the generated json string with a literal qobject. The later is easier to deal with, at run time as well as compile time: adding #if conditionals will be easier than in a json string. Signed-off-by: Marc-André Lureau Reviewed-by: Markus Armbruster --- scripts/qapi-introspect.py |

[Qemu-devel] [PATCH v4 10/51] qapi: add #if/#endif helpers

2018-01-11 Thread Marc-André Lureau
Add helpers to wrap generated code with #if/#endif lines. Add a function decorator that will be used to wrap visitor methods. The decorator will check if code was generated before adding #if/#endif lines. Used in the following patches. Signed-off-by: Marc-André Lureau --- scripts/qapi.py | 47 +

Re: [Qemu-devel] [PATCH v3 24/50] qapi: add some struct member tests

2018-01-11 Thread Marc-André Lureau
Hi On Sat, Dec 9, 2017 at 10:07 AM, Markus Armbruster wrote: > Marc-André Lureau writes: > >> Signed-off-by: Marc-André Lureau >> --- >> tests/Makefile.include| 2 ++ >> tests/qapi-schema/struct-if-invalid.err | 1 + >> tests/qapi-schema/struct-if-invalid.exit | 1 + >

[Qemu-devel] [PATCH v4 05/51] qapi: add 'if' to top-level expressions

2018-01-11 Thread Marc-André Lureau
Accept 'if' key in top-level elements, accepted as string or list of string type. The following patches will modify the test visitor to check the value is correctly saved, and generate #if/#endif code (as a single #if/endif line or a series for a list). Example of 'if' key: { 'struct': 'TestIfStru

  1   2   3   4   >