Skip to content

Commit 902eeba

Browse files
Marc Zyngierwilldeacon
authored andcommitted
KVM: arm64: Add documentation for KVM_EXIT_ARM_LDST64B
Add a bit of documentation for KVM_EXIT_ARM_LDST64B so that userspace knows what to expect. Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Oliver Upton <oupton@kernel.org> Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com> Signed-off-by: Zhou Wang <wangzhou1@hisilicon.com> Signed-off-by: Will Deacon <will@kernel.org>
1 parent f174a9f commit 902eeba

1 file changed

Lines changed: 36 additions & 7 deletions

File tree

Documentation/virt/kvm/api.rst

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,12 +1303,13 @@ userspace, for example because of missing instruction syndrome decode
13031303
information or because there is no device mapped at the accessed IPA, then
13041304
userspace can ask the kernel to inject an external abort using the address
13051305
from the exiting fault on the VCPU. It is a programming error to set
1306-
ext_dabt_pending after an exit which was not either KVM_EXIT_MMIO or
1307-
KVM_EXIT_ARM_NISV. This feature is only available if the system supports
1308-
KVM_CAP_ARM_INJECT_EXT_DABT. This is a helper which provides commonality in
1309-
how userspace reports accesses for the above cases to guests, across different
1310-
userspace implementations. Nevertheless, userspace can still emulate all Arm
1311-
exceptions by manipulating individual registers using the KVM_SET_ONE_REG API.
1306+
ext_dabt_pending after an exit which was not either KVM_EXIT_MMIO,
1307+
KVM_EXIT_ARM_NISV, or KVM_EXIT_ARM_LDST64B. This feature is only available if
1308+
the system supports KVM_CAP_ARM_INJECT_EXT_DABT. This is a helper which
1309+
provides commonality in how userspace reports accesses for the above cases to
1310+
guests, across different userspace implementations. Nevertheless, userspace
1311+
can still emulate all Arm exceptions by manipulating individual registers
1312+
using the KVM_SET_ONE_REG API.
13121313

13131314
See KVM_GET_VCPU_EVENTS for the data structure.
13141315

@@ -7050,12 +7051,14 @@ in send_page or recv a buffer to recv_page).
70507051

70517052
::
70527053

7053-
/* KVM_EXIT_ARM_NISV */
7054+
/* KVM_EXIT_ARM_NISV / KVM_EXIT_ARM_LDST64B */
70547055
struct {
70557056
__u64 esr_iss;
70567057
__u64 fault_ipa;
70577058
} arm_nisv;
70587059

7060+
- KVM_EXIT_ARM_NISV:
7061+
70597062
Used on arm64 systems. If a guest accesses memory not in a memslot,
70607063
KVM will typically return to userspace and ask it to do MMIO emulation on its
70617064
behalf. However, for certain classes of instructions, no instruction decode
@@ -7089,6 +7092,32 @@ Note that although KVM_CAP_ARM_NISV_TO_USER will be reported if
70897092
queried outside of a protected VM context, the feature will not be
70907093
exposed if queried on a protected VM file descriptor.
70917094

7095+
- KVM_EXIT_ARM_LDST64B:
7096+
7097+
Used on arm64 systems. When a guest using a LD64B, ST64B, ST64BV, ST64BV0,
7098+
outside of a memslot, KVM will return to userspace with KVM_EXIT_ARM_LDST64B,
7099+
exposing the relevant ESR_EL2 information and faulting IPA, similarly to
7100+
KVM_EXIT_ARM_NISV.
7101+
7102+
Userspace is supposed to fully emulate the instructions, which includes:
7103+
7104+
- fetch of the operands for a store, including ACCDATA_EL1 in the case
7105+
of a ST64BV0 instruction
7106+
- deal with the endianness if the guest is big-endian
7107+
- emulate the access, including the delivery of an exception if the
7108+
access didn't succeed
7109+
- provide a return value in the case of ST64BV/ST64BV0
7110+
- return the data in the case of a load
7111+
- increment PC if the instruction was successfully executed
7112+
7113+
Note that there is no expectation of performance for this emulation, as it
7114+
involves a large number of interaction with the guest state. It is, however,
7115+
expected that the instruction's semantics are preserved, specially the
7116+
single-copy atomicity property of the 64 byte access.
7117+
7118+
This exit reason must be handled if userspace sets ID_AA64ISAR1_EL1.LS64 to a
7119+
non-zero value, indicating that FEAT_LS64* is enabled.
7120+
70927121
::
70937122

70947123
/* KVM_EXIT_X86_RDMSR / KVM_EXIT_X86_WRMSR */

0 commit comments

Comments
 (0)