@@ -248,8 +248,8 @@ void install_2m_ept(unsigned long *pml4,
@map_2m : whether 2M page map is used
@perm : permission for every page
*/
-int setup_ept_range(unsigned long *pml4, unsigned long start,
- unsigned long len, int map_1g, int map_2m, u64 perm)
+void setup_ept_range(unsigned long *pml4, unsigned long start,
+ unsigned long len, int map_1g, int map_2m, u64 perm)
{
u64 phys = start;
u64 max = (u64)len + (u64)start;
@@ -270,7 +270,6 @@ int setup_ept_range(unsigned long *pml4, unsigned long start,
install_ept(pml4, phys, phys, perm);
phys += PAGE_SIZE;
}
- return 0;
}
/* get_ept_pte : Get the PTE of a given level in EPT,
@@ -558,8 +558,8 @@ void install_2m_ept(unsigned long *pml4, unsigned long phys,
unsigned long guest_addr, u64 perm);
void install_ept(unsigned long *pml4, unsigned long phys,
unsigned long guest_addr, u64 perm);
-int setup_ept_range(unsigned long *pml4, unsigned long start,
- unsigned long len, int map_1g, int map_2m, u64 perm);
+void setup_ept_range(unsigned long *pml4, unsigned long start,
+ unsigned long len, int map_1g, int map_2m, u64 perm);
unsigned long get_ept_pte(unsigned long *pml4,
unsigned long guest_addr, int level);
int set_ept_pte(unsigned long *pml4, unsigned long guest_addr,
@@ -919,11 +919,8 @@ static int setup_ept()
end_of_memory = fwcfg_get_u64(FW_CFG_RAM_SIZE);
if (end_of_memory < (1ul << 32))
end_of_memory = (1ul << 32);
- if (setup_ept_range(pml4, 0, end_of_memory,
- 0, support_2m, EPT_WA | EPT_RA | EPT_EA)) {
- printf("\tSet ept tables failed.\n");
- return 1;
- }
+ setup_ept_range(pml4, 0, end_of_memory, 0, support_2m,
+ EPT_WA | EPT_RA | EPT_EA);
return 0;
}
@@ -956,11 +953,10 @@ static int ept_init()
*((u32 *)data_page2) = MAGIC_VAL_2;
base_addr1 = (unsigned long)data_page1 & PAGE_MASK_2M;
base_addr2 = (unsigned long)data_page2 & PAGE_MASK_2M;
- if (setup_ept_range(pml4, base_addr1, base_addr1 + PAGE_SIZE_2M, 0, 0,
- EPT_WA | EPT_RA | EPT_EA) ||
- setup_ept_range(pml4, base_addr2, base_addr2 + PAGE_SIZE_2M, 0, 0,
- EPT_WA | EPT_RA | EPT_EA))
- return VMX_TEST_EXIT;
+ setup_ept_range(pml4, base_addr1, base_addr1 + PAGE_SIZE_2M, 0, 0,
+ EPT_WA | EPT_RA | EPT_EA);
+ setup_ept_range(pml4, base_addr2, base_addr2 + PAGE_SIZE_2M, 0, 0,
+ EPT_WA | EPT_RA | EPT_EA);
install_ept(pml4, (unsigned long)data_page1, (unsigned long)data_page2,
EPT_RA | EPT_WA | EPT_EA);
return VMX_TEST_START;
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> --- x86/vmx.c | 5 ++--- x86/vmx.h | 4 ++-- x86/vmx_tests.c | 16 ++++++---------- 3 files changed, 10 insertions(+), 15 deletions(-)