summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* ui/console: add escape sequence \e[5, 6nRen Kimura2019-11-291-15/+41
| | | | | | | | | | | Add support of escape sequence "\e[5n" and "\e[6n" to console. "\e[5n" reports status of console and it always succeed in virtual console. "\e[6n" reports now cursor position in console. Signed-off-by: Ren Kimura <rkx1209dev@gmail.com> Message-id: 1457466681-7714-2-git-send-email-rkx1209dev@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* MAINTAINERS: Add Samuel Thibault as slirp maintainerSamuel Thibault2019-11-291-0/+1
| | | | | Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
* cutils: add avx2 instruction optimizationLiang Li2019-11-292-11/+121
| | | | | | | | | | | | | | | | | | | | | | | buffer_find_nonzero_offset() is a hot function during live migration. Now it use SSE2 instructions for optimization. For platform supports AVX2 instructions, use AVX2 instructions for optimization can help to improve the performance of buffer_find_nonzero_offset() about 30% comparing to SSE2. Live migration can be faster with this optimization, the test result shows that for an 8GiB RAM idle guest just boots, this patch can help to shorten the total live migration time about 6%. This patch use the ifunc mechanism to select the proper function when running, for platform supports AVX2, execute the AVX2 instructions, else, execute the original instructions. Signed-off-by: Liang Li <liang.z.li@intel.com> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Suggested-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1457416397-26671-3-git-send-email-liang.z.li@intel.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* configure: detect ifunc and avx2 attributeLiang Li2019-11-291-0/+21
| | | | | | | | | | | | Detect if the compiler can support the ifun and avx2, if so, set CONFIG_AVX2_OPT which will be used to turn on the avx2 instruction optimization. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Liang Li <liang.z.li@intel.com> Message-Id: <1457416397-26671-2-git-send-email-liang.z.li@intel.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* Postcopy: Fix sync count in info migrateDr. David Alan Gilbert2019-11-291-0/+1
| | | | | | | | | | I'd missed the sync count off in the postcopy case. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Message-id: 1456394631-18010-1-git-send-email-dgilbert@redhat.com Message-Id: <1456394631-18010-1-git-send-email-dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* input-linux: add switch to enable auto-repeat eventsGerd Hoffmann2019-11-291-1/+6
| | | | | | | Enable with "-input-linux /dev/input/${device},repeat=on". Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1457087116-4379-4-git-send-email-kraxel@redhat.com
* input-linux: add option to toggle grab on all devicesGerd Hoffmann2019-11-291-0/+29
| | | | | | | | | Maintain a list of all input devices. Add an option to make grab work across all devices (so toggling grab on the keybard can switch over the mouse too). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1457087116-4379-3-git-send-email-kraxel@redhat.com
* input: linux evdev supportGerd Hoffmann2019-11-295-0/+380
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for reading input events directly from linux evdev devices and forward them to the guest. Unlike virtio-input-host which simply passes on all events to the guest without looking at them this will interpret the events and feed them into the qemu input subsystem. Therefore this is limited to what the qemu input subsystem and the emulated input devices are able to handle. Also there is no support for absolute coordinates (tablet/touchscreen). So we are talking here about basic mouse and keyboard support. The advantage is that it'll work without virtio-input drivers in the guest, the events are delivered to the usual ps/2 or usb input devices (depending on what the machine happens to have). And for keyboards qemu is able to switch the keyboard between guest and host on hotkey. The hotkey is hard-coded for now (both control keys), initialy the guest owns the keyboard. Probably most useful when assigning vga devices with vfio and using a physical monitor instead of vnc/spice/gtk as guest display. Usage: Add '-input-linux /dev/input/event<nr>' to the qemu command line. Note that udev has rules which populate /dev/input/by-{id,path} with static names, which might be more convinient to use. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1457087116-4379-2-git-send-email-kraxel@redhat.com
* tests: update acpi test dataGerd Hoffmann2019-11-294-0/+0
| | | | | | using tests/acpi-test-data/rebuild-expected-aml.sh Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* fw_cfg: document ACPI device node informationGabriel L. Somlo2019-11-291-0/+9
| | | | | | | | | Signed-off-by: Gabriel Somlo <somlo@cmu.edu> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Marc Marí <markmb@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1455906029-25565-6-git-send-email-somlo@cmu.edu Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* acpi: arm: add fw_cfg device node to dsdtGabriel L. Somlo2019-11-291-0/+15
| | | | | | | | | | | | | | | | Add a fw_cfg device node to the ACPI DSDT. This is mostly informational, as the authoritative fw_cfg MMIO region(s) are listed in the Device Tree. However, since we are building ACPI tables, we might as well be thorough while at it... Signed-off-by: Gabriel Somlo <somlo@cmu.edu> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Marc Marí <markmb@redhat.com> Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1455906029-25565-5-git-send-email-somlo@cmu.edu Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* acpi: pc: add fw_cfg device node to dsdtGabriel L. Somlo2019-11-291-0/+29
| | | | | | | | | | | | | | | Add a fw_cfg device node to the ACPI DSDT. While the guest-side firmware can't utilize this information (since it has to access the hard-coded fw_cfg device to extract ACPI tables to begin with), having fw_cfg listed in ACPI will help the guest kernel keep a more accurate inventory of in-use IO port regions. Signed-off-by: Gabriel Somlo <somlo@cmu.edu> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Marc Marí <markmb@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1455906029-25565-4-git-send-email-somlo@cmu.edu Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* pc: fw_cfg: move ioport base constant to pc.hGabriel L. Somlo2019-11-292-3/+4
| | | | | | | | | | | | | Move BIOS_CFG_IOPORT define from pc.c to pc.h, and rename it to FW_CFG_IO_BASE. Cc: Marc Marí <markmb@redhat.com> Signed-off-by: Gabriel Somlo <somlo@cmu.edu> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Marc Marí <markmb@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 1455906029-25565-3-git-send-email-somlo@cmu.edu Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* fw_cfg: expose control register size in fw_cfg.hGabriel L. Somlo2019-11-292-1/+6
| | | | | | | | | | | | | | | | Expose the size of the control register (FW_CFG_CTL_SIZE) in fw_cfg.h. Add comment to fw_cfg_io_realize() pointing out that since the 8-bit data register is always subsumed by the 16-bit control register in the port I/O case, we use the control register width as the *total* width of the (classic, non-DMA) port I/O region reserved for the device. Cc: Marc Marí <markmb@redhat.com> Signed-off-by: Gabriel Somlo <somlo@cmu.edu> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Marc Marí <markmb@redhat.com> Message-id: 1455906029-25565-2-git-send-email-somlo@cmu.edu Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* vnc: send cursor when a new client is connectingFrediano Ziglio2019-11-291-0/+3
| | | | | | | | | | If you have hardware cursor and you are reconnecting the VNC client you need to send the cursor. Failing to do so make the cursor invisible till is changed. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Message-id: 1456929142-14033-1-git-send-email-fziglio@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* net: check packet payload lengthPrasad J Pandit2019-11-291-2/+8
| | | | | | | | | | While computing IP checksum, 'net_checksum_calculate' reads payload length from the packet. It could exceed the given 'data' buffer size. Add a check to avoid it. Reported-by: Liu Ling <liuling-it@360.cn> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
* filter-buffer: Add status_changed callback processingzhanghailiang2019-11-291-6/+28
| | | | | | | | | | | | | | | While the status of filter-buffer changing from 'on' to 'off', it need to release all the buffered packets, and delete the related timer, while switch from 'off' to 'on', it need to resume the release packets timer. Here, we extract the process of setup timer into a new helper, which will be used in the new status_changed callback. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Cc: Jason Wang <jasowang@redhat.com> Cc: Yang Hongyang <hongyang.yang@easystack.cn> Signed-off-by: Jason Wang <jasowang@redhat.com>
* filter: Add 'status' property for filter objectzhanghailiang2019-11-293-1/+48
| | | | | | | | | | | | | | | With this property, users can control if this filter is 'on' or 'off'. The default behavior for filter is 'on'. For some types of filters, they may need to react to status changing, So here, we introduced status changing callback/notifier for filter class. We will skip the disabled ('off') filter when delivering packets in net layer. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Cc: Jason Wang <jasowang@redhat.com> Cc: Yang Hongyang <hongyang.yang@easystack.cn> Signed-off-by: Jason Wang <jasowang@redhat.com>
* rocker: allow user to specify rocker world by propertyJiri Pirko2019-11-291-1/+28
| | | | | | | | Add property to specify rocker world. All ports will be assigned to this world. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
* rocker: add name field into WorldOps ale let world specify its nameJiri Pirko2019-11-293-6/+3
| | | | | | | Also use this in world_name getter function. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
* rocker: return -ENOMEM in case of some world alloc failsJiri Pirko2019-11-291-0/+1
| | | | | | | Until now, 0 is returned in this error case. Fix it ro return -ENOMEM. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
* rocker: forbid to change world typeJiri Pirko2019-11-293-1/+13
| | | | | | | | Port to world assignment should be permitted only by qemu user. Driver should not be able to do it, so forbid that possibility. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
* net: netmap: probe netmap interface for virtio-net headerVincenzo Maffione2019-11-291-21/+38
| | | | | | | | | | | | | Previous implementation of has_ufo, has_vnet_hdr, has_vnet_hdr_len, etc. did not really probe for virtio-net header support for the netmap interface attached to the backend. These callbacks were correct for VALE ports, but incorrect for hardware NICs, pipes, monitors, etc. This patch fixes the implementation to work properly with all kinds of netmap ports. Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
* net: simplify net_init_tap_one logicPaolo Bonzini2019-11-291-2/+2
| | | | | | | | | | | net_init_tap_one receives in vhostfdname a fd name from vhostfd= or vhostfds=, or NULL if there is no vhostfd=/vhostfds=. It is simpler to just check vhostfdname, than it is to check for vhostfd= or vhostfds=. This also calms down Coverity, which otherwise thinks that monitor_fd_param could dereference a NULL vhostfdname. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
* MAINTAINERS: Add entries for include/net/ filesThomas Huth2019-11-291-0/+2
| | | | | | | | The include/net/ files correspond to the files in the net/ directory, thus there should be corresponding entries in the MAINTAINERS file. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
* net: filter: correctly remove filter from the list during finalizationJason Wang2019-11-291-1/+2
| | | | | | | | | | | | | | | | | Qemu may crash when we want to add two filters on the same netdev but the initialization of second fails (e.g missing parameters): ./qemu-system-x86_64 -netdev user,id=un0 \ -object filter-buffer,id=f0,netdev=un0,interval=10 \ -object filter-buffer,id=f1,netdev=un0 Segmentation fault (core dumped) This is because we don't check whether or not the filter was in the list of netdev. This patch fixes this. Cc: Yang Hongyang <hongyang.yang@easystack.cn> Reviewed-by: Yang Hongyang <hongyang.yang@easystack.cn> Signed-off-by: Jason Wang <jasowang@redhat.com>
* net: ne2000: check ring buffer control registersPrasad J Pandit2019-11-291-0/+4
| | | | | | | | | | | | | Ne2000 NIC uses ring buffer of NE2000_MEM_SIZE(49152) bytes to process network packets. Registers PSTART & PSTOP define ring buffer size & location. Setting these registers to invalid values could lead to infinite loop or OOB r/w access issues. Add check to avoid it. Reported-by: Yang Hongke <yanghongke@huawei.com> Tested-by: Yang Hongke <yanghongke@huawei.com> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
* rng: switch request queue to QSIMPLEQLadi Prosek2019-11-294-16/+19
| | | | | | | | | | | | | QSIMPLEQ supports appending to tail in O(1) and is intrusive so it doesn't require extra memory allocations for the bookkeeping data. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Ladi Prosek <lprosek@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Message-Id: <1457010971-24771-1-git-send-email-lprosek@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
* scsi-bus: Remove tape command from scsi_req_xferAlex Pyrgiotis2019-11-291-1/+0
| | | | | | | | | | | Remove the RECOVER_BUFFERED_DATA command from the list of commands that are handled by scsi_req_xfer(). Given that this command is tape-specific, it should be handled only by scsi_stream_req_xfer(). Signed-off-by: Alex Pyrgiotis <apyrgio@arrikto.com> Message-Id: <1457365822-22435-1-git-send-email-apyrgio@arrikto.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm/irqchip: use bitmap utility for gsi trackingWei Yang2019-11-291-24/+10
| | | | | | | | | By using utilities in bitops and bitmap, this patch tries to make it more friendly to audience. No functional change. Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Message-Id: <1457229445-25954-1-git-send-email-richard.weiyang@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* MAINTAINERS: Add entry for include/sysemu/kvm*.hThomas Huth2019-11-291-0/+1
| | | | | | | | | The include/sysemu/kvm*.h header files should be part of the overall KVM section. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1456403605-26587-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* doc/memory.txt: correct description of MemoryRegionOps fieldsPeter Maydell2019-11-291-3/+4
| | | | | | | | | | | | | Probably what happened was that when the API was being designed it started off with an 'aligned' field, and then later the field name and semantics were changed but the docs weren't updated to match. Similarly, cpu_register_io_memory() does not exist anymore, so clarify the documentation for .old_mmio. Reported-by: Cao jin <caoj.fnst@cn.fujitsu.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* doc/memory.txt: correct a logic errorxiaoqiang zhao2019-11-291-2/+2
| | | | | | | | | In the regions overlap example, region B has a higher priority thus should has a larger priority number than C. Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Message-Id: <1456476051-15121-1-git-send-email-zxq_yx_007@163.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* icount: possible options for sleep are on or offPranith Kumar2019-11-292-5/+5
| | | | | | | | | icount sleep takes on or off as options. A few places mention sleep=no which is not accepted. This patch corrects them. Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> Message-Id: <1456499811-16819-1-git-send-email-bobby.prani@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* exec: Introduce AddressSpaceDispatch.mru_sectionFam Zheng2019-11-291-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Under heavy workloads the lookup will likely end up with the same MemoryRegionSection from last time. Using a pointer to cache the result, like ram_list.mru_block, significantly reduces cost of address_space_translate. During address space topology update, as->dispatch will be reallocated so the pointer is invalidated automatically. Perf reports a visible drop on the cpu usage, because phys_page_find is not called. Before: 2.35% qemu-system-x86_64 [.] phys_page_find 0.97% qemu-system-x86_64 [.] address_space_translate_internal 0.95% qemu-system-x86_64 [.] address_space_translate 0.55% qemu-system-x86_64 [.] address_space_lookup_region After: 0.97% qemu-system-x86_64 [.] address_space_translate_internal 0.97% qemu-system-x86_64 [.] address_space_lookup_region 0.84% qemu-system-x86_64 [.] address_space_translate Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1456813104-25902-8-git-send-email-famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* exec: Factor out section_covers_addrFam Zheng2019-11-291-3/+12
| | | | | | | | | | | This will be shared by the next patch. Also add a comment explaining the unobvious condition on "size.hi". Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1456813104-25902-7-git-send-email-famz@redhat.com> [Small change to the comment. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* exec: Pass RAMBlock pointer to qemu_ram_freeFam Zheng2019-11-293-17/+10
| | | | | | | | | | The only caller now knows exactly which RAMBlock to free, so it's not necessary to do the lookup. Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1456813104-25902-6-git-send-email-famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* memory: Drop MemoryRegion.ram_addrFam Zheng2019-11-297-53/+40
| | | | | | | | | | | | All references to mr->ram_addr are replaced by memory_region_get_ram_addr(mr) (except for a few assertions that are replaced with mr->ram_block). Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1456813104-25902-5-git-send-email-famz@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* memory: Implement memory_region_get_ram_addr with mr->ram_blockFam Zheng2019-11-292-7/+6
| | | | | | Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1456813104-25902-4-git-send-email-famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* memory: Move assignment to ram_block to memory_region_init_*Fam Zheng2019-11-292-1/+5
| | | | | | | | | | | | | We don't force "const" qualifiers with pointers in QEMU, but it's still good to keep a clean function interface. Assigning to mr->ram_block is in this sense ugly - one initializer mutating its owning object's state. Move it to memory_region_init_*, where mr->ram_addr is assigned. Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1456813104-25902-3-git-send-email-famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* exec: Return RAMBlock pointer from allocating functionsFam Zheng2019-11-293-45/+53
| | | | | | | | | | | | Previously we return RAMBlock.offset; now return the pointer to the whole structure. ram_block_add returns void now, error is completely passed with errp. Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1456813104-25902-2-git-send-email-famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* i8257: fix Terminal Count statusHervé Poussineau2019-11-291-0/+4
| | | | | | | | | | | | | | When a DMA transfer is done (ie all bytes have been transfered), the corresponding Terminal Count bit must be set in the status register. This bit is already cleared in i8257_read_cont and i8257_write_cont when required. This fixes (at least) floppy transfer in IBM 40p firmware, which checks in DMA controller if everything went fine. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Message-Id: <1456404332-31556-1-git-send-email-hpoussin@reactos.org> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* log: do not log if QEMU is daemonized but without -DPaolo Bonzini2019-11-291-2/+5
| | | | | | | | | | | | | | | Commit 96c33a4 ("log: Redirect stderr to logfile if deamonized", 2016-02-22) wanted to move stderr of a daemonized QEMU to the file specified with -D. However, if -D was not passed, the patch had the side effect of not redirecting stderr to /dev/null. This happened because qemu_logfile was set to stderr rather than the expected value of NULL. The fix is simply in the "if" condition of do_qemu_set_log; the "if" for closing the file is also changed to match. Reported-by: Jan Tomko <jtomko@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qapi: Drop useless 'data' member of unionsEric Blake2019-11-296-27/+0
| | | | | | | | | | | | | | We started moving away from the use of the 'void *data' member in the C union corresponding to a QAPI union back in commit 544a373; recent commits have gotten rid of other uses. Now that it is completely unused, we can remove the member itself as well as the FIXME comment. Update the testsuite to drop the negative test union-clash-data. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1457021813-10704-11-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* chardev: Drop useless ChardevDummy typeEric Blake2019-11-294-15/+12
| | | | | | | | | | | | | | | Commit d0d7708b made ChardevDummy be an empty wrapper type around ChardevCommon. But there is no technical reason for this indirection, so simplify the code by directly using the base type. Also change the fallback assignment to assign u.null rather than u.data, since a future patch will remove the data member of the C struct generated for QAPI unions. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1457106160-23614-1-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* qapi: Avoid use of 'data' member of QAPI unionsEric Blake2019-11-292-15/+18
| | | | | | | | | | | | | QAPI code generators currently create a 'void *data' member as part of the anonymous union embedded in the C struct corresponding to a QAPI union. However, directly assigning to this member of the union feels a bit fishy, when we can assign to another member of the struct instead. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1457021813-10704-9-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* ui: Shorten references into InputEventEric Blake2019-11-297-89/+129
| | | | | | | | | | | | | | | | | | | An upcoming patch will alter how simple unions, like InputEvent, are laid out, which will impact all lines of the form 'evt->u.XXX' (expanding it to the longer 'evt->u.XXX.data'). For better legibility in that patch, and less need for line wrapping, it's better to use a temporary variable to reduce the effect of a layout change to just the variable initializations, rather than every reference within an InputEvent. There was one instance in hid.c:hid_pointer_event() where the code was referring to evt->u.rel inside the case label where evt->u.abs is the correct name; thankfully, both members of the union have the same type, so it happened to work, but it is now cleaner. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1457021813-10704-8-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* util: Shorten references into SocketAddressEric Blake2019-11-296-68/+88
| | | | | | | | | | | | | | | An upcoming patch will alter how simple unions, like SocketAddress, are laid out, which will impact all lines of the form 'addr->u.XXX' (expanding it to the longer 'addr->u.XXX.data'). For better legibility in that patch, and less need for line wrapping, it's better to use a temporary variable to reduce the effect of a layout change to just the variable initializations, rather than every reference within a SocketAddress. Also, take advantage of some C99 initialization where it makes sense (simplifying g_new0() to g_new()). Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1457021813-10704-7-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* chardev: Shorten references into ChardevBackendEric Blake2019-11-291-56/+66
| | | | | | | | | | | | | | | | | An upcoming patch will alter how simple unions, like ChardevBackend, are laid out, which will impact all lines of the form 'backend->u.XXX' (expanding it to the longer 'backend->u.XXX.data'). For better legibility in that patch, and less need for line wrapping, it's better to use a temporary variable to reduce the effect of a layout change to just the variable initializations, rather than every reference within a ChardevBackend. It doesn't hurt that this also makes the code more consistent: some clients touched here already had a temporary variable but weren't using it. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-By: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1457021813-10704-6-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* qapi: Update docs to match recent generator changesEric Blake2019-11-292-164/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | Several commits have been changing the generator, but not updating the docs to match: - The implicit tag member is named "type", not "kind". Screwed up in commit 39a1815. - Commit 9f08c8ec made list types lazy, and thereby dropped UserDefOneList if nothing explicitly uses the list type. - Commit 51e72bc1 switched the parameter order with 'name' occurring earlier. - Commit e65d89bf changed the layout of UserDefOneList. - Prefer the term 'member' over 'field'. - We now expose visit_type_FOO_members() for objects. - etc. Rework the examples to show slightly more output (we don't want to show too much; that's what the testsuite is for), and regenerate the output to match all recent changes. Also, rearrange output to show .h files before .c (understanding the interface first often makes the implementation easier to follow). Reported-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1457021813-10704-5-git-send-email-eblake@redhat.com>
OpenPOWER on IntegriCloud