sdl: move version logic from source code to makefile

Compile sdl.c / sdl2.c depending on CONFIG_SDLABI instead of
compiling both and have version #ifdefs in the source code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
sdl2: rename sdl2_state to sdl2_console, move to header file

Create sdl2.h header file, in preparation for sdl2 code splitup.
Populate it with sdl2_console struct (renamed from sdl2_state).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
sdl2: move keyboard input code to new sdl2-input.c

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
sdl2: turn on keyboard grabs

Makes quite some keys actually go to the guest instead of
being captured by the host window manager.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
sdl2: move sdl_update to new sdl2-2d.c

Create new sdl2-2d file for 2d display rendering.
Move over sdl_update code, and rename to sdl2_2d_update.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
sdl2: overhaul window size handling

Split do_sdl_resize function (which does alot more than just resizing)
into three: sdl2_window_{create,destroy,resize}.

Fix SDL_Renderer handling: must be guest display size not host window
size, and SDL2 will magically handle all scaling for us.

Make fullscreen actually enter fullscreen mode and simplify the code.
There is no need to store the original window size, the window manager
will do that for us.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
sdl2: move sdl_switch to sdl2-2d.c

Move sdl_switch to sdl2-2d.c file, rename to sdl2_2d_switch.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
sdl2: add+use sdl2_2d_redraw function.

Add a new sdl2_2d_redraw function for a complete screen refresh,
so we can stop using graphic_hw_invalidate for that.  There is
no need to bother console / gfx emulation code if we are just
going to re-blit the screen after window resizes.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
sdl2: factor out sdl2_poll_events

Create a new function to poll and handle sdl2 events,
which is then just called from the refresh timer.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
sdl2: move sdl2_2d_refresh to sdl2-2d.c

Now that common event handling code is split off, we can move
over sdl_refresh to sdl2-2d.c, and rename it to sdl2_2d_refresh.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
sdl2: Use correct sdl2_console for window events

SDL_PollEvent() polls events for all windows; therefore,
sdl2_poll_events() will poll the events for all windows and not only for
the one identified by the given sdl2_console.

This should be considered in handle_windowevent(): The window affected
by the event is not necessarily the one identified by the sdl2_console
object given to sdl2_poll_events(), but the one identified by
ev->window.windowID.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
sdl2: Work around SDL2 SDL_ShowWindow() bug

Apparently it is possible for X to send an event to a hidden SDL2
window, leading to SDL2 believing it is now shown. SDL2 will pass the
SDL_WINDOWEVENT_SHOWN message to the application without actually
showing the window; the problem is that the next SDL_ShowWindow() will
be a no-op because SDL2 assumes the window is already shown.

The correct way to react to SDL_WINDOWEVENT_SHOWN would be to clear
scon->hidden (analogous for SDL_WINDOWEVENT_HIDDEN). However, due to the
window not actually being shown, this will somehow not be correct after
all.

Therefore, just hide the window on SDL_WINDOWEVENT_SHOWN if it is
supposed to be hidden (and analogous for SDL_WINDOWEVENT_HIDDEN).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
update ipxe from 69313ed to 35c5379

Anton D. Kachalov (1):
      [intel] Add 8086:1557 card (Intel 82599 10G ethernet mezz)

Christian Hesse (1):
      [build] Merge util/geniso and util/genliso

Curtis Larsen (3):
      [efi] Use EFI_CONSOLE_CONTROL_PROTOCOL to set text mode if available
      [efi] Report errors from attempting to disconnect existing drivers
      [efi] Try various possible SNP receive filters

Dale Hamel (1):
      [smbios] Expose board serial number as ${board-serial}

Florian Schmaus (1):
      [build] Set GITVERSION only if there is a git repository

Hannes Reinecke (3):
      [ethernet] Provide eth_random_addr() to generate random Ethernet addresses
      [igbvf] Assign random MAC address if none is set
      [igbvf] Allow changing of MAC address

Jan Kiszka (1):
      [intel] Add I217-LM PCI ID

Marin Hannache (4):
      [nfs] Fix an invalid free() when loading a symlink
      [nfs] Fix an invalid free() when loading a regular (non-symlink) file
      [nfs] Rewrite NFS URI handling
      [readline] Add CTRL-W shortcut to remove a word

Michael Brown (144):
      [profile] Allow interrupts to be excluded from profiling results
      [intel] Exclude time spent in hypervisor from profiling
      [build] Fix version.o dependency upon git index
      [tcp] Defer sending ACKs until all received packets have been processed
      [lkrnprefix] Function as a bzImage kernel
      [build] Avoid errors when build directory is mounted via NFS
      [undi] Apply quota only to number of complete received packets
      [lkrnprefix] Make real-mode setup code relocatable
      [intel] Increase receive ring fill level
      [syslog] Strip invalid characters from hostname
      [test] Add self-tests for strdup()
      [libc] Prevent strndup() from reading beyond the end of the string
      [efi] Allow for optional protocols
      [efi] Make EFI_DEVICE_PATH_TO_TEXT_PROTOCOL optional
      [efi] Make EFI_HII_DATABASE_PROTOCOL optional
      [efi] Do not try to fetch loaded image device path protocol
      [ipv6] Fix definition of IN6_IS_ADDR_LINKLOCAL()
      [dhcpv6] Do not set sin6_scope_id on the unspecified client socket address
      [ipv6] Do not set sin6_scope_id on source address
      [ipv6] Include network device when transcribing multicast addresses
      [ipv6] Avoid potentially copying from a NULL pointer in ipv6_tx()
      [librm] Allow for the PIC interrupt vector offset to be changed
      [ifmgmt] Do not sleep CPU while configuring network devices
      [scsi] Improve sense code parsing
      [iscsi] Read IPv4 settings only from the relevant network device
      [iscsi] Include IP address origin in iBFT
      [debug] Allow debug message colours to be customised via DBGCOL=...
      [build] Expose build timestamp, build name, and product names
      [efi] Allow device paths to be easily included in debug messages
      [efi] Provide a meaningful EFI SNP device name
      [efi] Restructure EFI driver model
      [build] Fix erroneous object name in version object
      [build] Add yet another potential location for isolinux.bin
      [efi] Allow network devices to be created on top of arbitrary SNP devices
      [autoboot] Allow autoboot device to be identified by link-layer address
      [efi] Identify autoboot device by MAC address when chainloading
      [efi] Attempt to start only drivers claiming support for a device
      [efi] Rewrite SNP NIC driver
      [efi] Include SNP NIC driver within the all-drivers target
      [crypto] Add support for iPAddress subject alternative names
      [crypto] Fix debug message
      [netdevice] Reset network device index when last device is unregistered
      [efi] Update EDK2 headers
      [efi] Install our own disk I/O protocol and claim exclusive use of it
      [efi] Allow for interception of boot services calls by loaded image
      [efi] Print well-known GUIDs by name in debug messages
      [efi] Include EFI_CONSOLE_CONTROL_PROTOCOL header
      [ioapi] Fail ioremap() when attempting to map a zero bus address
      [intel] Check for ioremap() failures
      [realtek] Check for ioremap() failures
      [vmxnet3] Check for ioremap() failures
      [skel] Check for ioremap() failures
      [myson] Check for ioremap() failures
      [natsemi] Check for ioremap() failures
      [i386] Add functions to read and write model-specific registers
      [x86_64] Add functions to read and write model-specific registers
      [efi] Show more diagnostic information when building with DEBUG=efi_wrap
      [ioapi] Centralise notion of PAGE_SIZE
      [lotest] Discard packets arriving on the incorrect network device
      [xen] Import selected public headers
      [xen] Add basic support for PV-HVM domains
      [xen] Add support for Xen netfront virtual NICs
      [efi] Default to releasing network devices for use via SNP
      [efi] Unload started images only on failure
      [efi] Fill in loaded image's DeviceHandle if firmware fails to do so
      [efi] Fix incorrect debug message level when device has no device path
      [efi] Report exact failure when unable to open the device path
      [netdevice] Avoid registering duplicate network devices
      [efi] Ignore failures when attempting to install SNP HII protocol
      [efi] Expand the range of well-known EFI GUIDs in debug messages
      [efi] Provide efi_handle_name() for debugging
      [efi] Add ability to dump all openers of a given protocol on a handle
      [efi] Use efi_handle_name() instead of efi_handle_devpath_text()
      [efi] Use efi_handle_name() instead of efi_devpath_text() where applicable
      [efi] Allow compiler to perform type checks on EFI_HANDLE
      [efi] Avoid unnecessarily passing pointers to EFI_HANDLEs
      [efi] Dump existing openers when we are unable to open a protocol
      [efi] Dump handle information around connect/disconnect attempts
      [efi] Improve debugging of the debugging facilities
      [efi] Add excessive sanity checks into efi_debug functions
      [efi] Also try original ComponentName protocol for retrieving driver names
      [efi] Print raw device path when we have no DevicePathToTextProtocol
      [efi] Add ability to dump SNP device mode information
      [efi] Reset multicast filter list when setting SNP receive filters
      [efi] Provide centralised definitions of commonly-used GUIDs
      [efi] Open device path protocol only at point of use
      [efi] Move abstract device path and handle functions to efi_utils.c
      [efi] Generalise snpnet_pci_info() to efi_locate_device()
      [bios] Support displaying and hiding cursor
      [efi] Support displaying and hiding cursor
      [readline] Ensure cursor is visible when prompting for input
      [xen] Accept alternative Xen platform PCI device ID 5853:0002
      [xen] Use version 1 grant tables by default
      [xen] Cope with unexpected initial backend states
      [smc9000] Avoid using CONFIG as a preprocessor macro
      [build] Allow for named configurations at build time
      [intel] Display PBS value when applying ICH errata workaround
      [intel] Display before and after values for both PBS and PBA
      [intel] Apply PBS/PBA errata workaround only to ICH8 PCI device IDs
      [efi] Add definitions of GUIDs observed during Windows boot
      [efi] Dump details of any calls to our dummy block and disk I/O protocols
      [romprefix] Do not preserve unused register %di
      [build] Remove obsolete references to .zrom build targets
      [build] Allow ISA ROMs to be built
      [build] Avoid deleting config header files if build is interrupted
      [prefix] Halt system without burning CPU if we cannot access the payload
      [prefix] Report both %esi and %ecx when opening payload fails
      [util] Use PCI length field to obtain length of individual images
      [mromprefix] Use PCI length field to obtain length of individual images
      [mromprefix] Allow for .mrom images larger than 128kB
      [efi] Show details of intercepted LoadImage() calls
      [efi] Make our virtual file system case insensitive
      [efi] Wrap any images loaded by our wrapped image
      [efi] Use the SNP protocol instance to match the SNP chainloading device
      [efi] Avoid returning uninitialised data from PCI configuration space reads
      [efi] Make EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL optional
      [efi] Allow for non-PCI snpnet devices
      [build] Clean up all binary directories on "make [very]clean"
      [efi] Add efifatbin utility
      [efi] Provide dummy device path in efi_image_probe()
      [dhcp] Check for matching chaddr in received DHCP packets
      [dhcp] Remove obsolete dhcp_chaddr() function
      [build] Use -malign-double to build 32-bit UEFI binaries
      [efi] Centralise definitions of more protocol GUIDs
      [efi] Add definitions of GUIDs observed when chainloading from Intel driver
      [efi] Free transmit ring entry before calling netdev_tx_complete()
      [efi] Generalise snpnet_dev_info() to efi_device_info()
      [efi] Update to current EDK2 headers
      [efi] Add NII / UNDI driver
      [efi] Check for presence of UNDI in NII protocol
      [efi] Include NII driver within "snp" and "snponly" build targets
      [ping] Report timed-out pings via the callback function
      [ping] Allow termination after a specified number of packets
      [ping] Allow "ping" command output to be inhibited
      [intel] Use autoloaded MAC address instead of EEPROM MAC address
      [crypto] Fix parsing of OCSP responder ID key hash
      [vmxnet3] Add profiling code to exclude time spent in the hypervisor
      [netdevice] Fix erroneous use of free(iobuf) instead of free_iob(iobuf)
      [libc] Add ASSERTED macro to test if any assertion has triggered
      [list] Add sanity checks after list-adding functions
      [malloc] Tidy up debug output
      [malloc] Sanity check parameters to alloc_memblock() and free_memblock()
      [malloc] Check integrity of free list
      [malloc] Report caller address as soon as memory corruption is detected

Peter Lemenkov (1):
      [build] Check if git index actually exists

Robin Smidsrød (2):
      [build] Add named configuration for VirtualBox
      [build] Avoid using embedded script in VirtualBox named configuration

Sven Ulland (1):
      [lacp] Set "aggregatable" flag in response LACPDU

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
tap: fix vcpu long time io blocking on tap

[Adjusted doc comment for grammar.
--Stefan]

Signed-off-by: Wangkai <wangkai86@huawei.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
net: don't use set/get_pointer() in set/get_netdev()

Commit 1ceef9f27359cbe92ef124bf74de6f792e71f6fb (net: multiqueue
support) tries to use set_pointer() and get_pointer() to set and get
NICPeers which is not a pointer defined in DEFINE_PROP_NETDEV. This
trick works but result a unclean and fragile implementation (e.g
print_netdev and parse_netdev).

This patch solves this issue by not using set/get_pinter() and set and
get netdev directly in set_netdev() and get_netdev(). After this the
parse_netdev() and print_netdev() were no longer used and dropped from
the source.

[Renamed 'err' label to 'out' as suggested by Markus Armbruster.
--Stefan]

Cc: Markus Armbruster <armbru@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
net: Fuse g_malloc(); memset() into g_new0()

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
net: Use g_new() & friends where that makes obvious sense

g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
for two reasons.  One, it catches multiplication overflowing size_t.
Two, it returns T * rather than void *, which lets the compiler catch
more type errors.

This commit only touches allocations with size arguments of the form
sizeof(T).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
e1000: defer packets until BM enabled

Some guests seem to set BM for e1000 after
enabling RX.
If packets arrive in the window, device is wedged.
Probably works by luck on real hardware, work around
this by making can_receive depend on BM.

Tested-by: Gabriel Somlo <somlo@cmu.edu>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
vfio: migration to trace points

This patch removes all DPRINTF and replace them by trace points.
A few DPRINTF used in error cases were transformed into error_report.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
vfio: fix adding memory listener to the right address space

Depending on the device, container->space->as contains the valid AddressSpace.
Using address_space_memory breaks devices sitting behind an iommu (and using
a separate address space).

Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>