aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-11-05vnc: recycle empty vs->output bufferPeter Lieven1-0/+8
If the vs->output buffer is empty it will be dropped by the next qio_buffer_move_empty in vnc_jobs_consume_buffer anyway. So reuse the allocated buffer from this buffer in the worker thread where we otherwise would start with an empty (unallocated buffer). Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-17-git-send-email-kraxel@redhat.com [ added a comment describing the non-obvious optimization ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-11-05vnc: fix local state initGerd Hoffmann1-4/+4
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-16-git-send-email-kraxel@redhat.com
2015-11-05vnc: only alloc server surface with clients connectedGerd Hoffmann1-0/+12
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-15-git-send-email-kraxel@redhat.com
2015-11-05vnc: use vnc_{width,height} in vnc_set_area_dirtyGerd Hoffmann1-11/+10
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-14-git-send-email-kraxel@redhat.com
2015-11-05vnc: factor out vnc_update_server_surfaceGerd Hoffmann1-6/+15
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-13-git-send-email-kraxel@redhat.com
2015-11-05vnc: add vnc_width+vnc_height helpersGerd Hoffmann1-3/+13
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-12-git-send-email-kraxel@redhat.com
2015-11-05vnc: zap dead codeGerd Hoffmann1-4/+0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-11-git-send-email-kraxel@redhat.com
2015-11-05vnc-jobs: move buffer reset, use new buffer moveGerd Hoffmann1-7/+8
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-10-git-send-email-kraxel@redhat.com
2015-11-05vnc: kill jobs queue bufferGerd Hoffmann1-6/+0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-9-git-send-email-kraxel@redhat.com
2015-11-05vnc: attach names to buffersGerd Hoffmann2-0/+23
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-8-git-send-email-kraxel@redhat.com
2015-11-05buffer: add tracingGerd Hoffmann2-0/+24
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-7-git-send-email-kraxel@redhat.com
2015-11-05buffer: add buffer_shrinkGerd Hoffmann2-1/+29
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-6-git-send-email-kraxel@redhat.com
2015-11-05buffer: add buffer_moveGerd Hoffmann2-0/+26
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-5-git-send-email-kraxel@redhat.com
2015-11-05buffer: add buffer_move_emptyGerd Hoffmann2-0/+24
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel Berrange <berrange@redhat.com> Message-id: 1446203414-4013-4-git-send-email-kraxel@redhat.com
2015-11-05buffer: add buffer_initGerd Hoffmann2-0/+23
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1446203414-4013-3-git-send-email-kraxel@redhat.com
2015-11-05buffer: make the Buffer capacity increase in powers of twoPeter Lieven1-1/+4
This makes sure the number of reallocs is in O(log N). Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1446203414-4013-2-git-send-email-kraxel@redhat.com [ rebased to util/buffer.c ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-11-03Merge remote-tracking branch ↵Peter Maydell15-93/+251
'remotes/pmaydell/tags/pull-target-arm-20151103' into staging target-arm queue: * code cleanup to use symbolic constants for register bank numbers * fix direct booting of modern Linux kernels on xilinx_zynq by setting SCLR values to what the kernel expects firmware to have done * implement SYSRESETREQ for ARMv7M CPU (stellaris boards) * update MAINTAINERS to mention new qemu-arm mailing list * clean up display of PSTATE in AArch64 debug logs * report Secure/Nonsecure status in CPU debug logs * fix a missing _CCA attribute in ACPI tables * add support for GICv3 to ACPI tables # gpg: Signature made Tue 03 Nov 2015 13:58:46 GMT using RSA key ID 14360CDE # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" # gpg: aka "Peter Maydell <pmaydell@gmail.com>" # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" * remotes/pmaydell/tags/pull-target-arm-20151103: ARM: ACPI: Fix MPIDR value in ACPI table hw/arm/virt-acpi-build: Add GICC ACPI subtable for GICv3 hw/arm/virt-acpi-build: _CCA attribute is compulsory target-arm: Report S/NS status in the CPU debug logs target-arm: Bring AArch64 debug CPU display of PSTATE into line with AArch32 MAINTAINERS: Add new qemu-arm mailing list to ARM related entries arm: stellaris: exit on external reset request armv7-m: Implement SYSRESETREQ armv7-m: Return DeviceState* from armv7m_init() arm: xilinx_zynq: Add linux pre-boot arm: boot: Add board specific setup code API arm: boot: Adjust indentation of FIXUP comments target-arm: Add and use symbolic names for register banks Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20151103-1' into ↵Peter Maydell2-2/+2
staging usb: two bugfixes for ehci & usb-host. # gpg: Signature made Tue 03 Nov 2015 10:57:28 GMT using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-usb-20151103-1: usb-host: fix usb3ep0quirk test ehci: clear suspend bit on detach Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03ARM: ACPI: Fix MPIDR value in ACPI tableShannon Zhao1-1/+3
Use mp_affinity of ARMCPU as the CPU MPIDR instead of the CPU index. Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Message-id: 1446285001-7316-1-git-send-email-zhaoshenglong@huawei.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03hw/arm/virt-acpi-build: Add GICC ACPI subtable for GICv3Shannon Zhao1-14/+16
When booting VM with GICv3, the kernel needs GICC ACPI subtable to initialize the CPUs, e.g. MPIDR information. This adds GICC ACPI subtable for GICv3, but set GICC base address only when gic_version == 2 since it donesn't need GICC base address for GICv3. Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Message-id: 1446131773-5018-1-git-send-email-shannon.zhao@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03hw/arm/virt-acpi-build: _CCA attribute is compulsoryGraeme Gregory1-0/+1
According to ACPI specification 6.2.17 _CCA (Cache Coherency Attribute) this attribute is compulsory on ARM systems. Add this attribute to the PCI host bridges as required. Without this the kernel will produce the error [Firmware Bug]: PCI device 0000:00:00.0 fail to setup DMA. Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org> Message-id: 1446460786-13663-1-git-send-email-graeme.gregory@linaro.org Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03target-arm: Report S/NS status in the CPU debug logsPeter Maydell2-2/+21
If this CPU supports EL3, enhance the printing of the current CPU mode in debug logging to distinguish S from NS modes as appropriate. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1445883178-576-3-git-send-email-peter.maydell@linaro.org
2015-11-03target-arm: Bring AArch64 debug CPU display of PSTATE into line with AArch32Peter Maydell1-3/+5
The AArch64 debug CPU display of PSTATE as "PSTATE=200003c5 (flags --C-)" on the end of the same line as the last of the general purpose registers is unnecessarily different from the AArch32 display of PSR as "PSR=200001d3 --C- A svc32" on its own line. Update the AArch64 code to put PSTATE in its own line and in the same format, including printing the exception level (mode). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1445883178-576-2-git-send-email-peter.maydell@linaro.org
2015-11-03MAINTAINERS: Add new qemu-arm mailing list to ARM related entriesPeter Maydell1-0/+23
We now have a qemu-arm mailing list for ARM patches and discussion, so add an L: entry for it to the various ARM related entries in MAINTAINERS. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Message-id: 1446129661-5239-1-git-send-email-peter.maydell@linaro.org
2015-11-03arm: stellaris: exit on external reset requestMichael Davidsaver1-0/+12
Add GPIO in for the stellaris board which calls qemu_system_reset_request() on reset request. Signed-off-by: Michael Davidsaver <mdavidsaver@gmail.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03armv7-m: Implement SYSRESETREQMichael Davidsaver1-1/+8
Implement the SYSRESETREQ bit of the AIRCR register for armv7-m (ie. cortex-m3) to trigger a GPIO out. Signed-off-by: Michael Davidsaver <mdavidsaver@gmail.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03armv7-m: Return DeviceState* from armv7m_init()Michael Davidsaver4-26/+29
Change armv7m_init to return the DeviceState* for the NVIC. This allows access to all GPIO blocks, not just the IRQ inputs. Move qdev_get_gpio_in() calls out of armv7m_init() into board code for stellaris and stm32f205 boards. Signed-off-by: Michael Davidsaver <mdavidsaver@gmail.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03arm: xilinx_zynq: Add linux pre-bootPeter Crosthwaite1-0/+42
Add a Linux-specific pre-boot routine that matches the device- specific bootloaders behaviour. This is needed for modern Linux that expects the ARM PLL in SLCR to be a more even value (not 26). Cc: Alistair Francis <alistair.francis@xilinx.com> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Message-id: 9a9025ea65572586b50dca4e5819032e3c436d64.1446182614.git.crosthwaite.peter@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03arm: boot: Add board specific setup code APIPeter Crosthwaite2-1/+29
Add an API for boards to inject their own preboot software (or firmware) sequence. The software then returns to the bootloader via the link register. This allows boards to do their own little bits of firmware setup without needed to replace the bootloader completely (which is the requirement for existing firmware support). The blob is loaded by a callback if and only if doing a linux boot (similar to the existing write_secondary support). Rewrite the comment for the primary boot blob. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Message-id: 070295644c6ac84696d743913296e8cfefb48c15.1446182614.git.crosthwaite.peter@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03arm: boot: Adjust indentation of FIXUP commentsPeter Crosthwaite1-8/+8
These comments start immediately after the current longest name in the list. Tab them out to the next tab stop to give a little breathing room and prepare for FIXUP_BOARD_SETUP which will require more indent. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Message-id: b9b9bb8f1c307c1ef8a3f26ff1f34fabb34b332e.1446182614.git.crosthwaite.peter@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03target-arm: Add and use symbolic names for register banksSoren Brinkmann4-39/+56
Add BANK_<cpumode> #defines to index banked registers. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03usb-host: fix usb3ep0quirk testGerd Hoffmann1-1/+1
usb->speed is the usb speed the device is actually running on in the qemu emulation (i.e. from the guests point of view). So when plugging usb3 devices into ehci hostadapter this is HIGH not SUPER. To figure whenever the host talks to the device with superspeed we have to check speedmask instead and see whenever the superspeed bit is set there. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1445603230-11840-1-git-send-email-kraxel@redhat.com
2015-11-03ehci: clear suspend bit on detachGerd Hoffmann1-1/+1
When a device is detached, clear the suspend bit (PORTSC_SUSPEND) in the port status register. The specs are not *that* clear what is supposed to happen in case a suspended device is unplugged. But the enable bit (PORTSC_PED) is cleared, and the specs mention setting suspend with enable being unset is undefined behavior. So clearing them both looks reasonable, and it actually fixes the reported bug. https://bugzilla.redhat.com/show_bug.cgi?id=1268879 Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Message-id: 1445413462-18004-1-git-send-email-kraxel@redhat.com
2015-11-03Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20151103-1' into ↵Peter Maydell7-26/+94
staging ui: fixes for vnc, opengl and curses. # gpg: Signature made Tue 03 Nov 2015 09:53:24 GMT using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-ui-20151103-1: vnc: fix bug: vnc server can't start when 'to' is specified vnc: allow fall back to RAW encoding ui/opengl: Reduce build required libraries for opengl ui/curses: Fix pageup/pagedown on -curses ui/curses: Support line graphics chars on -curses mode ui/curses: Fix monitor color with -curses when 256 colors Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-03vnc: fix bug: vnc server can't start when 'to' is specifiedYang Hongyang1-0/+2
commit e0d03b8ceb52 converted VNC startup to use SocketAddress, the interface socket_listen don't have a port_offset param, so we need to add the port offset (5900) to both 'port' and 'to' opts. currently only 'port' is added by offset. This patch add the port offset to 'to' opts. Signed-off-by: Yang Hongyang <hongyang.yang@easystack.cn> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1445926252-14830-1-git-send-email-hongyang.yang@easystack.cn Cc: Daniel P. Berrange <berrange@redhat.com> Cc: Eric Blake <eblake@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-11-03vnc: allow fall back to RAW encodingPeter Lieven1-2/+18
I have observed that depending on the contents and the encoding it happens that sending data as RAW sometimes would take less space than the encoded data. This is especially the case for small updates or areas with high color images. If sending RAW encoded data is beneficial allow a fall back to RAW encoding for the framebuffer update. Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-11-03ui/opengl: Reduce build required libraries for openglOGAWA Hirofumi3-20/+7
We now use epoxy to load opengl libraries. This means we don't need to link opengl libraries directly if interfaces handled by epoxy. With this, we just need epoxy headers and epoxy's *.so to build. Tested with epoxy-1.3.1. - sdl2/gtk/console egl stuff doesn't require other than epoxy - milkymist-tmu2 glx stuff doesn't require other than epoxy (lm32 test is limited, because can't find mmone-bios.bin, so just test to load libGL with "./lm32-softmmu/qemu-system-lm32 -M milkymist,accel=qtest") Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> [ lm32 tested by kraxel ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-11-03ui/curses: Fix pageup/pagedown on -cursesOGAWA Hirofumi1-2/+6
Current KEY_NPAGE/KEY_PPAGE handling is broken on -curses. Those uses "GREY", but "KEY_MASK" masked out "GREY". To fix, we have to use correct mask value - SCANCODE_KEYMASK. Then, this adds support of "shift + pageup/pagedown". With this, -curses mode can use scroll-up/down as usual like other display modes. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-11-03ui/curses: Support line graphics chars on -curses modeOGAWA Hirofumi2-1/+55
This converts vga code to curses code in console_write_bh(). With this changes, we can see line graphics (for example, dialog uses) correctly. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-11-03ui/curses: Fix monitor color with -curses when 256 colorsOGAWA Hirofumi1-1/+6
If TERM=xterm-256color, COLOR_PAIRS==256 and monitor passes chtype like 0x74xx. Then, the code uses uninitialized color pair. As result, monitor uses black for both of fg and bg color, i.e. terminal is filled by black. To fix, this initialize above than 64 with default color (fg=white,bg=black). FIXME: on 256 color, curses may be possible better vga color emulation. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-11-02Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-11-02' into ↵Peter Maydell74-607/+663
staging QAPI patches # gpg: Signature made Mon 02 Nov 2015 09:07:23 GMT using RSA key ID EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" * remotes/armbru/tags/pull-qapi-2015-11-02: (25 commits) qapi: Simplify gen_struct_field() qapi: Reserve 'u' member name qapi: Finish converting to new qapi union layout tpm: Convert to new qapi union layout memory: Convert to new qapi union layout input: Convert to new qapi union layout char: Convert to new qapi union layout net: Convert to new qapi union layout sockets: Convert to new qapi union layout block: Convert to new qapi union layout tests: Convert to new qapi union layout qapi-visit: Convert to new qapi union layout qapi: Start converting to new qapi union layout qapi-visit: Remove redundant functions for flat union base qapi: Unbox base members qapi: Prefer typesafe upcasts to qapi base classes qapi-types: Refactor base fields output qapi-visit: Split off visit_type_FOO_fields forward decl vnc: Hoist allocation of VncBasicInfo to callers qapi: Reserve 'q_*' and 'has_*' member names ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-02qapi: Simplify gen_struct_field()Eric Blake1-9/+7
Rather than having all callers pass a name, type, and optional flag, have them instead pass a QAPISchemaObjectTypeMember which already has all that information. No change to generated code. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-25-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02qapi: Reserve 'u' member nameEric Blake6-1/+11
Now that we have separated union tag values from colliding with non-variant C names, by naming the union 'u', we should reserve this name for our use. Note that we want to forbid 'u' even in a struct with no variants, because it is possible for a future qemu release to extend QMP in a backwards-compatible manner while converting from a struct to a flat union. Fortunately, no existing clients were using this member name. If we ever find the need for QMP to have a member 'u', we could at that time relax things, perhaps by having c_name() munge the QMP member to 'q_u'. Note that we cannot forbid 'u' everywhere (by adding the rejection code to check_name()), because the existing QKeyCode enum already uses it; therefore we only reserve it as a struct type member name. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-24-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02qapi: Finish converting to new qapi union layoutEric Blake1-22/+6
We have two issues with our qapi union layout: 1) Even though the QMP wire format spells the tag 'type', the C code spells it 'kind', requiring some hacks in the generator. 2) The C struct uses an anonymous union, which places all tag values in the same namespace as all non-variant members. This leads to spurious collisions if a tag value matches a non-variant member's name. This patch is the back end for a series that converts to a saner qapi union layout. Now that all clients have been converted to use 'type' and 'obj->u.value', we can drop the temporary parallel support for 'kind' and 'obj->value'. Given a simple union qapi type: { 'union':'Foo', 'data': { 'a':'int', 'b':'bool' } } this is the overall effect, when compared to the state before this series of patches: | struct Foo { |- FooKind kind; |- union { /* union tag is @kind */ |+ FooKind type; |+ union { /* union tag is @type */ | void *data; | int64_t a; | bool b; |- }; |+ } u; | }; The testsuite still contains some examples of artificial restrictions (see flat-union-clash-type.json, for example) that are no longer technically necessary, now that there is no longer a collision between enum tag values and non-variant member names; but fixing this will be done in later patches, in part because some further changes are required to keep QAPISchema*.check() from asserting. Also, a later patch will add a reservation for the member name 'u' to avoid a collision between a user's non-variant names and our internal choice of C union name. Note, however, that we do not rename the generated enum, which is still 'FooKind'. A further patch could generate implicit enums as 'FooType', but while the generator already reserved the '*Kind' namespace (commit 4dc2e69), there are already QMP constructs with '*Type' naming, which means changing our reservation namespace would have lots of churn to C code to deal with a forced name change. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-23-git-send-email-eblake@redhat.com> [Commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02tpm: Convert to new qapi union layoutEric Blake2-5/+5
We have two issues with our qapi union layout: 1) Even though the QMP wire format spells the tag 'type', the C code spells it 'kind', requiring some hacks in the generator. 2) The C struct uses an anonymous union, which places all tag values in the same namespace as all non-variant members. This leads to spurious collisions if a tag value matches a non-variant member's name. Make the conversion to the new layout for TPM-related code. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-22-git-send-email-eblake@redhat.com> [Commit message tweaked slightly] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02memory: Convert to new qapi union layoutEric Blake3-10/+10
We have two issues with our qapi union layout: 1) Even though the QMP wire format spells the tag 'type', the C code spells it 'kind', requiring some hacks in the generator. 2) The C struct uses an anonymous union, which places all tag values in the same namespace as all non-variant members. This leads to spurious collisions if a tag value matches a non-variant member's name. Make the conversion to the new layout for memory-related code. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-21-git-send-email-eblake@redhat.com> [Commit message tweaked slightly] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02input: Convert to new qapi union layoutEric Blake9-123/+125
We have two issues with our qapi union layout: 1) Even though the QMP wire format spells the tag 'type', the C code spells it 'kind', requiring some hacks in the generator. 2) The C struct uses an anonymous union, which places all tag values in the same namespace as all non-variant members. This leads to spurious collisions if a tag value matches a non-variant member's name. Make the conversion to the new layout for input-related code. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-20-git-send-email-eblake@redhat.com> [Commit message tweaked slightly] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02char: Convert to new qapi union layoutEric Blake2-88/+88
We have two issues with our qapi union layout: 1) Even though the QMP wire format spells the tag 'type', the C code spells it 'kind', requiring some hacks in the generator. 2) The C struct uses an anonymous union, which places all tag values in the same namespace as all non-variant members. This leads to spurious collisions if a tag value matches a non-variant member's name. Make the conversion to the new layout for character-related code. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-19-git-send-email-eblake@redhat.com> [Commit message tweaked slightly] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02net: Convert to new qapi union layoutEric Blake10-32/+32
We have two issues with our qapi union layout: 1) Even though the QMP wire format spells the tag 'type', the C code spells it 'kind', requiring some hacks in the generator. 2) The C struct uses an anonymous union, which places all tag values in the same namespace as all non-variant members. This leads to spurious collisions if a tag value matches a non-variant member's name. Make the conversion to the new layout for net-related code. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-18-git-send-email-eblake@redhat.com> [Commit message tweaked slightly] Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-02sockets: Convert to new qapi union layoutEric Blake3-61/+61
We have two issues with our qapi union layout: 1) Even though the QMP wire format spells the tag 'type', the C code spells it 'kind', requiring some hacks in the generator. 2) The C struct uses an anonymous union, which places all tag values in the same namespace as all non-variant members. This leads to spurious collisions if a tag value matches a non-variant member's name. Make the conversion to the new layout for socket-related code. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1445898903-12082-17-git-send-email-eblake@redhat.com> [Commit message tweaked slightly] Signed-off-by: Markus Armbruster <armbru@redhat.com>