1
+ .. SPDX-License-Identifier: GPL-2.0
2
+
3
+ =================================
1
4
The PPC KVM paravirtual interface
2
5
=================================
3
6
@@ -34,8 +37,9 @@ up the hypercall. To call a hypercall, just call these instructions.
34
37
35
38
The parameters are as follows:
36
39
40
+ ======== ================ ================
37
41
Register IN OUT
38
-
42
+ ======== ================ ================
39
43
r0 - volatile
40
44
r3 1st parameter Return code
41
45
r4 2nd parameter 1st output value
@@ -47,18 +51,21 @@ The parameters are as follows:
47
51
r10 8th parameter 7th output value
48
52
r11 hypercall number 8th output value
49
53
r12 - volatile
54
+ ======== ================ ================
50
55
51
56
Hypercall definitions are shared in generic code, so the same hypercall numbers
52
57
apply for x86 and powerpc alike with the exception that each KVM hypercall
53
58
also needs to be ORed with the KVM vendor code which is (42 << 16).
54
59
55
60
Return codes can be as follows:
56
61
62
+ ==== =========================
57
63
Code Meaning
58
-
64
+ ==== =========================
59
65
0 Success
60
66
12 Hypercall not implemented
61
67
<0 Error
68
+ ==== =========================
62
69
63
70
The magic page
64
71
==============
@@ -72,7 +79,7 @@ desired location. The first parameter indicates the effective address when the
72
79
MMU is enabled. The second parameter indicates the address in real mode, if
73
80
applicable to the target. For now, we always map the page to -4096. This way we
74
81
can access it using absolute load and store functions. The following
75
- instruction reads the first field of the magic page:
82
+ instruction reads the first field of the magic page::
76
83
77
84
ld rX, -4096(0)
78
85
@@ -93,8 +100,10 @@ a bitmap of available features inside the magic page.
93
100
94
101
The following enhancements to the magic page are currently available:
95
102
103
+ ============================ =======================================
96
104
KVM_MAGIC_FEAT_SR Maps SR registers r/w in the magic page
97
105
KVM_MAGIC_FEAT_MAS0_TO_SPRG7 Maps MASn, ESR, PIR and high SPRGs
106
+ ============================ =======================================
98
107
99
108
For enhanced features in the magic page, please check for the existence of the
100
109
feature before using them!
@@ -121,8 +130,8 @@ when entering the guest or don't have any impact on the hypervisor's behavior.
121
130
122
131
The following bits are safe to be set inside the guest:
123
132
124
- MSR_EE
125
- MSR_RI
133
+ - MSR_EE
134
+ - MSR_RI
126
135
127
136
If any other bit changes in the MSR, please still use mtmsr(d).
128
137
@@ -138,9 +147,9 @@ guest. Implementing any of those mappings is optional, as the instruction traps
138
147
also act on the shared page. So calling privileged instructions still works as
139
148
before.
140
149
150
+ ======================= ================================
141
151
From To
142
- ==== ==
143
-
152
+ ======================= ================================
144
153
mfmsr rX ld rX, magic_page->msr
145
154
mfsprg rX, 0 ld rX, magic_page->sprg0
146
155
mfsprg rX, 1 ld rX, magic_page->sprg1
@@ -173,7 +182,7 @@ mtsrin rX, rY b <special mtsrin section>
173
182
174
183
[BookE only]
175
184
wrteei [0|1] b <special wrteei section>
176
-
185
+ ======================= ================================
177
186
178
187
Some instructions require more logic to determine what's going on than a load
179
188
or store instruction can deliver. To enable patching of those, we keep some
@@ -191,6 +200,7 @@ for example.
191
200
192
201
Hypercall ABIs in KVM on PowerPC
193
202
=================================
203
+
194
204
1) KVM hypercalls (ePAPR)
195
205
196
206
These are ePAPR compliant hypercall implementation (mentioned above). Even
0 commit comments