Perform page state conversions to private on a range of pages that are already in a hypervisor-owned state. The test introduces support for both 4K pages as well as 2M large pages depending on the order specified. Perform a write operation on the pages while they are shared pages. After conversion, run a re-validation test on one of the converted pages to ensure the page state is private. Signed-off-by: Pavan Kumar Paluri <papaluri@xxxxxxx> --- x86/amd_sev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/x86/amd_sev.c b/x86/amd_sev.c index 1723a235166b..6c6fe8e05adb 100644 --- a/x86/amd_sev.c +++ b/x86/amd_sev.c @@ -615,6 +615,17 @@ static void test_sev_psc_ghcb_nae(void) "Write to %d un-encrypted pages after private->shared conversion", 1 << SNP_PSC_ALLOC_ORDER); + /* Shared->Private operations */ + report_info("Shared->Private conversion test using GHCB NAE"); + + set_pte_encrypted((unsigned long)vm_pages, 1 << SNP_PSC_ALLOC_ORDER); + + sev_set_pages_state((unsigned long)vm_pages, 1 << SNP_PSC_ALLOC_ORDER, + SNP_PAGE_STATE_PRIVATE, ghcb, large_page); + + report(is_validated_private_page((unsigned long)vm_pages, large_page, true), + "Expected page state: Private"); + /* Cleanup */ free_pages_by_order(vm_pages, SNP_PSC_ALLOC_ORDER); } -- 2.34.1