1+ .. SPDX-License-Identifier: GPL-2.0
2+
3+ =================================
14The PPC KVM paravirtual interface
25=================================
36
@@ -34,8 +37,9 @@ up the hypercall. To call a hypercall, just call these instructions.
3437
3538The parameters are as follows:
3639
40+ ======== ================ ================
3741 Register IN OUT
38-
42+ ======== ================ ================
3943 r0 - volatile
4044 r3 1st parameter Return code
4145 r4 2nd parameter 1st output value
@@ -47,18 +51,21 @@ The parameters are as follows:
4751 r10 8th parameter 7th output value
4852 r11 hypercall number 8th output value
4953 r12 - volatile
54+ ======== ================ ================
5055
5156Hypercall definitions are shared in generic code, so the same hypercall numbers
5257apply for x86 and powerpc alike with the exception that each KVM hypercall
5358also needs to be ORed with the KVM vendor code which is (42 << 16).
5459
5560Return codes can be as follows:
5661
62+ ==== =========================
5763 Code Meaning
58-
64+ ==== =========================
5965 0 Success
6066 12 Hypercall not implemented
6167 <0 Error
68+ ==== =========================
6269
6370The magic page
6471==============
@@ -72,7 +79,7 @@ desired location. The first parameter indicates the effective address when the
7279MMU is enabled. The second parameter indicates the address in real mode, if
7380applicable to the target. For now, we always map the page to -4096. This way we
7481can 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::
7683
7784 ld rX, -4096(0)
7885
@@ -93,8 +100,10 @@ a bitmap of available features inside the magic page.
93100
94101The following enhancements to the magic page are currently available:
95102
103+ ============================ =======================================
96104 KVM_MAGIC_FEAT_SR Maps SR registers r/w in the magic page
97105 KVM_MAGIC_FEAT_MAS0_TO_SPRG7 Maps MASn, ESR, PIR and high SPRGs
106+ ============================ =======================================
98107
99108For enhanced features in the magic page, please check for the existence of the
100109feature before using them!
@@ -121,8 +130,8 @@ when entering the guest or don't have any impact on the hypervisor's behavior.
121130
122131The following bits are safe to be set inside the guest:
123132
124- MSR_EE
125- MSR_RI
133+ - MSR_EE
134+ - MSR_RI
126135
127136If any other bit changes in the MSR, please still use mtmsr(d).
128137
@@ -138,9 +147,9 @@ guest. Implementing any of those mappings is optional, as the instruction traps
138147also act on the shared page. So calling privileged instructions still works as
139148before.
140149
150+ ======================= ================================
141151From To
142- ==== ==
143-
152+ ======================= ================================
144153mfmsr rX ld rX, magic_page->msr
145154mfsprg rX, 0 ld rX, magic_page->sprg0
146155mfsprg rX, 1 ld rX, magic_page->sprg1
@@ -173,7 +182,7 @@ mtsrin rX, rY b <special mtsrin section>
173182
174183[BookE only]
175184wrteei [0|1] b <special wrteei section>
176-
185+ ======================= ================================
177186
178187Some instructions require more logic to determine what's going on than a load
179188or store instruction can deliver. To enable patching of those, we keep some
@@ -191,6 +200,7 @@ for example.
191200
192201Hypercall ABIs in KVM on PowerPC
193202=================================
203+
1942041) KVM hypercalls (ePAPR)
195205
196206These are ePAPR compliant hypercall implementation (mentioned above). Even
0 commit comments