HV: trusty: refine secure_world_control

Define Bitmap flag to indicate secure world's state:
    supported: 0(not supported), 1(supported)
    active:    0(inactive), 1(active)

Refine secure_world_memory:
    base_gpa_in_sos: base_gpa from SOS's view
    base_gpa_in_uos: base_gpa from UOS's view, this is the original base_gpa
                     allocated by bootloader.
    Recording above GPA is for usage of trusty EPT destroy and re-create.
    There is an assumption: the secure world's memory address is contiguous
    in both SOS and physical side.

Signed-off-by: Qi Yadong <yadong.qi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Qi Yadong
2018-05-25 09:30:37 +08:00
committed by lijinxia
parent ff96453993
commit b5b769f45a
9 changed files with 37 additions and 28 deletions

View File

@@ -804,7 +804,7 @@ uint64_t create_guest_initial_paging(struct vm *vm)
* FIXME: this is a tempory solution for trusty enabling,
* the final solution is that vSBL will setup guest page tables
*/
if (vm->sworld_control.sworld_enabled && !is_vm0(vm)) {
if (vm->sworld_control.flag.supported && !is_vm0(vm)) {
/* clear page entry for trusty */
(void)memset(pml4_addr + 6U * PAGE_SIZE_4K, 0U, PAGE_SIZE_4K);

View File

@@ -156,8 +156,8 @@ int create_vm(struct vm_description *vm_desc, struct vm **rtn_vm)
#endif
} else {
/* populate UOS vm fields according to vm_desc */
vm->sworld_control.sworld_enabled =
vm_desc->sworld_enabled;
vm->sworld_control.flag.supported =
vm_desc->sworld_supported;
(void)memcpy_s(&vm->GUID[0], sizeof(vm->GUID),
&vm_desc->GUID[0],
sizeof(vm_desc->GUID));
@@ -266,7 +266,7 @@ int shutdown_vm(struct vm *vm)
vioapic_cleanup(vm->arch_vm.virt_ioapic);
/* Destroy secure world */
if (vm->sworld_control.sworld_enabled) {
if (vm->sworld_control.flag.active) {
destroy_secure_world(vm);
}
/* Free EPT allocated resources assigned to VM */