diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-01-20 16:42:07 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-01-20 16:42:07 +0000 |
commit | 598cf1c805271564686f2d732b36f50c3c40dcdd (patch) | |
tree | f512a9398bba3023126b7303160a91c8d30b0adb /hw | |
parent | d1c82f7cc34443841095f490345f86c9d8baca34 (diff) | |
parent | abc62c89f3191774dbd600a2caec803cbf557160 (diff) |
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* 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)
* PC_COMPAT_2_8 fix (Marcelo)
* stronger bitmap assertions (Peter)
# gpg: Signature made Fri 20 Jan 2017 12:49:01 GMT
# gpg: using RSA key 0xBFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg: aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1
# Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83
* remotes/bonzini/tags/for-upstream: (35 commits)
pc.h: move x-mach-use-reliable-get-clock compat entry to PC_COMPAT_2_8
bitmap: assert that start and nr are non negative
Revert "win32: don't run subprocess tests on Mingw32 platform"
hax: add Darwin support
Plumb the HAXM-based hardware acceleration support
target/i386: Add Intel HAX files
kvm: move cpu synchronization code
KVM: PPC: eliminate unnecessary duplicate constants
ramblock-notifier: new
char: fix ctrl-a b not working
exec: Add missing rcu_read_unlock
x86: ioapic: fix fail migration when irqchip=split
x86: ioapic: dump version for "info ioapic"
x86: ioapic: add traces for ioapic
hxtool: emit Texinfo headings as @subsection
qemu-thread: fix qemu_thread_set_name() race in qemu_thread_create()
serial: fix memory leak in serial exit
scsi-block: fix direction of BYTCHK test for VERIFY commands
pc: fix crash in rtc_set_memory() if initial cpu is marked as hotplugged
acpi: filter based on CONFIG_ACPI_X86 rather than TARGET
...
# Conflicts:
# include/hw/i386/pc.h
Diffstat (limited to 'hw')
-rw-r--r-- | hw/Makefile.objs | 6 | ||||
-rw-r--r-- | hw/acpi/Makefile.objs | 17 | ||||
-rw-r--r-- | hw/acpi/acpi-stub.c | 29 | ||||
-rw-r--r-- | hw/acpi/ipmi-stub.c | 14 | ||||
-rw-r--r-- | hw/char/serial.c | 10 | ||||
-rw-r--r-- | hw/core/Makefile.objs | 2 | ||||
-rw-r--r-- | hw/core/reset.c | 72 | ||||
-rw-r--r-- | hw/i386/kvm/apic.c | 1 | ||||
-rw-r--r-- | hw/i386/kvmvapic.c | 1 | ||||
-rw-r--r-- | hw/i386/pc.c | 4 | ||||
-rw-r--r-- | hw/intc/apic_common.c | 3 | ||||
-rw-r--r-- | hw/intc/ioapic.c | 22 | ||||
-rw-r--r-- | hw/intc/ioapic_common.c | 3 | ||||
-rw-r--r-- | hw/intc/trace-events | 7 | ||||
-rw-r--r-- | hw/misc/vmport.c | 2 | ||||
-rw-r--r-- | hw/ppc/pnv_xscom.c | 2 | ||||
-rw-r--r-- | hw/ppc/ppce500_spin.c | 4 | ||||
-rw-r--r-- | hw/ppc/spapr.c | 2 | ||||
-rw-r--r-- | hw/ppc/spapr_hcall.c | 2 | ||||
-rw-r--r-- | hw/s390x/s390-pci-inst.c | 1 | ||||
-rw-r--r-- | hw/scsi/megasas.c | 11 | ||||
-rw-r--r-- | hw/scsi/scsi-disk.c | 2 | ||||
-rw-r--r-- | hw/smbios/Makefile.objs | 12 | ||||
-rw-r--r-- | hw/smbios/smbios-stub.c | 31 | ||||
-rw-r--r-- | hw/smbios/smbios.c | 2 | ||||
-rw-r--r-- | hw/smbios/smbios_type_38-stub.c | 14 | ||||
-rw-r--r-- | hw/timer/mc146818rtc.c | 12 | ||||
-rw-r--r-- | hw/usb/ccid-card-emulated.c | 2 | ||||
-rw-r--r-- | hw/virtio/Makefile.objs | 6 | ||||
-rw-r--r-- | hw/virtio/vhost-stub.c | 7 | ||||
-rw-r--r-- | hw/virtio/virtio.c | 10 |
31 files changed, 278 insertions, 35 deletions
diff --git a/hw/Makefile.objs b/hw/Makefile.objs index 0ffd281145..a2c61f6b09 100644 --- a/hw/Makefile.objs +++ b/hw/Makefile.objs @@ -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/ @@ -29,11 +29,11 @@ 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/ -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) diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs index 834c63b980..6acf79860a 100644 --- a/hw/acpi/Makefile.objs +++ b/hw/acpi/Makefile.objs @@ -1,10 +1,19 @@ +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-$(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-$(call lnot,$(CONFIG_ACPI_X86)) += acpi-stub.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 +else +common-obj-y += acpi-stub.o +endif +common-obj-$(CONFIG_ALL) += acpi-stub.o ipmi-stub.o diff --git a/hw/acpi/acpi-stub.c b/hw/acpi/acpi-stub.c new file mode 100644 index 0000000000..26bd22f7ec --- /dev/null +++ b/hw/acpi/acpi-stub.c @@ -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); +} diff --git a/hw/acpi/ipmi-stub.c b/hw/acpi/ipmi-stub.c new file mode 100644 index 0000000000..98b6dcee0d --- /dev/null +++ b/hw/acpi/ipmi-stub.c @@ -0,0 +1,14 @@ +/* + * IPMI ACPI firmware handling + * + * Copyright (c) 2015,2016 Corey Minyard, MontaVista Software, LLC + * + * 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 "hw/acpi/ipmi.h" + +void build_acpi_ipmi_devices(Aml *table, BusState *bus) +{ +} diff --git a/hw/char/serial.c b/hw/char/serial.c index ffbacd8227..67b18eda12 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -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); } diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs index a4c94e522d..833fd46897 100644 --- a/hw/core/Makefile.objs +++ b/hw/core/Makefile.objs @@ -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 diff --git a/hw/core/reset.c b/hw/core/reset.c new file mode 100644 index 0000000000..84c8869371 --- /dev/null +++ b/hw/core/reset.c @@ -0,0 +1,72 @@ +/* + * Reset handlers. + * + * Copyright (c) 2003-2008 Fabrice Bellard + * Copyright (c) 2016 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "qemu/queue.h" +#include "sysemu/reset.h" + +/* reset/shutdown handler */ + +typedef struct QEMUResetEntry { + QTAILQ_ENTRY(QEMUResetEntry) entry; + QEMUResetHandler *func; + void *opaque; +} QEMUResetEntry; + +static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers = + QTAILQ_HEAD_INITIALIZER(reset_handlers); + +void qemu_register_reset(QEMUResetHandler *func, void *opaque) +{ + QEMUResetEntry *re = g_malloc0(sizeof(QEMUResetEntry)); + + re->func = func; + re->opaque = opaque; + QTAILQ_INSERT_TAIL(&reset_handlers, re, entry); +} + +void qemu_unregister_reset(QEMUResetHandler *func, void *opaque) +{ + QEMUResetEntry *re; + + QTAILQ_FOREACH(re, &reset_handlers, entry) { + if (re->func == func && re->opaque == opaque) { + QTAILQ_REMOVE(&reset_handlers, re, entry); + g_free(re); + return; + } + } +} + +void qemu_devices_reset(void) +{ + QEMUResetEntry *re, *nre; + + /* reset all devices */ + QTAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) { + re->func(re->opaque); + } +} + diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c index df5180b1e0..1df6d26816 100644 --- a/hw/i386/kvm/apic.c +++ b/hw/i386/kvm/apic.c @@ -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" diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index b30d1b90c6..2f767b620e 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -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" diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 25e8586b48..f721fde0c2 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -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); } diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index d78c885509..3945dfd7b9 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -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; diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c index ea7ea0bce8..9047b8950a 100644 --- a/hw/intc/ioapic.c +++ b/hw/intc/ioapic.c @@ -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; @@ -426,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; } diff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c index 1b7ec5ec20..97c4f9c2df 100644 --- a/hw/intc/ioapic_common.c +++ b/hw/intc/ioapic_common.c @@ -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); diff --git a/hw/intc/trace-events b/hw/intc/trace-events index 6116df5436..92a6171692 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -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" diff --git a/hw/misc/vmport.c b/hw/misc/vmport.c index c763811a9f..be40930b8b 100644 --- a/hw/misc/vmport.c +++ b/hw/misc/vmport.c @@ -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 diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c index b82af4f086..38bc85f117 100644 --- a/hw/ppc/pnv_xscom.c +++ b/hw/ppc/pnv_xscom.c @@ -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" diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c index cf958a9e00..eb219abdff 100644 --- a/hw/ppc/ppce500_spin.c +++ b/hw/ppc/ppce500_spin.c @@ -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 diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 208ef7b110..a642e663d4 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -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" diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 9a9bedf1bd..b2a8e48569 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -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" diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 405cccd2d0..d2a8c0a083 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -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 diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index 67fc1e7893..6233865494 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -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); diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index bdd1e5f86c..c080888413 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -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; diff --git a/hw/smbios/Makefile.objs b/hw/smbios/Makefile.objs index c3d3753602..23bb2bac07 100644 --- a/hw/smbios/Makefile.objs +++ b/hw/smbios/Makefile.objs @@ -1,2 +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-$(CONFIG_ALL) += smbios-stub.o +common-obj-$(CONFIG_ALL) += smbios_type_38-stub.o diff --git a/hw/smbios/smbios-stub.c b/hw/smbios/smbios-stub.c new file mode 100644 index 0000000000..308739410f --- /dev/null +++ b/hw/smbios/smbios-stub.c @@ -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 <leif.lindholm@linaro.org> + * 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); +} diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 3a96cededd..1a5437a07d 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -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; diff --git a/hw/smbios/smbios_type_38-stub.c b/hw/smbios/smbios_type_38-stub.c new file mode 100644 index 0000000000..9528c2c28e --- /dev/null +++ b/hw/smbios/smbios_type_38-stub.c @@ -0,0 +1,14 @@ +/* + * IPMI SMBIOS firmware handling + * + * Copyright (c) 2015,2016 Corey Minyard, MontaVista Software, LLC + * + * 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 "hw/smbios/ipmi.h" + +void smbios_build_type_38_table(void) +{ +} diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index da209d02f0..637f8722a7 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -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() */ diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index eceb5f3ee2..99627860a3 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -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; } diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 95c4c30ea1..765d363c1f 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -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 diff --git a/hw/virtio/vhost-stub.c b/hw/virtio/vhost-stub.c new file mode 100644 index 0000000000..2d76cdebdc --- /dev/null +++ b/hw/virtio/vhost-stub.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "hw/virtio/vhost.h" + +bool vhost_has_free_slot(void) +{ + return true; +} diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index ac9b99b928..cc17b97899 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2082,10 +2082,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, @@ -2257,7 +2257,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); } @@ -2278,7 +2278,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); } @@ -2304,7 +2304,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); } |