mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-18 19:57:31 +00:00
hv: tee: add an API for creating identical memmap according to e820
Given an e820, this API creates an identical memmap for specified e820 memory type, EPT memory cache type and access right. Tracked-On: #6571 Signed-off-by: Jie Deng <jie.deng@intel.com> Reviewed-by: Wang, Yu1 <yu1.wang@intel.com> Acked-by: Eddie Dong <eddie.dong@Intel.com>
This commit is contained in:
parent
c4d59c8f91
commit
0b1418d395
@ -551,6 +551,24 @@ static uint64_t lapic_pt_enabled_pcpu_bitmap(struct acrn_vm *vm)
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
void prepare_vm_identical_memmap(struct acrn_vm *vm, uint16_t e820_entry_type, uint64_t prot_orig)
|
||||
{
|
||||
const struct e820_entry *entry;
|
||||
const struct e820_entry *p_e820 = vm->e820_entries;
|
||||
uint32_t entries_count = vm->e820_entry_num;
|
||||
uint64_t *pml4_page = (uint64_t *)vm->arch_vm.nworld_eptp;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0U; i < entries_count; i++) {
|
||||
entry = p_e820 + i;
|
||||
if (entry->type == e820_entry_type) {
|
||||
ept_add_mr(vm, pml4_page, entry->baseaddr,
|
||||
entry->baseaddr, entry->length,
|
||||
prot_orig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre vm_id < CONFIG_MAX_VM_NUM && vm_config != NULL && rtn_vm != NULL
|
||||
* @pre vm->state == VM_POWERED_OFF
|
||||
|
@ -247,6 +247,7 @@ struct acrn_vm *get_service_vm(void);
|
||||
|
||||
void create_service_vm_e820(struct acrn_vm *vm);
|
||||
void create_prelaunched_vm_e820(struct acrn_vm *vm);
|
||||
void prepare_vm_identical_memmap(struct acrn_vm *vm, uint16_t e820_entry_type, uint64_t prot_orig);
|
||||
uint64_t find_space_from_ve820(struct acrn_vm *vm, uint32_t size, uint64_t min_addr, uint64_t max_addr);
|
||||
|
||||
int32_t prepare_os_image(struct acrn_vm *vm);
|
||||
|
Loading…
Reference in New Issue
Block a user