Skip to content

Commit ee16841

Browse files
bonzinigregkh
authored andcommitted
Documentation: KVM: add API issues section
[ Upstream commit cde363a ] Add a section to document all the different ways in which the KVM API sucks. I am sure there are way more, give people a place to vent so that userspace authors are aware. Signed-off-by: Paolo Bonzini <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent b8f3b3c commit ee16841

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7265,3 +7265,49 @@ The argument to KVM_ENABLE_CAP is also a bitmask, and must be a subset
72657265
of the result of KVM_CHECK_EXTENSION. KVM will forward to userspace
72667266
the hypercalls whose corresponding bit is in the argument, and return
72677267
ENOSYS for the others.
7268+
7269+
9. Known KVM API problems
7270+
=========================
7271+
7272+
In some cases, KVM's API has some inconsistencies or common pitfalls
7273+
that userspace need to be aware of. This section details some of
7274+
these issues.
7275+
7276+
Most of them are architecture specific, so the section is split by
7277+
architecture.
7278+
7279+
9.1. x86
7280+
--------
7281+
7282+
``KVM_GET_SUPPORTED_CPUID`` issues
7283+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7284+
7285+
In general, ``KVM_GET_SUPPORTED_CPUID`` is designed so that it is possible
7286+
to take its result and pass it directly to ``KVM_SET_CPUID2``. This section
7287+
documents some cases in which that requires some care.
7288+
7289+
Local APIC features
7290+
~~~~~~~~~~~~~~~~~~~
7291+
7292+
CPU[EAX=1]:ECX[21] (X2APIC) is reported by ``KVM_GET_SUPPORTED_CPUID``,
7293+
but it can only be enabled if ``KVM_CREATE_IRQCHIP`` or
7294+
``KVM_ENABLE_CAP(KVM_CAP_IRQCHIP_SPLIT)`` are used to enable in-kernel emulation of
7295+
the local APIC.
7296+
7297+
The same is true for the ``KVM_FEATURE_PV_UNHALT`` paravirtualized feature.
7298+
7299+
CPU[EAX=1]:ECX[24] (TSC_DEADLINE) is not reported by ``KVM_GET_SUPPORTED_CPUID``.
7300+
It can be enabled if ``KVM_CAP_TSC_DEADLINE_TIMER`` is present and the kernel
7301+
has enabled in-kernel emulation of the local APIC.
7302+
7303+
Obsolete ioctls and capabilities
7304+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7305+
7306+
KVM_CAP_DISABLE_QUIRKS does not let userspace know which quirks are actually
7307+
available. Use ``KVM_CHECK_EXTENSION(KVM_CAP_DISABLE_QUIRKS2)`` instead if
7308+
available.
7309+
7310+
Ordering of KVM_GET_*/KVM_SET_* ioctls
7311+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7312+
7313+
TBD

0 commit comments

Comments
 (0)