lkml.org 
[lkml]   [2021]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v8 08/40] x86/sev: Check the vmpl level
    On Fri, Dec 17, 2021 at 04:33:02PM -0600, Tom Lendacky wrote:
    > > > > > + * There is no straightforward way to query the current VMPL level. The
    > > > > > + * simplest method is to use the RMPADJUST instruction to change a page
    > > > > > + * permission to a VMPL level-1, and if the guest kernel is launched at
    > > > > > + * a level <= 1, then RMPADJUST instruction will return an error.
    > > > > Perhaps a nit. When you say "level <= 1", do you mean a level lower than or
    > > > > equal to 1 semantically, or numerically?
    > >
    > > Its numerically, please see the AMD APM vol 3.
    >
    > Actually it is not numerically... if it was numerically, then 0 <= 1 would
    > return an error, but VMPL0 is the highest permission level.

    Just write in that comment exactly what this function does:

    "RMPADJUST modifies RMP permissions of a lesser-privileged (numerically
    higher) privilege level. Here, clear the VMPL1 permission mask of the
    GHCB page. If the guest is not running at VMPL0, this will fail.

    If the guest is running at VMP0, it will succeed. Even if that operation
    modifies permission bits, it is still ok to do currently because Linux
    SNP guests are supported only on VMPL0 so VMPL1 or higher permission
    masks changing is a don't-care."

    and then everything is clear wrt numbering, privilege, etc.

    Ok?

    --
    Regards/Gruss,
    Boris.

    https://people.kernel.org/tglx/notes-about-netiquette

    \
     
     \ /
      Last update: 2021-12-20 19:10    [W:2.645 / U:0.112 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site