aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-12-17build: rename CONFIG_LIBCAP to CONFIG_LIBCAP_NGPaolo Bonzini
Since we are actually testing for the newer capng library, rename the symbol to match. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17colo: fix return without releasing RCUPaolo Bonzini
Use WITH_RCU_READ_LOCK_GUARD to avoid exiting colo_init_ram_cache without releasing RCU. Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17memory: use RCU_READ_LOCK_GUARDPaolo Bonzini
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17qsp: Use WITH_RCU_READ_LOCK_GUARDDr. David Alan Gilbert
The automatic rcu read lock maintenance works quite nicely in this case where it previously relied on a comment to delimit the lifetime and now has a block. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17hyperv: Use auto rcu_read macrosDr. David Alan Gilbert
Use RCU_READ_LOCK_GUARD and WITH_RCU_READ_LOCK_GUARD to replace the manual rcu_read_(un)lock calls. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17hw/i386/pc: Extract the port92 devicePhilippe Mathieu-Daudé
This device is only used by the PC machines. The pc.c file is already big enough, with 2255 lines. By removing 113 lines of it, we reduced it by 5%. It is now a bit easier to navigate the file. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17hw/i386/pc: Inline port92_init()Philippe Mathieu-Daudé
This one-line function is not very helpful, so remove it by inlining the call to qdev_connect_gpio_out_named(). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17hw/i386/pc: Use TYPE_PORT92 instead of hardcoded stringPhilippe Mathieu-Daudé
By using the TYPE_* definitions for devices, we can: - quickly find where devices are used with 'git-grep' - easily rename a device (one-line change). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17hw/isa/isa-bus: cleanup irq functionsPaolo Bonzini
The irq number is unsigned; we reject negative values. But -1 is used for the isairq array, which is declared unsigned! And since we have a definition for the number of ISA IRQs, use it. Based on a patch by Philippe Mathieu-Daudé. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17hw/i386: Simplify ioapic_init_gsi()Philippe Mathieu-Daudé
All callers of ioapic_init_gsi() provide a parent. We want new uses to follow the same good practice and provide the parent name, so do not make this optional: assert the parent name is provided, and simplify the code. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17hw/i386: De-duplicate gsi_handler() to remove kvm_pc_gsi_handler()Philippe Mathieu-Daudé
Both gsi_handler() and kvm_pc_gsi_handler() have the same content, except one comment. Move the comment, and de-duplicate the code. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17pc: stubify x86 iommuPaolo Bonzini
Allow building microvm without x86-iommu.c. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17acpi: move PC stubs out of stubs/Paolo Bonzini
This is a small cleanup that lets microvm build entirely without include/hw/i386/pc.h. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17x86: move more x86-generic functions out of PC filesPaolo Bonzini
These are needed by microvm too, so move them outside of PC-specific files. With this patch, microvm.c need not include pc.h anymore. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17hw/i386/pc: Convert DPRINTF() to trace eventsPhilippe Mathieu-Daudé
Convert the deprecated DPRINTF() macro to trace events. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17x86: move SMM property to X86MachineStatePaolo Bonzini
Add it to microvm as well, it is a generic property of the x86 architecture. Suggested-by: Sergio Lopez <slp@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17pci-stub: add more MSI functionsPaolo Bonzini
On x86, KVM needs some function from the PCI subsystem in order to set up interrupt routes. Provide some stubs to support x86 machines that lack PCI. Reviewed-by: Sergio Lopez <slp@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17hw: replace hw/i386/pc.h with a header just for the i8259Paolo Bonzini
Remove the need to include i386/pc.h to get to the i8259 functions. This is enough to remove the inclusion of hw/i386/pc.h from all non-x86 files. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17fw_cfg: allow building without other devicesPaolo Bonzini
The microvm machine type uses fw_cfg but lacks SMBIOS and ACPI. Do not include the files if the symbol is not present in QEMU and remove dependencies on machine-specific files. Reviewed-by: Sergio Lopez <slp@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17i386: conditionally compile more filesPaolo Bonzini
Reviewed-by: Sergio Lopez <slp@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17configure: simplify vhost condition with KconfigMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17configure: set $PYTHON to a full pathPaolo Bonzini
This will make it possible to replace it in a shebang line. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17stubs: replace stubs with lnot if applicablePaolo Bonzini
The stubs mechanism relies on static libraries and compilation order, which is a bit brittle and should be avoided unless necessary. Replace it with Boolean operations on CONFIG_* symbols. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17crypto: move common bits for all emulators to libqemuutilPaolo Bonzini
qcrypto_random_*, AES and qcrypto_init do not need to be linked as a whole and are the only parts that are used by user-mode emulation. Place them in libqemuutil, so that whatever needs them will pick them up automatically. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17libvixl: remove per-target compiler flagsPaolo Bonzini
We are already including -D__STDC_LIMIT_MACROS in the global CXXFLAGS, so it makes sense to do the same for -D__STDC_CONSTANT_MACROS and -D__STDC_FORMAT_MACROS instead of limiting that to libvixl. The -Wno-sign-compare option can also be removed since GCC 4.6 is not supported anymore. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17tests: skip block layer tests if !CONFIG_TOOLSMarc-André Lureau
The block tests, as well as ahci-test needs qemu-img. Do not run them if it wasn't built. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17os-posix: simplify os_find_datadirMarc-André Lureau
Use g_build_filename instead of sprintf, and g_autofree instead of manual freeing. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17vhost-user-scsi: fix printf format warningMarc-André Lureau
Fixes: ../contrib/vhost-user-scsi/vhost-user-scsi.c:118:57: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat] g_warning("Unable to determine cdb len (0x%02hhX)", cdb[0] >> 5); Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17monitor: fix maybe-uninitializedMarc-André Lureau
../monitor/misc.c: In function ‘mon_get_cpu_sync’: /home/elmarco/src/qq/include/sysemu/hw_accel.h:22:9: error: ‘cpu’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 22 | kvm_cpu_synchronize_state(cpu); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../monitor/misc.c:397:15: note: ‘cpu’ was declared here 397 | CPUState *cpu; | ^~~ Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17migration: fix maybe-uninitialized warningMarc-André Lureau
../migration/ram.c: In function ‘multifd_recv_thread’: /home/elmarco/src/qq/include/qapi/error.h:165:5: error: ‘block’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 165 | error_setg_internal((errp), __FILE__, __LINE__, __func__, \ | ^~~~~~~~~~~~~~~~~~~ ../migration/ram.c:818:15: note: ‘block’ was declared here 818 | RAMBlock *block; | ^~~~~ Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17build-sys: do not include Windows SLIRP dependencies in $LIBSPaolo Bonzini
When including the internal SLIRP library, we should add all the libraries that it needs for the build. Right now they are all included by QEMU, but -liphlpapi is not needed without slirp. Move it from LIBS to slirp_libs. Based on a patch by Marc-André Lureau. Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17build-sys: build vhost-user-gpu only if CONFIG_TOOLSMarc-André Lureau
vhost-user-gpu is always built and installed, but it is not part of the emulator proper. Cut it if --disable-tools is specified. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17object: Improve documentation of interfacesGreg Kurz
QOM interfaces allow a limited form of multiple inheritance, at the condition of being stateless. That is, they cannot be instantiated and a pointer to an interface shouldn't be dereferenceable in any way. This is achieved by making the QOM instance type an incomplete type, which is, as mentioned by Markus Armbruster, the closest you can get to abstract class in C. Incomplete types are widely used to hide implementation details, but people usually expect to find at least one place where the type is fully defined. The fact that it doesn't happen with QOM interfaces is quite disturbing, especially since it isn't documented anywhere as recently discussed in this thread: https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg01579.html Amend the documentation in the object.h header file to provide more details about why and how to implement QOM interfaces using incomplete types. Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17Makefile: remove unused variablesPaolo Bonzini
Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17kvm: convert "-machine kernel_irqchip" to an accelerator propertyPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17kvm: introduce kvm_kernel_irqchip_* functionsPaolo Bonzini
The KVMState struct is opaque, so provide accessors for the fields that will be moved from current_machine to the accelerator. For now they just forward to the machine object, but this will change. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17kvm: convert "-machine kvm_shadow_mem" to an accelerator propertyPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17xen: convert "-machine igd-passthru" to an accelerator propertyPaolo Bonzini
The first machine property to fall is Xen's Intel integrated graphics passthrough. The "-machine igd-passthru" option does not set anymore a property on the machine object, but desugars to a GlobalProperty on accelerator objects. The setter is very simple, since the value ends up in a global variable, so this patch also provides an example before the more complicated cases that follow it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17tcg: add "-accel tcg,tb-size" and deprecate "-tb-size"Paolo Bonzini
-tb-size fits nicely in the new framework for accelerator-specific options. It is a very niche option, so insta-deprecate it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17tcg: convert "-accel threads" to a QOM propertyPaolo Bonzini
Replace the ad-hoc qemu_tcg_configure with generic code invoking QOM property getters and setters. More properties (and thus more valid -accel suboptions) will be added in the next patches, which will move accelerator-related "-machine" options to accelerators. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17accel: pass object to accel_init_machinePaolo Bonzini
We will have to set QOM properties before accel_init_machine, based on the options provided to -accel. Construct the object outside it so that it will be possible to iterate on properties between object_new_with_class and accel_init_machine. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17qom: add object_new_with_classPaolo Bonzini
Similar to CPU and machine classes, "-accel" class names are mangled, so we have to first get a class via accel_find and then instantiate it. Provide a new function to instantiate a class without going through object_class_get_name, and use it for CPUs and machines already. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17qom: introduce object_register_sugar_propPaolo Bonzini
Similar to the existing "-rtc driftfix" option, we will convert some legacy "-machine" command line options to global properties on accelerators. Because accelerators are not devices, we cannot use qdev_prop_register_global. Instead, provide a slot in the generic object_compat_props arrays for command line syntactic sugar. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17vl: warn for unavailable accelerators, clarify messagesPaolo Bonzini
So far, specifying an accelerator that was not compiled in did not result in an error; fix that. While at it, clarify the mysterious "Back to TCG" message. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17vl: configure accelerators from -accel optionsPaolo Bonzini
Drop the "accel" property from MachineState, and instead desugar "-machine accel=" to a list of "-accel" options. This has a semantic change due to removing merge_lists from -accel. For example: - "-accel kvm -accel tcg" all but ignored "-accel kvm". This is a bugfix. - "-accel kvm -accel thread=single" ignored "thread=single", since it applied the option to KVM. Now it fails due to not specifying the accelerator on "-accel thread=single". - "-accel tcg -accel thread=single" chose single-threaded TCG, while now it will fail due to not specifying the accelerator on "-accel thread=single". Also, "-machine accel" and "-accel" become incompatible. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17vl: introduce object_parse_property_optPaolo Bonzini
We will reuse the parsing loop of machine_set_property soon for "-accel", but we do not want the "_" -> "-" conversion since "-accel" can just standardize on dashes. We will also add a bunch of legacy option handling to keep the QOM machine object clean. Extract the loop into a separate function, and keep the legacy handling in machine_set_property. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17accel: compile accel/accel.c just oncePaolo Bonzini
Now that accel/accel.c does not use CONFIG_TCG or CONFIG_KVM anymore, it need not be compiled once for every softmmu target. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17vl: merge -accel processing into configure_acceleratorsPaolo Bonzini
The next step is to move the parsing of "-machine accel=..." into vl.c, unifying it with the configure_accelerators() function that has just been introduced. This way, we will be able to desugar it into multiple "-accel" options, without polluting accel/accel.c. The CONFIG_TCG and CONFIG_KVM symbols are not available in vl.c, but we can use accel_find instead to find their value at runtime. Once we know that the binary has one of TCG or KVM, the default accelerator can be expressed simply as "tcg:kvm", because TCG never fails to initialize. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17vl: extract accelerator option processing to a separate functionPaolo Bonzini
As a first step towards supporting multiple "-accel" options, push the late processing of -icount and -accel into a new function, and use qemu_opts_foreach to retrieve -accel options instead of stashing them into globals. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-12-17tcg: move qemu_tcg_configure to accel/tcg/tcg-all.cPaolo Bonzini
Move everything related to mttcg_enabled in accel/tcg/tcg-all.c, which will make even more sense when "thread" becomes a QOM property. For now, initializing mttcg_enabled in the instance_init function prepares for the next patch, which will only invoke qemu_tcg_configure when the command line includes a -accel option. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>