• Brijesh Singh's avatar
    x86/sev: Check the VMPL level · 81cc3df9
    Brijesh Singh authored
    The Virtual Machine Privilege Level (VMPL) feature in the SEV-SNP
    architecture allows a guest VM to divide its address space into four
    levels. The level can be used to provide hardware isolated abstraction
    layers within a VM. VMPL0 is the highest privilege level, and VMPL3 is
    the least privilege level. Certain operations must be done by the VMPL0
    software, such as:
    
    * Validate or invalidate memory range (PVALIDATE instruction)
    * Allocate VMSA page (RMPADJUST instruction when VMSA=1)
    
    The initial SNP support requires that the guest kernel is running at
    VMPL0. Add such a check to verify the guest is running at level 0 before
    continuing the boot. There is no easy method to query the current VMPL
    level, so use the RMPADJUST instruction to determine whether the guest
    is running at the VMPL0.
    
      [ bp: Massage commit message. ]
    Signed-off-by: default avatarBrijesh Singh <brijesh.singh@amd.com>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20220307213356.2797205-15-brijesh.singh@amd.com
    81cc3df9
sev.h 3.62 KB