mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 12:42:54 +00:00
HV: trusty: refine version checking when initializing trusty
Replace if--else logic with switch--case when checking interface version. Tracked-On: #1265 Signed-off-by: Qi Yadong <yadong.qi@intel.com> Acked-by: Zhu Bing <bing.zhu@intel.com>
This commit is contained in:
parent
9d602208e5
commit
8f0cb5630d
@ -417,28 +417,30 @@ bool initialize_trusty(struct vcpu *vcpu, uint64_t param)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boot_param.version > TRUSTY_VERSION_2) {
|
switch (boot_param.version) {
|
||||||
dev_dbg(ACRN_DBG_TRUSTY, "%s: Version(%u) not supported!\n",
|
case TRUSTY_VERSION_2:
|
||||||
__func__, boot_param.version);
|
trusty_entry_gpa = ((uint64_t)boot_param.entry_point) |
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
trusty_entry_gpa = (uint64_t)boot_param.entry_point;
|
|
||||||
trusty_base_gpa = (uint64_t)boot_param.base_addr;
|
|
||||||
trusty_mem_size = boot_param.mem_size;
|
|
||||||
|
|
||||||
if (boot_param.version >= TRUSTY_VERSION_2) {
|
|
||||||
trusty_entry_gpa |=
|
|
||||||
(((uint64_t)boot_param.entry_point_high) << 32);
|
(((uint64_t)boot_param.entry_point_high) << 32);
|
||||||
trusty_base_gpa |=
|
trusty_base_gpa = ((uint64_t)boot_param.base_addr) |
|
||||||
(((uint64_t)boot_param.base_addr_high) << 32);
|
(((uint64_t)boot_param.base_addr_high) << 32);
|
||||||
|
|
||||||
/* copy rpmb_key from OSloader */
|
/* copy rpmb_key from OSloader */
|
||||||
(void)memcpy_s(&g_key_info.rpmb_key[0][0], 64U,
|
(void)memcpy_s(&g_key_info.rpmb_key[0][0], 64U,
|
||||||
&boot_param.rpmb_key[0], 64U);
|
&boot_param.rpmb_key[0], 64U);
|
||||||
(void)memset(&boot_param.rpmb_key[0], 0U, 64U);
|
(void)memset(&boot_param.rpmb_key[0], 0U, 64U);
|
||||||
|
break;
|
||||||
|
case TRUSTY_VERSION:
|
||||||
|
trusty_entry_gpa = (uint64_t)boot_param.entry_point;
|
||||||
|
trusty_base_gpa = (uint64_t)boot_param.base_addr;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dev_dbg(ACRN_DBG_TRUSTY, "%s: Version(%u) not supported!\n",
|
||||||
|
__func__, boot_param.version);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trusty_mem_size = boot_param.mem_size;
|
||||||
|
|
||||||
create_secure_world_ept(vm, trusty_base_gpa, trusty_mem_size,
|
create_secure_world_ept(vm, trusty_base_gpa, trusty_mem_size,
|
||||||
TRUSTY_EPT_REBASE_GPA);
|
TRUSTY_EPT_REBASE_GPA);
|
||||||
trusty_base_hpa = vm->sworld_control.sworld_memory.base_hpa;
|
trusty_base_hpa = vm->sworld_control.sworld_memory.base_hpa;
|
||||||
|
Loading…
Reference in New Issue
Block a user