summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-03-15slirp: Reindent after refactoringGuillaume Subiron3-92/+91
No code change. Signed-off-by: Guillaume Subiron <maethor@subiron.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Thomas Huth <thuth@redhat.com>
2016-03-15slirp: Generalizing and neutralizing various TCP functions before adding ↵Guillaume Subiron7-31/+109
IPv6 stuff Basically, this patch adds some switch in various TCP functions to prepare them for the IPv6 case. To have something to "switch" in tcp_input() and tcp_respond(), a new argument is used to give them the sa_family of the addresses they are working on. This patch does not include the entailed reindentation, to make proofread easier. Reindentation is adressed in the following no-op patch. Signed-off-by: Guillaume Subiron <maethor@subiron.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Thomas Huth <thuth@redhat.com>
2016-03-15slirp: Factorizing tcpiphdr structure with an unionGuillaume Subiron8-45/+106
This patch factorizes the tcpiphdr structure to put the IPv4 fields in an union, for addition of version 6 in further patch. Using some macros, retrocompatibility of the existing code is assured. This patch also fixes the SLIRP_MSIZE and margin computation in various functions, and makes them compatible with the new tcpiphdr structure, whose size will be bigger than sizeof(struct tcphdr) + sizeof(struct ip) Signed-off-by: Guillaume Subiron <maethor@subiron.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Thomas Huth <thuth@redhat.com>
2016-03-15slirp: Adding IPv6 UDP supportGuillaume Subiron6-9/+208
This adds the sin6 case in the fhost and lhost unions and related macros. It adds udp6_input() and udp6_output(). It adds the IPv6 case in sorecvfrom(). Finally, udp_input() is called by ip6_input(). Signed-off-by: Guillaume Subiron <maethor@subiron.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Thomas Huth <thuth@redhat.com>
2016-03-15slirp: Adding ICMPv6 error sendingYann Bordenave3-3/+84
Adding icmp6_send_error to send ICMPv6 Error messages. This function is simpler than the v4 version. Adding some calls in various functions to send ICMP errors, when a received packet is too big, or when its hop limit is 0. Signed-off-by: Yann Bordenave <meow@meowstars.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Thomas Huth <thuth@redhat.com>
2016-03-15slirp: Fix ICMP error sendingYann Bordenave7-17/+18
Disambiguation : icmp_error is renamed into icmp_send_error, since it doesn't manage errors, but only sends ICMP Error messages. Signed-off-by: Yann Bordenave <meow@meowstars.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Thomas Huth <thuth@redhat.com>
2016-03-15slirp: Adding IPv6, ICMPv6 Echo and NDP autoconfigurationGuillaume Subiron12-6/+1019
This patch adds the functions needed to handle IPv6 packets. ICMPv6 and NDP headers are implemented. Slirp is now able to send NDP Router or Neighbor Advertisement when it receives Router or Neighbor Solicitation. Using a 64bit-sized IPv6 prefix, the guest is now able to perform stateless autoconfiguration (SLAAC) and to compute its IPv6 address. This patch adds an ndp_table, mainly inspired by arp_table, to keep an NDP cache and manage network address resolution. Slirp regularly sends NDP Neighbor Advertisement, as recommended by the RFC, to make the guest refresh its route. This also adds ip6_cksum() to compute ICMPv6 checksums using IPv6 pseudo-header. Some #define ETH_* are moved upper in slirp.h to make them accessible to other slirp/*.h Signed-off-by: Guillaume Subiron <maethor@subiron.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Thomas Huth <thuth@redhat.com>
2016-03-14Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' ↵Peter Maydell2-16/+56
into staging # gpg: Signature made Mon 14 Mar 2016 11:27:01 GMT using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/tracing-pull-request: trace: separate MMIO tracepoints from TB-access tracepoints trace: include CPU index in trace_memory_region_*() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-03-14Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20160311.0' ↵Peter Maydell9-415/+549
into staging VFIO updates 2016-03-11 - Allow devices to be specified via sysfs path (Alex Williamson) - vfio region helpers and generalization for future device specific regions (Alex Williamson) - Automatic ROM device ID and checksum fixup (Alex Williamson) - Split VGA setup to allow enabling VGA from quirks (Alex Williamson) - Remove fixed string limit for ROM MemoryRegion name (Neo Jia) - MAINTAINERS update (Thomas Huth) # gpg: Signature made Fri 11 Mar 2016 15:55:31 GMT using RSA key ID 3BB08B22 # gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" # gpg: aka "Alex Williamson <alex@shazbot.org>" # gpg: aka "Alex Williamson <alwillia@redhat.com>" # gpg: aka "Alex Williamson <alex.l.williamson@gmail.com>" * remotes/awilliam/tags/vfio-update-20160311.0: MAINTAINERS: Add entry for the include/hw/vfio/ folder vfio/pci: replace fixed string limit by g_strdup_printf vfio/pci: Split out VGA setup vfio/pci: Fixup PCI option ROMs vfio/pci: Convert all MemoryRegion to dynamic alloc and consistent functions vfio: Generalize region support vfio: Wrap VFIO_DEVICE_GET_REGION_INFO vfio: Add sysfsdev property for pci & platform Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-03-14Merge remote-tracking branch ↵Peter Maydell6-19/+26
'remotes/amit-migration/tags/migration-for-2.6-7' into staging migration: - postcopy is no longer experimental - fix a use-after-free in postcopy - fix a compile warning # gpg: Signature made Fri 11 Mar 2016 12:29:33 GMT using RSA key ID 854083B6 # gpg: Good signature from "Amit Shah <amit@amitshah.net>" # gpg: aka "Amit Shah <amit@kernel.org>" # gpg: aka "Amit Shah <amitshah@gmx.net>" * remotes/amit-migration/tags/migration-for-2.6-7: postcopy: Remove the x- postcopy: listen thread is never joined migration: fix use-after-free in loadvm_postcopy_handle_run_bh migration: fix warning for source_return_path_thread Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-03-14Merge remote-tracking branch ↵Peter Maydell24-244/+719
'remotes/berrange/tags/pull-io-win32-2016-03-11-1' into staging Merge I/O fixes for win32 # gpg: Signature made Fri 11 Mar 2016 10:03:20 GMT using RSA key ID 15104FDF # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" # gpg: aka "Daniel P. Berrange <berrange@redhat.com>" * remotes/berrange/tags/pull-io-win32-2016-03-11-1: osdep: remove use of socket_error() from all code osdep: add wrappers for socket functions char: remove qemu_chr_open_socket_fd method char: remove socket_try_connect method char: remove qemu_chr_finish_socket_connection method io: implement socket watch for win32 using WSAEventSelect+select io: remove checking of EWOULDBLOCK io: use qemu_accept to ensure SOCK_CLOEXEC is set io: introduce qio_channel_create_socket_watch io: pass HANDLE to g_source_add_poll on Win32 io: fix copy+paste mistake in socket error message io: assert errors before asserting content in I/O test io: set correct error object in background reader test thread io: wait for incoming client in socket test io: bind to socket before creating QIOChannelSocket io: initialize sockets in test program io: use bind() to check for IPv4/6 availability osdep: fix socket_error() to work with Mingw64 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-03-14Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20160311' into stagingPeter Maydell9-83/+289
CPU hotplug via cpu-add for s390x, cleanup of the s390x machine compat code and a bugfix in the s390-ccw bios. # gpg: Signature made Fri 11 Mar 2016 09:48:02 GMT using RSA key ID C6F02FAF # gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>" # gpg: aka "Cornelia Huck <cornelia.huck@de.ibm.com>" * remotes/cohuck/tags/s390x-20160311: s390x/cpu: use g_new0 s390x: Introduce S390MachineClass s390x: Introduce machine definition macros pc-bios/s390-ccw: fix old bug in ptr increment s390x/cpu: Allow hotplug of CPUs s390x/cpu: Add error handling to cpu creation s390x/cpu: Add CPU property links s390x/cpu: Tolerate max_cpus s390x/cpu: Get rid of side effects when creating a vcpu s390x/cpu: Set initial CPU state in common routine s390x/cpu: Cleanup init in preparation for hotplug Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-03-14trace: separate MMIO tracepoints from TB-access tracepointsHollis Blanchard2-0/+32
Memory accesses to code which has previously been translated into a TB show up in the MMIO path, so that they may invalidate the TB. It's extremely confusing to mix those in with device MMIOs, so split them into their own tracepoint. Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1456949575-1633-2-git-send-email-hollis_blanchard@mentor.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-03-14trace: include CPU index in trace_memory_region_*()Hollis Blanchard2-16/+24
Knowing which CPU performed an action is essential for understanding SMP guest behavior. However, cpu_physical_memory_rw() may be executed by a machine init function, before any VCPUs are running, when there is no CPU running ('current_cpu' is NULL). In this case, store -1 in the trace record as the CPU index. Trace analysis tools may need to be aware of this special case. Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com> Message-id: 1456949575-1633-1-git-send-email-hollis_blanchard@mentor.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-03-11postcopy: Remove the x-Dr. David Alan Gilbert5-11/+11
Postcopy seems to have survived a cycle with only a few fixes, and Jiri has the current libvirt wired up and working ( https://www.redhat.com/archives/libvir-list/2016-March/msg00080.html ) so remove the experimental tag. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1457690016-9070-3-git-send-email-dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-03-11postcopy: listen thread is never joinedDr. David Alan Gilbert1-1/+1
We don't join the listen thread, it does its own cleanup. Mark as detached not joinable. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reported-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1457690016-9070-2-git-send-email-dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-03-11migration: fix use-after-free in loadvm_postcopy_handle_run_bhDenis V. Lunev1-4/+12
MigrationState is destroyed before we can come into bottom half. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> CC: Juan Quintela <quintela@redhat.com> CC: Amit Shah <amit.shah@redhat.com> CC: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <1457537708-8622-1-git-send-email-den@openvz.org> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-03-11migration: fix warning for source_return_path_threadPeter Xu1-3/+2
max_len is not necessary, while it brings a warning during compilation when specify "-Wstack-usage=1000000". Replacing using sizeof(). Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <1457503932-31763-1-git-send-email-peterx@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-03-10MAINTAINERS: Add entry for the include/hw/vfio/ folderThomas Huth1-0/+1
The headers in include/hw/vfio/ should be listed in the VFIO section of the MAINTAINERS file. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2016-03-10vfio/pci: replace fixed string limit by g_strdup_printfNeo Jia1-2/+3
A trivial change to remove string limit by using g_strdup_printf Tested-by: Neo Jia <cjia@nvidia.com> Signed-off-by: Neo Jia <cjia@nvidia.com> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2016-03-10vfio/pci: Split out VGA setupAlex Williamson2-34/+50
This could be setup later by device specific code, such as IGD initialization. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2016-03-10vfio/pci: Fixup PCI option ROMsAlex Williamson1-0/+30
Devices like Intel graphics are known to not only have bad checksums, but also the wrong device ID. This is not so surprising given that the video BIOS is typically part of the system firmware image rather that embedded into the device and needs to support any IGD device installed into the system. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2016-03-10vfio/pci: Convert all MemoryRegion to dynamic alloc and consistent functionsAlex Williamson3-91/+71
Match common vfio code with setup, exit, and finalize functions for BAR, quirk, and VGA management. VGA is also changed to dynamic allocation to match the other MemoryRegions. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2016-03-10vfio: Generalize region supportAlex Williamson7-190/+283
Both platform and PCI vfio drivers create a "slow", I/O memory region with one or more mmap memory regions overlayed when supported by the device. Generalize this to a set of common helpers in the core that pulls the region info from vfio, fills the region data, configures slow mapping, and adds helpers for comleting the mmap, enable/disable, and teardown. This can be immediately used by the PCI MSI-X code, which needs to mmap around the MSI-X vector table. This also changes VFIORegion.mem to be dynamically allocated because otherwise we don't know how the caller has allocated VFIORegion and therefore don't know whether to unreference it to destroy the MemoryRegion or not. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2016-03-10osdep: remove use of socket_error() from all codeDaniel P. Berrange11-63/+46
Now that QEMU wraps the Win32 sockets methods to automatically set errno upon failure, there is no reason for callers to use the socket_error() method. They can rely on accessing errno even on Win32. Remove all use of socket_error() from general code, leaving it as a static method in oslib-win32.c only. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10osdep: add wrappers for socket functionsDaniel P. Berrange7-19/+291
The windows socket functions look identical to the normal POSIX sockets functions, but instead of setting errno, the caller needs to call WSAGetLastError(). QEMU has tried to deal with this incompatibility by defining a socket_error() method that callers must use that abstracts the difference between WSAGetLastError() and errno. This approach is somewhat error prone though - many callers of the sockets functions are just using errno directly because it is easy to forget the need use a QEMU specific wrapper. It is not always immediately obvious that a particular function will in fact call into Windows sockets functions, so the dev may not even realize they need to use socket_error(). This introduces an alternative approach to portability inspired by the way GNULIB fixes portability problems. We use a macro to redefine the original socket function names to refer to a QEMU wrapper function. The wrapper function calls the original Win32 sockets method and then sets errno from the WSAGetLastError() value. Thus all code can simply call the normal POSIX sockets APIs are have standard errno reporting on error, even on Windows. This makes the socket_error() method obsolete. We also bring closesocket & ioctlsocket into this approach. Even though they are non-standard Win32 names, we can't wrap the normal close/ioctl methods since there's no reliable way to distinguish between a file descriptor and HANDLE in Win32. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10char: remove qemu_chr_open_socket_fd methodDaniel P. Berrange1-35/+24
The qemu_chr_open_socket_fd method takes care of either doing a synchronous socket connect, or creating a listener socket. Part of the work when creating the listener socket is to register a watch for incoming clients. The caller of qemu_chr_open_socket_fd may not want this watch created, as it might be doing a synchronous wait for the first client. Rather than passing yet more parameters into qemu_chr_open_socket_fd to let it handle this, just remove the qemu_chr_open_socket_fd method an inline its functionality into the caller. This allows for a clearer control flow and shorter code. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10char: remove socket_try_connect methodDaniel P. Berrange1-15/+10
The qemu_chr_open_socket_fd() method multiplexes three different actions into one method. The socket_try_connect() method is one of its callers, but it only ever want one specific action performed. By inlining that action into socket_try_connect() we see that there is not in fact any failure scenario, so there is not even any reason for socket_try_connect to exist. Just inline the asynchronous connection attempts directly at the places that need them. This shortens & clarifies the code. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10char: remove qemu_chr_finish_socket_connection methodDaniel P. Berrange1-17/+7
The qemu_chr_finish_socket_connection method is multiplexing two different actions into one method. Each caller of it though, only wants one specific action. The code is shorter & clearer if we thus remove the method and just inline the specific actions where needed. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10io: implement socket watch for win32 using WSAEventSelect+selectPaolo Bonzini4-7/+170
On Win32 we cannot directly poll on socket handles. Instead we create a Win32 event object and associate the socket handle with the event. When the event signals readyness we then have to use select to determine which events are ready. Creating Win32 events is moderately heavyweight, so we don't want todo it every time we create a GSource, so this associates a single event with a QIOChannel. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10io: remove checking of EWOULDBLOCKDaniel P. Berrange3-12/+6
Since we now canonicalize WSAEWOULDBLOCK into EAGAIN there is no longer any need to explicitly check EWOULDBLOCK for Win32. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10io: use qemu_accept to ensure SOCK_CLOEXEC is setDaniel P. Berrange1-2/+2
The QIOChannelSocket code mistakenly uses the bare accept() function which does not set SOCK_CLOEXEC. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10io: introduce qio_channel_create_socket_watchPaolo Bonzini3-4/+37
Sockets are not in the same namespace as file descriptors on Windows. As an initial step, introduce separate APIs for file descriptor and socket watches. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-10io: pass HANDLE to g_source_add_poll on Win32Paolo Bonzini1-2/+11
Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-10io: fix copy+paste mistake in socket error messageDaniel P. Berrange1-1/+1
s/write/read/ in the error message reported after readmsg() fails Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10io: assert errors before asserting content in I/O testDaniel P. Berrange1-2/+2
When checking the results of an I/O operation test, assert that the error objects are NULL before asserting on the content. This is found to give more useful indication of the problem when diagnosing test failures. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10io: set correct error object in background reader test threadDaniel P. Berrange1-1/+1
The reader thread was accidentally setting the error pointer intended for the writer thread. If both threads set errors this would result in QEMU abort'ing due to the error already being set. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10io: wait for incoming client in socket testDaniel P. Berrange1-0/+2
Exercise the GSource code for server sockets by calling qio_channel_wait() prior to accepting the incoming client. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10io: bind to socket before creating QIOChannelSocketDaniel P. Berrange1-0/+10
In the QIOChannelSocket test we create a socket file descriptor and then try to create a QIOChannelSocket. This works on Linux, but fails on Win32 because it is not valid to call getsockname() on an unbound socket. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10io: initialize sockets in test programDaniel P. Berrange1-0/+1
The win32 sockets layer requires that socket_init() is called otherwise nothing will work. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10io: use bind() to check for IPv4/6 availabilityDaniel P. Berrange1-48/+31
Currently the test-io-channel-socket.c test uses getifaddrs to see if an IPv4/6 address is present on any host NIC, as a way to determine if IPv4/6 sockets can be used. This is problematic because getifaddrs is not available on Win32. Rather than testing indirectly via getifaddrs, just create a socket and try to bind() to the loopback address instead. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10osdep: fix socket_error() to work with Mingw64Daniel P. Berrange4-30/+81
Historically QEMU has had a socket_error() macro that was defined to map to WSASocketError(). The os-win32.h header file would define errno constants that mapped to the WSA error constants. This worked fine with Mingw32 since its header files never defined any errno values, nor did it even provide an errno.h. So callers of socket_error() could match on traditional Exxxx constants and it would all "just work". With Mingw64 though, things work rather differently. First there is an errno.h file which defines all the traditional errno constants you'd expect from a UNIX platform. There is then a winerror.h which defined the WSA error constants. Crucially the WSAExxxx errno values in winerror.h do not match the Exxxx errno values in error.h. If QEMU had only imported winerror.h it would still work, but the qemu/osdep.h file unconditionally imports errno.h. So callers of socket_error() will get now WSAExxxx values back and compare them to the Exxx constants. This will always fail silently at runtime. To solve this QEMU needs to stop assuming the WSAExxxx constant values match the Exxx constant values. Thus the socket_error() macro is turned into a small function that re-maps WSAExxxx values into Exxx. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10vfio: Wrap VFIO_DEVICE_GET_REGION_INFOAlex Williamson4-46/+73
In preparation for supporting capability chains on regions, wrap ioctl(VFIO_DEVICE_GET_REGION_INFO) so we don't duplicate the code for each caller. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2016-03-10vfio: Add sysfsdev property for pci & platformAlex Williamson3-100/+86
vfio-pci currently requires a host= parameter, which comes in the form of a PCI address in [domain:]<bus:slot.function> notation. We expect to find a matching entry in sysfs for that under /sys/bus/pci/devices/. vfio-platform takes a similar approach, but defines the host= parameter to be a string, which can be matched directly under /sys/bus/platform/devices/. On the PCI side, we have some interest in using vfio to expose vGPU devices. These are not actual discrete PCI devices, so they don't have a compatible host PCI bus address or a device link where QEMU wants to look for it. There's also really no requirement that vfio can only be used to expose physical devices, a new vfio bus and iommu driver could expose a completely emulated device. To fit within the vfio framework, it would need a kernel struct device and associated IOMMU group, but those are easy constraints to manage. To support such devices, which would include vGPUs, that honor the VFIO PCI programming API, but are not necessarily backed by a unique PCI address, add support for specifying any device in sysfs. The vfio API already has support for probing the device type to ensure compatibility with either vfio-pci or vfio-platform. With this, a vfio-pci device could either be specified as: -device vfio-pci,host=02:00.0 or -device vfio-pci,sysfsdev=/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0 or even -device vfio-pci,sysfsdev=/sys/bus/pci/devices/0000:02:00.0 When vGPU support comes along, this might look something more like: -device vfio-pci,sysfsdev=/sys/devices/virtual/intel-vgpu/vgpu0@0000:00:02.0 NB - This is only a made up example path The same change is made for vfio-platform, specifying sysfsdev has precedence over the old host option. Tested-by: Eric Auger <eric.auger@linaro.org> Reviewed-by: Eric Auger <eric.auger@linaro.org> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2016-03-10s390x/cpu: use g_new0Cornelia Huck1-1/+1
Let's use g_new0 to allocate cpu_states. Suggested-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-03-10s390x: Introduce S390MachineClassJanosch Frank2-14/+41
As we now have the new machine definitions, that let us disable/enable machine options more easily, we need a way to save them and make them publicly available. The new s390-virtio-ccw.h header exports the s390 ccw machine state and class, so they can be easily used in other C files. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-03-10s390x: Introduce machine definition macrosJanosch Frank1-42/+47
Most of the machine definition code looks the same between different machine versions. The new DEFINE_CCW_MACHINE macro makes defining a new machine easier by inserting standard machine version definitions. This also makes it possible to propagate values between machine versions. The patch is inspired by code from hw/ppc/spapr.c Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-03-10pc-bios/s390-ccw: fix old bug in ptr incrementEugene (jno) Dvurechenski1-1/+1
We need to increment by the size of the structure, whereas 'ns' is 'uint8_t *'. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-03-10s390x/cpu: Allow hotplug of CPUsMatthew Rosato2-0/+17
Implement cpu hotplug routine and add the machine hook. Signed-off-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Message-Id: <1457112875-5209-8-git-send-email-mjrosato@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-03-10s390x/cpu: Add error handling to cpu creationMatthew Rosato5-7/+112
Check for and propogate errors during s390 cpu creation. Signed-off-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com> Message-Id: <1457112875-5209-7-git-send-email-mjrosato@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>