← Documents Documentation/virt/kvm/devices/s390_flic.rst GitHub 원문 ↗

Linux 6.18.37 · 가상화 / KVM / Device

s390 FLIC

s390 floating interrupt pending list, async page fault, I/O adapter와 AIS migration state를 제어하는 device ABI입니다.

Source pathDocumentation/virt/kvm/devices/s390_flic.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

s390_flic.rst:1-170

s390 floating interrupt pending list, async page fault, I/O adapter와 AIS migration state를 제어하는 device ABI입니다.

구조체 field, ioctl, attribute, error code와 migration 수식은 원문 표기를 유지했습니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Pending interrupt와 async page fault

1-69

FLIC는 CPU별로 고정되지 않은 floating interrupt, 즉 I/O, service와 일부 machine-check interruption을 처리합니다. 모든 interrupt는 VM별 pending list에 저장되며 FLIC instance는 VM당 하나만 만들 수 있습니다.

FLIC 기본 operation
Attribute동작
`KVM_DEV_FLIC_ENQUEUE``attr->addr` buffer의 `attr->attr` byte를 `kvm_s390_irq` format으로 pending list에 주입
`KVM_DEV_FLIC_GET_ALL_IRQS`모든 floating interrupt를 userspace buffer로 복사하되 pending list에서는 삭제하지 않음
`KVM_DEV_FLIC_CLEAR_IRQS`Pending floating interrupt 전체 삭제, guest에는 주입하지 않음
`KVM_DEV_FLIC_CLEAR_IO_IRQ``attr->addr`의 subsystem identification word가 식별하는 subchannel의 I/O interrupt 하나 삭제
`KVM_DEV_FLIC_APF_ENABLE`Major page fault를 host가 asynchronous하게 처리하면서 guest 실행 지속
`KVM_DEV_FLIC_APF_DISABLE_WAIT`APF를 disable하고 기존 async fault 완료까지 대기

Pending list를 추가·조회·삭제하고 async page fault를 제어합니다.

GET_ALL_IRQS에서 userspace buffer가 작으면 `-ENOMEM`을 반환하므로 더 큰 buffer로 다시 시도해야 합니다. Kernel-space buffer allocation 실패는 `-ENOBUFS`, userspace copy 실패는 `-EFAULT`입니다.

Migration 전에 `APF_DISABLE_WAIT`로 이미 pending인 async page fault를 끝내야 각 init interrupt에 completion interrupt가 생성된 상태로 interrupt list를 이동할 수 있습니다. Ucontrol VM의 FLIC에서 APF enable·disable을 호출하면 `-EINVAL`입니다.

.. SPDX-License-Identifier: GPL-2.0

====================================
FLIC (floating interrupt controller)
====================================

FLIC handles floating (non per-cpu) interrupts, i.e. I/O, service and some
machine check interruptions. All interrupts are stored in a per-vm list of
pending interrupts. FLIC performs operations on this list.

Only one FLIC instance may be instantiated.

FLIC provides support to
- add interrupts (KVM_DEV_FLIC_ENQUEUE)
- inspect currently pending interrupts (KVM_FLIC_GET_ALL_IRQS)
- purge all pending floating interrupts (KVM_DEV_FLIC_CLEAR_IRQS)
- purge one pending floating I/O interrupt (KVM_DEV_FLIC_CLEAR_IO_IRQ)
- enable/disable for the guest transparent async page faults
- register and modify adapter interrupt sources (KVM_DEV_FLIC_ADAPTER_*)
- modify AIS (adapter-interruption-suppression) mode state (KVM_DEV_FLIC_AISM)
- inject adapter interrupts on a specified adapter (KVM_DEV_FLIC_AIRQ_INJECT)
- get/set all AIS mode states (KVM_DEV_FLIC_AISM_ALL)

Groups:
  KVM_DEV_FLIC_ENQUEUE
    Passes a buffer and length into the kernel which are then injected into
    the list of pending interrupts.
    attr->addr contains the pointer to the buffer and attr->attr contains
    the length of the buffer.
    The format of the data structure kvm_s390_irq as it is copied from userspace
    is defined in usr/include/linux/kvm.h.

  KVM_DEV_FLIC_GET_ALL_IRQS
    Copies all floating interrupts into a buffer provided by userspace.
    When the buffer is too small it returns -ENOMEM, which is the indication
    for userspace to try again with a bigger buffer.

    -ENOBUFS is returned when the allocation of a kernelspace buffer has
    failed.

    -EFAULT is returned when copying data to userspace failed.
    All interrupts remain pending, i.e. are not deleted from the list of
    currently pending interrupts.
    attr->addr contains the userspace address of the buffer into which all
    interrupt data will be copied.
    attr->attr contains the size of the buffer in bytes.

  KVM_DEV_FLIC_CLEAR_IRQS
    Simply deletes all elements from the list of currently pending floating
    interrupts.  No interrupts are injected into the guest.

  KVM_DEV_FLIC_CLEAR_IO_IRQ
    Deletes one (if any) I/O interrupt for a subchannel identified by the
    subsystem identification word passed via the buffer specified by
    attr->addr (address) and attr->attr (length).

  KVM_DEV_FLIC_APF_ENABLE
    Enables async page faults for the guest. So in case of a major page fault
    the host is allowed to handle this async and continues the guest.

    -EINVAL is returned when called on the FLIC of a ucontrol VM.

  KVM_DEV_FLIC_APF_DISABLE_WAIT
    Disables async page faults for the guest and waits until already pending
    async page faults are done. This is necessary to trigger a completion interrupt
    for every init interrupt before migrating the interrupt list.

    -EINVAL is returned when called on the FLIC of a ucontrol VM.

Adapter interrupt와 AIS mode

70-146
`kvm_s390_io_adapter`
Field의미
`id`Adapter 고유 ID
`isc`I/O interruption subclass
`maskable`Adapter interrupt masking 가능 여부
`swap`Indicator byte-swap 필요 여부
`flags`추가 adapter characteristic

`KVM_DEV_FLIC_ADAPTER_REGISTER`가 등록하는 I/O adapter descriptor입니다.

현재 정의된 `KVM_S390_ADAPTER_SUPPRESSIBLE` flag는 adapter가 AIS(adapter-interrupt-suppression) 적용 대상임을 뜻하며 AIS capability가 enable된 경우에만 효과가 있습니다. 알 수 없는 flag는 무시합니다.

Adapter modify request
Operation동작
`KVM_S390_IO_ADAPTER_MASK``mask` field에 따라 adapter mask 또는 unmask
`KVM_S390_IO_ADAPTER_MAP`현재 no-op; mapping은 IRQ route만 담당
`KVM_S390_IO_ADAPTER_UNMAP`현재 no-op; unmapping도 IRQ route만 담당

`kvm_s390_io_adapter_req`의 `type`이 수행할 operation을 선택합니다.

`KVM_DEV_FLIC_AISM`은 AIS capability가 있을 때 `kvm_s390_ais_req`의 ISC와 mode로 한 interruption subclass의 suppression mode를 바꿉니다.

AIS mode
Mode의미
`KVM_S390_AIS_MODE_ALL`ALL-Interruptions Mode; adapter interrupt injection을 항상 허용
`KVM_S390_AIS_MODE_SINGLE`SINGLE-Interruption Mode; 한 번만 허용하고 다시 ALL 또는 SINGLE로 설정할 때까지 이후 interrupt 억제

Adapter interrupt injection 허용 범위입니다.

`KVM_DEV_FLIC_AIRQ_INJECT`는 `attr->attr`에 지정한 adapter ID로 adapter interrupt를 주입합니다. AIS 대상 adapter이면 capability와 현재 ISC mode에 따라 suppression을 적용합니다.

  KVM_DEV_FLIC_ADAPTER_REGISTER
    Register an I/O adapter interrupt source. Takes a kvm_s390_io_adapter
    describing the adapter to register::

	struct kvm_s390_io_adapter {
		__u32 id;
		__u8 isc;
		__u8 maskable;
		__u8 swap;
		__u8 flags;
	};

   id contains the unique id for the adapter, isc the I/O interruption subclass
   to use, maskable whether this adapter may be masked (interrupts turned off),
   swap whether the indicators need to be byte swapped, and flags contains
   further characteristics of the adapter.

   Currently defined values for 'flags' are:

   - KVM_S390_ADAPTER_SUPPRESSIBLE: adapter is subject to AIS
     (adapter-interrupt-suppression) facility. This flag only has an effect if
     the AIS capability is enabled.

   Unknown flag values are ignored.


  KVM_DEV_FLIC_ADAPTER_MODIFY
    Modifies attributes of an existing I/O adapter interrupt source. Takes
    a kvm_s390_io_adapter_req specifying the adapter and the operation::

	struct kvm_s390_io_adapter_req {
		__u32 id;
		__u8 type;
		__u8 mask;
		__u16 pad0;
		__u64 addr;
	};

    id specifies the adapter and type the operation. The supported operations
    are:

    KVM_S390_IO_ADAPTER_MASK
      mask or unmask the adapter, as specified in mask

    KVM_S390_IO_ADAPTER_MAP
      This is now a no-op. The mapping is purely done by the irq route.
    KVM_S390_IO_ADAPTER_UNMAP
      This is now a no-op. The mapping is purely done by the irq route.

  KVM_DEV_FLIC_AISM
    modify the adapter-interruption-suppression mode for a given isc if the
    AIS capability is enabled. Takes a kvm_s390_ais_req describing::

	struct kvm_s390_ais_req {
		__u8 isc;
		__u16 mode;
	};

    isc contains the target I/O interruption subclass, mode the target
    adapter-interruption-suppression mode. The following modes are
    currently supported:

    - KVM_S390_AIS_MODE_ALL: ALL-Interruptions Mode, i.e. airq injection
      is always allowed;
    - KVM_S390_AIS_MODE_SINGLE: SINGLE-Interruption Mode, i.e. airq
      injection is only allowed once and the following adapter interrupts
      will be suppressed until the mode is set again to ALL-Interruptions
      or SINGLE-Interruption mode.

  KVM_DEV_FLIC_AIRQ_INJECT
    Inject adapter interrupts on a specified adapter.
    attr->attr contains the unique id for the adapter, which allows for
    adapter-specific checks and actions.
    For adapters subject to AIS, handle the airq injection suppression for
    an isc according to the adapter-interruption-suppression mode on condition
    that the AIS capability is enabled.

AIS 전체 상태와 compatibility note

147-170

`KVM_DEV_FLIC_AISM_ALL`은 모든 ISC의 AIS mode를 한 번에 get/set해 migration합니다. `kvm_s390_ais_all.simm`은 Single-Interruption-Mode mask, `nimm`은 No-Interruption-Mode mask이며 각 MSB0 bit가 ISC 0부터 순서대로 대응합니다.

각 ISC의 mode는 `simm` bit와 `nimm` bit 조합으로 표현됩니다. 이 attribute 지원은 `KVM_CAP_S390_AIS_MIGRATION`으로 확인합니다.

FLIC의 `KVM_SET_DEVICE_ATTR`·`KVM_GET_DEVICE_ATTR`은 unknown group 또는 attribute에 일반 device API의 `ENXIO`가 아니라 `EINVAL`을 반환합니다. 따라서 실패 error만 보고 특정 FLIC operation이 미지원이라고 결론 내릴 수 없습니다.

`KVM_DEV_FLIC_CLEAR_IO_IRQ`에 0인 `schid`를 전달해도 `EINVAL`입니다.

  KVM_DEV_FLIC_AISM_ALL
    Gets or sets the adapter-interruption-suppression mode for all ISCs. Takes
    a kvm_s390_ais_all describing::

	struct kvm_s390_ais_all {
	       __u8 simm; /* Single-Interruption-Mode mask */
	       __u8 nimm; /* No-Interruption-Mode mask *
	};

    simm contains Single-Interruption-Mode mask for all ISCs, nimm contains
    No-Interruption-Mode mask for all ISCs. Each bit in simm and nimm corresponds
    to an ISC (MSB0 bit 0 to ISC 0 and so on). The combination of simm bit and
    nimm bit presents AIS mode for a ISC.

    KVM_DEV_FLIC_AISM_ALL is indicated by KVM_CAP_S390_AIS_MIGRATION.

Note: The KVM_SET_DEVICE_ATTR/KVM_GET_DEVICE_ATTR device ioctls executed on
FLIC with an unknown group or attribute gives the error code EINVAL (instead of
ENXIO, as specified in the API documentation). It is not possible to conclude
that a FLIC operation is unavailable based on the error code resulting from a
usage attempt.

.. note:: The KVM_DEV_FLIC_CLEAR_IO_IRQ ioctl will return EINVAL in case a
	  zero schid is specified.