s390_flic.txt 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. FLIC (floating interrupt controller)
  2. ====================================
  3. FLIC handles floating (non per-cpu) interrupts, i.e. I/O, service and some
  4. machine check interruptions. All interrupts are stored in a per-vm list of
  5. pending interrupts. FLIC performs operations on this list.
  6. Only one FLIC instance may be instantiated.
  7. FLIC provides support to
  8. - add interrupts (KVM_DEV_FLIC_ENQUEUE)
  9. - inspect currently pending interrupts (KVM_FLIC_GET_ALL_IRQS)
  10. - purge all pending floating interrupts (KVM_DEV_FLIC_CLEAR_IRQS)
  11. - purge one pending floating I/O interrupt (KVM_DEV_FLIC_CLEAR_IO_IRQ)
  12. - enable/disable for the guest transparent async page faults
  13. - register and modify adapter interrupt sources (KVM_DEV_FLIC_ADAPTER_*)
  14. - modify AIS (adapter-interruption-suppression) mode state (KVM_DEV_FLIC_AISM)
  15. - inject adapter interrupts on a specified adapter (KVM_DEV_FLIC_AIRQ_INJECT)
  16. - get/set all AIS mode states (KVM_DEV_FLIC_AISM_ALL)
  17. Groups:
  18. KVM_DEV_FLIC_ENQUEUE
  19. Passes a buffer and length into the kernel which are then injected into
  20. the list of pending interrupts.
  21. attr->addr contains the pointer to the buffer and attr->attr contains
  22. the length of the buffer.
  23. The format of the data structure kvm_s390_irq as it is copied from userspace
  24. is defined in usr/include/linux/kvm.h.
  25. KVM_DEV_FLIC_GET_ALL_IRQS
  26. Copies all floating interrupts into a buffer provided by userspace.
  27. When the buffer is too small it returns -ENOMEM, which is the indication
  28. for userspace to try again with a bigger buffer.
  29. -ENOBUFS is returned when the allocation of a kernelspace buffer has
  30. failed.
  31. -EFAULT is returned when copying data to userspace failed.
  32. All interrupts remain pending, i.e. are not deleted from the list of
  33. currently pending interrupts.
  34. attr->addr contains the userspace address of the buffer into which all
  35. interrupt data will be copied.
  36. attr->attr contains the size of the buffer in bytes.
  37. KVM_DEV_FLIC_CLEAR_IRQS
  38. Simply deletes all elements from the list of currently pending floating
  39. interrupts. No interrupts are injected into the guest.
  40. KVM_DEV_FLIC_CLEAR_IO_IRQ
  41. Deletes one (if any) I/O interrupt for a subchannel identified by the
  42. subsystem identification word passed via the buffer specified by
  43. attr->addr (address) and attr->attr (length).
  44. KVM_DEV_FLIC_APF_ENABLE
  45. Enables async page faults for the guest. So in case of a major page fault
  46. the host is allowed to handle this async and continues the guest.
  47. KVM_DEV_FLIC_APF_DISABLE_WAIT
  48. Disables async page faults for the guest and waits until already pending
  49. async page faults are done. This is necessary to trigger a completion interrupt
  50. for every init interrupt before migrating the interrupt list.
  51. KVM_DEV_FLIC_ADAPTER_REGISTER
  52. Register an I/O adapter interrupt source. Takes a kvm_s390_io_adapter
  53. describing the adapter to register:
  54. struct kvm_s390_io_adapter {
  55. __u32 id;
  56. __u8 isc;
  57. __u8 maskable;
  58. __u8 swap;
  59. __u8 flags;
  60. };
  61. id contains the unique id for the adapter, isc the I/O interruption subclass
  62. to use, maskable whether this adapter may be masked (interrupts turned off),
  63. swap whether the indicators need to be byte swapped, and flags contains
  64. further characteristics of the adapter.
  65. Currently defined values for 'flags' are:
  66. - KVM_S390_ADAPTER_SUPPRESSIBLE: adapter is subject to AIS
  67. (adapter-interrupt-suppression) facility. This flag only has an effect if
  68. the AIS capability is enabled.
  69. Unknown flag values are ignored.
  70. KVM_DEV_FLIC_ADAPTER_MODIFY
  71. Modifies attributes of an existing I/O adapter interrupt source. Takes
  72. a kvm_s390_io_adapter_req specifying the adapter and the operation:
  73. struct kvm_s390_io_adapter_req {
  74. __u32 id;
  75. __u8 type;
  76. __u8 mask;
  77. __u16 pad0;
  78. __u64 addr;
  79. };
  80. id specifies the adapter and type the operation. The supported operations
  81. are:
  82. KVM_S390_IO_ADAPTER_MASK
  83. mask or unmask the adapter, as specified in mask
  84. KVM_S390_IO_ADAPTER_MAP
  85. perform a gmap translation for the guest address provided in addr,
  86. pin a userspace page for the translated address and add it to the
  87. list of mappings
  88. Note: A new mapping will be created unconditionally; therefore,
  89. the calling code should avoid making duplicate mappings.
  90. KVM_S390_IO_ADAPTER_UNMAP
  91. release a userspace page for the translated address specified in addr
  92. from the list of mappings
  93. KVM_DEV_FLIC_AISM
  94. modify the adapter-interruption-suppression mode for a given isc if the
  95. AIS capability is enabled. Takes a kvm_s390_ais_req describing:
  96. struct kvm_s390_ais_req {
  97. __u8 isc;
  98. __u16 mode;
  99. };
  100. isc contains the target I/O interruption subclass, mode the target
  101. adapter-interruption-suppression mode. The following modes are
  102. currently supported:
  103. - KVM_S390_AIS_MODE_ALL: ALL-Interruptions Mode, i.e. airq injection
  104. is always allowed;
  105. - KVM_S390_AIS_MODE_SINGLE: SINGLE-Interruption Mode, i.e. airq
  106. injection is only allowed once and the following adapter interrupts
  107. will be suppressed until the mode is set again to ALL-Interruptions
  108. or SINGLE-Interruption mode.
  109. KVM_DEV_FLIC_AIRQ_INJECT
  110. Inject adapter interrupts on a specified adapter.
  111. attr->attr contains the unique id for the adapter, which allows for
  112. adapter-specific checks and actions.
  113. For adapters subject to AIS, handle the airq injection suppression for
  114. an isc according to the adapter-interruption-suppression mode on condition
  115. that the AIS capability is enabled.
  116. KVM_DEV_FLIC_AISM_ALL
  117. Gets or sets the adapter-interruption-suppression mode for all ISCs. Takes
  118. a kvm_s390_ais_all describing:
  119. struct kvm_s390_ais_all {
  120. __u8 simm; /* Single-Interruption-Mode mask */
  121. __u8 nimm; /* No-Interruption-Mode mask *
  122. };
  123. simm contains Single-Interruption-Mode mask for all ISCs, nimm contains
  124. No-Interruption-Mode mask for all ISCs. Each bit in simm and nimm corresponds
  125. to an ISC (MSB0 bit 0 to ISC 0 and so on). The combination of simm bit and
  126. nimm bit presents AIS mode for a ISC.
  127. KVM_DEV_FLIC_AISM_ALL is indicated by KVM_CAP_S390_AIS_MIGRATION.
  128. Note: The KVM_SET_DEVICE_ATTR/KVM_GET_DEVICE_ATTR device ioctls executed on
  129. FLIC with an unknown group or attribute gives the error code EINVAL (instead of
  130. ENXIO, as specified in the API documentation). It is not possible to conclude
  131. that a FLIC operation is unavailable based on the error code resulting from a
  132. usage attempt.
  133. Note: The KVM_DEV_FLIC_CLEAR_IO_IRQ ioctl will return EINVAL in case a zero
  134. schid is specified.