- Sep 21, 2015
-
-
Markus Armbruster authored
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>
-
Markus Armbruster authored
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>
-
Markus Armbruster authored
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>
-
Markus Armbruster authored
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>
-
Markus Armbruster authored
Duplicated in commit 21cd70df. 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 2e4450ff), and uses explicit indexes instead of relying on order (see commit 912ae9c8). 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>
-
Markus Armbruster authored
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>
-
Markus Armbruster authored
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>
-
Markus Armbruster authored
Fixes flat unions to get the base's base members. Test case is from commit 2fc00432, 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>
-
Markus Armbruster authored
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>
-
Markus Armbruster authored
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>
-
Markus Armbruster authored
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>
-
Markus Armbruster authored
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>
-
Markus Armbruster authored
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>
-
- Sep 19, 2015
-
-
Peter Maydell authored
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>
-
Eduardo Habkost authored
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>
-
Andreas Färber authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
Coding style change only. Signed-off-by:
Eduardo Habkost <ehabkost@redhat.com> Signed-off-by:
Andreas Färber <afaerber@suse.de>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Eduardo Habkost authored
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>
-
Pavel Fedin authored
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>
-
Markus Armbruster authored
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 6a146eba, 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>
-
Markus Armbruster authored
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 0e558843 (v1.3.0): property_get_bool(). Screwed up in commit 1f21772d (v2.1.0): object_property_get_enum() and object_property_get_uint16List(). Screwed up in commit a8e3fbed (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>
-
- Sep 18, 2015
-
-
Rainer Müller authored
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>
-
Peter Maydell authored
# 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>
-
John Snow authored
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
-
John Snow authored
It's no longer used. We used to generate a D2H FIS based upon the command FIS that prompted the update, but in reality, the D2H FIS is generated purely from register state. cmd_fis is vestigial, so get rid of it. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1441140641-17631-4-git-send-email-jsnow@redhat.com
-
John Snow authored
The initial register device-to-host FIS no longer needs to specially set certain fields, as these can be handled generically by setting those fields explicitly with the signatures we want at port reset time. (1) Signatures are decomposed into their four component registers and set upon (AHCI) port reset. (2) the signature cache register is no longer set manually per-each device type, but instead just once during ahci_init_d2h. Signed-off-by:
John Snow <jsnow@redhat.com> Reviewed-by:
Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1441140641-17631-3-git-send-email-jsnow@redhat.com
-