aboutsummaryrefslogtreecommitdiff
path: root/hw/intc
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-07-06 11:42:59 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-07-06 11:42:59 +0100
commitb11365867568ba954de667a0bfe0945b8f78d6bd (patch)
tree4699b4f24ef3d432566e07e2e11d036e28633150 /hw/intc
parent67b9c5d4f37ea373ebf9aad251883886e34bf2e1 (diff)
parent1045e3cdafaf1218d9f771080ba5c9d4f64346e4 (diff)
downloadqemu-b11365867568ba954de667a0bfe0945b8f78d6bd.zip
qemu-b11365867568ba954de667a0bfe0945b8f78d6bd.tar.gz
qemu-b11365867568ba954de667a0bfe0945b8f78d6bd.tar.bz2
Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20170706' into staging
s390x/kvm/migration: fixes, enhancements and cleanups - new email address for Cornelia - Fixes: 3270, flic, virtio-scsi-ccw, ipl - Enhancements, cpumodel, migration # gpg: Signature made Thu 06 Jul 2017 08:18:19 BST # gpg: using RSA key 0x117BBC80B5A61C7C # gpg: Good signature from "Christian Borntraeger (IBM) <borntraeger@de.ibm.com>" # Primary key fingerprint: F922 9381 A334 08F9 DBAB FBCA 117B BC80 B5A6 1C7C * remotes/borntraeger/tags/s390x-20170706: hw/s390x/ipl: Fix endianness problem with netboot_start_addr virtio-scsi-ccw: use ioeventfd even when KVM is disabled s390x: return unavailable features via query-cpu-definitions s390x/MAINTAINERS: Update my email address s390x: fix realize inheritance for kvm-flic s390x: fix error propagation in kvm-flic's realize s390x/3270: fix instruction interception handler s390x: vmstatify config migration for virtio-ccw Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/intc')
-rw-r--r--hw/intc/s390_flic.c32
-rw-r--r--hw/intc/s390_flic_kvm.c29
2 files changed, 57 insertions, 4 deletions
diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c
index a26e906..837158b 100644
--- a/hw/intc/s390_flic.c
+++ b/hw/intc/s390_flic.c
@@ -17,6 +17,7 @@
#include "trace.h"
#include "hw/qdev.h"
#include "qapi/error.h"
+#include "hw/s390x/s390-virtio-ccw.h"
S390FLICState *s390_get_flic(void)
{
@@ -100,8 +101,8 @@ static void s390_flic_common_realize(DeviceState *dev, Error **errp)
uint32_t max_batch = S390_FLIC_COMMON(dev)->adapter_routes_max_batch;
if (max_batch > ADAPTER_ROUTES_MAX_GSI) {
- error_setg(errp, "flic adapter_routes_max_batch too big"
- "%d (%d allowed)", max_batch, ADAPTER_ROUTES_MAX_GSI);
+ error_setg(errp, "flic property adapter_routes_max_batch too big"
+ " (%d > %d)", max_batch, ADAPTER_ROUTES_MAX_GSI);
}
}
@@ -136,3 +137,30 @@ static void qemu_s390_flic_register_types(void)
}
type_init(qemu_s390_flic_register_types)
+
+const VMStateDescription vmstate_adapter_info = {
+ .name = "s390_adapter_info",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT64(ind_offset, AdapterInfo),
+ /*
+ * We do not have to migrate neither the id nor the addresses.
+ * The id is set by css_register_io_adapter and the addresses
+ * are set based on the IndAddr objects after those get mapped.
+ */
+ VMSTATE_END_OF_LIST()
+ },
+};
+
+const VMStateDescription vmstate_adapter_routes = {
+
+ .name = "s390_adapter_routes",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_STRUCT(adapter, AdapterRoutes, 1, vmstate_adapter_info,
+ AdapterInfo),
+ VMSTATE_END_OF_LIST()
+ }
+};
diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c
index b4c61d8..0bcd49f 100644
--- a/hw/intc/s390_flic_kvm.c
+++ b/hw/intc/s390_flic_kvm.c
@@ -15,6 +15,7 @@
#include "cpu.h"
#include <sys/ioctl.h>
#include "qemu/error-report.h"
+#include "qapi/error.h"
#include "hw/sysbus.h"
#include "sysemu/kvm.h"
#include "hw/s390x/s390_flic.h"
@@ -391,24 +392,43 @@ static const VMStateDescription kvm_s390_flic_vmstate = {
}
};
+typedef struct KVMS390FLICStateClass {
+ S390FLICStateClass parent_class;
+ DeviceRealize parent_realize;
+} KVMS390FLICStateClass;
+
+#define KVM_S390_FLIC_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(KVMS390FLICStateClass, (obj), TYPE_KVM_S390_FLIC)
+
+#define KVM_S390_FLIC_CLASS(klass) \
+ OBJECT_CLASS_CHECK(KVMS390FLICStateClass, (klass), TYPE_KVM_S390_FLIC)
+
static void kvm_s390_flic_realize(DeviceState *dev, Error **errp)
{
KVMS390FLICState *flic_state = KVM_S390_FLIC(dev);
struct kvm_create_device cd = {0};
struct kvm_device_attr test_attr = {0};
int ret;
+ Error *errp_local = NULL;
+ KVM_S390_FLIC_GET_CLASS(dev)->parent_realize(dev, &errp_local);
+ if (errp_local) {
+ goto fail;
+ }
flic_state->fd = -1;
if (!kvm_check_extension(kvm_state, KVM_CAP_DEVICE_CTRL)) {
+ error_setg_errno(&errp_local, errno, "KVM is missing capability"
+ " KVM_CAP_DEVICE_CTRL");
trace_flic_no_device_api(errno);
- return;
+ goto fail;
}
cd.type = KVM_DEV_TYPE_FLIC;
ret = kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &cd);
if (ret < 0) {
+ error_setg_errno(&errp_local, errno, "Creating the KVM device failed");
trace_flic_create_device(errno);
- return;
+ goto fail;
}
flic_state->fd = cd.fd;
@@ -417,6 +437,9 @@ static void kvm_s390_flic_realize(DeviceState *dev, Error **errp)
flic_state->clear_io_supported = !ioctl(flic_state->fd,
KVM_HAS_DEVICE_ATTR, test_attr);
+ return;
+fail:
+ error_propagate(errp, errp_local);
}
static void kvm_s390_flic_reset(DeviceState *dev)
@@ -446,6 +469,7 @@ static void kvm_s390_flic_class_init(ObjectClass *oc, void *data)
DeviceClass *dc = DEVICE_CLASS(oc);
S390FLICStateClass *fsc = S390_FLIC_COMMON_CLASS(oc);
+ KVM_S390_FLIC_CLASS(oc)->parent_realize = dc->realize;
dc->realize = kvm_s390_flic_realize;
dc->vmsd = &kvm_s390_flic_vmstate;
dc->reset = kvm_s390_flic_reset;
@@ -460,6 +484,7 @@ static const TypeInfo kvm_s390_flic_info = {
.name = TYPE_KVM_S390_FLIC,
.parent = TYPE_S390_FLIC_COMMON,
.instance_size = sizeof(KVMS390FLICState),
+ .class_size = sizeof(KVMS390FLICStateClass),
.class_init = kvm_s390_flic_class_init,
};