The initial paragraph of the documentation here makes it sound like a KVM_EXIT_MEMORY_FAULT will always accompany an EFAULT from KVM_RUN, but that's not a guarantee. Also, define zero to be a special value for the "size" field. This allows memory faults exits to be set up in spots where KVM_RUN must EFAULT, but is not able to supply an accurate size. Signed-off-by: Anish Moorthy <amoorthy@xxxxxxxxxx> --- Documentation/virt/kvm/api.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 8e5dad80b337..c5ce7944005c 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -7073,7 +7073,8 @@ spec refer, https://github.com/riscv/riscv-sbi-doc. KVM_EXIT_MEMORY_FAULT indicates the vCPU has encountered a memory fault that could not be resolved by KVM. The 'gpa' and 'size' (in bytes) describe the -guest physical address range [gpa, gpa + size) of the fault. The 'flags' field +guest physical address range [gpa, gpa + size) of the fault: when zero, it +indicates that the size of the fault could not be determined. The 'flags' field describes properties of the faulting access that are likely pertinent: - KVM_MEMORY_EXIT_FLAG_PRIVATE - When set, indicates the memory fault occurred @@ -8131,7 +8132,7 @@ unavailable to host or other VMs. :Architectures: x86 :Returns: Informational only, -EINVAL on direct KVM_ENABLE_CAP. -The presence of this capability indicates that KVM_RUN will fill +The presence of this capability indicates that KVM_RUN *may* fill kvm_run.memory_fault if KVM cannot resolve a guest page fault VM-Exit, e.g. if there is a valid memslot but no backing VMA for the corresponding host virtual address. -- 2.46.0.76.ge559c4bf1a-goog