crypto: ccp: Handle non-volatile INIT_EX data when SNP is enabled
authorTom Lendacky <thomas.lendacky@amd.com>
Fri, 26 Jan 2024 04:11:17 +0000 (22:11 -0600)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 29 Jan 2024 19:34:18 +0000 (20:34 +0100)
commit7364a6fbca45f826952ea932699fb2171d06ee73
tree795fec83f49062057dc885fbb0260c55c2f639fb
parent24512afa4336a1c14de750238abe32759cfba4b0
crypto: ccp: Handle non-volatile INIT_EX data when SNP is enabled

For SEV/SEV-ES, a buffer can be used to access non-volatile data so it
can be initialized from a file specified by the init_ex_path CCP module
parameter instead of relying on the SPI bus for NV storage, and
afterward the buffer can be read from to sync new data back to the file.

When SNP is enabled, the pages comprising this buffer need to be set to
firmware-owned in the RMP table before they can be accessed by firmware
for subsequent updates to the initial contents.

Implement that handling here.

  [ bp: Carve out allocation into a helper. ]

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Co-developed-by: Michael Roth <michael.roth@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-18-michael.roth@amd.com
drivers/crypto/ccp/sev-dev.c