diff mbox

[kvm-unit-tests,v2,6/6] x86: vmx: don't explicitly split identity EPT map

Message ID 1456871694-23042-7-git-send-email-pfeiner@google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Feiner March 1, 2016, 10:34 p.m. UTC
Since install_ept_entry automatically splits large EPTEs, it's no
longer necessary to explicitly pave the EPT identity map with 4K
entries mapping [base_addr1, base_addr1 + PAGE_SIZE_2M). I.e.,
install_ept(data_page1, data_page2) does the paving before installing
the 4k data_page1 -> data_page2 mapping.

The other setup_ept_range call was unnecessary.

Note that there was benign bug in the deleted code. The third argument
of setup_ept_range is length not end! Thus the range of GPA mappings
being split was [base_addr1, base_addr1 * 2 + PAGE_SIZE_2M).

Signed-off-by: Peter Feiner <pfeiner@google.com>
---
 x86/vmx_tests.c | 7 -------
 1 file changed, 7 deletions(-)
diff mbox

Patch

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index bb65c06..4ef2247 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -954,7 +954,6 @@  static int apic_version;
 
 static int ept_init()
 {
-	unsigned long base_addr1, base_addr2;
 	u32 ctrl_cpu[2];
 
 	if (!(ctrl_cpu_rev[0].clr & CPU_SECONDARY) ||
@@ -979,12 +978,6 @@  static int ept_init()
 	memset(data_page2, 0x0, PAGE_SIZE);
 	*((u32 *)data_page1) = MAGIC_VAL_1;
 	*((u32 *)data_page2) = MAGIC_VAL_2;
-	base_addr1 = (unsigned long)data_page1 & PAGE_MASK_2M;
-	base_addr2 = (unsigned long)data_page2 & PAGE_MASK_2M;
-	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);