s390_flic.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * QEMU S390x floating interrupt controller (flic)
  3. *
  4. * Copyright 2014 IBM Corp.
  5. * Author(s): Jens Freimann <jfrei@linux.vnet.ibm.com>
  6. * Cornelia Huck <cornelia.huck@de.ibm.com>
  7. *
  8. * This work is licensed under the terms of the GNU GPL, version 2 or (at
  9. * your option) any later version. See the COPYING file in the top-level
  10. * directory.
  11. */
  12. #include "qemu/error-report.h"
  13. #include "hw/sysbus.h"
  14. #include "migration/qemu-file.h"
  15. #include "hw/s390x/s390_flic.h"
  16. #include "trace.h"
  17. S390FLICState *s390_get_flic(void)
  18. {
  19. S390FLICState *fs;
  20. fs = S390_FLIC_COMMON(object_resolve_path(TYPE_KVM_S390_FLIC, NULL));
  21. if (!fs) {
  22. fs = S390_FLIC_COMMON(object_resolve_path(TYPE_QEMU_S390_FLIC, NULL));
  23. }
  24. return fs;
  25. }
  26. void s390_flic_init(void)
  27. {
  28. DeviceState *dev;
  29. int r;
  30. dev = s390_flic_kvm_create();
  31. if (!dev) {
  32. dev = qdev_create(NULL, TYPE_QEMU_S390_FLIC);
  33. object_property_add_child(qdev_get_machine(), TYPE_QEMU_S390_FLIC,
  34. OBJECT(dev), NULL);
  35. }
  36. r = qdev_init(dev);
  37. if (r) {
  38. error_report("flic: couldn't create qdev");
  39. }
  40. }
  41. static int qemu_s390_register_io_adapter(S390FLICState *fs, uint32_t id,
  42. uint8_t isc, bool swap,
  43. bool is_maskable)
  44. {
  45. /* nothing to do */
  46. return 0;
  47. }
  48. static int qemu_s390_io_adapter_map(S390FLICState *fs, uint32_t id,
  49. uint64_t map_addr, bool do_map)
  50. {
  51. /* nothing to do */
  52. return 0;
  53. }
  54. static int qemu_s390_add_adapter_routes(S390FLICState *fs,
  55. AdapterRoutes *routes)
  56. {
  57. return -ENOSYS;
  58. }
  59. static void qemu_s390_release_adapter_routes(S390FLICState *fs,
  60. AdapterRoutes *routes)
  61. {
  62. }
  63. static void qemu_s390_flic_class_init(ObjectClass *oc, void *data)
  64. {
  65. S390FLICStateClass *fsc = S390_FLIC_COMMON_CLASS(oc);
  66. fsc->register_io_adapter = qemu_s390_register_io_adapter;
  67. fsc->io_adapter_map = qemu_s390_io_adapter_map;
  68. fsc->add_adapter_routes = qemu_s390_add_adapter_routes;
  69. fsc->release_adapter_routes = qemu_s390_release_adapter_routes;
  70. }
  71. static const TypeInfo qemu_s390_flic_info = {
  72. .name = TYPE_QEMU_S390_FLIC,
  73. .parent = TYPE_S390_FLIC_COMMON,
  74. .instance_size = sizeof(QEMUS390FLICState),
  75. .class_init = qemu_s390_flic_class_init,
  76. };
  77. static const TypeInfo s390_flic_common_info = {
  78. .name = TYPE_S390_FLIC_COMMON,
  79. .parent = TYPE_SYS_BUS_DEVICE,
  80. .instance_size = sizeof(S390FLICState),
  81. .class_size = sizeof(S390FLICStateClass),
  82. };
  83. static void qemu_s390_flic_register_types(void)
  84. {
  85. type_register_static(&s390_flic_common_info);
  86. type_register_static(&qemu_s390_flic_info);
  87. }
  88. type_init(qemu_s390_flic_register_types)