13a553fc6SJens Freimann /* 27b35d0c4SCornelia Huck * QEMU S390x floating interrupt controller (flic) 33a553fc6SJens Freimann * 43a553fc6SJens Freimann * Copyright 2014 IBM Corp. 53a553fc6SJens Freimann * Author(s): Jens Freimann <jfrei@linux.vnet.ibm.com> 67b35d0c4SCornelia Huck * Cornelia Huck <cornelia.huck@de.ibm.com> 73a553fc6SJens Freimann * 83a553fc6SJens Freimann * This work is licensed under the terms of the GNU GPL, version 2 or (at 93a553fc6SJens Freimann * your option) any later version. See the COPYING file in the top-level 103a553fc6SJens Freimann * directory. 113a553fc6SJens Freimann */ 123a553fc6SJens Freimann 133a553fc6SJens Freimann #include "qemu/error-report.h" 143a553fc6SJens Freimann #include "hw/sysbus.h" 153a553fc6SJens Freimann #include "migration/qemu-file.h" 163a553fc6SJens Freimann #include "hw/s390x/s390_flic.h" 173a553fc6SJens Freimann #include "trace.h" 183a553fc6SJens Freimann 197b35d0c4SCornelia Huck S390FLICState *s390_get_flic(void) 207b35d0c4SCornelia Huck { 217b35d0c4SCornelia Huck S390FLICState *fs; 227b35d0c4SCornelia Huck 237b35d0c4SCornelia Huck fs = S390_FLIC_COMMON(object_resolve_path(TYPE_KVM_S390_FLIC, NULL)); 247b35d0c4SCornelia Huck if (!fs) { 257b35d0c4SCornelia Huck fs = S390_FLIC_COMMON(object_resolve_path(TYPE_QEMU_S390_FLIC, NULL)); 267b35d0c4SCornelia Huck } 277b35d0c4SCornelia Huck return fs; 287b35d0c4SCornelia Huck } 293a553fc6SJens Freimann 303a553fc6SJens Freimann void s390_flic_init(void) 313a553fc6SJens Freimann { 323a553fc6SJens Freimann DeviceState *dev; 333a553fc6SJens Freimann 347b35d0c4SCornelia Huck dev = s390_flic_kvm_create(); 357b35d0c4SCornelia Huck if (!dev) { 367b35d0c4SCornelia Huck dev = qdev_create(NULL, TYPE_QEMU_S390_FLIC); 377b35d0c4SCornelia Huck object_property_add_child(qdev_get_machine(), TYPE_QEMU_S390_FLIC, 383a553fc6SJens Freimann OBJECT(dev), NULL); 397b35d0c4SCornelia Huck } 40*ae4a2bd7SMarkus Armbruster qdev_init_nofail(dev); 413a553fc6SJens Freimann } 423a553fc6SJens Freimann 4303cf077aSCornelia Huck static int qemu_s390_register_io_adapter(S390FLICState *fs, uint32_t id, 4403cf077aSCornelia Huck uint8_t isc, bool swap, 4503cf077aSCornelia Huck bool is_maskable) 4603cf077aSCornelia Huck { 4703cf077aSCornelia Huck /* nothing to do */ 4803cf077aSCornelia Huck return 0; 4903cf077aSCornelia Huck } 5003cf077aSCornelia Huck 51d426d9fbSCornelia Huck static int qemu_s390_io_adapter_map(S390FLICState *fs, uint32_t id, 52d426d9fbSCornelia Huck uint64_t map_addr, bool do_map) 53d426d9fbSCornelia Huck { 54d426d9fbSCornelia Huck /* nothing to do */ 55d426d9fbSCornelia Huck return 0; 56d426d9fbSCornelia Huck } 57d426d9fbSCornelia Huck 58d426d9fbSCornelia Huck static int qemu_s390_add_adapter_routes(S390FLICState *fs, 59d426d9fbSCornelia Huck AdapterRoutes *routes) 60d426d9fbSCornelia Huck { 61d426d9fbSCornelia Huck return -ENOSYS; 62d426d9fbSCornelia Huck } 63d426d9fbSCornelia Huck 64d426d9fbSCornelia Huck static void qemu_s390_release_adapter_routes(S390FLICState *fs, 65d426d9fbSCornelia Huck AdapterRoutes *routes) 66d426d9fbSCornelia Huck { 67d426d9fbSCornelia Huck } 68d426d9fbSCornelia Huck 6903cf077aSCornelia Huck static void qemu_s390_flic_class_init(ObjectClass *oc, void *data) 7003cf077aSCornelia Huck { 7103cf077aSCornelia Huck S390FLICStateClass *fsc = S390_FLIC_COMMON_CLASS(oc); 7203cf077aSCornelia Huck 7303cf077aSCornelia Huck fsc->register_io_adapter = qemu_s390_register_io_adapter; 74d426d9fbSCornelia Huck fsc->io_adapter_map = qemu_s390_io_adapter_map; 75d426d9fbSCornelia Huck fsc->add_adapter_routes = qemu_s390_add_adapter_routes; 76d426d9fbSCornelia Huck fsc->release_adapter_routes = qemu_s390_release_adapter_routes; 7703cf077aSCornelia Huck } 7803cf077aSCornelia Huck 797b35d0c4SCornelia Huck static const TypeInfo qemu_s390_flic_info = { 807b35d0c4SCornelia Huck .name = TYPE_QEMU_S390_FLIC, 817b35d0c4SCornelia Huck .parent = TYPE_S390_FLIC_COMMON, 827b35d0c4SCornelia Huck .instance_size = sizeof(QEMUS390FLICState), 8303cf077aSCornelia Huck .class_init = qemu_s390_flic_class_init, 843a553fc6SJens Freimann }; 853a553fc6SJens Freimann 867b35d0c4SCornelia Huck static const TypeInfo s390_flic_common_info = { 877b35d0c4SCornelia Huck .name = TYPE_S390_FLIC_COMMON, 883a553fc6SJens Freimann .parent = TYPE_SYS_BUS_DEVICE, 897b35d0c4SCornelia Huck .instance_size = sizeof(S390FLICState), 907b35d0c4SCornelia Huck .class_size = sizeof(S390FLICStateClass), 913a553fc6SJens Freimann }; 923a553fc6SJens Freimann 937b35d0c4SCornelia Huck static void qemu_s390_flic_register_types(void) 943a553fc6SJens Freimann { 957b35d0c4SCornelia Huck type_register_static(&s390_flic_common_info); 967b35d0c4SCornelia Huck type_register_static(&qemu_s390_flic_info); 973a553fc6SJens Freimann } 983a553fc6SJens Freimann 997b35d0c4SCornelia Huck type_init(qemu_s390_flic_register_types) 100