@@ -40,6 +40,7 @@
/x86_64/set_sregs_test
/x86_64/sev_all_boot_test
/x86_64/sev_migrate_tests
+/x86_64/sev_private_mem_test
/x86_64/smaller_maxphyaddr_emulation_test
/x86_64/smm_test
/x86_64/state_test
@@ -104,6 +104,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/pmu_event_filter_test
TEST_GEN_PROGS_x86_64 += x86_64/private_mem_test
TEST_GEN_PROGS_x86_64 += x86_64/set_boot_cpu_id
TEST_GEN_PROGS_x86_64 += x86_64/set_sregs_test
+TEST_GEN_PROGS_x86_64 += x86_64/sev_private_mem_test
TEST_GEN_PROGS_x86_64 += x86_64/smaller_maxphyaddr_emulation_test
TEST_GEN_PROGS_x86_64 += x86_64/smm_test
TEST_GEN_PROGS_x86_64 += x86_64/state_test
new file mode 100644
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022, Google LLC.
+ */
+#define _GNU_SOURCE /* for program_invocation_short_name */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <private_mem_test_helper.h>
+
+int main(int argc, char *argv[])
+{
+ execute_sev_vm_with_private_test_mem(
+ VM_MEM_SRC_ANONYMOUS_AND_RESTRICTED_MEMFD);
+
+ /* Needs 2MB Hugepages */
+ if (get_free_huge_2mb_pages() >= 1) {
+ printf("Running SEV VM private mem test with 2M pages\n");
+ execute_sev_vm_with_private_test_mem(
+ VM_MEM_SRC_ANON_HTLB2M_AND_RESTRICTED_MEMFD);
+ } else
+ printf("Skipping SEV VM private mem test with 2M pages\n");
+
+ return 0;
+}
Add SEV VM specific private mem test to invoke selftest logic similar to the one executed for non-confidential VMs. Signed-off-by: Vishal Annapurve <vannapurve@google.com> --- tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 1 + .../kvm/x86_64/sev_private_mem_test.c | 26 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 tools/testing/selftests/kvm/x86_64/sev_private_mem_test.c