Psphinx.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]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).}(hhhhhNhNubah}(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’.}(hjhhhNhNubah}(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.}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]querying-for-existenceah ]h"]querying for existenceah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hKVM hypercall ABIh]hKVM hypercall ABI}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj8hhhhhKubh)}(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.}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK!hj8hhubh)}(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.}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK&hj8hhubh)}(hThe parameters are as follows:h]hThe parameters are as follows:}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK(hj8hhubh 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}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hfunction numberh]hfunction number}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(h Return codeh]h Return code}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hj6ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh](j)}(hhh]h)}(ha1h]ha1}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hjVubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(hhh]h)}(h1st parameterh]h1st parameter}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hjmubah}(h]h ]h"]h$]h&]uh1jhjSubj)}(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&]uh1jhjSubeh}(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&]uh1jhjubah}(h]h ]h"]h$]h&]jjuh1jhhhK/hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh](j)}(hhh]h)}(ha3h]ha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hj8hhubh)}(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&]uh1hhhhK5hj8hhubjt)}(hX==== ========================= Code Meaning ==== ========================= 0 Success -1 Hypercall not implemented -2 Bad Hypercall parameter ==== ========================= h]jz)}(hhh]j)}(hhh](j)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhj!ubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhj!ubj)}(hhh]j)}(hhh](j)}(hhh]h)}(hCodeh]hCode}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK8hj>ubah}(h]h ]h"]h$]h&]uh1jhj;ubj)}(hhh]h)}(hMeaningh]hMeaning}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK8hjUubah}(h]h ]h"]h$]h&]uh1jhj;ubeh}(h]h ]h"]h$]h&]uh1jhj8ubah}(h]h ]h"]h$]h&]uh1jhj!ubj)}(hhh](j)}(hhh](j)}(hhh]h)}(h0h]h0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK:hj~ubah}(h]h ]h"]h$]h&]uh1jhj{ubj)}(hhh]h)}(hSuccessh]hSuccess}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK:hjubah}(h]h ]h"]h$]h&]uh1jhj{ubeh}(h]h ]h"]h$]h&]uh1jhjxubj)}(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&]uh1jhjxubj)}(hhh](j)}(hhh]h)}(h-2h]h-2}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKj;jjjju nametypes}(jj5j>jjuh}(jhj2hj;j8jjAjju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.