From 819bd3091e986c1b6b10203a7138a53b849a53e0 Mon Sep 17 00:00:00 2001 From: Dominik Dingel Date: Thu, 5 Sep 2013 13:54:39 +0200 Subject: s390x/async_pf: Check for apf extension and enable pfault S390 can also use async page faults, to enhance guest scheduling. In case of live migration we want to disable the feature and let all pending request finish. Signed-off-by: Dominik Dingel Signed-off-by: Jens Freimann Signed-off-by: Christian Borntraeger --- hw/intc/s390_flic.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'hw/intc') diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index 1a7876da78..b2ef3e3f8e 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -63,6 +63,34 @@ static int flic_get_all_irqs(KVMS390FLICState *flic, return rc == -1 ? -errno : rc; } +static void flic_enable_pfault(KVMS390FLICState *flic) +{ + struct kvm_device_attr attr = { + .group = KVM_DEV_FLIC_APF_ENABLE, + }; + int rc; + + rc = ioctl(flic->fd, KVM_SET_DEVICE_ATTR, &attr); + + if (rc) { + fprintf(stderr, "flic: couldn't enable pfault\n"); + } +} + +static void flic_disable_wait_pfault(KVMS390FLICState *flic) +{ + struct kvm_device_attr attr = { + .group = KVM_DEV_FLIC_APF_DISABLE_WAIT, + }; + int rc; + + rc = ioctl(flic->fd, KVM_SET_DEVICE_ATTR, &attr); + + if (rc) { + fprintf(stderr, "flic: couldn't disable pfault\n"); + } +} + /** flic_enqueue_irqs - returns 0 on success * @buf: pointer to buffer which is passed to kernel * @len: length of buffer @@ -136,6 +164,8 @@ static void kvm_flic_save(QEMUFile *f, void *opaque) void *buf; int count; + flic_disable_wait_pfault((struct KVMS390FLICState *) opaque); + buf = g_try_malloc0(len); if (!buf) { /* Storing FLIC_FAILED into the count field here will cause the @@ -184,6 +214,8 @@ static int kvm_flic_load(QEMUFile *f, void *opaque, int version_id) goto out; } + flic_enable_pfault((struct KVMS390FLICState *) opaque); + count = qemu_get_be64(f); len = count * sizeof(struct kvm_s390_irq); if (count == FLIC_FAILED) { @@ -256,10 +288,14 @@ static void kvm_s390_flic_reset(DeviceState *dev) return; } + flic_disable_wait_pfault(flic); + rc = ioctl(flic->fd, KVM_SET_DEVICE_ATTR, &attr); if (rc) { trace_flic_reset_failed(errno); } + + flic_enable_pfault(flic); } static void kvm_s390_flic_class_init(ObjectClass *oc, void *data) -- cgit v1.2.1