mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-21 00:38:28 +00:00
hv: trusty: reserve memory for trusty
The previous would reserve memory for trusty in SOS kernel. Howerer, there would no available 16 MB continue memory any more after a long time. This result in allocating memory for trusty failed. This patch will reserve memory for trusty in ACRN hypervisor in which case the memory allocation for trusty will never fail. Tracked-On: #1942 Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -70,6 +70,8 @@ static struct page uos_nworld_pd_pages[CONFIG_MAX_VM_NUM - 1U][PD_PAGE_NUM(EPT_A
|
||||
static struct page uos_nworld_pt_pages[CONFIG_MAX_VM_NUM - 1U][PT_PAGE_NUM(EPT_ADDRESS_SPACE(CONFIG_UOS_RAM_SIZE))];
|
||||
|
||||
static struct page uos_sworld_pgtable_pages[CONFIG_MAX_VM_NUM - 1U][TRUSTY_PGTABLE_PAGE_NUM(TRUSTY_RAM_SIZE)];
|
||||
/* pre-assumption: TRUSTY_RAM_SIZE is 2M aligned */
|
||||
static struct page uos_sworld_memory[CONFIG_MAX_VM_NUM - 1U][TRUSTY_RAM_SIZE >> PAGE_SHIFT] __aligned(MEM_2M);
|
||||
|
||||
/* ept: extended page table*/
|
||||
static union pgtable_pages_info ept_pages_info[CONFIG_MAX_VM_NUM] = {
|
||||
@@ -84,6 +86,11 @@ static union pgtable_pages_info ept_pages_info[CONFIG_MAX_VM_NUM] = {
|
||||
},
|
||||
};
|
||||
|
||||
void *get_reserve_sworld_memory_base(void)
|
||||
{
|
||||
return uos_sworld_memory;
|
||||
}
|
||||
|
||||
static inline uint64_t ept_get_default_access_right(void)
|
||||
{
|
||||
return EPT_RWX;
|
||||
@@ -135,6 +142,11 @@ static inline struct page *ept_get_pt_page(const union pgtable_pages_info *info,
|
||||
return page;
|
||||
}
|
||||
|
||||
static inline void *ept_get_sworld_memory_base(const union pgtable_pages_info *info)
|
||||
{
|
||||
return info->ept.sworld_memory_base;
|
||||
}
|
||||
|
||||
void init_ept_mem_ops(struct acrn_vm *vm)
|
||||
{
|
||||
uint16_t vm_id = vm->vm_id;
|
||||
@@ -145,6 +157,9 @@ void init_ept_mem_ops(struct acrn_vm *vm)
|
||||
ept_pages_info[vm_id].ept.nworld_pd_base = uos_nworld_pd_pages[vm_id - 1U];
|
||||
ept_pages_info[vm_id].ept.nworld_pt_base = uos_nworld_pt_pages[vm_id - 1U];
|
||||
ept_pages_info[vm_id].ept.sworld_pgtable_base = uos_sworld_pgtable_pages[vm_id - 1U];
|
||||
ept_pages_info[vm_id].ept.sworld_memory_base = uos_sworld_memory[vm_id - 1U];
|
||||
|
||||
vm->arch_vm.ept_mem_ops.get_sworld_memory_base = ept_get_sworld_memory_base;
|
||||
}
|
||||
vm->arch_vm.ept_mem_ops.info = &ept_pages_info[vm_id];
|
||||
|
||||
|
Reference in New Issue
Block a user