[Qemu-devel] [PATCH v6 30/36] qapi: Use 'struct' instead of 'type' in schema

2015-04-04 Thread Eric Blake
Referring to "type" as both a meta-type (built-in, enum, union, alternte, or struct) and a specific type (the name that the schema uses for declaring structs) is confusing. Finish up the conversion to using "struct" in qapi schema by coverting all users, then remove the hack in the generator that

[Qemu-devel] [PATCH v6 36/36] qapi: Tweak doc references to QMP when QGA is also meant

2015-04-04 Thread Eric Blake
We have more than one qapi schema in use by more than one protocol. Add a new term 'Client JSON Protocol' for use throughout the document, to avoid confusion on whether something refers only to QMP and not QGA. Signed-off-by: Eric Blake Reviewed-by: Markus Armbruster --- v6: rebase to earlier

[Qemu-devel] [PATCH v6 33/36] qapi: Drop inline nested struct in query-version

2015-04-04 Thread Eric Blake
A future patch will be using a 'name':{dictionary} entry in the QAPI schema to specify a default value for an optional argument (see previous commit message for more details why); but existing use of inline nested structs conflicts with that goal. This patch fixes one of only two commands relying o

[Qemu-devel] [PATCH v6 31/36] qapi: Merge UserDefTwo and UserDefNested in tests

2015-04-04 Thread Eric Blake
In the testsuite, UserDefTwo and UserDefNested were identical structs other than the member names. Reduce code duplication by having just one type, and choose names that also favor reuse. This will also make it easier for a later patch to get rid of inline nested types in QAPI. When touching code

[Qemu-devel] [PATCH v6 23/36] qapi: Add some type check tests

2015-04-04 Thread Eric Blake
Demonstrate that the qapi generator silently parses confusing types, which may cause other errors later on. Later patches will update the expected results as the generator is made stricter. Most of the new tests focus on blatant errors. But returns-whitelist is a case where we have historically a

[Qemu-devel] [PATCH v6 34/36] qapi: Drop inline nested structs in query-pci

2015-04-04 Thread Eric Blake
A future patch will be using a 'name':{dictionary} entry in the QAPI schema to specify a default value for an optional argument (see previous commit message for more details why); but existing use of inline nested structs conflicts with that goal. This patch fixes one of only two commands relying o

[Qemu-devel] [PATCH v6 16/36] qapi: Use 'alternate' to replace anonymous union

2015-04-04 Thread Eric Blake
Previous patches have led up to the point where I create the new meta-type "'alternate':'Foo'". See the previous patches for documentation; I intentionally split as much work into earlier patches to minimize the size of this patch, but a lot of it is churn due to testsuite fallout after updating t

[Qemu-devel] [PATCH v6 20/36] qapi: Better error messages for duplicated expressions

2015-04-04 Thread Eric Blake
The previous commit demonstrated that the generator overlooked duplicate expressions: - a complex type or command reusing a built-in type name - redeclaration of a type name, whether by the same or different metatype - redeclaration of a command or event - collision of a type with implicit 'Kind' e

[Qemu-devel] [PATCH v6 29/36] qapi: Document 'struct' metatype

2015-04-04 Thread Eric Blake
Referring to "type" as both a meta-type (built-in, enum, union, alternte, or struct) and a specific type (the name that the schema uses for declaring structs) is confusing. Now that the generator accepts 'struct' as a synonym for 'type', update all documentation to use saner wording. Signed-off-b

[Qemu-devel] [PATCH v6 18/36] qapi: Better error messages for bad expressions

2015-04-04 Thread Eric Blake
The previous commit demonstrated that the generator overlooked some fairly basic broken expressions: - missing metataype - metatype key has a non-string value - unknown key in relation to the metatype - conflicting metatype (this patch treats the second metatype as an unknown key of the first key v

[Qemu-devel] [PATCH v6 32/36] qapi: Drop tests for inline nested structs

2015-04-04 Thread Eric Blake
A future patch will be using a 'name':{dictionary} entry in the QAPI schema to specify a default value for an optional argument; but existing use of inline nested structs conflicts with that goal. More precisely, a definition in the QAPI schema associates a name with a set of properties: Example

[Qemu-devel] [PATCH v6 25/36] qapi: Require valid names

2015-04-04 Thread Eric Blake
Previous commits demonstrated that the generator overlooked various bad naming situations: - types, commands, and events need a valid name - enum members must be valid names, when combined with prefix - union and alternate branches cannot be marked optional The set of valid names includes [a-zA-Z_

[Qemu-devel] [PATCH v6 17/36] qapi: Add some expr tests

2015-04-04 Thread Eric Blake
Demonstrate that the qapi generator doesn't deal well with expressions that aren't up to par. Later patches will improve the expected results as the generator is made stricter. Only a few of the the added tests actually behaves sanely at rejecting obvious problems or demonstrating success. Note t

[Qemu-devel] [PATCH v6 27/36] qapi: More rigorous checking for type safety bypass

2015-04-04 Thread Eric Blake
Now that we have a way to validate every type, we can also be stricter about enforcing that callers that want to bypass type safety in generated code. Prior to this patch, it didn't matter what value was associated with the key 'gen', but it looked odd that 'gen':'yes' could result in bypassing th

[Qemu-devel] [PATCH v6 28/36] qapi: Prefer 'struct' over 'type' in generator

2015-04-04 Thread Eric Blake
Referring to "type" as both a meta-type (built-in, enum, union, alternte, or struct) and a specific type (the name that the schema uses for declaring structs) is confusing. The confusion is only made worse by the fact that the generator mostly already refers to struct even when dealing with expr['

[Qemu-devel] [PATCH v6 21/36] qapi: Allow true, false and null in schema json

2015-04-04 Thread Eric Blake
From: Fam Zheng In the near term, we will use it for a sensible-looking 'gen':false inside command declarations, instead of the current ugly 'gen':'no'. In the long term, it will allow conversion from shorthand with defaults mentioned only in side-band documentation: 'data':{'*flag':'bool', '*s

[Qemu-devel] [PATCH v6 26/36] qapi: Whitelist commands that don't return dictionary

2015-04-04 Thread Eric Blake
...or an array of dictionaries. Although we have to cater to existing commands, returning a non-dictionary means the command is not extensible (no new name/value pairs can be added if more information must be returned in parallel). By making the whitelist explicit, any new command that falls foul

[Qemu-devel] [PATCH v6 35/36] qapi: Drop support for inline nested types

2015-04-04 Thread Eric Blake
A future patch will be using a 'name':{dictionary} entry in the QAPI schema to specify a default value for an optional argument (see previous commit messages for more details why); but existing use of inline nested structs conflicts with that goal. Now that all commands have been changed to avoid i

[Qemu-devel] [PATCH v6 22/36] qapi: Unify type bypass and add tests

2015-04-04 Thread Eric Blake
For a few QMP commands, we are forced to pass an arbitrary type without tracking it properly in QAPI. Among the existing clients, this unnamed type was spelled 'dict', 'visitor', and '**'; this patch standardizes on '**', matching the documentation changes earlier in the series. Meanwhile, for bo

[Qemu-devel] [PATCH v6 11/36] qapi: Tighten checking of unions

2015-04-04 Thread Eric Blake
Previous commits demonstrated that the generator had several flaws with less-than-perfect unions: - a simple union that listed the same branch twice (or two variant names that map to the same C enumerator, including the implicit MAX sentinel) ended up generating invalid C code - an anonymous union

[Qemu-devel] [PATCH v6 19/36] qapi: Add tests of redefined expressions

2015-04-04 Thread Eric Blake
Demonstrate that the qapi generator doesn't deal very well with redefined expressions. At the parse level, they are silently accepted; and while the testsuite just stops at parsing, I've further tested that many of them cause generator crashes or invalid C code if they were appended to qapi-schema

[Qemu-devel] [PATCH v6 02/36] qapi: Document type-safety considerations

2015-04-04 Thread Eric Blake
Go into more details about the various types of valid expressions in a qapi schema, including tweaks to document fixes being done later in the current patch series. Also fix some stale and missing documentation in the QMP specification. Signed-off-by: Eric Blake --- v6: split copyright change

[Qemu-devel] [PATCH v6 14/36] qapi: Rename anonymous union type in test

2015-04-04 Thread Eric Blake
Reduce churn in the future patch that replaces anonymous unions with a new metatype 'alternate' by changing 'AnonUnion' to 'Alternate'. Signed-off-by: Eric Blake Reviewed-by: Markus Armbruster --- v6: no change --- tests/qapi-schema/qapi-schema-test.json | 2 +- tests/qapi-schema/qapi-schema

[Qemu-devel] [PATCH v6 24/36] qapi: More rigourous checking of types

2015-04-04 Thread Eric Blake
Now that we know every expression is valid with regards to its keys, we can add further tests that those keys refer to valid types. With this patch, all uses of a type (the 'data': of command, type, union, alternate, and event; the 'returns': of command; the 'base': of type and union) must resolve

[Qemu-devel] [PATCH v6 15/36] qapi: Document new 'alternate' meta-type

2015-04-04 Thread Eric Blake
The next patch will quit special-casing "'union':'Foo', 'discriminator':{}" and instead use "'alternate':'Foo'". Separating docs from implementation makes it easier to focus on wording without holding up code. In particular, making alternate a separate type makes for a nice type hierarchy:

[Qemu-devel] [PATCH v6 08/36] qapi: Add some union tests

2015-04-04 Thread Eric Blake
Demonstrate that the qapi generator doesn't deal well with unions that aren't up to par. Later patches will update the expected reseults as the generator is made stricter. A few tests work as planned, but most show poor or missing error messages. Of particular note, qapi-code-gen.txt documents 'b

[Qemu-devel] [PATCH v6 09/36] qapi: Clean up test coverage of simple unions

2015-04-04 Thread Eric Blake
The tests of UserDefNativeListUnion serve to validate code generation of simple unions without a base type, except that it did not have full coverage in the strict test. The next commits will remove tests and support for simple unions with a base type, so there is no real loss at repurposing that

[Qemu-devel] [PATCH v6 06/36] qapi: Add some enum tests

2015-04-04 Thread Eric Blake
Demonstrate that the qapi generator doesn't deal well with enums that aren't up to par. Later patches will update the expected results as the generator is made stricter. Signed-off-by: Eric Blake --- v6: add test enum-bad-name (everything else was R-b Markus, but the new test means this still n

[Qemu-devel] [PATCH v6 00/36] drop qapi nested structs

2015-04-04 Thread Eric Blake
We want to eventually allow qapi defaults, by making: 'data':{'*flag':'bool'} as shorthand for something like: 'data':{'flag':{'type':'bool', 'optional':true}} so that the default can be specified: 'data':{'flag':{'type':'bool', 'optional':true, 'default':true}} This series does not quite get u

[Qemu-devel] [PATCH v6 10/36] qapi: Forbid base without discriminator in unions

2015-04-04 Thread Eric Blake
None of the existing QMP or QGA interfaces uses a union with a base type but no discriminator; it is easier to avoid this in the generator to save room for other future extensions more likely to be useful. A previous commit added a union-base-no-discriminator test to ensure that we eventually give

[Qemu-devel] [PATCH v6 05/36] qapi: Require ASCII in schema

2015-04-04 Thread Eric Blake
Python 2 and Python 3 have a wild history of whether strings default to ascii or unicode, where Python 3 requires checking isinstance(foo, basestr) to cover all strings, but where that code is not portable to Python 2. It's simpler to just state that we don't care about Unicode strings, and to jus

[Qemu-devel] [PATCH v6 13/36] qapi: Segregate anonymous unions into alternates in generator

2015-04-04 Thread Eric Blake
Special-casing 'discriminator == {}' for handling anonymous unions is getting awkward; since this particular type is not always a dictionary on the wire, it is easier to treat it as a completely different class of type, "alternate", so that if a type is listed in the union_types array, we know it i

[Qemu-devel] [PATCH v6 07/36] qapi: Better error messages for bad enums

2015-04-04 Thread Eric Blake
The previous commit demonstrated that the generator had several flaws with less-than-perfect enums: - an enum that listed the same string twice (or two variant strings that map to the same C enumerator) ended up generating an invalid C enum - because the generator adds a _MAX terminator to each enu

[Qemu-devel] [PATCH v6 01/36] qapi: Add copyright declaration on docs

2015-04-04 Thread Eric Blake
While our top-level COPYING with its GPLv2+ license applies to any documentation file that omits explicit instructions, these days it's better to be a good example of calling out our intentions. Correct use of GPL requires the use of a copyright statement, so I'm adding notice to two QAPI document

[Qemu-devel] [PATCH v6 12/36] qapi: Prepare for catching more semantic parse errors

2015-04-04 Thread Eric Blake
This patch widens the scope of a try block (with the attending reindentation required by Python) in preparation for a future patch adding more instances of QAPIExprError inside the block. It's easier to separate indentation from semantic changes, so this patch has no real behavior change. Signed-o

[Qemu-devel] [PATCH v6 03/36] qapi: Simplify builtin type handling

2015-04-04 Thread Eric Blake
There was some redundancy between builtin_types[] and builtin_type_qtypes{}. Merge them into one. Signed-off-by: Eric Blake Reviewed-by: Markus Armbruster --- v6: split from 2/28 --- scripts/qapi-types.py | 10 +- scripts/qapi-visit.py | 6 +++--- scripts/qapi.py | 8 +---

[Qemu-devel] [PATCH v6 04/36] qapi: Fix generation of 'size' builtin type

2015-04-04 Thread Eric Blake
We were missing the 'size' builtin type (which means that QAPI using [ 'size' ] would fail to compile). Signed-off-by: Eric Blake Reviewed-by: Markus Armbruster --- v6: split from 2/28 --- scripts/qapi.py | 1 + tests/qapi-schema/qapi-schema-test.json | 3 ++- tests/qa

Re: [Qemu-devel] QEMU IPMI support

2015-04-04 Thread Corey Minyard
Ok, done. It's at https://github.com/cminyard/qemu on github. There are two branches at the moment, stable-2.2-ipmi is based on the 2.2 release and will not rebase. master-ipmi-rebase will rebase on master as it moves. I haven't done extensive testing yet, and it has a few experimental things,

Re: [Qemu-devel] [PATCH for-2.3] alpha: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory

2015-04-04 Thread Richard Henderson
On 04/04/2015 05:14 AM, Dirk Müller wrote: > Therefore for any board that uses memory_region_init_ram directly, > -mem-path is not supported. > > Fix this by replacing memory_region_init_ram with > memory_region_allocate_system_memory. > > Cc: Richard Henderson > Signed-off-by: Dirk Mueller > -

Re: [Qemu-devel] [RFC PATCH] vl.c: add -semihosting-config "arg" sub-argument

2015-04-04 Thread Liviu Ionescu
> On 01 Apr 2015, at 16:18, Leon Alrae wrote: > > ... I would like to follow up with a clean up > where we've got a semi-hosting specific structure rather than keep generating > more semihosting_* variables. I checked the differences between my fork and the master branch (SourceTree for Mac is

[Qemu-devel] [PATCH for-2.3] cris: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory

2015-04-04 Thread Dirk Müller
Commit 0b183fc871:"memory: move mem_path handling to memory_region_allocate_system_memory" split memory_region_init_ram and memory_region_init_ram_from_file. Also it moved mem-path handling a step up from memory_region_init_ram to memory_region_allocate_system_memory. Therefore for any board that

[Qemu-devel] [PATCH v2 for-2.3] arm: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory

2015-04-04 Thread Dirk Müller
Commit 0b183fc871:"memory: move mem_path handling to memory_region_allocate_system_memory" split memory_region_init_ram and memory_region_init_ram_from_file. Also it moved mem-path handling a step up from memory_region_init_ram to memory_region_allocate_system_memory. Therefore for any board that

[Qemu-devel] [PATCH for-2.3] lm32: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory

2015-04-04 Thread Dirk Müller
Commit 0b183fc871:"memory: move mem_path handling to memory_region_allocate_system_memory" split memory_region_init_ram and memory_region_init_ram_from_file. Also it moved mem-path handling a step up from memory_region_init_ram to memory_region_allocate_system_memory. Therefore for any board that

[Qemu-devel] [PATCH for-2.3] alpha: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory

2015-04-04 Thread Dirk Müller
Commit 0b183fc871:"memory: move mem_path handling to memory_region_allocate_system_memory" split memory_region_init_ram and memory_region_init_ram_from_file. Also it moved mem-path handling a step up from memory_region_init_ram to memory_region_allocate_system_memory. Therefore for any board that

[Qemu-devel] [PULL 1/5] pcspk: Fix I/O port name

2015-04-04 Thread Michael Tokarev
From: Jan Kiszka Probably a copy&paste bug. Fixing it helps identifying the device model behind port 0x61. Signed-off-by: Jan Kiszka Reviewed-by: Gonglei Signed-off-by: Michael Tokarev --- hw/audio/pcspk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/audio/pcspk.c b

[Qemu-devel] [PULL 5/5] vhost: fix typo in vq_index description

2015-04-04 Thread Michael Tokarev
From: Greg Kurz Signed-off-by: Greg Kurz Acked-by: Jason Wang Signed-off-by: Michael Tokarev --- include/hw/virtio/vhost.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index d5593d1..8f04888 100644 --- a/include/hw/v

[Qemu-devel] [PULL 3/5] target-tricore: Fix check which was always false

2015-04-04 Thread Michael Tokarev
From: Stefan Weil With a mask value of 0x0040, the result will never be 1. This fixes a Coverity warning. Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- target-tricore/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-tricore/op_helper.c

[Qemu-devel] [PULL 2/5] target-i386: remove superfluous TARGET_HAS_SMC macro

2015-04-04 Thread Michael Tokarev
From: "Emilio G. Cota" Signed-off-by: Emilio G. Cota Reviewed-by: Paolo Bonzini Signed-off-by: Michael Tokarev --- target-i386/cpu.h | 2 -- translate-all.c | 4 2 files changed, 6 deletions(-) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 15db6d7..4ee12ca 100644 --- a/targ

[Qemu-devel] [PULL 0/5 for-2.3] Trivial patches for 2015-04-04

2015-04-04 Thread Michael Tokarev
Here's a very small trivial-patches pull request for the upcoming 2.3 release. There's nothing urgent here, so things can wait past 2.3, but these things are also safe. Only one "questionable" code change is the removal of TARGET_HAS_SMC macro, but it was applied long ago (to -trivial) and it loo

[Qemu-devel] [PULL 4/5] gitignore: Ignore more .pod files.

2015-04-04 Thread Michael Tokarev
From: Eric Blake kvm_stat.{1,pod} started showing up as untracked files in my directory, and I nearly accidentally merged them into a commit with my usual habit of 'git add .'. Rather than spelling out each such file, just ignore the entire pattern. Signed-off-by: Eric Blake Reviewed-by: Stefa