x86/sev: Add RMP entry lookup helpers
authorBrijesh Singh <brijesh.singh@amd.com>
Fri, 26 Jan 2024 04:11:06 +0000 (22:11 -0600)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 29 Jan 2024 16:25:55 +0000 (17:25 +0100)
commit94b36bc244bb134ec616dd3f2d37343cd8c1be54
tree1e607e72327731e4f108a487b500df58a247bcdd
parente3fd08afb7c350d5612f113eadfb4ebb6ed08deb
x86/sev: Add RMP entry lookup helpers

Add a helper that can be used to access information contained in the RMP
entry corresponding to a particular PFN. This will be needed to make
decisions on how to handle setting up mappings in the NPT in response to
guest page-faults and handling things like cleaning up pages and setting
them back to the default hypervisor-owned state when they are no longer
being used for private data.

  [ mdr: separate 'assigned' indicator from return code, and simplify
    function signatures for various helpers. ]

Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Co-developed-by: Ashish Kalra <ashish.kalra@amd.com>
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20240126041126.1927228-7-michael.roth@amd.com
arch/x86/include/asm/sev.h
arch/x86/virt/svm/sev.c