diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2013-07-15 17:45:03 +0200 |
---|---|---|
committer | Cornelia Huck <cornelia.huck@de.ibm.com> | 2014-05-20 13:05:58 +0200 |
commit | 03cf077ac9c02ccc192b9011ced12cc74f9151bb (patch) | |
tree | c19eaf4fcfa9f022aca35727c1871161564e9a69 /hw/intc/s390_flic_kvm.c | |
parent | 7b35d0c44cae3dcce6347a0729a416c2929cd4bb (diff) |
s390x: add I/O adapter registration
Register an I/O adapter interrupt source for when virtio-ccw devices start
using adapter interrupts.
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'hw/intc/s390_flic_kvm.c')
-rw-r--r-- | hw/intc/s390_flic_kvm.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index 70c1710ec3..cc4072e5df 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -151,6 +151,33 @@ static int __get_all_irqs(KVMS390FLICState *flic, return r; } +static int kvm_s390_register_io_adapter(S390FLICState *fs, uint32_t id, + uint8_t isc, bool swap, + bool is_maskable) +{ + struct kvm_s390_io_adapter adapter = { + .id = id, + .isc = isc, + .maskable = is_maskable, + .swap = swap, + }; + KVMS390FLICState *flic = KVM_S390_FLIC(fs); + int r, ret; + struct kvm_device_attr attr = { + .group = KVM_DEV_FLIC_ADAPTER_REGISTER, + .addr = (uint64_t)&adapter, + }; + + if (!kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING)) { + return -ENOSYS; + } + + r = ioctl(flic->fd, KVM_SET_DEVICE_ATTR, &attr); + + ret = r ? -errno : 0; + return ret; +} + /** * kvm_flic_save - Save pending floating interrupts * @f: QEMUFile containing migration state @@ -304,10 +331,12 @@ static void kvm_s390_flic_reset(DeviceState *dev) static void kvm_s390_flic_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); + S390FLICStateClass *fsc = S390_FLIC_COMMON_CLASS(oc); dc->realize = kvm_s390_flic_realize; dc->unrealize = kvm_s390_flic_unrealize; dc->reset = kvm_s390_flic_reset; + fsc->register_io_adapter = kvm_s390_register_io_adapter; } static const TypeInfo kvm_s390_flic_info = { |