mmu:create temporary page tables for guest at run time

Before this patch, guest temporary page tables were generated by hardcode
at compile time, HV will copy this page tables to guest before guest
launch.

This patch creates temporary page tables at runtime for the range of 0~4G,
and create page tables to cover new range(511G~511G+16M) with trusty
requirement.

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Mingqiang Chi
2018-04-03 18:45:29 +08:00
committed by Jack Ren
parent 4d0f26d0e1
commit 9aa9a77457
11 changed files with 143 additions and 56 deletions

View File

@@ -43,6 +43,9 @@
#define CPU_PAGE_SIZE 0x1000
#define CPU_PAGE_MASK 0xFFFFFFFFFFFFF000
#define MMU_PTE_PAGE_SHIFT CPU_PAGE_SHIFT
#define MMU_PDE_PAGE_SHIFT 21
/* Define CPU stack alignment */
#define CPU_STACK_ALIGN 16

View File

@@ -113,7 +113,7 @@ struct vm_state_info {
};
struct vm_arch {
void *guest_pml4; /* Guest pml4 */
uint64_t guest_init_pml4;/* Guest init pml4 */
/* EPT hierarchy for Normal World */
uint64_t nworld_eptp;
/* EPT hierarchy for Secure World

View File

@@ -381,7 +381,7 @@ extern uint8_t CPU_Boot_Page_Tables_Start_VM[];
/* External Interfaces */
int is_ept_supported(void);
void *create_guest_paging(struct vm *vm);
uint64_t create_guest_initial_paging(struct vm *vm);
void destroy_ept(struct vm *vm);
uint64_t gpa2hpa(struct vm *vm, uint64_t gpa);
uint64_t gpa2hpa_check(struct vm *vm, uint64_t gpa,

View File

@@ -36,6 +36,10 @@
#define MMC_PROD_NAME_WITH_PSN_LEN 15
#define BUP_MKHI_BOOTLOADER_SEED_LEN 64
/* Trusty EPT rebase gpa: 511G */
#define TRUSTY_EPT_REBASE_GPA (511ULL*1024ULL*1024ULL*1024ULL)
#define TRUSTY_MEMORY_SIZE 0x01000000
/* Structure of seed info */
struct seed_info {
uint8_t cse_svn;