diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2016-08-04 10:24:27 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-08-04 10:24:27 +0100 |
commit | 09704e6ded83fa0bec14baf32f800f6512156ca0 (patch) | |
tree | 72647b9a6c3b35984749926c21a9d2c17e86b3ee /hw | |
parent | 29b2517ac79ecd42c169248668e4007dee90dc5a (diff) | |
parent | e911765cbb9e9ddf5d952c88bb52180a62c6cea0 (diff) |
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* xsetbv fix (x86 targets TCG)
* remove unused functions
* qht segfault and memory leak fixes
* NBD fixes
* Fix for non-power-of-2 discard granularity
* Memory hotplug fixes
* Migration regressions
* IOAPIC fixes and (disabled by default) EOI register support
* Various other small fixes
# gpg: Signature made Wed 03 Aug 2016 18:01:05 BST
# 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: (25 commits)
util: Fix assertion in iov_copy() upon zero 'bytes' and non-zero 'offset'
qdev: Fix use after free in qdev_init_nofail error path
Reorganize help output of '-display' option
x86: ioapic: add support for explicit EOI
x86: ioapic: ignore level irq during processing
apic: fix broken migration for kvm-apic
fw_cfg: Make base type "fw_cfg" abstract
block: Cater to iscsi with non-power-of-2 discard
osdep: Document differences in rounding macros
nbd: Limit nbdflags to 16 bits
nbd: Fix bad flag detection on server
i2c: fix migration regression introduced by broadcast support
mptsas: really fix migration compatibility
qdist: return "(empty)" instead of NULL when printing an empty dist
qdist: use g_renew and g_new instead of g_realloc and g_malloc.
qdist: fix memory leak during binning
target-i386: fix typo in xsetbv implementation
qht: do not segfault when gathering stats from an uninitialized qht
util: Drop inet_listen()
util: drop unix_nonblocking_connect()
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/core/qdev.c | 2 | ||||
-rw-r--r-- | hw/i2c/core.c | 10 | ||||
-rw-r--r-- | hw/intc/ioapic.c | 36 | ||||
-rw-r--r-- | hw/nvram/fw_cfg.c | 1 | ||||
-rw-r--r-- | hw/scsi/mptsas.c | 4 | ||||
-rw-r--r-- | hw/scsi/mptsas.h | 2 |
6 files changed, 45 insertions, 10 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index ee4a083e64..57834423b9 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -354,12 +354,14 @@ void qdev_init_nofail(DeviceState *dev) assert(!dev->realized); + object_ref(OBJECT(dev)); object_property_set_bool(OBJECT(dev), true, "realized", &err); if (err) { error_reportf_err(err, "Initialization of device %s failed: ", object_get_typename(OBJECT(dev))); exit(1); } + object_unref(OBJECT(dev)); } void qdev_machine_creation_done(void) diff --git a/hw/i2c/core.c b/hw/i2c/core.c index abb3efb1db..4afbe0bde5 100644 --- a/hw/i2c/core.c +++ b/hw/i2c/core.c @@ -17,6 +17,8 @@ struct I2CNode { QLIST_ENTRY(I2CNode) next; }; +#define I2C_BROADCAST 0x00 + struct I2CBus { BusState qbus; @@ -47,6 +49,8 @@ static void i2c_bus_pre_save(void *opaque) if (!QLIST_EMPTY(&bus->current_devs)) { if (!bus->broadcast) { bus->saved_address = QLIST_FIRST(&bus->current_devs)->elt->address; + } else { + bus->saved_address = I2C_BROADCAST; } } } @@ -58,7 +62,6 @@ static const VMStateDescription vmstate_i2c_bus = { .pre_save = i2c_bus_pre_save, .fields = (VMStateField[]) { VMSTATE_UINT8(saved_address, I2CBus), - VMSTATE_BOOL(broadcast, I2CBus), VMSTATE_END_OF_LIST() } }; @@ -93,7 +96,7 @@ int i2c_start_transfer(I2CBus *bus, uint8_t address, int recv) I2CSlaveClass *sc; I2CNode *node; - if (address == 0x00) { + if (address == I2C_BROADCAST) { /* * This is a broadcast, the current_devs will be all the devices of the * bus. @@ -221,7 +224,8 @@ static int i2c_slave_post_load(void *opaque, int version_id) I2CNode *node; bus = I2C_BUS(qdev_get_parent_bus(DEVICE(dev))); - if ((bus->saved_address == dev->address) || (bus->broadcast)) { + if ((bus->saved_address == dev->address) || + (bus->saved_address == I2C_BROADCAST)) { node = g_malloc(sizeof(struct I2CNode)); node->elt = dev; QLIST_INSERT_HEAD(&bus->current_devs, node, next); diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c index 2d3282a864..31791b0986 100644 --- a/hw/intc/ioapic.c +++ b/hw/intc/ioapic.c @@ -21,6 +21,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "monitor/monitor.h" #include "hw/hw.h" #include "hw/i386/pc.h" @@ -117,21 +118,25 @@ static void ioapic_service(IOAPICCommonState *s) s->ioredtbl[i] |= IOAPIC_LVT_REMOTE_IRR; } + if (coalesce) { + /* We are level triggered interrupts, and the + * guest should be still working on previous one, + * so skip it. */ + continue; + } + #ifdef CONFIG_KVM if (kvm_irqchip_is_split()) { if (info.trig_mode == IOAPIC_TRIGGER_EDGE) { kvm_set_irq(kvm_state, i, 1); kvm_set_irq(kvm_state, i, 0); } else { - if (!coalesce) { - kvm_set_irq(kvm_state, i, 1); - } + kvm_set_irq(kvm_state, i, 1); } continue; } -#else - (void)coalesce; #endif + /* No matter whether IR is enabled, we translate * the IOAPIC message into a MSI one, and its * address space will decide whether we need a @@ -265,7 +270,7 @@ ioapic_mem_read(void *opaque, hwaddr addr, unsigned int size) val = s->id << IOAPIC_ID_SHIFT; break; case IOAPIC_REG_VER: - val = IOAPIC_VERSION | + val = s->version | ((IOAPIC_NUM_PINS - 1) << IOAPIC_VER_ENTRIES_SHIFT); break; default: @@ -354,6 +359,13 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val, } } break; + case IOAPIC_EOI: + /* Explicit EOI is only supported for IOAPIC version 0x20 */ + if (size != 4 || s->version != 0x20) { + break; + } + ioapic_eoi_broadcast(val); + break; } ioapic_update_kvm_routes(s); @@ -387,6 +399,12 @@ static void ioapic_realize(DeviceState *dev, Error **errp) { IOAPICCommonState *s = IOAPIC_COMMON(dev); + if (s->version != 0x11 && s->version != 0x20) { + error_report("IOAPIC only supports version 0x11 or 0x20 " + "(default: 0x11)."); + exit(1); + } + memory_region_init_io(&s->io_memory, OBJECT(s), &ioapic_io_ops, s, "ioapic", 0x1000); @@ -397,6 +415,11 @@ static void ioapic_realize(DeviceState *dev, Error **errp) qemu_add_machine_init_done_notifier(&s->machine_done); } +static Property ioapic_properties[] = { + DEFINE_PROP_UINT8("version", IOAPICCommonState, version, 0x11), + DEFINE_PROP_END_OF_LIST(), +}; + static void ioapic_class_init(ObjectClass *klass, void *data) { IOAPICCommonClass *k = IOAPIC_COMMON_CLASS(klass); @@ -404,6 +427,7 @@ static void ioapic_class_init(ObjectClass *klass, void *data) k->realize = ioapic_realize; dc->reset = ioapic_reset_common; + dc->props = ioapic_properties; } static const TypeInfo ioapic_info = { diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 2873030ade..f10d5ec9c8 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -990,6 +990,7 @@ static void fw_cfg_class_init(ObjectClass *klass, void *data) static const TypeInfo fw_cfg_info = { .name = TYPE_FW_CFG, .parent = TYPE_SYS_BUS_DEVICE, + .abstract = true, .instance_size = sizeof(FWCfgState), .class_init = fw_cfg_class_init, }; diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c index bebe5130fe..0e0a22f696 100644 --- a/hw/scsi/mptsas.c +++ b/hw/scsi/mptsas.c @@ -1295,6 +1295,8 @@ static void mptsas_scsi_init(PCIDevice *dev, Error **errp) /* With msi=auto, we fall back to MSI off silently */ error_free(err); + /* Only used for migration. */ + s->msi_in_use = (ret == 0); } memory_region_init_io(&s->mmio_io, OBJECT(s), &mptsas_mmio_ops, s, @@ -1370,7 +1372,7 @@ static const VMStateDescription vmstate_mptsas = { .post_load = mptsas_post_load, .fields = (VMStateField[]) { VMSTATE_PCI_DEVICE(dev, MPTSASState), - VMSTATE_UNUSED(sizeof(bool)), /* Was msi_in_use */ + VMSTATE_BOOL(msi_in_use, MPTSASState), VMSTATE_UINT32(state, MPTSASState), VMSTATE_UINT8(who_init, MPTSASState), VMSTATE_UINT8(doorbell_state, MPTSASState), diff --git a/hw/scsi/mptsas.h b/hw/scsi/mptsas.h index da014a397e..0436a33911 100644 --- a/hw/scsi/mptsas.h +++ b/hw/scsi/mptsas.h @@ -31,6 +31,8 @@ struct MPTSASState { OnOffAuto msi; uint64_t sas_addr; + bool msi_in_use; + /* Doorbell register */ uint32_t state; uint8_t who_init; |