summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* get_maintainer.pl: \C is deprecatedPaolo Bonzini2015-09-251-11/+11
| | | | | | | | | | "Match a single C-language char (octet) even if that is part of a larger UTF-8 character. Thus it breaks up characters into their UTF-8 bytes, so you may end up with malformed pieces of UTF-8." Just use a period instead. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* vhost-scsi: include linux/vhost.hMarc-André Lureau2015-09-252-25/+1
| | | | | | | | Replace ad-hoc declarations with the linux header. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1442585920-28373-1-git-send-email-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Makefile: fix build when VPATH is outside GIT treeDaniel P. Berrange2015-09-251-2/+1
| | | | | | | | | | | | | | | | | | | | | | | Steve Ellcey / Leon Alrae reported that QEMU fails to build when the VPATH directory is outside of the GIT tree, and the system emulators & tools build is disabled. eg cd .. mkdir build cd build ../qemu/configure --disable-system --disable-tools make (...) make[1]: *** No rule to make target `../qom/object.o', needed by `qemu-aarch64'. Stop. make: *** [subdir-aarch64-linux-user] Error 2 The problem is due to the fact that some sub directory deps were listed against SOFTMMU_SUBDIR_RULES instead of SUBDIR_RULES, so were only processed for system emulators, not user emalutors. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442570495-22029-1-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* scsi-generic: let guests recognize readonly=on on passthrough devicesPaolo Bonzini2015-09-251-0/+14
| | | | | | | | | | | | | | | | | Passed-through SCSI devices can be opened with the readonly=on option. When this happens, Linux filters away write commands so that the guest cannot overwrite the contents of the device. However, the guest does not know that the device is read-only, and accepts writes. The writes only fail later when the page cache is flushed. This patch modifies scsi-generic to modify the MODE SENSE data and set the read-only bit in the device-specific parameters, so that the guest OS treats the disk as write protected. Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* checkpatch: do not recommend qemu_strtok over strtokPaolo Bonzini2015-09-251-2/+2
| | | | | | If anything it should recommend strtok_r! Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* tests: add some qemu_strtosz() testsMarc-André Lureau2015-09-251-0/+91
| | | | | | | | While reading the function I decided to write some tests. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1442419377-9309-2-git-send-email-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* utils: rename strtosz to use qemu prefixMarc-André Lureau2015-09-257-33/+36
| | | | | | | | | | | Not only it makes sense, but it gets rid of checkpatch warning: WARNING: consider using qemu_strtosz in preference to strtosz Also remove get rid of tabs to please checkpatch. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1442419377-9309-1-git-send-email-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qemu-nbd: convert to use the QAPI SocketAddress objectDaniel P. Berrange2015-09-251-64/+38
| | | | | | | | | | The qemu-nbd program currently uses a QemuOpts objects when setting up sockets. Switch it over to use the QAPI SocketAddress objects instead. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442411543-28513-3-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* nbd: convert to use the QAPI SocketAddress objectDaniel P. Berrange2015-09-251-34/+37
| | | | | | | | | | The nbd block driver currently uses a QemuOpts object when setting up sockets. Switch it over to use the QAPI SocketAddress object instead. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442411543-28513-2-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Merge remote-tracking branch 'remotes/weil/tags/pull-wxx-20150924' into stagingPeter Maydell2015-09-2412-10/+222
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wxx patch queue # gpg: Signature made Thu 24 Sep 2015 20:24:50 BST using RSA key ID 677450AD # gpg: Good signature from "Stefan Weil <sw@weilnetz.de>" # gpg: aka "Stefan Weil <stefan.weil@weilnetz.de>" # gpg: aka "Stefan Weil <stefan.weil@bib.uni-mannheim.de>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 4923 6FEA 75C9 5D69 8EC2 B78A E08C 21D5 6774 50AD * remotes/weil/tags/pull-wxx-20150924: oslib-win32: only provide localtime_r/gmtime_r if missing gtk: avoid redefining _WIN32_WINNT macro qemu-thread: add a fast path to the Win32 QemuEvent slirp: Fix non blocking connect for w32 nsis: Add QEMU version information to Windows registry Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * oslib-win32: only provide localtime_r/gmtime_r if missingDaniel P. Berrange2015-09-244-1/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The oslib-win32 file currently provides a localtime_r and gmtime_r replacement unconditionally. Some versions of Mingw-w64 would provide crude macros for localtime_r/gmtime_r which QEMU takes care to disable. Latest versions of Mingw-w64 now provide actual functions for localtime_r/gmtime_r, but with a twist that you have to include unistd.h or pthread.h before including time.h. By luck some files in QEMU have such an include order, resulting in compile errors: CC util/osdep.o In file included from include/qemu-common.h:48:0, from util/osdep.c:48: include/sysemu/os-win32.h:77:12: error: redundant redeclaration of 'gmtime_r' [-Werror=redundant-decls] struct tm *gmtime_r(const time_t *timep, struct tm *result); ^ In file included from include/qemu-common.h:35:0, from util/osdep.c:48: /usr/i686-w64-mingw32/sys-root/mingw/include/time.h:272:107: note: previous definition of 'gmtime_r' was here In file included from include/qemu-common.h:48:0, from util/osdep.c:48: include/sysemu/os-win32.h:79:12: error: redundant redeclaration of 'localtime_r' [-Werror=redundant-decls] struct tm *localtime_r(const time_t *timep, struct tm *result); ^ In file included from include/qemu-common.h:35:0, from util/osdep.c:48: /usr/i686-w64-mingw32/sys-root/mingw/include/time.h:269:107: note: previous definition of 'localtime_r' was here This change adds a configure test to see if localtime_r exits, and only enables the QEMU impl if missing. We also re-arrange qemu-common.h try attempt to guarantee that all source files get unistd.h before time.h and thus see the localtime_r/gmtime_r defs. [sw: Use "official" spellings for Mingw-w64, MinGW in comments.] [sw: Terminate sentences with a dot in comments.] Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Stefan Weil <sw@weilnetz.de>
| * gtk: avoid redefining _WIN32_WINNT macroDaniel P. Berrange2015-09-242-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building for Mingw64 target on Fedora 22 a warning is issued about _WIN32_WINNT being redefined. In file included from ui/gtk.c:40:0: include/ui/gtk.h:5:0: warning: "_WIN32_WINNT" redefined # define _WIN32_WINNT 0x0601 /* needed to get definition of MAPVK_VK_TO_VSC */ ^ In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/crtdefs.h:10:0, from /usr/i686-w64-mingw32/sys-root/mingw/include/stdio.h:9, from /home/berrange/src/virt/qemu/include/qemu/fprintf-fn.h:12, from /home/berrange/src/virt/qemu/include/qemu-common.h:18, from ui/gtk.c:37: /usr/i686-w64-mingw32/sys-root/mingw/include/_mingw.h:225:0: note: this is the location of the previous definition #define _WIN32_WINNT 0x502 ^ Rather than try to get MAPVK_VK_TO_VSC defined indirectly by defining _WIN32_WINNT, instead just define it explicitly if missing. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
| * qemu-thread: add a fast path to the Win32 QemuEventPaolo Bonzini2015-09-243-4/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QemuEvents are used heavily by call_rcu. We do not want them to be slow, but the current implementation does a kernel call on every invocation of qemu_event_* and won't cut it. So, wrap a Win32 manual-reset event with a fast userspace path. The states and transitions are the same as for the futex and mutex/condvar implementations, but the slow path is different of course. The idea is to reset the Win32 event lazily, as part of a test-reset-test-wait sequence. Such a sequence is, indeed, how QemuEvents are used by RCU and other subsystems! The patch includes a formal model of the algorithm. Tested-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de>
| * slirp: Fix non blocking connect for w32Stefan Weil2015-09-241-1/+7
| | | | | | | | Signed-off-by: Stefan Weil <sw@weilnetz.de>
| * nsis: Add QEMU version information to Windows registryStefan Weil2015-09-242-0/+4
|/ | | | | | | | The uninstall keys include an option key "DisplayVersion" which we set now. By default the version value is read from file VERSION, but it is also possible to pass VERSION=#.#.# to make. Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Merge remote-tracking branch 'remotes/elmarco/tags/rm-libcacard' into stagingPeter Maydell2015-09-2433-5849/+21
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove libcacard # gpg: Signature made Wed 23 Sep 2015 22:37:11 BST using RSA key ID 75969CE5 # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" # gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * remotes/elmarco/tags/rm-libcacard: libcacard: use the standalone project Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * libcacard: use the standalone projectMarc-André Lureau2015-09-2333-5849/+21
| | | | | | | | | | | | | | | | | | | | | | | | libcacard is now a standalone project hosted with the Spice project (see the 2.5.0 release announcement), remove it from qemu tree. Use the library if found during configure or if --enable-smartcard. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Paolo Bonzini <pbonzini@redhat.com>
* | Merge remote-tracking branch ↵Peter Maydell2015-09-2417-122/+686
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'remotes/pmaydell/tags/pull-target-arm-20150924' into staging target-arm queue: * support VGICv3 in KVM * fix bug in ACPI table entries for flash devices in virt board * update Allwinner entry in MAINTAINERS # gpg: Signature made Thu 24 Sep 2015 01:29:55 BST 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-20150924: MAINTAINERS: update Allwinner A10 maintainer hw/arm/virt-acpi-build: Fix wrong size of flash in ACPI table hw/arm/virt: Add gic-version option to virt machine hw/intc: Initial implementation of vGICv3 arm_kvm: Do not assume particular GIC type in kvm_arch_irqchip_create() intc/gic: Extract some reusable vGIC code hw/intc: Implement GIC-500 base class Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | MAINTAINERS: update Allwinner A10 maintainerBeniamino Galvani2015-09-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the maintainer for Allwinner A10 to myself as Li Guang's mail address bounces. While at it, extend the file pattern for the entry to include allwinner_emac.[ch]. Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Message-id: 1442865156-5598-1-git-send-email-b.galvani@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | hw/arm/virt-acpi-build: Fix wrong size of flash in ACPI tableShannon Zhao2015-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While virt machine creates two flash devices with total size 0x08000000, the ACPI table generation code was wrongly using this total size as the size of each flash device, so it would overlap other MMIO spaces. Make each device entry in the table half the total; this brings the ACPI table into line with the code which generates the device tree and which creates the flash devices themselves. Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Reviewed-by: Andrew Jones <drjones@redhat.com> Reviewed-by: Wei Huang <wei@redhat.com> Tested-by: Graeme Gregory <graeme.gregory@linaro.org> Message-id: 1442455041-6596-1-git-send-email-shannon.zhao@linaro.org [PMM: edited commit message] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | hw/arm/virt: Add gic-version option to virt machinePavel Fedin2015-09-245-46/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add gic_version to VirtMachineState, set it to value of the option and pass it around where necessary. Instantiate devices and fdt nodes according to the choice. max_cpus for virt machine increased to 123 (calculated from redistributor space available in the memory map). GICv2 compatibility check happens inside arm_gic_common_realize(). ITS region is added to the memory map too, however currently it not used, just reserved. Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Tested-by: Ashok kumar <ashoks@broadcom.com> [PMM: Added missing cpu_to_le* calls, thanks to Shannon Zhao] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | hw/intc: Initial implementation of vGICv3Pavel Fedin2015-09-244-0/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the initial version of KVM-accelerated GICv3 support. State load and save are not yet supported, live migration is not possible. In order to get correct class name in a simpler way, gicv3_class_name() function is implemented, similar to gic_class_name(). Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Ashok kumar <ashoks@broadcom.com> Message-id: 69d8f01d14994d7a1a140e96aef59fd332d02293.1441784344.git.p.fedin@samsung.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | arm_kvm: Do not assume particular GIC type in kvm_arch_irqchip_create()Pavel Fedin2015-09-242-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to use different GIC types from v2. There are no kernels which could advertise KVM_CAP_DEVICE_CTRL without the actual ability to create GIC with it. GIC version probe code moved to kvm_arm_vgic_probe() which will be used later. Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Reviewed-by: Eric Auger <eric.auger@linaro.org> Tested-by: Ashok kumar <ashoks@broadcom.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 015f4d9e4a8a50dfbdd734c4730558e24a69c6dc.1441784344.git.p.fedin@samsung.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | intc/gic: Extract some reusable vGIC codePavel Fedin2015-09-244-65/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some functions previously used only by vGICv2 are useful also for vGICv3 implementation. Untie them from GICState and make accessible from within other modules: - kvm_arm_gic_set_irq() - kvm_gic_supports_attr() - moved to common code and renamed to kvm_device_check_attr() - kvm_gic_access() - turned into GIC-independent kvm_device_access(). Data pointer changed to void * because some GICv3 registers are 64-bit wide Some of these changes are not used right now, but they will be helpful for implementing live migration. Actually kvm_dist_get() and kvm_dist_put() could also be made reusable, but they would require two extra parameters (s->dev_fd and s->num_cpu) as well as lots of typecasts of 's' to DeviceState * and back to GICState *. This makes the code very ugly so i decided to stop at this point. I tried also an approach with making a base class for all possible GICs, but it would contain only three variables (dev_fd, cpu_num and irq_num), and accessing them through the rest of the code would be again tedious (either ugly casts or qemu-style separate object pointer). So i disliked it too. Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Tested-by: Ashok kumar <ashoks@broadcom.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 2ef56d1dd64ffb75ed02a10dcdaf605e5b8ff4f8.1441784344.git.p.fedin@samsung.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | hw/intc: Implement GIC-500 base classShlomo Pongratz2015-09-243-0/+209
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class is to be used by both software and KVM implementations of GICv3 Currently it is mostly a placeholder, but in future it is supposed to hold qemu's representation of GICv3 state, which is necessary for migration. The interface of this class is fully compatible with GICv2 one. This is done in order to simplify integration with existing code. Signed-off-by: Shlomo Pongratz <shlomo.pongratz@huawei.com> Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Reviewed-by: Eric Auger <eric.auger@linaro.org> Tested-by: Ashok kumar <ashoks@broadcom.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: aff8baaee493cdcab0694b4a1d4dd5ff27c37ed2.1441784344.git.p.fedin@samsung.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* | Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20150923.0' ↵Peter Maydell2015-09-238-1329/+1558
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into staging VFIO updates 2015-09-23 - Tracing improvements to use common prefixes for functional areas - Quirks overhaul: - Split PCI quirks to separate file - Make them understandable and more extensible - Improve use of MemoryRegions and eliminate use of target pagesize - Eliminate build-time debugging, everything migrated to runtime opts # gpg: Signature made Wed 23 Sep 2015 21:09:05 BST 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-20150923.0: vfio/pci: Add emulated PCI IDs vfio/pci: Cache vendor and device ID vfio/pci: Move AMD device specific reset to quirks vfio/pci: Remove old config window and mirror quirks vfio/pci: Config mirror quirk vfio/pci: Config window quirks vfio/pci: Rework RTL8168 quirk vfio/pci: Cleanup Nvidia 0x3d0 quirk vfio/pci: Cleanup ATI 0x3c3 quirk vfio/pci: Foundation for new quirk structure vfio/pci: Cleanup ROM blacklist quirk vfio/pci: Split quirks to a separate file vfio/pci: Extract PCI structures to a separate header vfio: Change polarity of our no-mmap option vfio/pci: Make interrupt bypass runtime configurable vfio/pci: Rename MSI/X functions for easier tracing vfio/pci: Rename INTx functions for easier tracing vfio/pci: Cleanup vfio_early_setup_msix() error path vfio/pci: Cleanup RTL8168 quirk and tracing Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * vfio/pci: Add emulated PCI IDsAlex Williamson2015-09-234-6/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifying an emulated PCI vendor/device ID can be useful for testing various quirk paths, even though the behavior and functionality of the device with bogus IDs is fully unsupportable. We need to use a uint32_t for the vendor/device IDs, even though the registers themselves are only 16-bit in order to be able to determine whether the value is valid and user set. The same support is added for subsystem vendor/device ID, though these have the possibility of being useful and supported for more than a testing tool. An emulated platform might want to impose their own subsystem IDs or at least hide the physical subsystem ID. Windows guests will often reinstall drivers due to a change in subsystem IDs, something that VM users may want to avoid. Of course careful attention would be required to ensure that guest drivers do not rely on the subsystem ID as a basis for device driver quirks. All of these options are added using the standard experimental option prefix and should not be considered stable. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Cache vendor and device IDAlex Williamson2015-09-233-19/+11
| | | | | | | | | | | | | | Simplify access to commonly referenced PCI vendor and device ID by caching it on the VFIOPCIDevice struct. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Move AMD device specific reset to quirksAlex Williamson2015-09-234-157/+177
| | | | | | | | | | | | | | This is just another quirk, for reset rather than affecting memory regions. Move it to our new quirks file. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Remove old config window and mirror quirksAlex Williamson2015-09-233-186/+0
| | | | | | | | | | | | These are now unused. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Config mirror quirkAlex Williamson2015-09-232-110/+129
| | | | | | | | | | | | Re-implement our mirror quirk using the new infrastructure. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Config window quirksAlex Williamson2015-09-232-90/+276
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Config windows make use of an address register and a data register. In VGA cards, these are often used to provide real mode code in the BIOS an easy way to access MMIO registers since the window often resides in an I/O port register. When the MMIO register has a mirror of PCI config space, we need to trap those accesses and redirect them to emulated config space. The previous version of this functionality made use of a single MemoryRegion and single match address. This version uses separate MemoryRegions for each of the address and data registers and allows for multiple match addresses. This is useful for Nvidia cards which have two ranges which index into PCI config space. The previous implementation is left for the follow-on patch for a more reviewable diff. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Rework RTL8168 quirkAlex Williamson2015-09-232-80/+105
| | | | | | | | | | | | | | | | | | Another rework of this quirk, this time to update to the new quirk structure. We can handle the address and data registers with separate MemoryRegions and a quirk specific data structure, making the code much more understandable. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Cleanup Nvidia 0x3d0 quirkAlex Williamson2015-09-232-68/+111
| | | | | | | | | | | | | | | | The Nvidia 0x3d0 quirk makes use of a two separate registers and gives us our first chance to make use of separate memory regions for each to simplify the code a bit. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Cleanup ATI 0x3c3 quirkAlex Williamson2015-09-232-19/+11
| | | | | | | | | | | | | | | | This is an easy quirk that really doesn't need a data structure if its own. We can pass vdev as the opaque data and access to the MemoryRegion isn't required. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Foundation for new quirk structureAlex Williamson2015-09-232-104/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VFIOQuirk hosts a single memory region and a fixed set of data fields that try to handle all the quirk cases, but end up making those that don't exactly match really confusing. This patch introduces a struct intended to provide more flexibility and simpler code. VFIOQuirk is stripped to its basics, an opaque data pointer for quirk specific data and a pointer to an array of MemoryRegions with a counter. This still allows us to have common teardown routines, but adds much greater flexibility to support multiple memory regions and quirk specific data structures that are easier to maintain. The existing VFIOQuirk is transformed into VFIOLegacyQuirk, which further patches will eliminate entirely. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Cleanup ROM blacklist quirkAlex Williamson2015-09-233-20/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | Create a vendor:device ID helper that we'll also use as we rework the rest of the quirks. Re-reading the config entries, even if we get more blacklist entries, is trivial overhead and only incurred during device setup. There's no need to typedef the blacklist structure, it's a static private data type used once. The elements get bumped up to uint32_t to avoid future maintenance issues if PCI_ANY_ID gets used for a blacklist entry (avoiding an actual hardware match). Our test loop is also crying out to be simplified as a for loop. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Split quirks to a separate fileAlex Williamson2015-09-234-882/+908
| | | | | | | | Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Extract PCI structures to a separate headerAlex Williamson2015-09-232-143/+159
| | | | | | | | Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio: Change polarity of our no-mmap optionAlex Williamson2015-09-234-4/+4
| | | | | | | | | | | | | | | | | | The default should be to allow mmap and new drivers shouldn't need to expose an option or set it to other than the allocation default in their initfn. Take advantage of the experimental flag to change this option to the correct polarity. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Make interrupt bypass runtime configurableAlex Williamson2015-09-232-12/+12
| | | | | | | | | | | | | | Tracing is more effective when we can completely disable all KVM bypass paths. Make these runtime rather than build-time configurable. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Rename MSI/X functions for easier tracingAlex Williamson2015-09-232-45/+40
| | | | | | | | | | | | | | | | | | This allows vfio_msi* tracing. The MSI/X interrupt tracing is also pulled out of #ifdef DEBUG_VFIO to avoid a recompile for tracing this path. A few cycles to read the message is hardly anything if we're already in QEMU. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Rename INTx functions for easier tracingAlex Williamson2015-09-232-31/+31
| | | | | | | | | | | | | | Rename functions and tracing callbacks so that we can trace vfio_intx* to see all the INTx related activities. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
| * vfio/pci: Cleanup vfio_early_setup_msix() error pathAlex Williamson2015-09-231-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | With the addition of the Chelsio quirk we have an error path out of vfio_early_setup_msix() that doesn't free the allocated VFIOMSIXInfo struct. This doesn't introduce a leak as it still gets freed in the vfio_put_device() path, but it's complicated and sloppy to rely on that. Restructure to free the allocated data on error and only link it into the vdev on success. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Reported-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
| * vfio/pci: Cleanup RTL8168 quirk and tracingAlex Williamson2015-09-232-57/+41
|/ | | | | | | | | | | | | | | | | | | | | | | | There's quite a bit of cleanup that can be done to the RTL8168 quirk, as well as the tracing to prevent a spew of uninteresting accesses for anything else the driver might choose to use the window registers for besides the MSI-X table. There should be no functional change, but it's now possible to get compact and useful traces by enabling vfio_rtl8168_quirk*, ex: vfio_rtl8168_quirk_write 0000:04:00.0 [address]: 0x1f000 vfio_rtl8168_quirk_read 0000:04:00.0 [address]: 0x8001f000 vfio_rtl8168_quirk_read 0000:04:00.0 [data]: 0xfee0100c vfio_rtl8168_quirk_write 0000:04:00.0 [address]: 0x1f004 vfio_rtl8168_quirk_read 0000:04:00.0 [address]: 0x8001f004 vfio_rtl8168_quirk_read 0000:04:00.0 [data]: 0x0 vfio_rtl8168_quirk_write 0000:04:00.0 [address]: 0x1f008 vfio_rtl8168_quirk_read 0000:04:00.0 [address]: 0x8001f008 vfio_rtl8168_quirk_read 0000:04:00.0 [data]: 0x49b1 vfio_rtl8168_quirk_write 0000:04:00.0 [address]: 0x1f00c vfio_rtl8168_quirk_read 0000:04:00.0 [address]: 0x8001f00c vfio_rtl8168_quirk_read 0000:04:00.0 [data]: 0x0 Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
* Merge remote-tracking branch 'remotes/dgibson/tags/spapr-next-20150923' into ↵Peter Maydell2015-09-2318-156/+954
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | staging sPAPR Patch Queue: 2015-09-23 Highlights: * pseries-2.5 machine type * Memory hotplug for "pseries" guests * Fixes to the PAPR Dynamic Reconfiguration hotplug code * Several PAPR compliance fixes * New SLOF with: * GPT support * Much faster VGA handling # gpg: Signature made Wed 23 Sep 2015 02:50:10 BST using DSA key ID FDDA6FC6 # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: F730 2185 38B4 D13E FD80 34F2 6882 CAC6 FDDA 6FC6 * remotes/dgibson/tags/spapr-next-20150923: (36 commits) sPAPR: Enable EEH on VFIO PCI device only sPAPR: Revert don't enable EEH on emulated PCI devices ppc/spapr: Implement H_RANDOM hypercall in QEMU ppc/spapr: Fix buffer overflow in spapr_populate_drconf_memory() spapr: Fix default NUMA node allocation for threads spapr: Move memory hotplug to RTAS_LOG_V6_HP_ID_DRC_COUNT type spapr: Support hotplug by specifying DRC count spapr: Revert to memory@XXXX representation for non-hotplugged memory spapr: Populate ibm,associativity-lookup-arrays correctly for non-NUMA spapr: Provide better error message when slots exceed max allowed spapr: Don't allow memory hotplug to memory less nodes spapr: Memory hotplug support spapr: Make hash table size a factor of maxram_size spapr: Support ibm,dynamic-reconfiguration-memory spapr: Add LMB DR connectors spapr: Use QEMU limit for maximum CPUs number spapr: Don't use QOM [*] syntax for DR connectors. spapr_drc: use RTAS return codes for methods called by RTAS spapr: Initialize hotplug memory address space spapr_drc: don't allow 'empty' DRCs to be unisolated or allocated ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * sPAPR: Enable EEH on VFIO PCI device onlyGavin Shan2015-09-231-1/+1
| | | | | | | | | | | | | | | | | | This checks if the PCI device retrieved from the PCI device address is VFIO PCI device when enabling EEH functionality. If it's not VFIO PCI device, the EEH functonality isn't enabled. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
| * sPAPR: Revert don't enable EEH on emulated PCI devicesGavin Shan2015-09-231-7/+0
| | | | | | | | | | | | | | | | | | | | This reverts commit 7cb18007 ("sPAPR: Don't enable EEH on emulated PCI devices") as rtas_ibm_set_eeh_option() isn't the right place to check if there has the corresponding PCI device for the input address, which can be PE address, not PCI device address. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
| * ppc/spapr: Implement H_RANDOM hypercall in QEMUThomas Huth2015-09-236-1/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PAPR interface defines a hypercall to pass high-quality hardware generated random numbers to guests. Recent kernels can already provide this hypercall to the guest if the right hardware random number generator is available. But in case the user wants to use another source like EGD, or QEMU is running with an older kernel, we should also have this call in QEMU, so that guests that do not support virtio-rng yet can get good random numbers, too. This patch now adds a new pseudo-device to QEMU that either directly provides this hypercall to the guest or is able to enable the in-kernel hypercall if available. The in-kernel hypercall can be enabled with the use-kvm property, e.g.: qemu-system-ppc64 -device spapr-rng,use-kvm=true For handling the hypercall in QEMU instead, a "RngBackend" is required since the hypercall should provide "good" random data instead of pseudo-random (like from a "simple" library function like rand() or g_random_int()). Since there are multiple RngBackends available, the user must select an appropriate back-end via the "rng" property of the device, e.g.: qemu-system-ppc64 -object rng-random,filename=/dev/hwrng,id=gid0 \ -device spapr-rng,rng=gid0 ... See http://wiki.qemu-project.org/Features-Done/VirtIORNG for other example of specifying RngBackends. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
| * ppc/spapr: Fix buffer overflow in spapr_populate_drconf_memory()Thomas Huth2015-09-231-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The buffer that is allocated in spapr_populate_drconf_memory() is used for setting both, the "ibm,dynamic-memory" and the "ibm,associativity-lookup-arrays" property. However, only the size of the first one is taken into account when allocating the memory. So if the length of the second property is larger than the length of the first one, we run into a buffer overflow here! Fix it by taking the length of the second property into account, too. Fixes: "spapr: Support ibm,dynamic-reconfiguration-memory" patch Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
OpenPOWER on IntegriCloud