Qsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget1/translations/zh_CN/virt/kvm/loongarch/hypercallsmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget1/translations/zh_TW/virt/kvm/loongarch/hypercallsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget1/translations/it_IT/virt/kvm/loongarch/hypercallsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget1/translations/ja_JP/virt/kvm/loongarch/hypercallsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget1/translations/ko_KR/virt/kvm/loongarch/hypercallsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget1/translations/pt_BR/virt/kvm/loongarch/hypercallsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget1/translations/sp_SP/virt/kvm/loongarch/hypercallsmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhK/var/lib/git/docbuild/linux/Documentation/virt/kvm/loongarch/hypercalls.rsthKubhsection)}(hhh](htitle)}(h#The LoongArch paravirtual interfaceh]h#The LoongArch paravirtual interface}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hKVM hypercalls use the HVCL instruction with code 0x100 and the hypercall number is put in a0. Up to five arguments may be placed in registers a1 - a5. The return value is placed in v0 (an alias of a0).h]hKVM hypercalls use the HVCL instruction with code 0x100 and the hypercall number is put in a0. Up to five arguments may be placed in registers a1 - a5. The return value is placed in v0 (an alias of a0).}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hCSource code for this interface can be found in arch/loongarch/kvm*.h]hCSource code for this interface can be found in arch/loongarch/kvm*.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hhh](h)}(hQuerying for existenceh]hQuerying for existence}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hwTo determine if the host is running on KVM, we can utilize the cpucfg() function at index CPUCFG_KVM_BASE (0x40000000).h]hwTo determine if the host is running on KVM, we can utilize the cpucfg() function at index CPUCFG_KVM_BASE (0x40000000).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hThe CPUCFG_KVM_BASE range, spanning from 0x40000000 to 0x400000FF, The CPUCFG_KVM_BASE range between 0x40000000 - 0x400000FF is marked as reserved. Consequently, all current and future processors will not implement any feature within this range.h]hThe CPUCFG_KVM_BASE range, spanning from 0x40000000 to 0x400000FF, The CPUCFG_KVM_BASE range between 0x40000000 - 0x400000FF is marked as reserved. Consequently, all current and future processors will not implement any feature within this range.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hOn a KVM-virtualized Linux system, a read operation on cpucfg() at index CPUCFG_KVM_BASE (0x40000000) returns the magic string 'KVM\0'.h]hOn a KVM-virtualized Linux system, a read operation on cpucfg() at index CPUCFG_KVM_BASE (0x40000000) returns the magic string ‘KVM0’.}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hOnce you have determined that your host is running on a paravirtualization- capable KVM, you may now use hypercalls as described below.h]hOnce you have determined that your host is running on a paravirtualization- capable KVM, you may now use hypercalls as described below.}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]querying-for-existenceah ]h"]querying for existenceah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hKVM hypercall ABIh]hKVM hypercall ABI}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjLhhhhhKubh)}(hX The KVM hypercall ABI is simple, with one scratch register a0 (v0) and at most five generic registers (a1 - a5) used as input parameters. The FP (Floating- point) and vector registers are not utilized as input registers and must remain unmodified during a hypercall.h]hX The KVM hypercall ABI is simple, with one scratch register a0 (v0) and at most five generic registers (a1 - a5) used as input parameters. The FP (Floating- point) and vector registers are not utilized as input registers and must remain unmodified during a hypercall.}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK!hjLhhubh)}(hHHypercall functions can be inlined as it only uses one scratch register.h]hHHypercall functions can be inlined as it only uses one scratch register.}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK&hjLhhubh)}(hThe parameters are as follows:h]hThe parameters are as follows:}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK(hjLhhubh block_quote)}(hX======== ================= ================ Register IN OUT ======== ================= ================ a0 function number Return code a1 1st parameter - a2 2nd parameter - a3 3rd parameter - a4 4th parameter - a5 5th parameter - ======== ================= ================ h]htable)}(hhh]htgroup)}(hhh](hcolspec)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubhthead)}(hhh]hrow)}(hhh](hentry)}(hhh]h)}(hRegisterh]hRegister}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK+hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hINh]hIN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK+hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hOUTh]hOUT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK+hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubhtbody)}(hhh](j)}(hhh](j)}(hhh]h)}(ha0h]ha0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hfunction numberh]hfunction number}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hj3ubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(h Return codeh]h Return code}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hjJubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh](j)}(hhh]h)}(ha1h]ha1}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hjjubah}(h]h ]h"]h$]h&]uh1jhjgubj)}(hhh]h)}(h1st parameterh]h1st parameter}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hjubah}(h]h ]h"]h$]h&]uh1jhjgubj)}(hhh]h bullet_list)}(hhh]h list_item)}(hhh]h}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]bullet-uh1jhhhK.hjubah}(h]h ]h"]h$]h&]uh1jhjgubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh](j)}(hhh]h)}(ha2h]ha2}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK/hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(h2nd parameterh]h2nd parameter}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK/hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]j)}(hhh]j)}(hhh]h}(h]h ]h"]h$]h&]uh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jhjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]colsKuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhhhK*hjLhhubh)}(h-The return codes may be one of the following:h]h-The return codes may be one of the following:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK5hjLhhubj)}(hX==== ========================= Code Meaning ==== ========================= 0 Success -1 Hypercall not implemented -2 Bad Hypercall parameter ==== ========================= h]j)}(hhh]j)}(hhh](j)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhj5ubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhj5ubj)}(hhh]j)}(hhh](j)}(hhh]h)}(hCodeh]hCode}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK8hjRubah}(h]h ]h"]h$]h&]uh1jhjOubj)}(hhh]h)}(hMeaningh]hMeaning}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK8hjiubah}(h]h ]h"]h$]h&]uh1jhjOubeh}(h]h ]h"]h$]h&]uh1jhjLubah}(h]h ]h"]h$]h&]uh1jhj5ubj)}(hhh](j)}(hhh](j)}(hhh]h)}(h0h]h0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK:hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hSuccessh]hSuccess}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK:hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh](j)}(hhh]h)}(h-1h]h-1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK;hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hHypercall not implementedh]hHypercall not implemented}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK;hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh](j)}(hhh]h)}(h-2h]h-2}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK