← Documents Documentation/virt/kvm/s390/s390-pv.rst GitHub 원문 ↗

Linux 6.18.37 · 가상화 / KVM / PowerPC·s390

s390 Ultravisor and Protected VMs

Ultravisor, format 4 SIE, 보호된 interrupt injection과 명령 에뮬레이션 경로를 설명합니다.

Source pathDocumentation/virt/kvm/s390/s390-pv.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

s390-pv.rst:1-116

Ultravisor, format 4 SIE, 보호된 interrupt injection과 명령 에뮬레이션 경로를 설명합니다.

ABI 필드, 명령·레지스터 이름, 소스 경로와 줄 좌표를 보존하고 보안 경계와 실행 순서를 구조화했습니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =========================================
4 s390 (IBM Z) Ultravisor and Protected VMs
5 =========================================
6
7 Summary
8 -------
9 Protected virtual machines (PVM) are KVM VMs that do not allow KVM to
10 access VM state like guest memory or guest registers. Instead, the
11 PVMs are mostly managed by a new entity called Ultravisor (UV). The UV
12 provides an API that can be used by PVMs and KVM to request management
13 actions.
14
15 Each guest starts in non-protected mode and then may make a request to
16 transition into protected mode. On transition, KVM registers the guest
17 and its VCPUs with the Ultravisor and prepares everything for running
18 it.
19
20 The Ultravisor will secure and decrypt the guest's boot memory
21 (i.e. kernel/initrd). It will safeguard state changes like VCPU
22 starts/stops and injected interrupts while the guest is running.
23
24 As access to the guest's state, such as the SIE state description, is
25 normally needed to be able to run a VM, some changes have been made in
26 the behavior of the SIE instruction. A new format 4 state description
27 has been introduced, where some fields have different meanings for a
28 PVM. SIE exits are minimized as much as possible to improve speed and
29 reduce exposed guest state.
30
31
32 Interrupt injection
33 -------------------
34 Interrupt injection is safeguarded by the Ultravisor. As KVM doesn't
35 have access to the VCPUs' lowcores, injection is handled via the
36 format 4 state description.
37
38 Machine check, external, IO and restart interruptions each can be
39 injected on SIE entry via a bit in the interrupt injection control
40 field (offset 0x54). If the guest cpu is not enabled for the interrupt
41 at the time of injection, a validity interception is recognized. The
42 format 4 state description contains fields in the interception data
43 block where data associated with the interrupt can be transported.
44
45 Program and Service Call exceptions have another layer of
46 safeguarding; they can only be injected for instructions that have
47 been intercepted into KVM. The exceptions need to be a valid outcome
48 of an instruction emulation by KVM, e.g. we can never inject a
49 addressing exception as they are reported by SIE since KVM has no
50 access to the guest memory.
51
52
53 Mask notification interceptions
54 -------------------------------
55 KVM cannot intercept lctl(g) and lpsw(e) anymore in order to be
56 notified when a PVM enables a certain class of interrupt. As a
57 replacement, two new interception codes have been introduced: One
58 indicating that the contents of CRs 0, 6, or 14 have been changed,
59 indicating different interruption subclasses; and one indicating that
60 PSW bit 13 has been changed, indicating that a machine check
61 intervention was requested and those are now enabled.
62
63 Instruction emulation
64 ---------------------
65 With the format 4 state description for PVMs, the SIE instruction already
66 interprets more instructions than it does with format 2. It is not able
67 to interpret every instruction, but needs to hand some tasks to KVM;
68 therefore, the SIE and the ultravisor safeguard emulation inputs and outputs.
69
70 The control structures associated with SIE provide the Secure
71 Instruction Data Area (SIDA), the Interception Parameters (IP) and the
72 Secure Interception General Register Save Area. Guest GRs and most of
73 the instruction data, such as I/O data structures, are filtered.
74 Instruction data is copied to and from the SIDA when needed. Guest
75 GRs are put into / retrieved from the Secure Interception General
76 Register Save Area.
77
78 Only GR values needed to emulate an instruction will be copied into this
79 save area and the real register numbers will be hidden.
80
81 The Interception Parameters state description field still contains
82 the bytes of the instruction text, but with pre-set register values
83 instead of the actual ones. I.e. each instruction always uses the same
84 instruction text, in order not to leak guest instruction text.
85 This also implies that the register content that a guest had in r<n>
86 may be in r<m> from the hypervisor's point of view.
87
88 The Secure Instruction Data Area contains instruction storage
89 data. Instruction data, i.e. data being referenced by an instruction
90 like the SCCB for sclp, is moved via the SIDA. When an instruction is
91 intercepted, the SIE will only allow data and program interrupts for
92 this instruction to be moved to the guest via the two data areas
93 discussed before. Other data is either ignored or results in validity
94 interceptions.
95
96
97 Instruction emulation interceptions
98 -----------------------------------
99 There are two types of SIE secure instruction intercepts: the normal
100 and the notification type. Normal secure instruction intercepts will
101 make the guest pending for instruction completion of the intercepted
102 instruction type, i.e. on SIE entry it is attempted to complete
103 emulation of the instruction with the data provided by KVM. That might
104 be a program exception or instruction completion.
105
106 The notification type intercepts inform KVM about guest environment
107 changes due to guest instruction interpretation. Such an interception
108 is recognized, for example, for the store prefix instruction to provide
109 the new lowcore location. On SIE reentry, any KVM data in the data areas
110 is ignored and execution continues as if the guest instruction had
111 completed. For that reason KVM is not allowed to inject a program
112 interrupt.
113
114 Links
115 -----
116 `KVM Forum 2019 presentation <https://static.sched.com/hosted_files/kvmforum2019/3b/ibm_protected_vms_s390x.pdf>`_
117

3. 한국어 전문 번역

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

Ultravisor 관리 모델

1-31

PVM은 KVM이 guest memory나 guest register 같은 VM state에 접근하지 못하는 KVM VM입니다. 대부분의 관리는 Ultravisor(UV)가 담당하며 PVM과 KVM은 UV API로 관리 작업을 요청합니다.

게스트는 non-protected mode로 시작해 protected mode 전환을 요청할 수 있습니다. KVM은 게스트와 vCPU를 UV에 등록하고 실행을 준비하며 UV는 kernel/initrd 부팅 메모리를 보호·복호화하고 vCPU 시작·정지와 interrupt injection 같은 상태 변경을 보호합니다.

PVM 실행에는 format 4 SIE state description을 사용합니다. 일부 필드 의미가 달라지고 속도 향상과 guest state 노출 축소를 위해 SIE exit를 가능한 한 줄입니다.

.. SPDX-License-Identifier: GPL-2.0

=========================================
s390 (IBM Z) Ultravisor and Protected VMs
=========================================

Summary
-------
Protected virtual machines (PVM) are KVM VMs that do not allow KVM to
access VM state like guest memory or guest registers. Instead, the
PVMs are mostly managed by a new entity called Ultravisor (UV). The UV
provides an API that can be used by PVMs and KVM to request management
actions.

Each guest starts in non-protected mode and then may make a request to
transition into protected mode. On transition, KVM registers the guest
and its VCPUs with the Ultravisor and prepares everything for running
it.

The Ultravisor will secure and decrypt the guest's boot memory
(i.e. kernel/initrd). It will safeguard state changes like VCPU
starts/stops and injected interrupts while the guest is running.

As access to the guest's state, such as the SIE state description, is
normally needed to be able to run a VM, some changes have been made in
the behavior of the SIE instruction. A new format 4 state description
has been introduced, where some fields have different meanings for a
PVM. SIE exits are minimized as much as possible to improve speed and
reduce exposed guest state.

보호된 interrupt injection

32-52

KVM은 PVM vCPU의 lowcore에 접근할 수 없으므로 UV가 format 4 state description을 통해 interrupt injection을 보호합니다. machine check, external, I/O, restart interrupt는 offset `0x54`의 interrupt injection control bit로 SIE 진입 시 주입합니다.

주입 시 guest CPU가 해당 interrupt를 허용하지 않으면 validity interception이 발생합니다. 관련 데이터는 format 4 interception data block의 필드로 전달합니다.

program exception과 Service Call exception은 KVM으로 intercept된 명령에서 유효한 에뮬레이션 결과일 때만 주입할 수 있습니다. KVM은 guest memory에 접근할 수 없고 addressing exception은 SIE가 보고하므로 이를 임의로 주입할 수 없습니다.

Interrupt injection
-------------------
Interrupt injection is safeguarded by the Ultravisor. As KVM doesn't
have access to the VCPUs' lowcores, injection is handled via the
format 4 state description.

Machine check, external, IO and restart interruptions each can be
injected on SIE entry via a bit in the interrupt injection control
field (offset 0x54). If the guest cpu is not enabled for the interrupt
at the time of injection, a validity interception is recognized. The
format 4 state description contains fields in the interception data
block where data associated with the interrupt can be transported.

Program and Service Call exceptions have another layer of
safeguarding; they can only be injected for instructions that have
been intercepted into KVM. The exceptions need to be a valid outcome
of an instruction emulation by KVM, e.g. we can never inject a
addressing exception as they are reported by SIE since KVM has no
access to the guest memory.

mask notification interception

53-62

KVM은 PVM이 interrupt class를 활성화할 때 더 이상 `lctl(g)`와 `lpsw(e)`를 intercept할 수 없습니다. 대신 CR 0·6·14 내용 변경을 알리는 코드와 PSW bit 13 변경을 알리는 두 notification interception code가 추가됐습니다.

첫 코드는 여러 interrupt subclass 변경을, 둘째 코드는 machine check intervention이 요청되어 이제 허용됨을 나타냅니다.

Mask notification interceptions
-------------------------------
KVM cannot intercept lctl(g) and lpsw(e) anymore in order to be
notified when a PVM enables a certain class of interrupt.  As a
replacement, two new interception codes have been introduced: One
indicating that the contents of CRs 0, 6, or 14 have been changed,
indicating different interruption subclasses; and one indicating that
PSW bit 13 has been changed, indicating that a machine check
intervention was requested and those are now enabled.

보호된 명령 에뮬레이션

63-96

format 4 SIE는 format 2보다 많은 명령을 직접 해석하지만 모든 명령을 처리하지는 못합니다. SIE와 UV는 KVM에 넘기는 에뮬레이션 입력과 결과를 함께 보호합니다.

secure emulation 구조
구조역할
SIDASecure Instruction Data Area; SCCB 같은 명령 storage data 이동
IPInterception Parameters; 실제 register 번호 대신 미리 정한 값이 든 명령 bytes
Secure Interception General Register Save Area에뮬레이션에 필요한 GR 값만 전달하며 실제 register 번호 숨김

실제 guest state 노출을 제한하는 세 영역입니다.

IP의 명령 텍스트는 실제 register 값 대신 고정된 register 값을 사용해 guest instruction text가 새지 않게 합니다. 따라서 guest 관점의 `r<n>` 내용이 하이퍼바이저 관점에서는 `r<m>`에 있을 수 있습니다.

SIDA는 명령이 참조하는 storage data를 옮깁니다. SIE는 intercept된 명령에 필요한 data와 program interrupt만 앞의 데이터 영역을 통해 guest로 이동하게 하며 다른 데이터는 무시하거나 validity interception으로 처리합니다.

Instruction emulation
---------------------
With the format 4 state description for PVMs, the SIE instruction already
interprets more instructions than it does with format 2. It is not able
to interpret every instruction, but needs to hand some tasks to KVM;
therefore, the SIE and the ultravisor safeguard emulation inputs and outputs.

The control structures associated with SIE provide the Secure
Instruction Data Area (SIDA), the Interception Parameters (IP) and the
Secure Interception General Register Save Area.  Guest GRs and most of
the instruction data, such as I/O data structures, are filtered.
Instruction data is copied to and from the SIDA when needed.  Guest
GRs are put into / retrieved from the Secure Interception General
Register Save Area.

Only GR values needed to emulate an instruction will be copied into this
save area and the real register numbers will be hidden.

The Interception Parameters state description field still contains
the bytes of the instruction text, but with pre-set register values
instead of the actual ones. I.e. each instruction always uses the same
instruction text, in order not to leak guest instruction text.
This also implies that the register content that a guest had in r<n>
may be in r<m> from the hypervisor's point of view.

The Secure Instruction Data Area contains instruction storage
data. Instruction data, i.e. data being referenced by an instruction
like the SCCB for sclp, is moved via the SIDA. When an instruction is
intercepted, the SIE will only allow data and program interrupts for
this instruction to be moved to the guest via the two data areas
discussed before. Other data is either ignored or results in validity
interceptions.

secure instruction interception 유형

97-113
SIE secure instruction intercept
유형동작
Normalguest를 명령 완료 대기 상태로 두고 다음 SIE 진입에서 KVM 제공 데이터로 program exception 또는 명령 완료 시도
NotificationSIE가 해석한 guest 환경 변경을 KVM에 통지; 재진입 시 KVM 데이터는 무시하고 명령 완료 뒤처럼 계속 실행

정상형과 알림형의 재진입 의미가 다릅니다.

notification 예시는 store prefix 명령 뒤 새 lowcore 위치를 알리는 경우입니다. 이미 명령이 완료된 것으로 이어지므로 KVM은 notification intercept에 program interrupt를 주입할 수 없습니다.

Instruction emulation interceptions
-----------------------------------
There are two types of SIE secure instruction intercepts: the normal
and the notification type. Normal secure instruction intercepts will
make the guest pending for instruction completion of the intercepted
instruction type, i.e. on SIE entry it is attempted to complete
emulation of the instruction with the data provided by KVM. That might
be a program exception or instruction completion.

The notification type intercepts inform KVM about guest environment
changes due to guest instruction interpretation. Such an interception
is recognized, for example, for the store prefix instruction to provide
the new lowcore location. On SIE reentry, any KVM data in the data areas
is ignored and execution continues as if the guest instruction had
completed. For that reason KVM is not allowed to inject a program
interrupt.