• Brijesh Singh's avatar
    KVM: SEV: Add support to handle RMP nested page faults · c63cf135
    Brijesh Singh authored
    When SEV-SNP is enabled in the guest, the hardware places restrictions
    on all memory accesses based on the contents of the RMP table. When
    hardware encounters RMP check failure caused by the guest memory access
    it raises the #NPF. The error code contains additional information on
    the access type. See the APM volume 2 for additional information.
    
    When using gmem, RMP faults resulting from mismatches between the state
    in the RMP table vs. what the guest expects via its page table result
    in KVM_EXIT_MEMORY_FAULTs being forwarded to userspace to handle. This
    means the only expected case that needs to be handled in the kernel is
    when the page size of the entry in the RMP table is larger than the
    mapping in the nested page table, in which case a PSMASH instruction
    needs to be issued to split the large RMP entry into individual 4K
    entries so that subsequent accesses can succeed.
    Signed-off-by: default avatarBrijesh Singh <brijesh.singh@amd.com>
    Co-developed-by: default avatarMichael Roth <michael.roth@amd.com>
    Signed-off-by: default avatarMichael Roth <michael.roth@amd.com>
    Signed-off-by: default avatarAshish Kalra <ashish.kalra@amd.com>
    Message-ID: <20240501085210.2213060-12-michael.roth@amd.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    c63cf135
mmu.h 9.93 KB