s390_flic.rst 6.3 KB

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