Skip to contentSkip to conversation

Misc patches for 2017-01-11

GIT PULL Paolo Bonzini 3 participants 35 messages Jan 16, 2017 – Jan 19, 2017 Kbuild

lore
Share & tools
lore
#1 lore raw

[Qemu-devel] [PULL 01/32] bugfix: vm halt when in reset looping

In reply to Paolo Bonzini

From: hangaohuai <[email protected]>

reset mc146818rtc device when RESET event happens.

Fix the problem:
1. Guest boot the second cpu, set CMOS_RESET_CODE 0x0a to protect selfboot;
2. VM being reset by others, hmp_system_reset;
3. seabios resume check the CMOS_RESET_CODE, if 0x0a, jump to the BDA

     resume execution by jump via 40h:0067h;

4. Guest halt;

Message-Id: <[email protected]>

---
 hw/timer/mc146818rtc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
hw/timer/mc146818rtc.c +12 -0
index da209d0..637f872 100644
@@ -946,11 +946,23 @@ static Property mc146818rtc_properties[] = {
     DEFINE_PROP_END_OF_LIST(),
 };
 
+static void rtc_resetdev(DeviceState *d)
+{
+    RTCState *s = MC146818_RTC(d);
+
+    /* Reason: VM do suspend self will set 0xfe
+     * Reset any values other than 0xfe(Guest suspend case) */
+    if (s->cmos_data[0x0f] != 0xfe) {
+        s->cmos_data[0x0f] = 0x00;
+    }
+}
+
 static void rtc_class_initfn(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = rtc_realizefn;
+    dc->reset = rtc_resetdev;
     dc->vmsd = &vmstate_rtc;
     dc->props = mc146818rtc_properties;
     /* Reason: needs to be wired up by rtc_init() */
Signature · 1 line
2.9.3
#2 lore raw

[Qemu-devel] [PULL 02/32] megasas: fix guest-triggered memory leak

In reply to Paolo Bonzini

If the guest sets the sglist size to a value >=2GB, megasas_handle_dcmd will return MFI_STAT_MEMORY_NOT_AVAILABLE without freeing the memory. Avoid this by returning only the status from map_dcmd, and loading cmd->iov_size in the caller.

---
 hw/scsi/megasas.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
hw/scsi/megasas.c +6 -5
index 67fc1e7..6233865 100644
@@ -683,14 +683,14 @@ static int megasas_map_dcmd(MegasasState *s, MegasasCmd *cmd)
         trace_megasas_dcmd_invalid_sge(cmd->index,
                                        cmd->frame->header.sge_count);
         cmd->iov_size = 0;
-        return -1;
+        return -EINVAL;
     }
     iov_pa = megasas_sgl_get_addr(cmd, &cmd->frame->dcmd.sgl);
     iov_size = megasas_sgl_get_len(cmd, &cmd->frame->dcmd.sgl);
     pci_dma_sglist_init(&cmd->qsg, PCI_DEVICE(s), 1);
     qemu_sglist_add(&cmd->qsg, iov_pa, iov_size);
     cmd->iov_size = iov_size;
-    return cmd->iov_size;
+    return 0;
 }
 
 static void megasas_finish_dcmd(MegasasCmd *cmd, uint32_t iov_size)
@@ -1559,19 +1559,20 @@ static const struct dcmd_cmd_tbl_t {
 
 static int megasas_handle_dcmd(MegasasState *s, MegasasCmd *cmd)
 {
-    int opcode, len;
+    int opcode;
     int retval = 0;
+    size_t len;
     const struct dcmd_cmd_tbl_t *cmdptr = dcmd_cmd_tbl;
 
     opcode = le32_to_cpu(cmd->frame->dcmd.opcode);
     trace_megasas_handle_dcmd(cmd->index, opcode);
-    len = megasas_map_dcmd(s, cmd);
-    if (len < 0) {
+    if (megasas_map_dcmd(s, cmd) < 0) {
         return MFI_STAT_MEMORY_NOT_AVAILABLE;
     }
     while (cmdptr->opcode != -1 && cmdptr->opcode != opcode) {
         cmdptr++;
     }
+    len = cmd->iov_size;
     if (cmdptr->opcode == -1) {
         trace_megasas_dcmd_unhandled(cmd->index, opcode, len);
         retval = megasas_dcmd_dummy(s, cmd);
Signature · 1 line
2.9.3
#3 lore raw

[Qemu-devel] [PULL 03/32] qom: Make all interface types abstract

In reply to Paolo Bonzini

From: Eduardo Habkost <[email protected]>

"qom-list-types abstract=false" currently returns all interface types, as if they were not abstract. Fix this by making sure all interface types are abstract.

All interface types have instance_size == 0, so we can use it to set abstract=true on type_initialize().

Message-Id: <[email protected]>

---
 qom/object.c                   |  6 +++++
 tests/device-introspect-test.c | 60 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 63 insertions(+), 3 deletions(-)
qom/object.c +6 -0
index 7a05e35..760fafb 100644
@@ -272,6 +272,12 @@ static void type_initialize(TypeImpl *ti)
 
     ti->class_size = type_class_get_size(ti);
     ti->instance_size = type_object_get_size(ti);
+    /* Any type with zero instance_size is implicitly abstract.
+     * This means interface types are all abstract.
+     */
+    if (ti->instance_size == 0) {
+        ti->abstract = true;
+    }
 
     ti->class = g_malloc0(ti->class_size);
 
tests/device-introspect-test.c +57 -3

93 lines not on this page · raw message

Signature · 1 line
2.9.3
#0 lore raw

The following changes since commit 2ccede18bd24fce5db83fef3674563a1f256717b:

Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.9-pull-request' into staging (2017-01-16 12:41:35 +0000)

are available in the git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 91c7e9f6b82804c6b53ecc5057d6b305b766ba49:

Revert "win32: don't run subprocess tests on Mingw32 platform" (2017-01-16 17:55:25 +0100)

----------------------------------------------------------------
* QOM interface fix (Eduardo)
* RTC fixes (Gaohuai, Igor)
* Memory leak fixes (Li Qiang, me)
* Ctrl-a b regression (Marc-André)
* Stubs cleanups and fixes (Leif, me)
* hxtool tweak (me)
* HAX support (Vincent)
* QemuThread, exec.c and SCSI fixes (Roman, Xinhua, me)

----------------------------------------------------------------
Caoxinhua (1):
qemu-thread: fix qemu_thread_set_name() race in qemu_thread_create()

Eduardo Habkost (1):
qom: Make all interface types abstract

Igor Mammedov (1):
pc: fix crash in rtc_set_memory() if initial cpu is marked as hotplugged

Leif Lindholm (1):
smbios: filter based on CONFIG_SMBIOS rather than TARGET

Li Qiang (1):
serial: fix memory leak in serial exit

Marc-André Lureau (2):
char: fix ctrl-a b not working
Revert "win32: don't run subprocess tests on Mingw32 platform"

Paolo Bonzini (16):
megasas: fix guest-triggered memory leak
stubs: merge all monitor stubs in one file, remove monitor_cur_is_qmp stub
stubs: move smbios stubs to hw/smbios
stubs: move acpi stubs to hw/acpi
stubs: remove unused stub for serial_hd
hw: move reset handlers from vl.c to hw/core
stubs: group stubs for user-mode emulation
stubs: group all monitor_fdset_* functions in a single file
stubs: move vhost stubs to stubs/vhost.o
event_notifier: cleanups around event_notifier_set_handler
build: remove --enable-colo/--disable-colo
stubs: remove stubs/kvm.c
acpi: filter based on CONFIG_ACPI_X86 rather than TARGET
scsi-block: fix direction of BYTCHK test for VERIFY commands
hxtool: emit Texinfo headings as @subsection
ramblock-notifier: new

Peter Xu (3):
x86: ioapic: add traces for ioapic
x86: ioapic: dump version for "info ioapic"
x86: ioapic: fix fail migration when irqchip=split

Roman Kapl (1):
exec: Add missing rcu_read_unlock

Vincent Palatin (4):
kvm: move cpu synchronization code target/i386: Add Intel HAX files
Plumb the HAXM-based hardware acceleration support
hax: add Darwin support

hangaohuai (1):
bugfix: vm halt when in reset looping

 MAINTAINERS                                        |    1 +
 Makefile.target                                    |    5 +-
 arch_init.c                                        |   21 -
 configure                                          |   27 +-
 cpus.c                                             |   79 +-
 exec.c                                             |    6 +
 gdbstub.c                                          |    1 +
 hax-stub.c                                         |   34 +
 hw/Makefile.objs                                   |    6 +-
 hw/acpi/Makefile.objs                              |   17 +-
 hw/acpi/acpi-stub.c                                |   29 +
 stubs/ipmi.c => hw/acpi/ipmi-stub.c                |    0
 hw/char/serial.c                                   |   10 +
 hw/core/Makefile.objs                              |    2 +-
 hw/core/reset.c                                    |   72 ++
 hw/i386/kvm/apic.c                                 |    1 +
 hw/i386/kvmvapic.c                                 |    1 +
 hw/i386/pc.c                                       |    4 +-
 hw/intc/apic_common.c                              |    3 +-
 hw/intc/ioapic.c                                   |   22 +-
 hw/intc/ioapic_common.c                            |    3 +-
 hw/intc/trace-events                               |    7 +
 hw/misc/vmport.c                                   |    2 +-
 hw/ppc/pnv_xscom.c                                 |    2 +-
 hw/ppc/ppce500_spin.c                              |    4 +-
 hw/ppc/spapr.c                                     |    2 +-
 hw/ppc/spapr_hcall.c                               |    2 +-
 hw/s390x/s390-pci-inst.c                           |    1 +
 hw/scsi/megasas.c                                  |   11 +-
 hw/scsi/scsi-disk.c                                |    2 +-
 hw/smbios/Makefile.objs                            |   12 +-
 hw/smbios/smbios-stub.c                            |   31 +
 hw/smbios/smbios.c                                 |    2 +-
 .../smbios/smbios_type_38-stub.c                   |    0
 hw/timer/mc146818rtc.c                             |   12 +
 hw/usb/ccid-card-emulated.c                        |    2 +-
 hw/virtio/Makefile.objs                            |    6 +-
 stubs/vhost.c => hw/virtio/vhost-stub.c            |    0
 hw/virtio/virtio.c                                 |   10 +-
 include/exec/memory.h                              |    6 +-
 include/exec/ram_addr.h                            |   46 +-
 include/exec/ramlist.h                             |   72 ++
 include/hw/hw.h                                    |    6 +-
 include/hw/smbios/smbios.h                         |    2 +-
 include/qemu/event_notifier.h                      |    3 -
 include/qemu/main-loop.h                           |   15 +
 include/qom/cpu.h                                  |    5 +
 include/sysemu/arch_init.h                         |    2 -
 include/sysemu/hax.h                               |   56 +
 include/sysemu/hw_accel.h                          |   48 +
 include/sysemu/kvm.h                               |   23 -
 include/sysemu/reset.h                             |   10 +
 include/sysemu/sysemu.h                            |    1 -
 iohandler.c                                        |    8 +
 migration/Makefile.objs                            |    3 +-
 monitor.c                                          |    2 +-
 numa.c                                             |   29 +
 qemu-char.c                                        |   15 +-
 qemu-options-wrapper.h                             |    2 +-
 qemu-options.hx                                    |   42 +-
 qom/cpu.c                                          |    2 +-
 qom/object.c                                       |    6 +
 scripts/hxtool                                     |   11 +-
 stubs/Makefile.objs                                |   19 +-
 stubs/cpus.c                                       |   11 -
 stubs/fdset-add-fd.c                               |    8 -
 stubs/fdset-find-fd.c                              |    8 -
 stubs/fdset-get-fd.c                               |    8 -
 stubs/fdset-remove-fd.c                            |    7 -
 stubs/fdset.c                                      |   22 +
 stubs/get-next-serial.c                            |    4 -
 stubs/iohandler.c                                  |    8 -
 stubs/kvm.c                                        |    8 -
 stubs/migration-colo.c                             |   46 -
 stubs/mon-is-qmp.c                                 |   10 -
 stubs/monitor-init.c                               |    7 -
 stubs/{get-fd.c => monitor.c}                      |    6 +
 stubs/replay-user.c                                |   33 -
 stubs/reset.c                                      |   14 -
 target/arm/cpu.c                                   |    2 +-
 target/i386/Makefile.objs                          |    7 +
 target/i386/hax-all.c                              | 1155 ++++++++++++++++++++
 target/i386/hax-darwin.c                           |  316 ++++++
 target/i386/hax-darwin.h                           |   63 ++
 target/i386/hax-i386.h                             |   94 ++
 target/i386/hax-interface.h                        |  361 ++++++
 target/i386/hax-mem.c                              |  289 +++++
 target/i386/hax-windows.c                          |  479 ++++++++
 target/i386/hax-windows.h                          |   89 ++
 target/i386/helper.c                               |    1 +
 target/i386/hyperv.c                               |    7 +-
 target/i386/kvm.c                                  |    1 +
 target/mips/kvm.c                                  |    5 +
 target/ppc/kvm.c                                   |    7 +-
 target/ppc/mmu-hash64.c                            |    2 +-
 target/ppc/translate_init.c                        |    2 +-
 target/s390x/gdbstub.c                             |    1 +
 target/s390x/kvm.c                                 |    5 +
 tests/Makefile.include                             |    1 +
 tests/device-introspect-test.c                     |   60 +-
 user-exec-stub.c                                   |   34 +
 util/event_notifier-posix.c                        |    9 -
 util/event_notifier-win32.c                        |   12 -
 util/qemu-thread-posix.c                           |   12 +-
 util/qemu-thread-win32.c                           |    4 +-
 vl.c                                               |   62 +-
 xen-mapcache.c                                     |    3 +
 107 files changed, 3717 insertions(+), 452 deletions(-)
 create mode 100644 hax-stub.c
 create mode 100644 hw/acpi/acpi-stub.c
 rename stubs/ipmi.c => hw/acpi/ipmi-stub.c (100%)
 create mode 100644 hw/core/reset.c
 create mode 100644 hw/smbios/smbios-stub.c
 rename stubs/smbios_type_38.c => hw/smbios/smbios_type_38-stub.c (100%)
 rename stubs/vhost.c => hw/virtio/vhost-stub.c (100%)
 create mode 100644 include/exec/ramlist.h
 create mode 100644 include/sysemu/hax.h
 create mode 100644 include/sysemu/hw_accel.h
 create mode 100644 include/sysemu/reset.h
 delete mode 100644 stubs/cpus.c
 delete mode 100644 stubs/fdset-add-fd.c
 delete mode 100644 stubs/fdset-find-fd.c
 delete mode 100644 stubs/fdset-get-fd.c
 delete mode 100644 stubs/fdset-remove-fd.c
 create mode 100644 stubs/fdset.c
 delete mode 100644 stubs/get-next-serial.c
 delete mode 100644 stubs/iohandler.c
 delete mode 100644 stubs/kvm.c
 delete mode 100644 stubs/migration-colo.c
 delete mode 100644 stubs/mon-is-qmp.c
 delete mode 100644 stubs/monitor-init.c
 rename stubs/{get-fd.c => monitor.c} (75%)
 delete mode 100644 stubs/replay-user.c
 delete mode 100644 stubs/reset.c
 create mode 100644 target/i386/hax-all.c
 create mode 100644 target/i386/hax-darwin.c
 create mode 100644 target/i386/hax-darwin.h
 create mode 100644 target/i386/hax-i386.h
 create mode 100644 target/i386/hax-interface.h
 create mode 100644 target/i386/hax-mem.c
 create mode 100644 target/i386/hax-windows.c
 create mode 100644 target/i386/hax-windows.h
 create mode 100644 user-exec-stub.c
Signature · 1 line
2.9.3
target/ppc/kvm.c +1 -1
index 6c53a6d..ec92c64 100644
@@ -26,7 +26,7 @@
 #include "cpu.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/numa.h"
 #include "kvm_ppc.h"
 #include "sysemu/cpus.h"
#4 lore raw

[Qemu-devel] [PULL 04/32] smbios: filter based on CONFIG_SMBIOS rather than TARGET

From: Leif Lindholm <[email protected]>

-smbios command line options were accepted but silently ignored on TARGET_ARM, due to a test for TARGET_I386 in arch_init.c.

Copy the mechanism of hw/pci/pci-stub.c to implement an smbios-stub instead, enabled for all targets without CONFIG_SMBIOS.

Message-Id: <[email protected]>

---
 arch_init.c                |  8 --------
 hw/Makefile.objs           |  2 +-
 hw/smbios/Makefile.objs    |  3 +++
 hw/smbios/smbios-stub.c    | 31 +++++++++++++++++++++++++++++++
 hw/smbios/smbios.c         |  2 +-
 include/hw/smbios/smbios.h |  2 +-
 include/sysemu/arch_init.h |  1 -
 vl.c                       |  2 +-
 8 files changed, 38 insertions(+), 13 deletions(-)
 create mode 100644 hw/smbios/smbios-stub.c
arch_init.c +0 -8
index 5cc58b2..34e7694 100644
@@ -28,7 +28,6 @@
 #include "sysemu/arch_init.h"
 #include "hw/pci/pci.h"
 #include "hw/audio/audio.h"
-#include "hw/smbios/smbios.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
 #include "qmp-commands.h"
@@ -248,13 +247,6 @@ void do_acpitable_option(const QemuOpts *opts)
 #endif
 }
 
-void do_smbios_option(QemuOpts *opts)
-{
-#ifdef TARGET_I386
-    smbios_entry_add(opts);
-#endif
-}
-
 int kvm_available(void)
 {
 #ifdef CONFIG_KVM
hw/Makefile.objs +1 -1
index 0ffd281..2a73ae5 100644
@@ -33,7 +33,7 @@ devices-dirs-$(CONFIG_VIRTIO) += virtio/
 devices-dirs-$(CONFIG_SOFTMMU) += watchdog/
 devices-dirs-$(CONFIG_SOFTMMU) += xen/
 devices-dirs-$(CONFIG_MEM_HOTPLUG) += mem/
-devices-dirs-$(CONFIG_SMBIOS) += smbios/
+devices-dirs-$(CONFIG_SOFTMMU) += smbios/
 devices-dirs-y += core/
 common-obj-y += $(devices-dirs-y)
 obj-y += $(devices-dirs-y)
hw/smbios/Makefile.objs +3 -0
index c3d3753..ee0712b 100644
@@ -1,2 +1,5 @@
 common-obj-$(CONFIG_SMBIOS) += smbios.o
 common-obj-$(call land,$(CONFIG_SMBIOS),$(CONFIG_IPMI)) += smbios_type_38.o
+
+common-obj-$(call lnot,$(CONFIG_SMBIOS)) += smbios-stub.o
+common-obj-$(CONFIG_ALL) += smbios-stub.o
hw/smbios/smbios-stub.c new file +31 -0
new file mode 100644
index 0000000..3087394
@@ -0,0 +1,31 @@
+/*
+ * SMBIOS stubs for platforms that don't support SMBIOS.
+ *
+ * Copyright (c) 2010 Isaku Yamahata <yamahata at valinux co jp>
+ *                    VA Linux Systems Japan K.K.
+ * Copyright (c) 2016 Leif Lindholm <[email protected]>
+ *                    Linaro Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/qmp/qerror.h"
+#include "qmp-commands.h"
+#include "hw/smbios/smbios.h"
+
+void smbios_entry_add(QemuOpts *opts, Error **errp)
+{
+    error_setg(errp, QERR_UNSUPPORTED);
+}
hw/smbios/smbios.c +1 -1
index 3a96ced..1a5437a 100644
@@ -882,7 +882,7 @@ static void save_opt(const char **dest, QemuOpts *opts, const char *name)
     }
 }
 
-void smbios_entry_add(QemuOpts *opts)
+void smbios_entry_add(QemuOpts *opts, Error **errp)
 {
     const char *val;
 
include/hw/smbios/smbios.h +1 -1
index 1cd53cc..31e8d5f 100644
@@ -257,7 +257,7 @@ struct smbios_type_127 {
     struct smbios_structure_header header;
 } QEMU_PACKED;
 
-void smbios_entry_add(QemuOpts *opts);
+void smbios_entry_add(QemuOpts *opts, Error **errp);
 void smbios_set_cpuid(uint32_t version, uint32_t features);
 void smbios_set_defaults(const char *manufacturer, const char *product,
                          const char *version, bool legacy_mode,
include/sysemu/arch_init.h +0 -1
index 1c9dad1..88dcf77 100644
@@ -29,7 +29,6 @@ extern const uint32_t arch_type;
 
 void select_soundhw(const char *optarg);
 void do_acpitable_option(const QemuOpts *opts);
-void do_smbios_option(QemuOpts *opts);
 void audio_init(void);
 int kvm_available(void);
 int xen_available(void);
vl.c +1 -1
index c643d3f..63355e5 100644
@@ -3707,7 +3707,7 @@ int main(int argc, char **argv, char **envp)
                 if (!opts) {
                     exit(1);
                 }
-                do_smbios_option(opts);
+                smbios_entry_add(opts, &error_fatal);
                 break;
             case QEMU_OPTION_fwcfg:
                 opts = qemu_opts_parse_noisily(qemu_find_opts("fw_cfg"),
Signature · 1 line
2.9.3
#5 lore raw

[Qemu-devel] [PULL 05/32] stubs: merge all monitor stubs in one file, remove monitor_cur_is_qmp stub

In reply to Paolo Bonzini

monitor_cur_is_qmp was previously used by other stubs, but it's not since 397d30e ("qemu-error: remove dependency of stubs on monitor", 2016-11-01).

---
 stubs/Makefile.objs           |  4 +---
 stubs/mon-is-qmp.c            | 10 ----------
 stubs/monitor-init.c          |  7 -------
 stubs/{get-fd.c => monitor.c} |  6 ++++++
 4 files changed, 7 insertions(+), 20 deletions(-)
 delete mode 100644 stubs/mon-is-qmp.c
 delete mode 100644 stubs/monitor-init.c
 rename stubs/{get-fd.c => monitor.c} (75%)
stubs/Makefile.objs +1 -3
index 2b5bb74..9fc373e 100644
@@ -15,7 +15,6 @@ stub-obj-y += fdset-find-fd.o
 stub-obj-y += fdset-get-fd.o
 stub-obj-y += fdset-remove-fd.o
 stub-obj-y += gdbstub.o
-stub-obj-y += get-fd.o
 stub-obj-y += get-next-serial.o
 stub-obj-y += get-vm-name.o
 stub-obj-y += iothread.o
@@ -23,8 +22,7 @@ stub-obj-y += iothread-lock.o
 stub-obj-y += is-daemonized.o
 stub-obj-y += machine-init-done.o
 stub-obj-y += migr-blocker.o
-stub-obj-y += mon-is-qmp.o
-stub-obj-y += monitor-init.o
+stub-obj-y += monitor.o
 stub-obj-y += notify-event.o
 stub-obj-y += qtest.o
 stub-obj-y += replay.o
stubs/mon-is-qmp.c deleted +0 -10
deleted file mode 100644
index a8344ce..0000000
@@ -1,10 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "monitor/monitor.h"
-
-Monitor *cur_mon;
-
-bool monitor_cur_is_qmp(void)
-{
-    return false;
-}
stubs/monitor-init.c deleted +0 -7
deleted file mode 100644
index de1bc7c..0000000
@@ -1,7 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "monitor/monitor.h"
-
-void monitor_init(CharDriverState *chr, int flags)
-{
-}
stubs/monitor.c renamed from stubs/get-fd.c +6 -0
similarity index 75%
rename from stubs/get-fd.c
rename to stubs/monitor.c
index 7dfdfb5..1d574b1 100644
@@ -3,8 +3,14 @@
 #include "qemu-common.h"
 #include "monitor/monitor.h"
 
+Monitor *cur_mon = NULL;
+
 int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
 {
     error_setg(errp, "only QEMU supports file descriptor passing");
     return -1;
 }
+
+void monitor_init(CharDriverState *chr, int flags)
+{
+}
Signature · 1 line
2.9.3
#6 lore raw

[Qemu-devel] [PULL 06/32] stubs: move smbios stubs to hw/smbios

In reply to Paolo Bonzini

No need to include them in libqemustub.a, since only system emulators need them.

---
 hw/smbios/Makefile.objs                                   | 11 ++++++++---
 stubs/smbios_type_38.c => hw/smbios/smbios_type_38-stub.c |  0
 stubs/Makefile.objs                                       |  1 -
 3 files changed, 8 insertions(+), 4 deletions(-)
 rename stubs/smbios_type_38.c => hw/smbios/smbios_type_38-stub.c (100%)
hw/smbios/Makefile.objs +8 -3
index ee0712b..23bb2ba 100644
@@ -1,5 +1,10 @@
-common-obj-$(CONFIG_SMBIOS) += smbios.o
-common-obj-$(call land,$(CONFIG_SMBIOS),$(CONFIG_IPMI)) += smbios_type_38.o
+ifeq ($(CONFIG_SMBIOS),y)
+common-obj-y += smbios.o
+common-obj-$(CONFIG_IPMI) += smbios_type_38.o
+common-obj-$(call lnot,$(CONFIG_IPMI)) += smbios_type_38-stub.o
+else
+common-obj-y += smbios-stub.o
+endif
 
-common-obj-$(call lnot,$(CONFIG_SMBIOS)) += smbios-stub.o
 common-obj-$(CONFIG_ALL) += smbios-stub.o
+common-obj-$(CONFIG_ALL) += smbios_type_38-stub.o
hw/smbios/smbios_type_38-stub.c renamed from stubs/smbios_type_38.c +0 -0
similarity index 100%
rename from stubs/smbios_type_38.c
rename to hw/smbios/smbios_type_38-stub.c
stubs/Makefile.objs +0 -1
index 9fc373e..13c5d45 100644
@@ -44,7 +44,6 @@ stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
 stub-obj-y += vhost.o
 stub-obj-y += iohandler.o
-stub-obj-y += smbios_type_38.o
 stub-obj-y += ipmi.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += migration-colo.o
Signature · 1 line
2.9.3
#7 lore raw

[Qemu-devel] [PULL 07/32] stubs: move acpi stubs to hw/acpi

In reply to Paolo Bonzini

No need to include them in libqemustub.a, since only system emulators need them.

---
 hw/acpi/Makefile.objs               | 12 ++++++++----
 stubs/ipmi.c => hw/acpi/ipmi-stub.c |  0
 stubs/Makefile.objs                 |  1 -
 3 files changed, 8 insertions(+), 5 deletions(-)
 rename stubs/ipmi.c => hw/acpi/ipmi-stub.c (100%)
hw/acpi/Makefile.objs +8 -4
index 834c63b..dfc8229 100644
@@ -4,7 +4,11 @@ common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu_hotplug.o
 common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o
 common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu.o
 common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o
-common-obj-$(CONFIG_ACPI) += acpi_interface.o
-common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
-common-obj-$(CONFIG_ACPI) += aml-build.o
-common-obj-$(call land,$(CONFIG_ACPI),$(CONFIG_IPMI)) += ipmi.o
+
+common-obj-y += acpi_interface.o
+common-obj-y += bios-linker-loader.o
+common-obj-y += aml-build.o
+
+common-obj-$(CONFIG_IPMI) += ipmi.o
+common-obj-$(call lnot,$(CONFIG_IPMI)) += ipmi-stub.o
+common-obj-$(CONFIG_ALL) += ipmi-stub.o
hw/acpi/ipmi-stub.c renamed from stubs/ipmi.c +0 -0
similarity index 100%
rename from stubs/ipmi.c
rename to hw/acpi/ipmi-stub.c
stubs/Makefile.objs +0 -1
index 13c5d45..c4df915 100644
@@ -44,6 +44,5 @@ stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
 stub-obj-y += vhost.o
 stub-obj-y += iohandler.o
-stub-obj-y += ipmi.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += migration-colo.o
Signature · 1 line
2.9.3
#8 lore raw

[Qemu-devel] [PULL 08/32] stubs: remove unused stub for serial_hd

In reply to Paolo Bonzini
---
 stubs/Makefile.objs     | 1 -
 stubs/get-next-serial.c | 4 ----
 2 files changed, 5 deletions(-)
 delete mode 100644 stubs/get-next-serial.c
stubs/Makefile.objs +0 -1
index c4df915..5b3e7c6 100644
@@ -15,7 +15,6 @@ stub-obj-y += fdset-find-fd.o
 stub-obj-y += fdset-get-fd.o
 stub-obj-y += fdset-remove-fd.o
 stub-obj-y += gdbstub.o
-stub-obj-y += get-next-serial.o
 stub-obj-y += get-vm-name.o
 stub-obj-y += iothread.o
 stub-obj-y += iothread-lock.o
stubs/get-next-serial.c deleted +0 -4
deleted file mode 100644
index 6ff6a6d..0000000
@@ -1,4 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-
-CharDriverState *serial_hds[0];
Signature · 1 line
2.9.3
#9 lore raw

[Qemu-devel] [PULL 09/32] hw: move reset handlers from vl.c to hw/core

In reply to Paolo Bonzini

They are small, it is not worth stubbing them. Just include them in user-mode emulators and unit tests as well.

---
 hw/core/Makefile.objs   |  2 +-
 hw/core/reset.c         | 72 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/hw.h         |  6 +----
 include/sysemu/reset.h  | 10 +++++++
 include/sysemu/sysemu.h |  1 -
 stubs/Makefile.objs     |  1 -
 stubs/reset.c           | 14 ----------
 tests/Makefile.include  |  1 +
 vl.c                    | 42 -----------------------------
 9 files changed, 85 insertions(+), 64 deletions(-)
 create mode 100644 hw/core/reset.c
 create mode 100644 include/sysemu/reset.h
 delete mode 100644 stubs/reset.c
hw/core/Makefile.objs +1 -1
index a4c94e5..833fd46 100644
@@ -1,6 +1,6 @@
 # core qdev-related obj files, also used by *-user:
 common-obj-y += qdev.o qdev-properties.o
-common-obj-y += bus.o
+common-obj-y += bus.o reset.o
 common-obj-y += fw-path-provider.o
 # irq.o needed for qdev GPIO handling:
 common-obj-y += irq.o
hw/core/reset.c new file +72 -0

72 lines not on this page · raw message

include/hw/hw.h +1 -5
index 3669ebd..e22d4ce 100644
@@ -12,11 +12,7 @@
 #include "hw/irq.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
-
-typedef void QEMUResetHandler(void *opaque);
-
-void qemu_register_reset(QEMUResetHandler *func, void *opaque);
-void qemu_unregister_reset(QEMUResetHandler *func, void *opaque);
+#include "sysemu/reset.h"
 
 void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
 
include/sysemu/reset.h new file +10 -0
new file mode 100644
index 0000000..0b0d6d7
@@ -0,0 +1,10 @@
+#ifndef QEMU_SYSEMU_RESET_H
+#define QEMU_SYSEMU_RESET_H
+
+typedef void QEMUResetHandler(void *opaque);
+
+void qemu_register_reset(QEMUResetHandler *func, void *opaque);
+void qemu_unregister_reset(QEMUResetHandler *func, void *opaque);
+void qemu_devices_reset(void);
+
+#endif
include/sysemu/sysemu.h +0 -1
index cccde56..ff8ffb5 100644
@@ -63,7 +63,6 @@ void qemu_system_vmstop_request_prepare(void);
 int qemu_shutdown_requested_get(void);
 int qemu_reset_requested_get(void);
 void qemu_system_killed(int signal, pid_t pid);
-void qemu_devices_reset(void);
 void qemu_system_reset(bool report);
 void qemu_system_guest_panicked(void);
 size_t qemu_target_page_bits(void);
stubs/Makefile.objs +0 -1
index 5b3e7c6..c89a9da 100644
@@ -26,7 +26,6 @@ stub-obj-y += notify-event.o
 stub-obj-y += qtest.o
 stub-obj-y += replay.o
 stub-obj-y += replay-user.o
-stub-obj-y += reset.o
 stub-obj-y += runstate-check.o
 stub-obj-y += set-fd-handler.o
 stub-obj-y += slirp.o
stubs/reset.c deleted +0 -14
deleted file mode 100644
index 5d47711..0000000
@@ -1,14 +0,0 @@
-#include "qemu/osdep.h"
-#include "hw/hw.h"
-
-/* Stub functions for binaries that never call qemu_devices_reset(),
- * and don't need to keep track of the reset handler list.
- */
-
-void qemu_register_reset(QEMUResetHandler *func, void *opaque)
-{
-}
-
-void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
-{
-}
tests/Makefile.include +1 -0
index 2029013..c5c25a8 100644
@@ -517,6 +517,7 @@ tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
 	hw/core/bus.o \
 	hw/core/irq.o \
 	hw/core/fw-path-provider.o \
+	hw/core/reset.o \
 	$(test-qapi-obj-y)
 tests/test-vmstate$(EXESUF): tests/test-vmstate.o \
 	migration/vmstate.o migration/qemu-file.o \
vl.c +0 -42

54 lines not on this page · raw message

Signature · 1 line
2.9.3
#10 lore raw

[Qemu-devel] [PULL 10/32] stubs: group stubs for user-mode emulation

In reply to Paolo Bonzini

Some stubs are used for user-mode emulation only; they are not needed by tools. Move them out of stubs/.

---
 MAINTAINERS         |  1 +
 Makefile.target     |  4 ++--
 stubs/Makefile.objs |  2 --
 stubs/cpus.c        | 11 -----------
 stubs/replay-user.c | 33 ---------------------------------
 user-exec-stub.c    | 34 ++++++++++++++++++++++++++++++++++
 6 files changed, 37 insertions(+), 48 deletions(-)
 delete mode 100644 stubs/cpus.c
 delete mode 100644 stubs/replay-user.c
 create mode 100644 user-exec-stub.c
MAINTAINERS +1 -0
index 1444b26..39e8230 100644
@@ -1494,6 +1494,7 @@ M: Riku Voipio <[email protected]>
 S: Maintained
 F: thunk.c
 F: user-exec.c
+F: user-exec-stub.c
 
 BSD user
 S: Orphan
Makefile.target +2 -2
index 8ae82cb..9e8edd9 100644
@@ -115,7 +115,7 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \
              -I$(SRC_PATH)/linux-user
 
 obj-y += linux-user/
-obj-y += gdbstub.o thunk.o user-exec.o
+obj-y += gdbstub.o thunk.o user-exec.o user-exec-stub.o
 
 endif #CONFIG_LINUX_USER
 
@@ -128,7 +128,7 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
 			 -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR)
 
 obj-y += bsd-user/
-obj-y += gdbstub.o user-exec.o
+obj-y += gdbstub.o user-exec.o user-exec-stub.o
 
 endif #CONFIG_BSD_USER
 
stubs/Makefile.objs +0 -2
index c89a9da..1eec1fb 100644
@@ -25,7 +25,6 @@ stub-obj-y += monitor.o
 stub-obj-y += notify-event.o
 stub-obj-y += qtest.o
 stub-obj-y += replay.o
-stub-obj-y += replay-user.o
 stub-obj-y += runstate-check.o
 stub-obj-y += set-fd-handler.o
 stub-obj-y += slirp.o
@@ -35,7 +34,6 @@ stub-obj-y += uuid.o
 stub-obj-y += vm-stop.o
 stub-obj-y += vmstate.o
 stub-obj-$(CONFIG_WIN32) += fd-register.o
-stub-obj-y += cpus.o
 stub-obj-y += kvm.o
 stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += target-monitor-defs.o
stubs/cpus.c deleted +0 -11
deleted file mode 100644
index e192722..0000000
@@ -1,11 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "qom/cpu.h"
-
-void cpu_resume(CPUState *cpu)
-{
-}
-
-void qemu_init_vcpu(CPUState *cpu)
-{
-}
stubs/replay-user.c deleted +0 -33
deleted file mode 100644
index b29e7eb..0000000
@@ -1,33 +0,0 @@
-/*
- * replay.c
- *
- * Copyright (c) 2010-2015 Institute for System Programming
- *                         of the Russian Academy of Sciences.
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- *
- */
-
-#include "qemu/osdep.h"
-#include "sysemu/replay.h"
-
-bool replay_exception(void)
-{
-    return true;
-}
-
-bool replay_has_exception(void)
-{
-    return false;
-}
-
-bool replay_interrupt(void)
-{
-    return true;
-}
-
-bool replay_has_interrupt(void)
-{
-    return false;
-}
user-exec-stub.c new file +34 -0
new file mode 100644
index 0000000..dbcf1ad
@@ -0,0 +1,34 @@
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "qom/cpu.h"
+#include "sysemu/replay.h"
+
+void cpu_resume(CPUState *cpu)
+{
+}
+
+void qemu_init_vcpu(CPUState *cpu)
+{
+}
+
+/* User mode emulation does not support record/replay yet.  */
+
+bool replay_exception(void)
+{
+    return true;
+}
+
+bool replay_has_exception(void)
+{
+    return false;
+}
+
+bool replay_interrupt(void)
+{
+    return true;
+}
+
+bool replay_has_interrupt(void)
+{
+    return false;
+}
Signature · 1 line
2.9.3
#11 lore raw

[Qemu-devel] [PULL 11/32] stubs: group all monitor_fdset_* functions in a single file

In reply to Paolo Bonzini

It makes little sense to implement only one of them, so avoid proliferation of stubs files.

---
 stubs/Makefile.objs     |  5 +----
 stubs/fdset-add-fd.c    |  8 --------
 stubs/fdset-find-fd.c   |  8 --------
 stubs/fdset-get-fd.c    |  8 --------
 stubs/fdset-remove-fd.c |  7 -------
 stubs/fdset.c           | 22 ++++++++++++++++++++++
 6 files changed, 23 insertions(+), 35 deletions(-)
 delete mode 100644 stubs/fdset-add-fd.c
 delete mode 100644 stubs/fdset-find-fd.c
 delete mode 100644 stubs/fdset-get-fd.c
 delete mode 100644 stubs/fdset-remove-fd.c
 create mode 100644 stubs/fdset.c
stubs/Makefile.objs +1 -4
index 1eec1fb..40b4e15 100644
@@ -10,10 +10,7 @@ stub-obj-y += cpu-get-clock.o
 stub-obj-y += cpu-get-icount.o
 stub-obj-y += dump.o
 stub-obj-y += error-printf.o
-stub-obj-y += fdset-add-fd.o
-stub-obj-y += fdset-find-fd.o
-stub-obj-y += fdset-get-fd.o
-stub-obj-y += fdset-remove-fd.o
+stub-obj-y += fdset.o
 stub-obj-y += gdbstub.o
 stub-obj-y += get-vm-name.o
 stub-obj-y += iothread.o
stubs/fdset-add-fd.c deleted +0 -8
deleted file mode 100644
index bf9e60a..0000000
@@ -1,8 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "monitor/monitor.h"
-
-int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd)
-{
-    return -1;
-}
stubs/fdset-find-fd.c deleted +0 -8
deleted file mode 100644
index 1d9caf3..0000000
@@ -1,8 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "monitor/monitor.h"
-
-int monitor_fdset_dup_fd_find(int dup_fd)
-{
-    return -1;
-}
stubs/fdset-get-fd.c deleted +0 -8
deleted file mode 100644
index 5325044..0000000
@@ -1,8 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "monitor/monitor.h"
-
-int monitor_fdset_get_fd(int64_t fdset_id, int flags)
-{
-    return -1;
-}
stubs/fdset-remove-fd.c deleted +0 -7
deleted file mode 100644
index 47ea297..0000000
@@ -1,7 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "monitor/monitor.h"
-
-void monitor_fdset_dup_fd_remove(int dupfd)
-{
-}
stubs/fdset.c new file +22 -0
new file mode 100644
index 0000000..6020cf2
@@ -0,0 +1,22 @@
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "monitor/monitor.h"
+
+int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd)
+{
+    return -1;
+}
+
+int monitor_fdset_dup_fd_find(int dup_fd)
+{
+    return -1;
+}
+
+int monitor_fdset_get_fd(int64_t fdset_id, int flags)
+{
+    return -1;
+}
+
+void monitor_fdset_dup_fd_remove(int dupfd)
+{
+}
Signature · 1 line
2.9.3
#12 lore raw

[Qemu-devel] [PULL 12/32] stubs: move vhost stubs to stubs/vhost.o

In reply to Paolo Bonzini

No need to include them in libqemustub.a, since only system emulators need them.

---
 hw/Makefile.objs                        | 2 +-
 hw/virtio/Makefile.objs                 | 6 +++++-
 stubs/vhost.c => hw/virtio/vhost-stub.c | 0
 stubs/Makefile.objs                     | 1 -
 4 files changed, 6 insertions(+), 3 deletions(-)
 rename stubs/vhost.c => hw/virtio/vhost-stub.c (100%)
hw/Makefile.objs +1 -1
index 2a73ae5..7be399e 100644
@@ -29,7 +29,7 @@ devices-dirs-$(CONFIG_SOFTMMU) += timer/
 devices-dirs-$(CONFIG_TPM) += tpm/
 devices-dirs-$(CONFIG_SOFTMMU) += usb/
 devices-dirs-$(CONFIG_SOFTMMU) += vfio/
-devices-dirs-$(CONFIG_VIRTIO) += virtio/
+devices-dirs-$(CONFIG_SOFTMMU) += virtio/
 devices-dirs-$(CONFIG_SOFTMMU) += watchdog/
 devices-dirs-$(CONFIG_SOFTMMU) += xen/
 devices-dirs-$(CONFIG_MEM_HOTPLUG) += mem/
hw/virtio/Makefile.objs +5 -1
index 95c4c30..765d363 100644
@@ -1,3 +1,4 @@
+ifeq ($(CONFIG_VIRTIO),y)
 common-obj-y += virtio-rng.o
 common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
 common-obj-y += virtio-bus.o
@@ -5,7 +6,10 @@ common-obj-y += virtio-mmio.o
 
 obj-y += virtio.o virtio-balloon.o 
 obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o
-
 obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o
 obj-y += virtio-crypto.o
 obj-$(CONFIG_VIRTIO_PCI) += virtio-crypto-pci.o
+endif
+
+common-obj-$(call lnot,$(CONFIG_LINUX)) += vhost-stub.o
+common-obj-$(CONFIG_ALL) += vhost-stub.o
hw/virtio/vhost-stub.c renamed from stubs/vhost.c +0 -0
similarity index 100%
rename from stubs/vhost.c
rename to hw/virtio/vhost-stub.c
stubs/Makefile.objs +0 -1
index 40b4e15..0b642d7 100644
@@ -35,7 +35,6 @@ stub-obj-y += kvm.o
 stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
-stub-obj-y += vhost.o
 stub-obj-y += iohandler.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += migration-colo.o
Signature · 1 line
2.9.3
#13 lore raw

[Qemu-devel] [PULL 13/32] event_notifier: cleanups around event_notifier_set_handler

In reply to Paolo Bonzini

Remove the useless is_external argument. Since the iohandler AioContext is never used for block devices, aio_disable_external is never called on it. This lets us remove stubs/iohandler.c.

---
 hw/usb/ccid-card-emulated.c   |  2 +-
 hw/virtio/virtio.c            | 10 +++++-----
 include/qemu/event_notifier.h |  3 ---
 include/qemu/main-loop.h      | 15 +++++++++++++++
 iohandler.c                   |  8 ++++++++
 stubs/Makefile.objs           |  1 -
 stubs/iohandler.c             |  8 --------
 target/i386/hyperv.c          |  7 ++++---
 util/event_notifier-posix.c   |  9 ---------
 util/event_notifier-win32.c   | 12 ------------
 10 files changed, 33 insertions(+), 42 deletions(-)
 delete mode 100644 stubs/iohandler.c
hw/usb/ccid-card-emulated.c +1 -1
index eceb5f3..9962786 100644
@@ -407,7 +407,7 @@ static int init_event_notifier(EmulatedState *card)
         DPRINTF(card, 2, "event notifier creation failed\n");
         return -1;
     }
-    event_notifier_set_handler(&card->notifier, false, card_event_handler);
+    event_notifier_set_handler(&card->notifier, card_event_handler);
     return 0;
 }
 
hw/virtio/virtio.c +5 -5
index aa4f38f..a181514 100644
@@ -2090,10 +2090,10 @@ void virtio_queue_set_guest_notifier_fd_handler(VirtQueue *vq, bool assign,
                                                 bool with_irqfd)
 {
     if (assign && !with_irqfd) {
-        event_notifier_set_handler(&vq->guest_notifier, false,
+        event_notifier_set_handler(&vq->guest_notifier,
                                    virtio_queue_guest_notifier_read);
     } else {
-        event_notifier_set_handler(&vq->guest_notifier, false, NULL);
+        event_notifier_set_handler(&vq->guest_notifier, NULL);
     }
     if (!assign) {
         /* Test and clear notifier before closing it,
@@ -2262,7 +2262,7 @@ static int virtio_device_start_ioeventfd_impl(VirtIODevice *vdev)
             err = r;
             goto assign_error;
         }
-        event_notifier_set_handler(&vq->host_notifier, true,
+        event_notifier_set_handler(&vq->host_notifier,
                                    virtio_queue_host_notifier_read);
     }
 
@@ -2283,7 +2283,7 @@ assign_error:
             continue;
         }
 
-        event_notifier_set_handler(&vq->host_notifier, true, NULL);
+        event_notifier_set_handler(&vq->host_notifier, NULL);
         r = virtio_bus_set_host_notifier(qbus, n, false);
         assert(r >= 0);
     }
@@ -2309,7 +2309,7 @@ static void virtio_device_stop_ioeventfd_impl(VirtIODevice *vdev)
         if (!virtio_queue_get_num(vdev, n)) {
             continue;
         }
-        event_notifier_set_handler(&vq->host_notifier, true, NULL);
+        event_notifier_set_handler(&vq->host_notifier, NULL);
         r = virtio_bus_set_host_notifier(qbus, n, false);
         assert(r >= 0);
     }
include/qemu/event_notifier.h +0 -3
index e326990..599c99f 100644
@@ -34,9 +34,6 @@ int event_notifier_init(EventNotifier *, int active);
 void event_notifier_cleanup(EventNotifier *);
 int event_notifier_set(EventNotifier *);
 int event_notifier_test_and_clear(EventNotifier *);
-int event_notifier_set_handler(EventNotifier *,
-                               bool is_external,
-                               EventNotifierHandler *);
 
 #ifdef CONFIG_POSIX
 void event_notifier_init_fd(EventNotifier *, int fd);
include/qemu/main-loop.h +15 -0
index a9d4f23..d7e24af 100644
@@ -203,6 +203,21 @@ void qemu_set_fd_handler(int fd,
                          IOHandler *fd_write,
                          void *opaque);
 
+
+/**
+ * event_notifier_set_handler: Register an EventNotifier with the main loop
+ *
+ * This function tells the main loop to wake up whenever the
+ * #EventNotifier was set.
+ *
+ * @e: The #EventNotifier to be observed.
+ *
+ * @handler: A level-triggered callback that is fired when @e
+ * has been set.  @e is passed to it as a parameter.
+ */
+void event_notifier_set_handler(EventNotifier *e,
+                                EventNotifierHandler *handler);
+
 GSource *iohandler_get_g_source(void);
 AioContext *iohandler_get_aio_context(void);
 #ifdef CONFIG_POSIX
iohandler.c +8 -0
index eb625d9..623b55b 100644
@@ -66,6 +66,14 @@ void qemu_set_fd_handler(int fd,
                        fd_read, fd_write, NULL, opaque);
 }
 
+void event_notifier_set_handler(EventNotifier *e,
+                                EventNotifierHandler *handler)
+{
+    iohandler_init();
+    aio_set_event_notifier(iohandler_ctx, e, false,
+                           handler, NULL);
+}
+
 /* reaping of zombies.  right now we're not passing the status to
    anyone, but it would be possible to add a callback.  */
 #ifndef _WIN32
stubs/Makefile.objs +0 -1
index 0b642d7..e863d9a 100644
@@ -35,6 +35,5 @@ stub-obj-y += kvm.o
 stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
-stub-obj-y += iohandler.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += migration-colo.o
stubs/iohandler.c deleted +0 -8
deleted file mode 100644
index 22b0ee5..0000000
@@ -1,8 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "qemu/main-loop.h"
-
-AioContext *iohandler_get_aio_context(void)
-{
-    abort();
-}
target/i386/hyperv.c +4 -3
index 39a230f..8545574 100644
@@ -12,6 +12,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/main-loop.h"
 #include "hyperv.h"
 #include "standard-headers/asm-x86/hyperv.h"
 
@@ -88,7 +89,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint,
         goto err_sint_set_notifier;
     }
 
-    event_notifier_set_handler(&sint_route->sint_ack_notifier, false,
+    event_notifier_set_handler(&sint_route->sint_ack_notifier,
                                kvm_hv_sint_ack_handler);
 
     gsi = kvm_irqchip_add_hv_sint_route(kvm_state, vcpu_id, sint);
@@ -112,7 +113,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint,
 err_irqfd:
     kvm_irqchip_release_virq(kvm_state, gsi);
 err_gsi:
-    event_notifier_set_handler(&sint_route->sint_ack_notifier, false, NULL);
+    event_notifier_set_handler(&sint_route->sint_ack_notifier, NULL);
     event_notifier_cleanup(&sint_route->sint_ack_notifier);
 err_sint_set_notifier:
     event_notifier_cleanup(&sint_route->sint_set_notifier);
@@ -128,7 +129,7 @@ void kvm_hv_sint_route_destroy(HvSintRoute *sint_route)
                                           &sint_route->sint_set_notifier,
                                           sint_route->gsi);
     kvm_irqchip_release_virq(kvm_state, sint_route->gsi);
-    event_notifier_set_handler(&sint_route->sint_ack_notifier, false, NULL);
+    event_notifier_set_handler(&sint_route->sint_ack_notifier, NULL);
     event_notifier_cleanup(&sint_route->sint_ack_notifier);
     event_notifier_cleanup(&sint_route->sint_set_notifier);
     g_free(sint_route);
util/event_notifier-posix.c +0 -9
index f2aacfc..7e40252 100644
@@ -90,15 +90,6 @@ int event_notifier_get_fd(const EventNotifier *e)
     return e->rfd;
 }
 
-int event_notifier_set_handler(EventNotifier *e,
-                               bool is_external,
-                               EventNotifierHandler *handler)
-{
-    aio_set_fd_handler(iohandler_get_aio_context(), e->rfd, is_external,
-                       (IOHandler *)handler, NULL, NULL, e);
-    return 0;
-}
-
 int event_notifier_set(EventNotifier *e)
 {
     static const uint64_t value = 1;
util/event_notifier-win32.c +0 -12
index de87df0..519fb59 100644
@@ -32,18 +32,6 @@ HANDLE event_notifier_get_handle(EventNotifier *e)
     return e->event;
 }
 
-int event_notifier_set_handler(EventNotifier *e,
-                               bool is_external,
-                               EventNotifierHandler *handler)
-{
-    if (handler) {
-        return qemu_add_wait_object(e->event, (IOHandler *)handler, e);
-    } else {
-        qemu_del_wait_object(e->event, (IOHandler *)handler, e);
-        return 0;
-    }
-}
-
 int event_notifier_set(EventNotifier *e)
 {
     SetEvent(e->event);
Signature · 1 line
2.9.3
#14 lore raw

[Qemu-devel] [PULL 14/32] build: remove --enable-colo/--disable-colo

In reply to Paolo Bonzini

No need to provide this knob, so remove it and stubs/migration-colo.c.

---
 configure               | 11 -----------
 migration/Makefile.objs |  3 +--
 stubs/Makefile.objs     |  1 -
 stubs/migration-colo.c  | 46 ----------------------------------------------
 4 files changed, 1 insertion(+), 60 deletions(-)
 delete mode 100644 stubs/migration-colo.c
configure +0 -11
index 86f5214..9879c65 100755
@@ -228,7 +228,6 @@ vhost_net="no"
 vhost_scsi="no"
 vhost_vsock="no"
 kvm="no"
-colo="yes"
 rdma=""
 gprof="no"
 debug_tcg="no"
@@ -920,10 +919,6 @@ for opt do
   ;;
   --enable-kvm) kvm="yes"
   ;;
-  --disable-colo) colo="no"
-  ;;
-  --enable-colo) colo="yes"
-  ;;
   --disable-tcg-interpreter) tcg_interpreter="no"
   ;;
   --enable-tcg-interpreter) tcg_interpreter="yes"
@@ -1372,7 +1367,6 @@ disabled with --disable-FEATURE, default is enabled if available:
   fdt             fdt device tree
   bluez           bluez stack connectivity
   kvm             KVM acceleration support
-  colo            COarse-grain LOck-stepping VM for Non-stop Service
   rdma            RDMA-based migration support
   vde             support for vde network
   netmap          support for netmap network
@@ -5062,7 +5056,6 @@ echo "Linux AIO support $linux_aio"
 echo "ATTR/XATTR support $attr"
 echo "Install blobs     $blobs"
 echo "KVM support       $kvm"
-echo "COLO support      $colo"
 echo "RDMA support      $rdma"
 echo "TCG interpreter   $tcg_interpreter"
 echo "fdt support       $fdt"
@@ -5701,10 +5694,6 @@ if have_backend "syslog"; then
 fi
 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
 
-if test "$colo" = "yes"; then
-  echo "CONFIG_COLO=y" >> $config_host_mak
-fi
-
 if test "$rdma" = "yes" ; then
   echo "CONFIG_RDMA=y" >> $config_host_mak
 fi
migration/Makefile.objs +1 -2
index 3f3e237..480dd49 100644
@@ -1,7 +1,6 @@
 common-obj-y += migration.o socket.o fd.o exec.o
 common-obj-y += tls.o
-common-obj-y += colo-comm.o
-common-obj-$(CONFIG_COLO) += colo.o colo-failover.o
+common-obj-y += colo-comm.o colo.o colo-failover.o
 common-obj-y += vmstate.o
 common-obj-y += qemu-file.o
 common-obj-y += qemu-file-channel.o
stubs/Makefile.objs +0 -1
index e863d9a..a7d3b72 100644
@@ -36,4 +36,3 @@ stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
 stub-obj-y += pc_madt_cpu_entry.o
-stub-obj-y += migration-colo.o
stubs/migration-colo.c deleted +0 -46

46 lines not on this page · raw message

Signature · 1 line
2.9.3
#15 lore raw

[Qemu-devel] [PULL 15/32] stubs: remove stubs/kvm.c

In reply to Paolo Bonzini

This has a single function, just move it to the other target/*/kvm.c files.

---
 stubs/Makefile.objs | 1 -
 stubs/kvm.c         | 8 --------
 target/mips/kvm.c   | 5 +++++
 target/ppc/kvm.c    | 5 +++++
 target/s390x/kvm.c  | 5 +++++
 5 files changed, 15 insertions(+), 9 deletions(-)
 delete mode 100644 stubs/kvm.c
stubs/Makefile.objs +0 -1
index a7d3b72..a187295 100644
@@ -31,7 +31,6 @@ stub-obj-y += uuid.o
 stub-obj-y += vm-stop.o
 stub-obj-y += vmstate.o
 stub-obj-$(CONFIG_WIN32) += fd-register.o
-stub-obj-y += kvm.o
 stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
stubs/kvm.c deleted +0 -8
deleted file mode 100644
index ddd6204..0000000
@@ -1,8 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "sysemu/kvm.h"
-
-int kvm_arch_irqchip_create(MachineState *ms, KVMState *s)
-{
-    return 0;
-}
target/mips/kvm.c +5 -0
index dcf5fbb..998c341 100644
@@ -55,6 +55,11 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
     return 0;
 }
 
+int kvm_arch_irqchip_create(MachineState *ms, KVMState *s)
+{
+    return 0;
+}
+
 int kvm_arch_init_vcpu(CPUState *cs)
 {
     MIPSCPU *cpu = MIPS_CPU(cs);
target/ppc/kvm.c +5 -0
index 9c4834c..6c53a6d 100644
@@ -145,6 +145,11 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
     return 0;
 }
 
+int kvm_arch_irqchip_create(MachineState *ms, KVMState *s)
+{
+    return 0;
+}
+
 static int kvm_arch_sync_sregs(PowerPCCPU *cpu)
 {
     CPUPPCState *cenv = &cpu->env;
target/s390x/kvm.c +5 -0
index 97afe02..e938954 100644
@@ -294,6 +294,11 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
     return 0;
 }
 
+int kvm_arch_irqchip_create(MachineState *ms, KVMState *s)
+{
+    return 0;
+}
+
 unsigned long kvm_arch_vcpu_id(CPUState *cpu)
 {
     return cpu->cpu_index;
Signature · 1 line
2.9.3
#16 lore raw

[Qemu-devel] [PULL 16/32] acpi: filter based on CONFIG_ACPI_X86 rather than TARGET

In reply to Paolo Bonzini

Copy the mechanism of hw/smbios/smbios-stub.c to implement an ACPI-stub instead, so that -acpitable can be later extended to ARM.

---
 arch_init.c                | 13 -------------
 hw/Makefile.objs           |  2 +-
 hw/acpi/Makefile.objs      |  7 ++++++-
 hw/acpi/acpi-stub.c        | 29 +++++++++++++++++++++++++++++
 include/sysemu/arch_init.h |  1 -
 vl.c                       |  3 ++-
 6 files changed, 38 insertions(+), 17 deletions(-)
 create mode 100644 hw/acpi/acpi-stub.c
arch_init.c +0 -13
index 34e7694..6c4e287 100644
@@ -234,19 +234,6 @@ void audio_init(void)
     }
 }
 
-void do_acpitable_option(const QemuOpts *opts)
-{
-#ifdef TARGET_I386
-    Error *err = NULL;
-
-    acpi_table_add(opts, &err);
-    if (err) {
-        error_reportf_err(err, "Wrong acpi table provided: ");
-        exit(1);
-    }
-#endif
-}
-
 int kvm_available(void)
 {
 #ifdef CONFIG_KVM
hw/Makefile.objs +1 -1
index 7be399e..a2c61f6 100644
@@ -1,5 +1,5 @@
 devices-dirs-$(call land, $(CONFIG_VIRTIO),$(call land,$(CONFIG_VIRTFS),$(CONFIG_PCI))) += 9pfs/
-devices-dirs-$(CONFIG_ACPI) += acpi/
+devices-dirs-$(CONFIG_SOFTMMU) += acpi/
 devices-dirs-$(CONFIG_SOFTMMU) += adc/
 devices-dirs-$(CONFIG_SOFTMMU) += audio/
 devices-dirs-$(CONFIG_SOFTMMU) += block/
hw/acpi/Makefile.objs +6 -1
index dfc8229..6acf798 100644
@@ -1,9 +1,11 @@
+ifeq ($(CONFIG_ACPI),y)
 common-obj-$(CONFIG_ACPI_X86) += core.o piix4.o pcihp.o
 common-obj-$(CONFIG_ACPI_X86_ICH) += ich9.o tco.o
 common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu_hotplug.o
 common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o
 common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu.o
 common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o
+common-obj-$(call lnot,$(CONFIG_ACPI_X86)) += acpi-stub.o
 
 common-obj-y += acpi_interface.o
 common-obj-y += bios-linker-loader.o
@@ -11,4 +13,7 @@ common-obj-y += aml-build.o
 
 common-obj-$(CONFIG_IPMI) += ipmi.o
 common-obj-$(call lnot,$(CONFIG_IPMI)) += ipmi-stub.o
-common-obj-$(CONFIG_ALL) += ipmi-stub.o
+else
+common-obj-y += acpi-stub.o
+endif
+common-obj-$(CONFIG_ALL) += acpi-stub.o ipmi-stub.o
hw/acpi/acpi-stub.c new file +29 -0
new file mode 100644
index 0000000..26bd22f
@@ -0,0 +1,29 @@
+/*
+ * ACPI stubs for platforms that don't support ACPI.
+ *
+ * Copyright (c) 2006 Fabrice Bellard
+ * Copyright (c) 2016 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/qmp/qerror.h"
+#include "qmp-commands.h"
+#include "hw/acpi/acpi.h"
+
+void acpi_table_add(const QemuOpts *opts, Error **errp)
+{
+    error_setg(errp, QERR_UNSUPPORTED);
+}
include/sysemu/arch_init.h +0 -1
index 88dcf77..20b01e3 100644
@@ -28,7 +28,6 @@ enum {
 extern const uint32_t arch_type;
 
 void select_soundhw(const char *optarg);
-void do_acpitable_option(const QemuOpts *opts);
 void audio_init(void);
 int kvm_available(void);
 int xen_available(void);
vl.c +2 -1
index a2aff23..a52c5f2 100644
@@ -65,6 +65,7 @@ int main(int argc, char **argv)
 #include "hw/bt.h"
 #include "sysemu/watchdog.h"
 #include "hw/smbios/smbios.h"
+#include "hw/acpi/acpi.h"
 #include "hw/xen/xen.h"
 #include "hw/qdev.h"
 #include "hw/loader.h"
@@ -3657,7 +3658,7 @@ int main(int argc, char **argv, char **envp)
                 if (!opts) {
                     exit(1);
                 }
-                do_acpitable_option(opts);
+                acpi_table_add(opts, &error_fatal);
                 break;
             case QEMU_OPTION_smbios:
                 opts = qemu_opts_parse_noisily(qemu_find_opts("smbios"),
Signature · 1 line
2.9.3
#17 lore raw

[Qemu-devel] [PULL 17/32] pc: fix crash in rtc_set_memory() if initial cpu is marked as hotplugged

In reply to Paolo Bonzini

From: Igor Mammedov <[email protected]>

'hotplugged' propperty is meant to be used on migration side when migrating source with hotplugged devices.
However though it not exacly correct usage of 'hotplugged' property it's possible to set generic hotplugged property for CPU using
-cpu foo,hotplugged=on
or
-global foo.hotplugged=on

in this case qemu crashes with following backtrace:

...

because pc_cpu_plug() assumes that hotplugged CPU could appear only after rtc/fw_cfg are initialized.
Fix crash by replacing assumption with explicit checks of rtc/fw_cfg and updating them only if they were initialized.

Message-Id: <[email protected]>

---
 hw/i386/pc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/i386/pc.c +3 -1
index 25e8586..f721fde 100644
@@ -1820,8 +1820,10 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev,
 
     /* increment the number of CPUs */
     pcms->boot_cpus++;
-    if (dev->hotplugged) {
+    if (pcms->rtc) {
         rtc_set_cpus_count(pcms->rtc, pcms->boot_cpus);
+    }
+    if (pcms->fw_cfg) {
         fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus);
     }
 
Signature · 1 line
2.9.3
#18 lore raw

[Qemu-devel] [PULL 18/32] scsi-block: fix direction of BYTCHK test for VERIFY commands

In reply to Paolo Bonzini

The direction is wrong; scsi_block_is_passthrough returns false for commands that *can* use sglists.

Fixes 8fdc7839e40f43a426bc7e858cf1dbfe315a3804
---
 hw/scsi/scsi-disk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/scsi-disk.c +1 -1
index bdd1e5f..c080888 100644
@@ -2701,7 +2701,7 @@ static bool scsi_block_is_passthrough(SCSIDiskState *s, uint8_t *buf)
          * for the number of logical blocks specified in the length
          * field).  For other modes, do not use scatter/gather operation.
          */
-        if ((buf[1] & 6) != 2) {
+        if ((buf[1] & 6) == 2) {
             return false;
         }
         break;
Signature · 1 line
2.9.3
#19 lore raw

[Qemu-devel] [PULL 19/32] serial: fix memory leak in serial exit

In reply to Paolo Bonzini

From: Li Qiang <[email protected]>

The serial_exit_core function doesn't free some resources. This can lead memory leak when hotplug and unplug. This patch avoid this.

Message-Id: <[email protected]>

---
 hw/char/serial.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
hw/char/serial.c +10 -0
index ffbacd8..67b18ed 100644
@@ -906,6 +906,16 @@ void serial_realize_core(SerialState *s, Error **errp)
 void serial_exit_core(SerialState *s)
 {
     qemu_chr_fe_deinit(&s->chr);
+
+    timer_del(s->modem_status_poll);
+    timer_free(s->modem_status_poll);
+
+    timer_del(s->fifo_timeout_timer);
+    timer_free(s->fifo_timeout_timer);
+
+    fifo8_destroy(&s->recv_fifo);
+    fifo8_destroy(&s->xmit_fifo);
+
     qemu_unregister_reset(serial_reset, s);
 }
 
Signature · 1 line
2.9.3
#20 lore raw

[Qemu-devel] [PULL 20/32] qemu-thread: fix qemu_thread_set_name() race in qemu_thread_create()

In reply to Paolo Bonzini

From: Caoxinhua <[email protected]>

QEMU will crash with the follow backtrace if the new created thread exited before we call qemu_thread_set_name() for it.

(gdb) bt
#0 0x00007f9a68b095d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x00007f9a68b0acc8 in __GI_abort () at abort.c:90
#2 0x00007f9a69cda389 in PAT_abort () from /usr/lib64/libuvpuserhotfix.so
#3 0x00007f9a69cdda0d in patchIllInsHandler () from /usr/lib64/libuvpuserhotfix.so
#4 <signal handler called>
#5 pthread_setname_np (th=140298470549248, name=name@entry=0x8cc74a "io-task-worker") at ../nptl/sysdeps/unix/sysv/linux/pthread_setname.c:49
#6 0x00000000007f5f20 in qemu_thread_set_name (thread=thread@entry=0x7ffd2ac09680, name=name@entry=0x8cc74a "io-task-worker") at util/qemu_thread_posix.c:459
#7 0x00000000007f679e in qemu_thread_create (thread=thread@entry=0x7ffd2ac09680, name=name@entry=0x8cc74a "io-task-worker",start_routine=start_routine@entry=0x7c1300 <qio_task_thread_worker>, arg=arg@entry=0x7f99b8001720, mode=mode@entry=1) at util/qemu_thread_posix.c:498 #8 0x00000000007c15b6 in qio_task_run_in_thread (task=task@entry=0x7f99b80033d0, worker=worker@entry=0x7bd920 <qio_channel_socket_connect_worker>, opaque=0x7f99b8003370, destroy=0x7c6220 <qapi_free_SocketAddress>) at io/task.c:133 #9 0x00000000007bda04 in qio_channel_socket_connect_async (ioc=0x7f99b80014c0, addr=0x37235d0, callback=callback@entry=0x54ad00 <qemu_chr_socket_connected>, opaque=opaque@entry=0x38118b0, destroy=destroy@entry=0x0) at io/channel_socket.c:191 #10 0x00000000005487f6 in socket_reconnect_timeout (opaque=0x38118b0) at qemu_char.c:4402
#11 0x00007f9a6a1533b3 in g_timeout_dispatch () from /usr/lib64/libglib-2.0.so.0
#12 0x00007f9a6a15299a in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#13 0x0000000000747386 in glib_pollfds_poll () at main_loop.c:227
#14 0x0000000000747424 in os_host_main_loop_wait (timeout=404000000) at main_loop.c:272
#15 0x0000000000747575 in main_loop_wait (nonblocking=nonblocking@entry=0) at main_loop.c:520
#16 0x0000000000557d31 in main_loop () at vl.c:2170
#17 0x000000000041c8b7 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:5083

Let's detach the new thread after calling qemu_thread_set_name().

Message-Id: <[email protected]>

---
 util/qemu-thread-posix.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
util/qemu-thread-posix.c +6 -6
index d20cdde..d31793d 100644
@@ -481,12 +481,6 @@ void qemu_thread_create(QemuThread *thread, const char *name,
     if (err) {
         error_exit(err, __func__);
     }
-    if (mode == QEMU_THREAD_DETACHED) {
-        err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-        if (err) {
-            error_exit(err, __func__);
-        }
-    }
 
     /* Leave signal handling to the iothread.  */
     sigfillset(&set);
@@ -499,6 +493,12 @@ void qemu_thread_create(QemuThread *thread, const char *name,
         qemu_thread_set_name(thread, name);
     }
 
+    if (mode == QEMU_THREAD_DETACHED) {
+        err = pthread_detach(thread->thread);
+        if (err) {
+            error_exit(err, __func__);
+        }
+    }
     pthread_sigmask(SIG_SETMASK, &oldset, NULL);
 
     pthread_attr_destroy(&attr);
Signature · 1 line
2.9.3
#21 lore raw

[Qemu-devel] [PULL 21/32] hxtool: emit Texinfo headings as @subsection

In reply to Paolo Bonzini

Remove the colon, and add it in qemu-options-wrapper.h instead. The introduction of @subsection also found a case where the table was not closed and reopened around a heading, so fix it.

---
 qemu-options-wrapper.h |  2 +-
 qemu-options.hx        | 31 +++++++++++++++++++------------
 scripts/hxtool         | 11 +++++++++--
 3 files changed, 29 insertions(+), 15 deletions(-)
qemu-options-wrapper.h +1 -1
index 13bfea0..4d7aeb1 100644
@@ -14,7 +14,7 @@
 
 #define ARCHHEADING(text, arch_mask) \
     if ((arch_mask) & arch_type)    \
-        puts(stringify(text));
+        puts(stringify(text) ":");
 
 #define DEFHEADING(text) ARCHHEADING(text, QEMU_ARCH_ALL)
 
qemu-options.hx +19 -12
index c534a2f..b62d2d7 100644
@@ -6,7 +6,7 @@ HXCOMM construct option structures, enums and help message for specified
 HXCOMM architectures.
 HXCOMM HXCOMM can be used for comments, discarded from both texi and C
 
-DEFHEADING(Standard options:)
+DEFHEADING(Standard options)
 STEXI
 @table @option
 ETEXI
@@ -468,7 +468,7 @@ STEXI
 ETEXI
 DEFHEADING()
 
-DEFHEADING(Block device options:)
+DEFHEADING(Block device options)
 STEXI
 @table @option
 ETEXI
@@ -856,7 +856,7 @@ STEXI
 ETEXI
 DEFHEADING()
 
-DEFHEADING(USB options:)
+DEFHEADING(USB options)
 STEXI
 @table @option
 ETEXI
@@ -920,7 +920,7 @@ STEXI
 ETEXI
 DEFHEADING()
 
-DEFHEADING(Display options:)
+DEFHEADING(Display options)
 STEXI
 @table @option
 ETEXI
@@ -1449,7 +1449,7 @@ STEXI
 ETEXI
 ARCHHEADING(, QEMU_ARCH_I386)
 
-ARCHHEADING(i386 target only:, QEMU_ARCH_I386)
+ARCHHEADING(i386 target only, QEMU_ARCH_I386)
 STEXI
 @table @option
 ETEXI
@@ -1565,7 +1565,7 @@ STEXI
 ETEXI
 DEFHEADING()
 
-DEFHEADING(Network options:)
+DEFHEADING(Network options)
 STEXI
 @table @option
 ETEXI
@@ -2146,7 +2146,7 @@ STEXI
 ETEXI
 DEFHEADING()
 
-DEFHEADING(Character device options:)
+DEFHEADING(Character device options)
 STEXI
 
 The general form of a character device option is:
@@ -2481,7 +2481,7 @@ STEXI
 ETEXI
 DEFHEADING()
 
-DEFHEADING(Device URL Syntax:)
+DEFHEADING(Device URL Syntax)
 STEXI
 
 In addition to using normal file images for the emulated storage devices,
@@ -2711,7 +2711,7 @@ STEXI
 @end table
 ETEXI
 
-DEFHEADING(Bluetooth(R) options:)
+DEFHEADING(Bluetooth(R) options)
 STEXI
 @table @option
 ETEXI
@@ -2787,7 +2787,7 @@ ETEXI
 DEFHEADING()
 
 #ifdef CONFIG_TPM
-DEFHEADING(TPM device options:)
+DEFHEADING(TPM device options)
 
 DEF("tpmdev", HAS_ARG, QEMU_OPTION_tpmdev, \
     "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n"
@@ -2861,7 +2861,7 @@ DEFHEADING()
 
 #endif
 
-DEFHEADING(Linux/Multiboot boot specific:)
+DEFHEADING(Linux/Multiboot boot specific)
 STEXI
 
 When using these options, you can use a given Linux or Multiboot
@@ -2917,7 +2917,7 @@ STEXI
 ETEXI
 DEFHEADING()
 
-DEFHEADING(Debug/Expert options:)
+DEFHEADING(Debug/Expert options)
 STEXI
 @table @option
 ETEXI
@@ -3775,7 +3775,14 @@ Dump json-encoded vmstate information for current machine type to file
 in @var{file}
 ETEXI
 
+STEXI
+@end table
+ETEXI
+DEFHEADING()
 DEFHEADING(Generic object creation)
+STEXI
+@table @option
+ETEXI
 
 DEF("object", HAS_ARG, QEMU_OPTION_object,
     "-object TYPENAME[,PROP1=VALUE1,...]\n"
scripts/hxtool +9 -2
index 04f7d7b..5468cd7 100644
@@ -16,6 +16,13 @@ hxtoh()
     done
 }
 
+print_texi_heading()
+{
+    if test "$*" != ""; then
+        printf "@subsection %s\n" "$*"
+    fi
+}
+
 hxtotexi()
 {
     flag=0
@@ -45,10 +52,10 @@ hxtotexi()
             fi
             ;;
             DEFHEADING*)
-            printf '%s\n' "$(expr "$str" : "DEFHEADING(\(.*\))")"
+            print_texi_heading "$(expr "$str" : "DEFHEADING(\(.*\))")"
             ;;
             ARCHHEADING*)
-            printf '%s\n' "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")"
+            print_texi_heading "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")"
             ;;
             *)
             test $flag -eq 1 && printf '%s\n' "$str"
Signature · 1 line
2.9.3
#22 lore raw

[Qemu-devel] [PULL 22/32] x86: ioapic: add traces for ioapic

In reply to Paolo Bonzini

From: Peter Xu <[email protected]>

Quoted 1 line

From time to time, there are issues with ioapic, either on guest side or

on hypervisor side. Good to have some persistent traces for better triaging and debugging.

Message-Id: <[email protected]>

---
 hw/intc/ioapic.c     | 17 +++++++++++++++--
 hw/intc/trace-events |  7 +++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
hw/intc/ioapic.c +15 -2
index ea7ea0b..d1254f8 100644
@@ -33,6 +33,7 @@
 #include "target/i386/cpu.h"
 #include "hw/i386/apic-msidef.h"
 #include "hw/i386/x86-iommu.h"
+#include "trace.h"
 
 //#define DEBUG_IOAPIC
 
@@ -115,6 +116,7 @@ static void ioapic_service(IOAPICCommonState *s)
                     s->irr &= ~mask;
                 } else {
                     coalesce = s->ioredtbl[i] & IOAPIC_LVT_REMOTE_IRR;
+                    trace_ioapic_set_remote_irr(i);
                     s->ioredtbl[i] |= IOAPIC_LVT_REMOTE_IRR;
                 }
 
@@ -220,6 +222,8 @@ void ioapic_eoi_broadcast(int vector)
     uint64_t entry;
     int i, n;
 
+    trace_ioapic_eoi_broadcast(vector);
+
     for (i = 0; i < MAX_IOAPICS; i++) {
         s = ioapics[i];
         if (!s) {
@@ -229,6 +233,7 @@ void ioapic_eoi_broadcast(int vector)
             entry = s->ioredtbl[n];
             if ((entry & IOAPIC_LVT_REMOTE_IRR)
                 && (entry & IOAPIC_VECTOR_MASK) == vector) {
+                trace_ioapic_clear_remote_irr(n, vector);
                 s->ioredtbl[n] = entry & ~IOAPIC_LVT_REMOTE_IRR;
                 if (!(entry & IOAPIC_LVT_MASKED) && (s->irr & (1 << n))) {
                     ioapic_service(s);
@@ -256,7 +261,9 @@ ioapic_mem_read(void *opaque, hwaddr addr, unsigned int size)
     int index;
     uint32_t val = 0;
 
-    switch (addr & 0xff) {
+    addr &= 0xff;
+
+    switch (addr) {
     case IOAPIC_IOREGSEL:
         val = s->ioregsel;
         break;
@@ -286,6 +293,9 @@ ioapic_mem_read(void *opaque, hwaddr addr, unsigned int size)
         DPRINTF("read: %08x = %08x\n", s->ioregsel, val);
         break;
     }
+
+    trace_ioapic_mem_read(addr, size, val);
+
     return val;
 }
 
@@ -324,7 +334,10 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val,
     IOAPICCommonState *s = opaque;
     int index;
 
-    switch (addr & 0xff) {
+    addr &= 0xff;
+    trace_ioapic_mem_write(addr, size, val);
+
+    switch (addr) {
     case IOAPIC_IOREGSEL:
         s->ioregsel = val;
         break;
hw/intc/trace-events +7 -0
index 340f617..180b893 100644
@@ -14,6 +14,13 @@ apic_deliver_irq(uint8_t dest, uint8_t dest_mode, uint8_t delivery_mode, uint8_t
 apic_mem_readl(uint64_t addr, uint32_t val)  "%"PRIx64" = %08x"
 apic_mem_writel(uint64_t addr, uint32_t val) "%"PRIx64" = %08x"
 
+# hw/intc/ioapic.c
+ioapic_set_remote_irr(int n) "set remote irr for pin %d"
+ioapic_clear_remote_irr(int n, int vector) "clear remote irr for pin %d vector %d"
+ioapic_eoi_broadcast(int vector) "EOI broadcast for vector %d"
+ioapic_mem_read(uint8_t addr, uint8_t size, uint32_t val) "ioapic mem read addr 0x%"PRIx8" size 0x%"PRIx8" retval 0x%"PRIx32
+ioapic_mem_write(uint8_t addr, uint8_t size, uint32_t val) "ioapic mem write addr 0x%"PRIx8" size 0x%"PRIx8" val 0x%"PRIx32
+
 # hw/intc/slavio_intctl.c
 slavio_intctl_mem_readl(uint32_t cpu, uint64_t addr, uint32_t ret) "read cpu %d reg 0x%"PRIx64" = %x"
 slavio_intctl_mem_writel(uint32_t cpu, uint64_t addr, uint32_t val) "write cpu %d reg 0x%"PRIx64" = %x"
Signature · 1 line
2.9.3
#23 lore raw

[Qemu-devel] [PULL 23/32] x86: ioapic: dump version for "info ioapic"

In reply to Paolo Bonzini

From: Peter Xu <[email protected]>

Message-Id: <[email protected]>

---
 hw/intc/ioapic_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/intc/ioapic_common.c +2 -1
index 1b7ec5e..97c4f9c 100644
@@ -58,7 +58,8 @@ void ioapic_print_redtbl(Monitor *mon, IOAPICCommonState *s)
     uint32_t remote_irr = 0;
     int i;
 
-    monitor_printf(mon, "ioapic id=0x%02x sel=0x%02x", s->id, s->ioregsel);
+    monitor_printf(mon, "ioapic ver=0x%x id=0x%02x sel=0x%02x",
+                   s->version, s->id, s->ioregsel);
     if (s->ioregsel) {
         monitor_printf(mon, " (redir[%u])\n",
                        (s->ioregsel - IOAPIC_REG_REDTBL_BASE) >> 1);
Signature · 1 line
2.9.3
#24 lore raw

[Qemu-devel] [PULL 24/32] x86: ioapic: fix fail migration when irqchip=split

In reply to Paolo Bonzini

From: Peter Xu <[email protected]>

Split irqchip works based on the fact that we kept the first 24 gsi routing entries inside KVM for userspace ioapic's use. When system boot, we'll reserve these MSI routing entries before hand. However, after migration, we forgot to re-configure it up in the destination side. The result is, we'll get invalid gsi routing entries after migration (all empty), and we get interrupts with vector=0, then strange things happen, like keyboard hang.

The solution is simple - we update them after migration, which is a one line fix.

Message-Id: <[email protected]>

---
 hw/intc/ioapic.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/intc/ioapic.c +5 -0
index d1254f8..9047b89 100644
@@ -439,6 +439,11 @@ static void ioapic_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     k->realize = ioapic_realize;
+    /*
+     * If APIC is in kernel, we need to update the kernel cache after
+     * migration, otherwise first 24 gsi routes will be invalid.
+     */
+    k->post_load = ioapic_update_kvm_routes;
     dc->reset = ioapic_reset_common;
     dc->props = ioapic_properties;
 }
Signature · 1 line
2.9.3
#25 lore raw

[Qemu-devel] [PULL 25/32] exec: Add missing rcu_read_unlock

In reply to Paolo Bonzini

From: Roman Kapl <[email protected]>

rcu_read_unlock was not called if the address_space_access_valid result is negative.

This caused (at least) a problem when qemu on PPC/E500+TAP failed to terminate properly and instead got stuck in a deadlock.

Message-Id: <[email protected]>

---
 exec.c | 1 +
 1 file changed, 1 insertion(+)
exec.c +1 -0
index 47835c1..c95ae33 100644
@@ -2960,6 +2960,7 @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_
         if (!memory_access_is_direct(mr, is_write)) {
             l = memory_access_size(mr, l, addr);
             if (!memory_region_access_valid(mr, xlat, l, is_write)) {
+                rcu_read_unlock();
                 return false;
             }
         }
Signature · 1 line
2.9.3
#26 lore raw

[Qemu-devel] [PULL 26/32] char: fix ctrl-a b not working

In reply to Paolo Bonzini

From: Marc-André Lureau <[email protected]>

CharDriverState.be should be updated to point to the current associated backend.

Fix the regression introduced in the "mux" chardev from commit a4afa548fc6dd9842ed86639b4d37d4d1c4ad480.

https://bugs.launchpad.net/bugs/1654137

Message-Id: <[email protected]>

---
 qemu-char.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
qemu-char.c +10 -5
index 2c9940c..676944a 100644
@@ -499,7 +499,7 @@ void qemu_chr_fe_printf(CharBackend *be, const char *fmt, ...)
 
 static void remove_fd_in_watch(CharDriverState *chr);
 static void mux_chr_set_handlers(CharDriverState *chr, GMainContext *context);
-static void mux_set_focus(MuxDriver *d, int focus);
+static void mux_set_focus(CharDriverState *chr, int focus);
 
 static int null_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
 {
@@ -666,7 +666,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch)
         case 'c':
             assert(d->mux_cnt > 0); /* handler registered with first fe */
             /* Switch to the next registered device */
-            mux_set_focus(d, (d->focus + 1) % d->mux_cnt);
+            mux_set_focus(chr, (d->focus + 1) % d->mux_cnt);
             break;
         case 't':
             d->timestamps = !d->timestamps;
@@ -826,8 +826,10 @@ static void mux_chr_set_handlers(CharDriverState *chr, GMainContext *context)
                              context, true);
 }
 
-static void mux_set_focus(MuxDriver *d, int focus)
+static void mux_set_focus(CharDriverState *chr, int focus)
 {
+    MuxDriver *d = chr->opaque;
+
     assert(focus >= 0);
     assert(focus < d->mux_cnt);
 
@@ -836,6 +838,7 @@ static void mux_set_focus(MuxDriver *d, int focus)
     }
 
     d->focus = focus;
+    chr->be = d->backends[focus];
     mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_IN);
 }
 
@@ -935,7 +938,9 @@ void qemu_chr_fe_deinit(CharBackend *b)
 
     if (b->chr) {
         qemu_chr_fe_set_handlers(b, NULL, NULL, NULL, NULL, NULL, true);
-        b->chr->be = NULL;
+        if (b->chr->be == b) {
+            b->chr->be = NULL;
+        }
         if (b->chr->is_mux) {
             MuxDriver *d = b->chr->opaque;
             d->backends[b->tag] = NULL;
@@ -999,7 +1004,7 @@ void qemu_chr_fe_take_focus(CharBackend *b)
     }
 
     if (b->chr->is_mux) {
-        mux_set_focus(b->chr->opaque, b->tag);
+        mux_set_focus(b->chr, b->tag);
     }
 }
 
Signature · 1 line
2.9.3
#27 lore raw

[Qemu-devel] [PULL 27/32] ramblock-notifier: new

In reply to Paolo Bonzini

This adds a notify interface of ram block additions and removals.

---
 exec.c                  |  5 ++++
 include/exec/memory.h   |  6 +----
 include/exec/ram_addr.h | 46 ++-----------------------------
 include/exec/ramlist.h  | 72 +++++++++++++++++++++++++++++++++++++++++++++++++
 numa.c                  | 29 ++++++++++++++++++++
 xen-mapcache.c          |  3 +++
 6 files changed, 112 insertions(+), 49 deletions(-)
 create mode 100644 include/exec/ramlist.h
exec.c +5 -0
index c95ae33..067c51b 100644
@@ -1687,6 +1687,7 @@ static void ram_block_add(RAMBlock *new_block, Error **errp)
         qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE);
         /* MADV_DONTFORK is also needed by KVM in absence of synchronous MMU */
         qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK);
+        ram_block_notify_add(new_block->host, new_block->max_length);
     }
 }
 
@@ -1817,6 +1818,10 @@ void qemu_ram_free(RAMBlock *block)
         return;
     }
 
+    if (block->host) {
+        ram_block_notify_remove(block->host, block->max_length);
+    }
+
     qemu_mutex_lock_ramlist();
     QLIST_REMOVE_RCU(block, next);
     ram_list.mru_block = NULL;
include/exec/memory.h +1 -5
index bec9756..a10044f 100644
@@ -16,16 +16,12 @@
 
 #ifndef CONFIG_USER_ONLY
 
-#define DIRTY_MEMORY_VGA       0
-#define DIRTY_MEMORY_CODE      1
-#define DIRTY_MEMORY_MIGRATION 2
-#define DIRTY_MEMORY_NUM       3        /* num of dirty bits */
-
 #include "exec/cpu-common.h"
 #ifndef CONFIG_USER_ONLY
 #include "exec/hwaddr.h"
 #endif
 #include "exec/memattrs.h"
+#include "exec/ramlist.h"
 #include "qemu/queue.h"
 #include "qemu/int128.h"
 #include "qemu/notify.h"
include/exec/ram_addr.h +2 -44

65 lines not on this page · raw message

include/exec/ramlist.h new file +72 -0

72 lines not on this page · raw message

numa.c +29 -0
index 379bc8a..9f56be9 100644
@@ -25,6 +25,7 @@
 #include "qemu/osdep.h"
 #include "sysemu/numa.h"
 #include "exec/cpu-common.h"
+#include "exec/ramlist.h"
 #include "qemu/bitmap.h"
 #include "qom/cpu.h"
 #include "qemu/error-report.h"
@@ -572,3 +573,31 @@ int numa_get_node_for_cpu(int idx)
     }
     return i;
 }
+
+void ram_block_notifier_add(RAMBlockNotifier *n)
+{
+    QLIST_INSERT_HEAD(&ram_list.ramblock_notifiers, n, next);
+}
+
+void ram_block_notifier_remove(RAMBlockNotifier *n)
+{
+    QLIST_REMOVE(n, next);
+}
+
+void ram_block_notify_add(void *host, size_t size)
+{
+    RAMBlockNotifier *notifier;
+
+    QLIST_FOREACH(notifier, &ram_list.ramblock_notifiers, next) {
+        notifier->ram_block_added(notifier, host, size);
+    }
+}
+
+void ram_block_notify_remove(void *host, size_t size)
+{
+    RAMBlockNotifier *notifier;
+
+    QLIST_FOREACH(notifier, &ram_list.ramblock_notifiers, next) {
+        notifier->ram_block_removed(notifier, host, size);
+    }
+}
xen-mapcache.c +3 -0
index 8f3a592..31debdf 100644
@@ -163,6 +163,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
     err = g_malloc0(nb_pfn * sizeof (int));
 
     if (entry->vaddr_base != NULL) {
+        ram_block_notify_remove(entry->vaddr_base, entry->size);
         if (munmap(entry->vaddr_base, entry->size) != 0) {
             perror("unmap fails");
             exit(-1);
@@ -188,6 +189,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
     entry->valid_mapping = (unsigned long *) g_malloc0(sizeof(unsigned long) *
             BITS_TO_LONGS(size >> XC_PAGE_SHIFT));
 
+    ram_block_notify_add(entry->vaddr_base, entry->size);
     bitmap_zero(entry->valid_mapping, nb_pfn);
     for (i = 0; i < nb_pfn; i++) {
         if (!err[i]) {
@@ -397,6 +399,7 @@ static void xen_invalidate_map_cache_entry_unlocked(uint8_t *buffer)
     }
 
     pentry->next = entry->next;
+    ram_block_notify_remove(entry->vaddr_base, entry->size);
     if (munmap(entry->vaddr_base, entry->size) != 0) {
         perror("unmap fails");
         exit(-1);
Signature · 1 line
2.9.3
#28 lore raw

[Qemu-devel] [PULL 28/32] kvm: move cpu synchronization code

In reply to Paolo Bonzini

From: Vincent Palatin <[email protected]>

Move the generic cpu_synchronize_ functions to the common hw_accel.h header, in order to prepare for the addition of a second hardware accelerator.

Message-Id: <f5c3cffe8d520011df1c2e5437bb814989b48332.1484045952.git.vpalatin@chromium.org>

---
 cpus.c                      |  1 +
 gdbstub.c                   |  1 +
 hw/i386/kvm/apic.c          |  1 +
 hw/i386/kvmvapic.c          |  1 +
 hw/misc/vmport.c            |  2 +-
 hw/ppc/pnv_xscom.c          |  2 +-
 hw/ppc/ppce500_spin.c       |  4 ++--
 hw/ppc/spapr.c              |  2 +-
 hw/ppc/spapr_hcall.c        |  2 +-
 hw/s390x/s390-pci-inst.c    |  1 +
 include/sysemu/hw_accel.h   | 39 +++++++++++++++++++++++++++++++++++++++
 include/sysemu/kvm.h        | 23 -----------------------
 monitor.c                   |  2 +-
 qom/cpu.c                   |  2 +-
 target/arm/cpu.c            |  2 +-
 target/i386/helper.c        |  1 +
 target/i386/kvm.c           |  1 +
 target/ppc/kvm.c            |  2 +-
 target/ppc/mmu-hash64.c     |  2 +-
 target/ppc/translate_init.c |  2 +-
 target/s390x/gdbstub.c      |  1 +
 21 files changed, 59 insertions(+), 35 deletions(-)
 create mode 100644 include/sysemu/hw_accel.h
cpus.c +1 -0
index 5213351..fc78502 100644
@@ -33,6 +33,7 @@
 #include "sysemu/block-backend.h"
 #include "exec/gdbstub.h"
 #include "sysemu/dma.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/kvm.h"
 #include "qmp-commands.h"
 #include "exec/exec-all.h"
gdbstub.c +1 -0
index de62d26..de9b62b 100644
@@ -32,6 +32,7 @@
 #define MAX_PACKET_LENGTH 4096
 
 #include "qemu/sockets.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/kvm.h"
 #include "exec/semihost.h"
 #include "exec/exec-all.h"
hw/i386/kvm/apic.c +1 -0
index df5180b..1df6d26 100644
@@ -14,6 +14,7 @@
 #include "cpu.h"
 #include "hw/i386/apic_internal.h"
 #include "hw/pci/msi.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/kvm.h"
 #include "target/i386/kvm_i386.h"
 
hw/i386/kvmvapic.c +1 -0
index b30d1b9..2f767b6 100644
@@ -14,6 +14,7 @@
 #include "exec/exec-all.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/cpus.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/kvm.h"
 #include "hw/i386/apic_internal.h"
 #include "hw/sysbus.h"
hw/misc/vmport.c +1 -1
index c763811..be40930 100644
@@ -25,7 +25,7 @@
 #include "hw/hw.h"
 #include "hw/isa/isa.h"
 #include "hw/i386/pc.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "hw/qdev.h"
 
 //#define VMPORT_DEBUG
hw/ppc/pnv_xscom.c +1 -1
index b82af4f..38bc85f 100644
@@ -20,7 +20,7 @@
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "qemu/log.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "target/ppc/cpu.h"
 #include "hw/sysbus.h"
 
hw/ppc/ppce500_spin.c +2 -2
index cf958a9..eb219ab 100644
@@ -29,9 +29,9 @@
 
 #include "qemu/osdep.h"
 #include "hw/hw.h"
-#include "sysemu/sysemu.h"
 #include "hw/sysbus.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
+#include "sysemu/sysemu.h"
 #include "e500.h"
 
 #define MAX_CPUS 32
hw/ppc/spapr.c +1 -1
index 208ef7b..a642e66 100644
@@ -36,7 +36,7 @@
 #include "sysemu/device_tree.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/cpus.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "kvm_ppc.h"
 #include "migration/migration.h"
 #include "mmu-hash64.h"
hw/ppc/spapr_hcall.c +1 -1
index 9a9bedf..b2a8e48 100644
@@ -1,5 +1,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/sysemu.h"
 #include "qemu/log.h"
 #include "cpu.h"
@@ -9,7 +10,6 @@
 #include "mmu-hash64.h"
 #include "cpu-models.h"
 #include "trace.h"
-#include "sysemu/kvm.h"
 #include "kvm_ppc.h"
 #include "hw/ppc/spapr_ovec.h"
 
hw/s390x/s390-pci-inst.c +1 -0
index 0864d9b..4d0775c 100644
@@ -18,6 +18,7 @@
 #include "s390-pci-bus.h"
 #include "exec/memory-internal.h"
 #include "qemu/error-report.h"
+#include "sysemu/hw_accel.h"
 
 /* #define DEBUG_S390PCI_INST */
 #ifdef DEBUG_S390PCI_INST
include/sysemu/hw_accel.h new file +39 -0
new file mode 100644
index 0000000..03812cf
@@ -0,0 +1,39 @@
+/*
+ * QEMU Hardware accelertors support
+ *
+ * Copyright 2016 Google, Inc.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_HW_ACCEL_H
+#define QEMU_HW_ACCEL_H
+
+#include "qom/cpu.h"
+#include "sysemu/hax.h"
+#include "sysemu/kvm.h"
+
+static inline void cpu_synchronize_state(CPUState *cpu)
+{
+    if (kvm_enabled()) {
+        kvm_cpu_synchronize_state(cpu);
+    }
+}
+
+static inline void cpu_synchronize_post_reset(CPUState *cpu)
+{
+    if (kvm_enabled()) {
+        kvm_cpu_synchronize_post_reset(cpu);
+    }
+}
+
+static inline void cpu_synchronize_post_init(CPUState *cpu)
+{
+    if (kvm_enabled()) {
+        kvm_cpu_synchronize_post_init(cpu);
+    }
+}
+
+#endif /* QEMU_HW_ACCEL_H */
include/sysemu/kvm.h +0 -23
index df67cc0..3045ee7 100644
@@ -461,29 +461,6 @@ void kvm_cpu_synchronize_state(CPUState *cpu);
 void kvm_cpu_synchronize_post_reset(CPUState *cpu);
 void kvm_cpu_synchronize_post_init(CPUState *cpu);
 
-/* generic hooks - to be moved/refactored once there are more users */
-
-static inline void cpu_synchronize_state(CPUState *cpu)
-{
-    if (kvm_enabled()) {
-        kvm_cpu_synchronize_state(cpu);
-    }
-}
-
-static inline void cpu_synchronize_post_reset(CPUState *cpu)
-{
-    if (kvm_enabled()) {
-        kvm_cpu_synchronize_post_reset(cpu);
-    }
-}
-
-static inline void cpu_synchronize_post_init(CPUState *cpu)
-{
-    if (kvm_enabled()) {
-        kvm_cpu_synchronize_post_init(cpu);
-    }
-}
-
 /**
  * kvm_irqchip_add_msi_route - Add MSI route for specific vector
  * @s:      KVM state
monitor.c +1 -1
index 0841d43..d38956f 100644
@@ -50,7 +50,7 @@
 #include "sysemu/balloon.h"
 #include "qemu/timer.h"
 #include "migration/migration.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "qemu/acl.h"
 #include "sysemu/tpm.h"
 #include "qapi/qmp/qerror.h"
qom/cpu.c +1 -1
index 03d9190..2c5274f 100644
@@ -22,7 +22,7 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "qom/cpu.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "qemu/notify.h"
 #include "qemu/log.h"
 #include "exec/log.h"
target/arm/cpu.c +1 -1
index f5cb30a..f7f20d3 100644
@@ -31,7 +31,7 @@
 #endif
 #include "hw/arm/arm.h"
 #include "sysemu/sysemu.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "kvm_arm.h"
 
 static void arm_cpu_set_pc(CPUState *cs, vaddr value)
target/i386/helper.c +1 -0
index 43e87dd..19b2656 100644
@@ -24,6 +24,7 @@
 #include "kvm_i386.h"
 #ifndef CONFIG_USER_ONLY
 #include "sysemu/sysemu.h"
+#include "sysemu/hw_accel.h"
 #include "monitor/monitor.h"
 #include "hw/i386/apic_internal.h"
 #endif
target/i386/kvm.c +1 -0
index 10a9cd8..e6c4f75 100644
@@ -23,6 +23,7 @@
 #include "qemu-common.h"
 #include "cpu.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/kvm_int.h"
 #include "kvm_i386.h"
 #include "hyperv.h"
target/ppc/kvm.c +1 -1
index 6c53a6d..ec92c64 100644
@@ -26,7 +26,7 @@
 #include "cpu.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "sysemu/numa.h"
 #include "kvm_ppc.h"
 #include "sysemu/cpus.h"
target/ppc/mmu-hash64.c +1 -1
index fdb7a78..0efc8c6 100644
@@ -23,7 +23,7 @@
 #include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 #include "qemu/error-report.h"
-#include "sysemu/kvm.h"
+#include "sysemu/hw_accel.h"
 #include "kvm_ppc.h"
 #include "mmu-hash64.h"
 #include "exec/log.h"
target/ppc/translate_init.c +1 -1
index 19ef250..b0c65b9 100644
@@ -21,10 +21,10 @@
 #include "qemu/osdep.h"
 #include "disas/bfd.h"
 #include "exec/gdbstub.h"
-#include "sysemu/kvm.h"
 #include "kvm_ppc.h"
 #include "sysemu/arch_init.h"
 #include "sysemu/cpus.h"
+#include "sysemu/hw_accel.h"
 #include "cpu-models.h"
 #include "mmu-hash32.h"
 #include "mmu-hash64.h"
target/s390x/gdbstub.c +1 -0
index 3d223de..3c652fb 100644
@@ -23,6 +23,7 @@
 #include "exec/exec-all.h"
 #include "exec/gdbstub.h"
 #include "qemu/bitops.h"
+#include "sysemu/hw_accel.h"
 
 int s390_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
 {
Signature · 1 line
2.9.3
#29 lore raw

[Qemu-devel] [PULL 30/32] Plumb the HAXM-based hardware acceleration support

In reply to Paolo Bonzini

From: Vincent Palatin <[email protected]>

Use the Intel HAX is kernel-based hardware acceleration module for Windows (similar to KVM on Linux).

Based on the "target/i386: Add Intel HAX to android emulator" patch from David Chou <[email protected]>

Message-Id: <7b9cae28a0c379ab459c7a8545c9a39762bd394f.1484045952.git.vpalatin@chromium.org>

[Drop hax_populate_ram stub. - Paolo]
---
 Makefile.target           |  1 +
 configure                 | 18 +++++++++++
 cpus.c                    | 78 ++++++++++++++++++++++++++++++++++++++++++++++-
 hax-stub.c                |  5 ---
 hw/intc/apic_common.c     |  3 +-
 include/qom/cpu.h         |  5 +++
 include/sysemu/hw_accel.h |  9 ++++++
 qemu-options.hx           | 11 +++++++
 target/i386/Makefile.objs |  4 +++
 util/qemu-thread-win32.c  |  4 +--
 vl.c                      | 15 +++++++--
 11 files changed, 141 insertions(+), 12 deletions(-)
Makefile.target +1 -0
index 9e8edd9..fa2b151 100644
@@ -97,6 +97,7 @@ obj-y += target/$(TARGET_BASE_ARCH)/
 obj-y += disas.o
 obj-y += tcg-runtime.o
 obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
+obj-$(call lnot,$(CONFIG_HAX)) += hax-stub.o
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
 
 obj-$(CONFIG_LIBDECNUMBER) += libdecnumber/decContext.o
configure +18 -0
index 9879c65..091ae05 100755
@@ -228,6 +228,7 @@ vhost_net="no"
 vhost_scsi="no"
 vhost_vsock="no"
 kvm="no"
+hax="no"
 rdma=""
 gprof="no"
 debug_tcg="no"
@@ -561,6 +562,7 @@ CYGWIN*)
 ;;
 MINGW32*)
   mingw32="yes"
+  hax="yes"
   audio_possible_drivers="dsound sdl"
   if check_include dsound.h; then
     audio_drv_list="dsound"
@@ -610,6 +612,7 @@ OpenBSD)
 Darwin)
   bsd="yes"
   darwin="yes"
+  hax="yes"
   LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
   if [ "$cpu" = "x86_64" ] ; then
     QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
@@ -919,6 +922,10 @@ for opt do
   ;;
   --enable-kvm) kvm="yes"
   ;;
+  --disable-hax) hax="no"
+  ;;
+  --enable-hax) hax="yes"
+  ;;
   --disable-tcg-interpreter) tcg_interpreter="no"
   ;;
   --enable-tcg-interpreter) tcg_interpreter="yes"
@@ -1367,6 +1374,7 @@ disabled with --disable-FEATURE, default is enabled if available:
   fdt             fdt device tree
   bluez           bluez stack connectivity
   kvm             KVM acceleration support
+  hax             HAX acceleration support
   rdma            RDMA-based migration support
   vde             support for vde network
   netmap          support for netmap network
@@ -5056,6 +5064,7 @@ echo "Linux AIO support $linux_aio"
 echo "ATTR/XATTR support $attr"
 echo "Install blobs     $blobs"
 echo "KVM support       $kvm"
+echo "HAX support       $hax"
 echo "RDMA support      $rdma"
 echo "TCG interpreter   $tcg_interpreter"
 echo "fdt support       $fdt"
@@ -6039,6 +6048,15 @@ case "$target_name" in
       fi
     fi
 esac
+if test "$hax" = "yes" ; then
+  if test "$target_softmmu" = "yes" ; then
+    case "$target_name" in
+    i386|x86_64)
+      echo "CONFIG_HAX=y" >> $config_target_mak
+    ;;
+    esac
+  fi
+fi
 if test "$target_bigendian" = "yes" ; then
   echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
 fi
cpus.c +77 -1

114 lines not on this page · raw message

hax-stub.c +0 -5
index a532dba..c0e6f89 100644
@@ -23,11 +23,6 @@ int hax_sync_vcpus(void)
     return 0;
 }
 
-int hax_populate_ram(uint64_t va, uint32_t size)
-{
-    return -ENOSYS;
-}
-
 int hax_init_vcpu(CPUState *cpu)
 {
     return -ENOSYS;
hw/intc/apic_common.c +2 -1
index d78c885..3945dfd 100644
@@ -26,6 +26,7 @@
 #include "hw/i386/apic.h"
 #include "hw/i386/apic_internal.h"
 #include "trace.h"
+#include "sysemu/hax.h"
 #include "sysemu/kvm.h"
 #include "hw/qdev.h"
 #include "hw/sysbus.h"
@@ -316,7 +317,7 @@ static void apic_common_realize(DeviceState *dev, Error **errp)
 
     /* Note: We need at least 1M to map the VAPIC option ROM */
     if (!vapic && s->vapic_control & VAPIC_ENABLE_MASK &&
-        ram_size >= 1024 * 1024) {
+        !hax_enabled() && ram_size >= 1024 * 1024) {
         vapic = sysbus_create_simple("kvmvapic", -1, NULL);
     }
     s->vapic = vapic;
include/qom/cpu.h +5 -0
index 3f79a8e..ca4d0fb 100644
@@ -227,6 +227,8 @@ struct CPUWatchpoint {
 struct KVMState;
 struct kvm_run;
 
+struct hax_vcpu_state;
+
 #define TB_JMP_CACHE_BITS 12
 #define TB_JMP_CACHE_SIZE (1 << TB_JMP_CACHE_BITS)
 
@@ -392,6 +394,9 @@ struct CPUState {
        (absolute value) offset as small as possible.  This reduces code
        size, especially for hosts without large memory offsets.  */
     uint32_t tcg_exit_req;
+
+    bool hax_vcpu_dirty;
+    struct hax_vcpu_state *hax_vcpu;
 };
 
 QTAILQ_HEAD(CPUTailQ, CPUState);
include/sysemu/hw_accel.h +9 -0
index 03812cf..c9b3105 100644
@@ -20,6 +20,9 @@ static inline void cpu_synchronize_state(CPUState *cpu)
     if (kvm_enabled()) {
         kvm_cpu_synchronize_state(cpu);
     }
+    if (hax_enabled()) {
+        hax_cpu_synchronize_state(cpu);
+    }
 }
 
 static inline void cpu_synchronize_post_reset(CPUState *cpu)
@@ -27,6 +30,9 @@ static inline void cpu_synchronize_post_reset(CPUState *cpu)
     if (kvm_enabled()) {
         kvm_cpu_synchronize_post_reset(cpu);
     }
+    if (hax_enabled()) {
+        hax_cpu_synchronize_post_reset(cpu);
+    }
 }
 
 static inline void cpu_synchronize_post_init(CPUState *cpu)
@@ -34,6 +40,9 @@ static inline void cpu_synchronize_post_init(CPUState *cpu)
     if (kvm_enabled()) {
         kvm_cpu_synchronize_post_init(cpu);
     }
+    if (hax_enabled()) {
+        hax_cpu_synchronize_post_init(cpu);
+    }
 }
 
 #endif /* QEMU_HW_ACCEL_H */
qemu-options.hx +11 -0
index b62d2d7..80df526 100644
@@ -3280,6 +3280,17 @@ Enable KVM full virtualization support. This option is only available
 if KVM support is enabled when compiling.
 ETEXI
 
+DEF("enable-hax", 0, QEMU_OPTION_enable_hax, \
+    "-enable-hax     enable HAX virtualization support\n", QEMU_ARCH_I386)
+STEXI
+@item -enable-hax
+@findex -enable-hax
+Enable HAX (Hardware-based Acceleration eXecution) support. This option
+is only available if HAX support is enabled when compiling. HAX is only
+applicable to MAC and Windows platform, and thus does not conflict with
+KVM.
+ETEXI
+
 DEF("xen-domid", HAS_ARG, QEMU_OPTION_xen_domid,
     "-xen-domid id   specify xen guest domain id\n", QEMU_ARCH_ALL)
 DEF("xen-create", 0, QEMU_OPTION_xen_create,
target/i386/Makefile.objs +4 -0
index b223d79..acbe7b0 100644
@@ -5,3 +5,7 @@ obj-y += gdbstub.o
 obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o monitor.o
 obj-$(CONFIG_KVM) += kvm.o hyperv.o
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
+# HAX support
+ifdef CONFIG_WIN32
+obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-windows.o
+endif
util/qemu-thread-win32.c +2 -2
index 728e76b..95d4ba4 100644
@@ -497,8 +497,8 @@ HANDLE qemu_thread_get_handle(QemuThread *thread)
 
     EnterCriticalSection(&data->cs);
     if (!data->exited) {
-        handle = OpenThread(SYNCHRONIZE | THREAD_SUSPEND_RESUME, FALSE,
-                            thread->tid);
+        handle = OpenThread(SYNCHRONIZE | THREAD_SUSPEND_RESUME |
+                            THREAD_SET_CONTEXT, FALSE, thread->tid);
     } else {
         handle = NULL;
     }
vl.c +12 -3
index a52c5f2..a260f30 100644
@@ -93,6 +93,7 @@ int main(int argc, char **argv)
 #include "sysemu/cpus.h"
 #include "migration/colo.h"
 #include "sysemu/kvm.h"
+#include "sysemu/hax.h"
 #include "qapi/qmp/qjson.h"
 #include "qemu/option.h"
 #include "qemu/config-file.h"
@@ -1913,7 +1914,7 @@ static void main_loop(void)
     int64_t ti;
 #endif
     do {
-        nonblocking = !kvm_enabled() && !xen_enabled() && last_io > 0;
+        nonblocking = tcg_enabled() && last_io > 0;
 #ifdef CONFIG_PROFILER
         ti = profile_getclock();
 #endif
@@ -3679,6 +3680,10 @@ int main(int argc, char **argv, char **envp)
                 olist = qemu_find_opts("machine");
                 qemu_opts_parse_noisily(olist, "accel=kvm", false);
                 break;
+            case QEMU_OPTION_enable_hax:
+                olist = qemu_find_opts("machine");
+                qemu_opts_parse_noisily(olist, "accel=hax", false);
+                break;
             case QEMU_OPTION_M:
             case QEMU_OPTION_machine:
                 olist = qemu_find_opts("machine");
@@ -4373,8 +4378,8 @@ int main(int argc, char **argv, char **envp)
 
     cpu_ticks_init();
     if (icount_opts) {
-        if (kvm_enabled() || xen_enabled()) {
-            error_report("-icount is not allowed with kvm or xen");
+        if (!tcg_enabled()) {
+            error_report("-icount is not allowed with hardware virtualization");
             exit(1);
         }
         configure_icount(icount_opts, &error_abort);
@@ -4510,6 +4515,10 @@ int main(int argc, char **argv, char **envp)
 
     numa_post_machine_init();
 
+    if (hax_enabled()) {
+        hax_sync_vcpus();
+    }
+
     if (qemu_opts_foreach(qemu_find_opts("fw_cfg"),
                           parse_fw_cfg, fw_cfg_find(), NULL) != 0) {
         exit(1);
Signature · 1 line
2.9.3
#30 lore raw

[Qemu-devel] [PULL 32/32] Revert "win32: don't run subprocess tests on Mingw32 platform"

In reply to Paolo Bonzini

From: Marc-André Lureau <[email protected]>

This reverts commit 7ad9339e372fcd12d584684d7f52ac259604a4f4.

The error "Failed to execute helper program (No such file or directory)" is due to broken glib installation, missing windows gspawn helpers.

Message-Id: <[email protected]>

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index 091ae05..1f2ee71 100755
@@ -3079,7 +3079,7 @@ fi
 
 # g_test_trap_subprocess added in 2.38. Used by some tests.
 glib_subprocess=yes
-if test "$mingw32" = "yes" || ! $pkg_config --atleast-version=2.38 glib-2.0; then
+if ! $pkg_config --atleast-version=2.38 glib-2.0; then
     glib_subprocess=no
 fi
 
Signature · 1 line
2.9.3
#31 lore raw

[Qemu-devel] [PULL 31/32] hax: add Darwin support

In reply to Paolo Bonzini

From: Vincent Palatin <[email protected]>

Re-add the MacOSX/Darwin support:
Use the Intel HAX is kernel-based hardware acceleration module (similar to KVM on Linux).

Based on the original "target/i386: Add Intel HAX to android emulator" patch from David Chou <[email protected]> from emu-2.2-release branch in the external/qemu-android repository.

Message-Id: <81b85c3032da902e73e77302af508b4b1a7c0ead.1484045952.git.vpalatin@chromium.org>

---
 target/i386/Makefile.objs |   3 +
 target/i386/hax-darwin.c  | 316 ++++++++++++++++++++++++++++++++++++++++++++++
 target/i386/hax-darwin.h  |  63 +++++++++
 target/i386/hax-i386.h    |   8 ++
 4 files changed, 390 insertions(+)
 create mode 100644 target/i386/hax-darwin.c
 create mode 100644 target/i386/hax-darwin.h
target/i386/Makefile.objs +3 -0
index acbe7b0..4fcb7f3 100644
@@ -9,3 +9,6 @@ obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
 ifdef CONFIG_WIN32
 obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-windows.o
 endif
+ifdef CONFIG_DARWIN
+obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-darwin.o
+endif
target/i386/hax-darwin.c new file +316 -0

316 lines not on this page · raw message

target/i386/hax-darwin.h new file +63 -0

63 lines not on this page · raw message

target/i386/hax-i386.h +8 -0
index bcbd105..8ffe91f 100644
@@ -16,6 +16,10 @@
 #include "cpu.h"
 #include "sysemu/hax.h"
 
+#ifdef CONFIG_DARWIN
+typedef int hax_fd;
+#endif
+
 #ifdef CONFIG_WIN32
 typedef HANDLE hax_fd;
 #endif
@@ -77,6 +81,10 @@ hax_fd hax_mod_open(void);
 void hax_memory_init(void);
 
 
+#ifdef CONFIG_DARWIN
+#include "target/i386/hax-darwin.h"
+#endif
+
 #ifdef CONFIG_WIN32
 #include "target/i386/hax-windows.h"
 #endif
Signature · 1 line
2.9.3
#32 lore raw

[Qemu-devel] [PULL 29/32] target/i386: Add Intel HAX files

In reply to Paolo Bonzini

From: Vincent Palatin <[email protected]>

That's a forward port of the core HAX interface code from the emu-2.2-release branch in the external/qemu-android repository as used by the Android emulator.

The original commit was "target/i386: Add Intel HAX to android emulator" saying:
"""
Backport of 2b3098ff27bab079caab9b46b58546b5036f5c0c
from studio-1.4-dev into emu-master-dev

Intel HAX (harware acceleration) will enhance android emulator performance in Windows and Mac OS X in the systems powered by Intel processors with "Intel Hardware Accelerated Execution Manager" package installed when user runs android emulator with Intel target.

"""

It has been modified to build and run along with the current code base. The formatting has been fixed to go through scripts/checkpatch.pl, and the DPRINTF macros have been updated to get the instanciations checked by the compiler.

The FPU registers saving/restoring has been updated to match the current QEMU registers layout.

The implementation has been simplified by doing the following modifications:
- removing the code for supporting the hardware without Unrestricted Guest (UG) mode (including all the code to fallback on TCG emulation).
- not including the Darwin support (which is not yet debugged/tested).
- simplifying the initialization by removing the leftovers from the Android specific code, then trimming down the remaining logic.
- removing the unused MemoryListener callbacks.

Message-Id: <e1023837f8d0e4c470f6c4a3bf643971b2bca5be.1484045952.git.vpalatin@chromium.org>

---
 hax-stub.c                  |   39 ++
 include/sysemu/hax.h        |   56 +++
 target/i386/hax-all.c       | 1155 +++++++++++++++++++++++++++++++++++++++++++
 target/i386/hax-i386.h      |   86 ++++
 target/i386/hax-interface.h |  361 ++++++++++++++
 target/i386/hax-mem.c       |  289 +++++++++++
 target/i386/hax-windows.c   |  479 ++++++++++++++++++
 target/i386/hax-windows.h   |   89 ++++
 8 files changed, 2554 insertions(+)
 create mode 100644 hax-stub.c
 create mode 100644 include/sysemu/hax.h
 create mode 100644 target/i386/hax-all.c
 create mode 100644 target/i386/hax-i386.h
 create mode 100644 target/i386/hax-interface.h
 create mode 100644 target/i386/hax-mem.c
 create mode 100644 target/i386/hax-windows.c
 create mode 100644 target/i386/hax-windows.h
hax-stub.c new file +39 -0
new file mode 100644
index 0000000..a532dba
@@ -0,0 +1,39 @@
+/*
+ * QEMU HAXM support
+ *
+ * Copyright (c) 2015, Intel Corporation
+ *
+ * Copyright 2016 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
+#include "sysemu/hax.h"
+
+int hax_sync_vcpus(void)
+{
+    return 0;
+}
+
+int hax_populate_ram(uint64_t va, uint32_t size)
+{
+    return -ENOSYS;
+}
+
+int hax_init_vcpu(CPUState *cpu)
+{
+    return -ENOSYS;
+}
+
+int hax_smp_cpu_exec(CPUState *cpu)
+{
+    return -ENOSYS;
+}
include/sysemu/hax.h new file +56 -0

56 lines not on this page · raw message

target/i386/hax-all.c new file +1155 -0

1,155 lines not on this page · raw message

target/i386/hax-i386.h new file +86 -0

86 lines not on this page · raw message

target/i386/hax-interface.h new file +361 -0

361 lines not on this page · raw message

target/i386/hax-mem.c new file +289 -0

289 lines not on this page · raw message

target/i386/hax-windows.c new file +479 -0

479 lines not on this page · raw message

target/i386/hax-windows.h new file +89 -0

89 lines not on this page · raw message

Signature · 1 line
2.9.3
#33 lore raw
In reply to Paolo Bonzini
Your series seems to have some coding style problems. See output below for more information:

Hi,

Your series seems to have some coding style problems. See output below for more information:

Subject: [Qemu-devel] [PULL v2 00/32] Misc patches for 2017-01-11
Message-id: [email protected]
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
9fa6fee Revert "win32: don't run subprocess tests on Mingw32 platform" 57cb1e8 hax: add Darwin support
854318e Plumb the HAXM-based hardware acceleration support
8b5d061 target/i386: Add Intel HAX files
c0f03d5 kvm: move cpu synchronization code
dd5a94e ramblock-notifier: new
31df959 char: fix ctrl-a b not working
a6edb6e exec: Add missing rcu_read_unlock
9d5f574 x86: ioapic: fix fail migration when irqchip=split
9f32b9d x86: ioapic: dump version for "info ioapic"
06292ef x86: ioapic: add traces for ioapic
482463e hxtool: emit Texinfo headings as @subsection
746cabc qemu-thread: fix qemu_thread_set_name() race in qemu_thread_create() 9316fcd serial: fix memory leak in serial exit
af2a443 scsi-block: fix direction of BYTCHK test for VERIFY commands 5697c78 pc: fix crash in rtc_set_memory() if initial cpu is marked as hotplugged 968c706 acpi: filter based on CONFIG_ACPI_X86 rather than TARGET 5cf1c1b stubs: remove stubs/kvm.c
f410666 build: remove --enable-colo/--disable-colo
e2b8154 event_notifier: cleanups around event_notifier_set_handler aad3b7b stubs: move vhost stubs to stubs/vhost.o
10e9a75 stubs: group all monitor_fdset_* functions in a single file e24f7f5 stubs: group stubs for user-mode emulation
da4e6c5 hw: move reset handlers from vl.c to hw/core
22d1a64 stubs: remove unused stub for serial_hd
21b3ae6 stubs: move acpi stubs to hw/acpi
3b51b10 stubs: move smbios stubs to hw/smbios
6f0af3a stubs: merge all monitor stubs in one file, remove monitor_cur_is_qmp stub 2fd2385 smbios: filter based on CONFIG_SMBIOS rather than TARGET caf9bec qom: Make all interface types abstract
cf91058 megasas: fix guest-triggered memory leak
b667112 bugfix: vm halt when in reset looping

=== OUTPUT BEGIN ===
Checking PATCH 1/32: bugfix: vm halt when in reset looping... Checking PATCH 2/32: megasas: fix guest-triggered memory leak... Checking PATCH 3/32: qom: Make all interface types abstract...
WARNING: line over 80 characters
#132: FILE: tests/device-introspect-test.c:174:
+ qtest_add_func("device/introspect/abstract-interfaces", test_abstract_interfaces);

total: 0 errors, 1 warnings, 105 lines checked

Your patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 4/32: smbios: filter based on CONFIG_SMBIOS rather than TARGET... Checking PATCH 5/32: stubs: merge all monitor stubs in one file, remove monitor_cur_is_qmp stub...
ERROR: do not initialise globals to 0 or NULL
#76: FILE: stubs/monitor.c:6:
+Monitor *cur_mon = NULL;

total: 1 errors, 0 warnings, 30 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 6/32: stubs: move smbios stubs to hw/smbios...
Checking PATCH 7/32: stubs: move acpi stubs to hw/acpi...
Checking PATCH 8/32: stubs: remove unused stub for serial_hd...
Checking PATCH 9/32: hw: move reset handlers from vl.c to hw/core...
Checking PATCH 10/32: stubs: group stubs for user-mode emulation...
Checking PATCH 11/32: stubs: group all monitor_fdset_* functions in a single file... Checking PATCH 12/32: stubs: move vhost stubs to stubs/vhost.o...
Checking PATCH 13/32: event_notifier: cleanups around event_notifier_set_handler... Checking PATCH 14/32: build: remove --enable-colo/--disable-colo...
Checking PATCH 15/32: stubs: remove stubs/kvm.c...
Checking PATCH 16/32: acpi: filter based on CONFIG_ACPI_X86 rather than TARGET... Checking PATCH 17/32: pc: fix crash in rtc_set_memory() if initial cpu is marked as hotplugged... Checking PATCH 18/32: scsi-block: fix direction of BYTCHK test for VERIFY commands... Checking PATCH 19/32: serial: fix memory leak in serial exit...
Checking PATCH 20/32: qemu-thread: fix qemu_thread_set_name() race in qemu_thread_create()... Checking PATCH 21/32: hxtool: emit Texinfo headings as @subsection...
Checking PATCH 22/32: x86: ioapic: add traces for ioapic...
Checking PATCH 23/32: x86: ioapic: dump version for "info ioapic"...
Checking PATCH 24/32: x86: ioapic: fix fail migration when irqchip=split... Checking PATCH 25/32: exec: Add missing rcu_read_unlock...
Checking PATCH 26/32: char: fix ctrl-a b not working...
Checking PATCH 27/32: ramblock-notifier: new...
Checking PATCH 28/32: kvm: move cpu synchronization code...
Checking PATCH 29/32: target/i386: Add Intel HAX files...
Checking PATCH 30/32: Plumb the HAXM-based hardware acceleration support... Checking PATCH 31/32: hax: add Darwin support...
Checking PATCH 32/32: Revert "win32: don't run subprocess tests on Mingw32 platform"... === OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#34 lore raw
In reply to Paolo Bonzini
Quoted 11 lines · Paolo Bonzini

The following changes since commit 2ccede18bd24fce5db83fef3674563a1f256717b:

Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.9-pull-request' into staging (2017-01-16 12:41:35 +0000)

are available in the git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 91c7e9f6b82804c6b53ecc5057d6b305b766ba49:

Revert "win32: don't run subprocess tests on Mingw32 platform" (2017-01-16 17:55:25 +0100)

Fails to build, ppc64be host:

In file included from /home/pm215/qemu/linux-headers/linux/kvm.h:13:0,

                 from /home/pm215/qemu/include/sysemu/kvm.h:23,
                 from /home/pm215/qemu/include/sysemu/hw_accel.h:16,
                 from /home/pm215/qemu/target/ppc/translate_init.c:27,
                 from /home/pm215/qemu/target/ppc/translate.c:6786:

/home/pm215/qemu/build/all/linux-headers/asm/kvm.h:320:0: error:
"KVM_INTERRUPT_SET" redefined [-Wer
ror]
#define KVM_INTERRUPT_SET -1U
^
In file included from /home/pm215/qemu/target/ppc/translate_init.c:24:0,

                 from /home/pm215/qemu/target/ppc/translate.c:6786:

/home/pm215/qemu/target/ppc/kvm_ppc.h:319:0: note: this is the location of the previous definition
#define KVM_INTERRUPT_SET -1
^
In file included from /home/pm215/qemu/linux-headers/linux/kvm.h:13:0,

                 from /home/pm215/qemu/include/sysemu/kvm.h:23,
                 from /home/pm215/qemu/include/sysemu/hw_accel.h:16,
                 from /home/pm215/qemu/target/ppc/translate_init.c:27,
                 from /home/pm215/qemu/target/ppc/translate.c:6786:

/home/pm215/qemu/build/all/linux-headers/asm/kvm.h:321:0: error:
"KVM_INTERRUPT_UNSET" redefined [-Werror]
#define KVM_INTERRUPT_UNSET -2U
^

thanks
-- PMM