summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* qapi: New QMP command query-qmp-schema for QMP introspectionMarkus Armbruster2015-09-2127-11/+830
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qapi/introspect.json defines the introspection schema. It's designed for QMP introspection, but should do for similar uses, such as QGA. The introspection schema does not reflect all the rules and restrictions that apply to QAPI schemata. A valid QAPI schema has an introspection value conforming to the introspection schema, but the converse is not true. Introspection lowers away a number of schema details, and makes implicit things explicit: * The built-in types are declared with their JSON type. All integer types are mapped to 'int', because how many bits we use internally is an implementation detail. It could be pressed into external interface service as very approximate range information, but that's a bad idea. If we need range information, we better do it properly. * Implicit type definitions are made explicit, and given auto-generated names: - Array types, named by appending "List" to the name of their element type, like in generated C. - The enumeration types implicitly defined by simple union types, named by appending "Kind" to the name of their simple union type, like in generated C. - Types that don't occur in generated C. Their names start with ':' so they don't clash with the user's names. * All type references are by name. * The struct and union types are generalized into an object type. * Base types are flattened. * Commands take a single argument and return a single result. Dictionary argument or list result is an implicit type definition. The empty object type is used when a command takes no arguments or produces no results. The argument is always of object type, but the introspection schema doesn't reflect that. The 'gen': false directive is omitted as implementation detail. The 'success-response' directive is omitted as well for now, even though it's not an implementation detail, because it's not used by QMP. * Events carry a single data value. Implicit type definition and empty object type use, just like for commands. The value is of object type, but the introspection schema doesn't reflect that. * Types not used by commands or events are omitted. Indirect use counts as use. * Optional members have a default, which can only be null right now Instead of a mandatory "optional" flag, we have an optional default. No default means mandatory, default null means optional without default value. Non-null is available for optional with default (possible future extension). * Clients should *not* look up types by name, because type names are not ABI. Look up the command or event you're interested in, then follow the references. TODO Should we hide the type names to eliminate the temptation? New generator scripts/qapi-introspect.py computes an introspection value for its input, and generates a C variable holding it. It can generate awfully long lines. Marked TODO. A new test-qmp-input-visitor test case feeds its result for both tests/qapi-schema/qapi-schema-test.json and qapi-schema.json to a QmpInputVisitor to verify it actually conforms to the schema. New QMP command query-qmp-schema takes its return value from that variable. Its reply is some 85KiBytes for me right now. If this turns out to be too much, we have a couple of options: * We can use shorter names in the JSON. Not the QMP style. * Optionally return the sub-schema for commands and events given as arguments. Right now qmp_query_schema() sends the string literal computed by qmp-introspect.py. To compute sub-schema at run time, we'd have to duplicate parts of qapi-introspect.py in C. Unattractive. * Let clients cache the output of query-qmp-schema. It changes only on QEMU upgrades, i.e. rarely. Provide a command query-qmp-schema-hash. Clients can have a cache indexed by hash, and re-query the schema only when they don't have it cached. Even simpler: put the hash in the QMP greeting. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi: Pseudo-type '**' is now unused, drop itMarkus Armbruster2015-09-2111-40/+11
| | | | | | | | | | 'gen': false needs to stay for now, because netdev_add is still using it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-25-git-send-email-armbru@redhat.com>
* qapi-schema: Fix up misleading specification of netdev_addMarkus Armbruster2015-09-213-8/+11
| | | | | | | | | | | | | | | | | It doesn't take a 'props' argument, let alone one in the format "NAME=VALUE,..." The bogus arguments specification doesn't matter due to 'gen': false. Clean it up to be incomplete rather than wrong, and document the incompleteness. While there, improve netdev_add usage example in the manual: add a device option to show how it's done. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-24-git-send-email-armbru@redhat.com>
* qom: Don't use 'gen': false for qom-get, qom-set, object-addMarkus Armbruster2015-09-215-26/+14
| | | | | | | | | | With the previous commit, the generated marshalers just work, and save us a bit of handwritten code. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-23-git-send-email-armbru@redhat.com>
* qapi: Introduce a first class 'any' typeMarkus Armbruster2015-09-2125-10/+171
| | | | | | | | | | | It's first class, because unlike '**', it actually works, i.e. doesn't require 'gen': false. '**' will go away next. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
* qapi: Make output visitor return qnull() instead of NULLMarkus Armbruster2015-09-212-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Before commit 1d10b44, it crashed. Since then, it returns NULL, with a FIXME comment. The FIXME is valid: code that assumes QObject * can't be null exists. I'm not aware of a way to feed this problematic return value to code that actually chokes on null in the current code, but the next few commits will create one, failing "make check". Commit 481b002 solved a very similar problem by introducing a special null QObject. Using this special null QObject is clearly the right way to resolve this FIXME, so do that, and update the test accordingly. However, the patch isn't quite right: it messes up the reference counting. After about SIZE_MAX visits, the reference counter overflows, failing the assertion in qnull_destroy_obj(). Because that's many orders of magnitude more visits of nulls than we expect, we take this patch despite its flaws, to get the QMP introspection stuff in without further delay. We'll want to fix it for real before the release. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-21-git-send-email-armbru@redhat.com>
* qapi: Improve built-in type documentationMarkus Armbruster2015-09-211-11/+18
| | | | | | | | | | Clarify how they map to JSON. Add how they map to C. Fix the reference to StringInputVisitor. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-20-git-send-email-armbru@redhat.com>
* qapi-commands: De-duplicate output marshaling functionsMarkus Armbruster2015-09-212-9/+12
| | | | | | | | | | | | | | gen_marshal_output() uses its parameter name only for name of the generated function. Name it after the type being marshaled instead of its caller, and drop duplicates. Saves 7 copies of qmp_marshal_output_int() in qemu-ga, and one copy of qmp_marshal_output_str() in qemu-system-*. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-19-git-send-email-armbru@redhat.com>
* qapi: De-duplicate parameter list generationMarkus Armbruster2015-09-213-24/+21
| | | | | | | | | Generated qapi-event.[ch] lose line breaks. No change otherwise. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-18-git-send-email-armbru@redhat.com>
* qapi: Rename qmp_marshal_input_FOO() to qmp_marshal_FOO()Markus Armbruster2015-09-216-133/+133
| | | | | | | | | These functions marshal both input and output. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-17-git-send-email-armbru@redhat.com>
* qapi-commands: Rearrange codeMarkus Armbruster2015-09-211-48/+39
| | | | | | | | | | | | | | | | | | | | | Rename gen_marshal_input() to gen_marshal(), because the generated function marshals both arguments and results. Rename gen_visitor_input_containers_decl() to gen_marshal_vars(), and move the other variable declarations there, too. Rename gen_visitor_input_block() to gen_marshal_input_visit(), and rearrange its code slightly. Rename gen_marshal_input_decl() to gen_marshal_proto(), because the result isn't a full declaration, unlike gen_command_decl()'s. New gen_marshal_decl() actually returns a full declaration. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-16-git-send-email-armbru@redhat.com>
* qapi-visit: Rearrange code a bitMarkus Armbruster2015-09-211-29/+19
| | | | | | | | | | Move gen_visit_decl() to a better place. Inline generate_visit_struct_body(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-15-git-send-email-armbru@redhat.com>
* qapi: Clean up after recent conversions to QAPISchemaVisitorMarkus Armbruster2015-09-216-325/+272
| | | | | | | | | | | | | | | | | | | | | | | | Generate just 'FOO' instead of 'struct FOO' when possible. Drop helper functions that are now unused. Make pep8 and pylint reasonably happy. Rename generate_FOO() functions to gen_FOO() for consistency. Use more consistent and sensible variable names. Consistently use c_ for mapping keys when their value is a C identifier or type. Simplify gen_enum() and gen_visit_union() Consistently use single quotes for C text string literals. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1442401589-24189-14-git-send-email-armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi: Replace dirty is_c_ptr() by method c_null()Markus Armbruster2015-09-212-14/+5
| | | | | | | | | | | | | | is_c_ptr() looks whether the end of the C text for the type looks like a pointer. Works, but is fragile. We now have a better tool: use QAPISchemaType method c_null(). The initializers for non-pointers become prettier: 0, false or the enumeration constant with the value 0 instead of {0}. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-13-git-send-email-armbru@redhat.com>
* qapi-event: Convert to QAPISchemaVisitor, fixing data with baseMarkus Armbruster2015-09-212-46/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes events whose data is struct with base to include the struct's base members. Test case is qapi-schema-test.json's event __org.qemu_x-command: { 'event': '__ORG.QEMU_X-EVENT', 'data': '__org.qemu_x-Struct' } { 'struct': '__org.qemu_x-Struct', 'base': '__org.qemu_x-Base', 'data': { '__org.qemu_x-member2': 'str' } } { 'struct': '__org.qemu_x-Base', 'data': { '__org.qemu_x-member1': '__org.qemu_x-Enum' } } Patch's effect on generated qapi_event_send___org_qemu_x_event(): -void qapi_event_send___org_qemu_x_event(const char *__org_qemu_x_member2, +void qapi_event_send___org_qemu_x_event(__org_qemu_x_Enum __org_qemu_x_member1, + const char *__org_qemu_x_member2, Error **errp) { QDict *qmp; @@ -224,6 +225,10 @@ void qapi_event_send___org_qemu_x_event( goto clean; } + visit_type___org_qemu_x_Enum(v, &__org_qemu_x_member1, "__org.qemu_x-member1", &local_err); + if (local_err) { + goto clean; + } visit_type_str(v, (char **)&__org_qemu_x_member2, "__org.qemu_x-member2", &local_err); if (local_err) { goto clean; Code is generated in a different order now, but that doesn't matter. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
* qapi-event: Eliminate global variable event_enum_valueMarkus Armbruster2015-09-211-2/+1
| | | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-11-git-send-email-armbru@redhat.com>
* qapi: De-duplicate enum code generationMarkus Armbruster2015-09-214-122/+64
| | | | | | | | | | | | | | | Duplicated in commit 21cd70d. Yes, we can't import qapi-types, but that's no excuse. Move the helpers from qapi-types.py to qapi.py, and replace the duplicates in qapi-event.py. The generated event enumeration type's lookup table becomes const-correct (see commit 2e4450f), and uses explicit indexes instead of relying on order (see commit 912ae9c). Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1442401589-24189-10-git-send-email-armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi-commands: Convert to QAPISchemaVisitorMarkus Armbruster2015-09-212-70/+91
| | | | | | | | | Output unchanged apart from reordering and white-space. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1442401589-24189-9-git-send-email-armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
* qapi-visit: Convert to QAPISchemaVisitor, fixing bugsMarkus Armbruster2015-09-214-165/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes flat unions to visit the base's base members (the previous commit merely added them to the struct). Same test case. Patch's effect on visit_type_UserDefFlatUnion(): static void visit_type_UserDefFlatUnion_fields(Visitor *m, UserDefFlatUnion **obj, Error **errp) { Error *err = NULL; + visit_type_int(m, &(*obj)->integer, "integer", &err); + if (err) { + goto out; + } visit_type_str(m, &(*obj)->string, "string", &err); if (err) { goto out; Test cases updated for the bug fix. Fixes alternates to generate a visitor for their implicit enumeration type. None of them are currently used, obviously. Example: block-core.json's BlockdevRef now generates visit_type_BlockdevRefKind(). Code is generated in a different order now, and therefore has got a few new forward declarations. Doesn't matter. The guard QAPI_VISIT_BUILTIN_VISITOR_DECL is renamed to QAPI_VISIT_BUILTIN. The previous commit's two ugly special cases exist here, too. Mark both TODO. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi-types: Convert to QAPISchemaVisitor, fixing flat unionsMarkus Armbruster2015-09-214-177/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes flat unions to get the base's base members. Test case is from commit 2fc0043, in qapi-schema-test.json: { 'union': 'UserDefFlatUnion', 'base': 'UserDefUnionBase', 'discriminator': 'enum1', 'data': { 'value1' : 'UserDefA', 'value2' : 'UserDefB', 'value3' : 'UserDefB' } } { 'struct': 'UserDefUnionBase', 'base': 'UserDefZero', 'data': { 'string': 'str', 'enum1': 'EnumOne' } } { 'struct': 'UserDefZero', 'data': { 'integer': 'int' } } Patch's effect on UserDefFlatUnion: struct UserDefFlatUnion { /* Members inherited from UserDefUnionBase: */ + int64_t integer; char *string; EnumOne enum1; /* Own members: */ union { /* union tag is @enum1 */ void *data; UserDefA *value1; UserDefB *value2; UserDefB *value3; }; }; Flat union visitors remain broken. They'll be fixed next. Code is generated in a different order now, but that doesn't matter. The two guards QAPI_TYPES_BUILTIN_STRUCT_DECL and QAPI_TYPES_BUILTIN_CLEANUP_DECL are replaced by just QAPI_TYPES_BUILTIN. Two ugly special cases for simple unions now stand out like sore thumbs: 1. The type tag is named 'type' everywhere, except in generated C, where it's 'kind'. 2. QAPISchema lowers simple unions to semantically equivalent flat unions. However, the C generated for a simple unions differs from the C generated for its equivalent flat union, and we therefore need special code to preserve that pointless difference for now. Mark both TODO. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* tests/qapi-schema: Convert test harness to QAPISchemaVisitorMarkus Armbruster2015-09-2116-118/+249
| | | | | | | | | | | | | | The old code prints the result of parsing (list of expression dictionaries), and partial results of semantic analysis (list of enum dictionaries, list of struct dictionaries). The new code prints a trace of a schema visit, i.e. what the back-ends are going to use. Built-in and array types are omitted, because they're boring. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi: New QAPISchemaVisitorMarkus Armbruster2015-09-211-0/+64
| | | | | | | | | | The visitor will help keeping the code generation code simple and reasonably separated from QAPISchema details. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1442401589-24189-5-git-send-email-armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi: QAPISchema code generation helper methodsMarkus Armbruster2015-09-211-7/+87
| | | | | | | | | | New methods c_name(), c_type(), c_null(), json_type(), alternate_qtype(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1442401589-24189-4-git-send-email-armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi: New QAPISchema intermediate reperesentationMarkus Armbruster2015-09-216-13/+377
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QAPI code generators work with a syntax tree (nested dictionaries) plus a few symbol tables (also dictionaries) on the side. They have clearly outgrown these simple data structures. There's lots of rummaging around in dictionaries, and information is recomputed on the fly. For the work I'm going to do, I want more clearly defined and more convenient interfaces. Going forward, I also want less coupling between the back-ends and the syntax tree, to make messing with the syntax easier. Create a bunch of classes to represent QAPI schemata. Have the QAPISchema initializer call the parser, then walk the syntax tree to create the new internal representation, and finally perform semantic analysis. Shortcut: the semantic analysis still relies on existing check_exprs() to do the actual semantic checking. All this code needs to move into the classes. Mark as TODO. Simple unions are lowered to flat unions. Flat unions and structs are represented as a more general object type. Catching name collisions in generated code would be nice. Mark as TODO. We generate array types eagerly, even though most of them aren't used. Mark as TODO. Nothing uses the new intermediate representation just yet, thus no change to generated files. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* qapi: Rename class QAPISchema to QAPISchemaParserMarkus Armbruster2015-09-211-4/+4
| | | | | | | | | | | I want to name a new class QAPISchema. While there, make it a new-style class. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-2-git-send-email-armbru@redhat.com>
* Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' ↵Peter Maydell2015-09-1971-816/+957
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into staging QOM infrastructure fixes and device conversions * QOM API error handling fixes * Performance improvements for device GPIO property creation * Remaining conversion of QEMUMachine to QOM # gpg: Signature made Sat 19 Sep 2015 15:40:44 BST using RSA key ID 3E7E013F # gpg: Good signature from "Andreas Färber <afaerber@suse.de>" # gpg: aka "Andreas Färber <afaerber@suse.com>" * remotes/afaerber/tags/qom-devices-for-peter: (21 commits) machine: Eliminate QEMUMachine and qemu_register_machine() Revert use of DEFINE_MACHINE() for registrations of multiple machines Use DEFINE_MACHINE() to register all machines mac_world: Break long line machine: DEFINE_MACHINE() macro exynos4: Declare each QEMUMachine as a separate variable exynos4: Use MachineClass instead of exynos4_machines array exynos4: Use EXYNOS4210_NCPUS instead of max_cpus on error message machine: Set MachineClass::name automatically machine: Ensure all TYPE_MACHINE subclasses have the right suffix mac99: Use MACHINE_TYPE_NAME to encode class name s390: Rename s390-ccw-virtio-2.4 class name to use MACHINE_TYPE_NAME s390-virtio: Rename machine class name to use MACHINE_TYPE_NAME pseries: Rename machine class names to use MACHINE_TYPE_NAME arm: Rename virt machine class to use MACHINE_TYPE_NAME vexpress: Rename machine classes to use MACHINE_TYPE_NAME vexpress: Don't set name on abstract class machine: MACHINE_TYPE_NAME macro qdev: Do not use slow [*] expansion for GPIO creation qom: Fix invalid error check in property_get_str() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * machine: Eliminate QEMUMachine and qemu_register_machine()Eduardo Habkost2015-09-195-66/+2
| | | | | | | | | | | | | | The struct is not used anymore and can be eliminated. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * Revert use of DEFINE_MACHINE() for registrations of multiple machinesAndreas Färber2015-09-1915-88/+484
| | | | | | | | | | | | | | | | | | The script used for converting from QEMUMachine had used one DEFINE_MACHINE() per machine registered. In cases where multiple machines are registered from one source file, avoid the excessive generation of module init functions by reverting this unrolling. Signed-off-by: Andreas Färber <afaerber@suse.de>
| * Use DEFINE_MACHINE() to register all machinesEduardo Habkost2015-09-1957-772/+517
| | | | | | | | | | | | | | | | | | Convert all machines to use DEFINE_MACHINE() instead of QEMUMachine automatically using a script. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> [AF: Style cleanups, convert imx25_pdk machine] Signed-off-by: Andreas Färber <afaerber@suse.de>
| * mac_world: Break long lineEduardo Habkost2015-09-191-1/+2
| | | | | | | | | | | | | | Coding style change only. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * machine: DEFINE_MACHINE() macroEduardo Habkost2015-09-191-0/+17
| | | | | | | | | | | | | | | | | | The macro will allow easy registration of a TYPE_MACHINE subclass, using only the machine name and a MachineClass initialization function as parameter. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * exynos4: Declare each QEMUMachine as a separate variableEduardo Habkost2015-09-191-17/+14
| | | | | | | | | | | | | | | | | | This will make the code follow the same pattern used for other machines, and will make it easier to automatically convert the code to be QOM-based. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * exynos4: Use MachineClass instead of exynos4_machines arrayEduardo Habkost2015-09-191-1/+3
| | | | | | | | | | | | | | | | We don't need a QEMUMachine array to query max_cpus, if we can get the corresponding MachineClass. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * exynos4: Use EXYNOS4210_NCPUS instead of max_cpus on error messageEduardo Habkost2015-09-191-2/+1
| | | | | | | | | | | | | | | | The code is checking smp_cpus against EXYNOS4210_NCPUS, not against max_cpus, so use EXYNOS4210_NCPUS in the error message for consistency. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * machine: Set MachineClass::name automaticallyEduardo Habkost2015-09-198-18/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Now all TYPE_MACHINE subclasses use MACHINE_TYPE_NAME to generate the class name. So instead of requiring each subclass to set MachineClass::name manually, we can now set it automatically at the TYPE_MACHINE class_base_init() function. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> [AF/ehabkost: Updated for s390-ccw machines] [AF: Cleanup of intermediate virt and vexpress name handling] Signed-off-by: Andreas Färber <afaerber@suse.de>
| * machine: Ensure all TYPE_MACHINE subclasses have the right suffixEduardo Habkost2015-09-191-0/+9
| | | | | | | | | | | | | | | | | | Now that all non-abstract TYPE_MACHINE subclasses have the -machine suffix, add an assert to ensure this will be always true. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * mac99: Use MACHINE_TYPE_NAME to encode class nameEduardo Habkost2015-09-191-1/+1
| | | | | | | | | | | | | | | | | | It will result in exactly the same class name, but it will make the code consistent with the other classes. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * s390: Rename s390-ccw-virtio-2.4 class name to use MACHINE_TYPE_NAMEEduardo Habkost2015-09-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | Machine class names should use the "-machine" suffix to allow class-name-based machine class lookup to work. Rename the s390-ccw-virtio-2.4 machine class using the MACHINE_TYPE_NAME macro. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> [AF/ehabkost: Updated for 2.5 machine] Signed-off-by: Andreas Färber <afaerber@suse.de>
| * s390-virtio: Rename machine class name to use MACHINE_TYPE_NAMEEduardo Habkost2015-09-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | Machine class names should use the "-machine" suffix to allow class-name-based machine class lookup to work. Rename the s390-virtio machine class using the MACHINE_TYPE_NAME macro. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * pseries: Rename machine class names to use MACHINE_TYPE_NAMEEduardo Habkost2015-09-191-4/+4
| | | | | | | | | | | | | | | | | | | | Machine class names should use the "-machine" suffix to allow class-name-based machine class lookup to work. Rename the the pseries machine classes using the MACHINE_TYPE_NAME macro. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * arm: Rename virt machine class to use MACHINE_TYPE_NAMEEduardo Habkost2015-09-191-2/+3
| | | | | | | | | | | | | | | | | | | | Machine class names should use the "-machine" suffix to allow class-name-based machine class lookup to work. Rename the arm virt machine class using the MACHINE_TYPE_NAME macro. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * vexpress: Rename machine classes to use MACHINE_TYPE_NAMEEduardo Habkost2015-09-191-4/+6
| | | | | | | | | | | | | | | | | | | | | | Machine class names should use the "-machine" suffix to allow class-name-based machine class lookup to work. Rename the vexpress machine classes using the MACHINE_TYPE_NAME macro. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> [AF: Introduce VEXPRESS_*_MACHINE_NAME] Signed-off-by: Andreas Färber <afaerber@suse.de>
| * vexpress: Don't set name on abstract classEduardo Habkost2015-09-191-1/+0
| | | | | | | | | | | | | | | | | | | | The MachineClass::name field won't be ever be used on TYPE_VEXPRESS, as it is an abstract class and the machine class lookup code explicitly skips abstract classes. We can remove it to make the code simpler. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * machine: MACHINE_TYPE_NAME macroEduardo Habkost2015-09-192-1/+7
| | | | | | | | | | | | | | | | | | | | The macro will be useful to ensure the machine class names follow the right format to make machine class lookup by class name work correctly. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qdev: Do not use slow [*] expansion for GPIO creationPavel Fedin2015-09-191-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expansion of [*] suffix is very slow because index expansion is done using trial and error strategy, starting every time from zero and retrying with the next index until insertion succeeds. With large number of already added properties this process takes huge amount of time (O(n^2) complexity). Some architectures (like ARM) use very large amount of IRQ pins in interrupt controller models. This flaw makes machine startup extremely slow (~20 seconds for ARM64 with 32 CPUs). This patch decreases this time down to ~10 seconds. Also in qdev_init_gpio_out_named() memset() is now called only once for the whole array instead of per-cell cleaning Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qom: Fix invalid error check in property_get_str()Markus Armbruster2015-09-191-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a function returns a null pointer on error and only on error, you can do if (!foo(foos, errp)) { ... handle error ... } instead of the more cumbersome Error *err = NULL; if (!foo(foos, &err)) { error_propagate(errp, err); ... handle error ... } A StringProperty's getter, however, may return null on success! We then fail to call visit_type_str(). Screwed up in 6a146eb, v1.1. Fails tests/qom-test in my current, heavily hacked QAPI branch. No reproducer for master known (but I didn't look hard). Cc: Anthony Liguori <anthony@codemonkey.ws> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Andreas Färber <afaerber@suse.de>
| * qom: Do not reuse errp after a possible errorMarkus Armbruster2015-09-191-6/+35
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The argument for an Error **errp parameter must point to a null pointer. If it doesn't, and an error happens, error_set() fails its assertion. Instead of foo(foos, errp); bar(bars, errp); you need to do something like Error *err = NULL; foo(foos, &err); if (err) { error_propagate(errp, err); goto out; } bar(bars, errp); out: Screwed up in commit 0e55884 (v1.3.0): property_get_bool(). Screwed up in commit 1f21772 (v2.1.0): object_property_get_enum() and object_property_get_uint16List(). Screwed up in commit a8e3fbe (v2.4.0): property_get_enum(), property_set_enum(). Found by inspection, no actual crashes observed. Fix them up. Cc: Anthony Liguori <anthony@codemonkey.ws> Cc: Hu Tao <hutao@cn.fujitsu.com> Cc: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Andreas Färber <afaerber@suse.de>
* cocoa: Suppress Cocoa window with -displayRainer Müller2015-09-181-0/+1
| | | | | | | | | | | Do not open a Cocoa window when another display is selected that will be initialized later. The Cocoa display cannot be selected with -display, so there is no need to check its argument. Signed-off-by: Rainer Müller <raimue@codingfarm.de> Reviewed-by: Andreas Färber <andreas.faerber@web.de> Message-id: 1441807710-25431-1-git-send-email-raimue@codingfarm.de Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into stagingPeter Maydell2015-09-188-119/+342
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # gpg: Signature made Fri 18 Sep 2015 15:59:02 BST using RSA key ID AAFC390E # gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" * remotes/jnsnow/tags/ide-pull-request: ahci: clean up initial d2h semantics ahci: remove cmd_fis argument from write_fis_d2h ahci: fix signature generation ahci: remove dead reset code atapi: abort transfers with 0 byte limits ide: fix ATAPI command permissions ide-test: add cdrom dma test ide-test: add cdrom pio test qtest/ahci: export generate_pattern qtest/ahci: use generate_pattern everywhere ide: unify io_buffer_offset increments Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * ahci: clean up initial d2h semanticsJohn Snow2015-09-181-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | with write_fis_d2h and signature generation tidied up, let's adjust the initial d2h semantics to make more sense. The initial d2h is considered delivered if there is guest memory to save it to. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1441140641-17631-5-git-send-email-jsnow@redhat.com
OpenPOWER on IntegriCloud