xref: /kvm-unit-tests/x86/access_test.c (revision c98ce6e0f823e2aaccdf6af60103a71853ad6f92)
10f10d9aeSAaron Lewis #include "libcflat.h"
20f10d9aeSAaron Lewis #include "processor.h"
30f10d9aeSAaron Lewis #include "x86/vm.h"
40f10d9aeSAaron Lewis #include "access.h"
50f10d9aeSAaron Lewis 
60f10d9aeSAaron Lewis int main(void)
70f10d9aeSAaron Lewis {
80f10d9aeSAaron Lewis     int r;
90f10d9aeSAaron Lewis 
100f10d9aeSAaron Lewis     printf("starting test\n\n");
1122866f1eSAaron Lewis     r = ac_test_run(PT_LEVEL_PML4);
120f10d9aeSAaron Lewis 
13*c98ce6e0SAlexandru Elisei #ifndef CONFIG_EFI
1492a6c9b9SPaolo Bonzini     /*
1592a6c9b9SPaolo Bonzini      * Not supported yet for UEFI, because setting up 5
1692a6c9b9SPaolo Bonzini      * level page table requires entering real mode.
1792a6c9b9SPaolo Bonzini      */
180f10d9aeSAaron Lewis     if (this_cpu_has(X86_FEATURE_LA57)) {
190f10d9aeSAaron Lewis         printf("starting 5-level paging test.\n\n");
200f10d9aeSAaron Lewis         setup_5level_page_table();
2122866f1eSAaron Lewis         r = ac_test_run(PT_LEVEL_PML5);
220f10d9aeSAaron Lewis     }
2392a6c9b9SPaolo Bonzini #endif
240f10d9aeSAaron Lewis 
250f10d9aeSAaron Lewis     return r ? 0 : 1;
260f10d9aeSAaron Lewis }
27