Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Commit

Permalink
bm: trigger vmcall to activate VT-d in eVMM
Browse files Browse the repository at this point in the history
Add new function trusty_late_init() which is called between
ExitBootService() and kernel jumping.
Currently, only activate_vtd_vmcall() is called in trusty_late_init().

Signed-off-by: Yadong Qi <yadong.qi@intel.com>
  • Loading branch information
YadongQi committed Dec 3, 2021
1 parent 9a84515 commit 2f70202
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/trusty_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@

EFI_STATUS load_tos_image(OUT VOID **bootimage);

VOID trusty_late_init(VOID);

#endif /* _TRUSTY_COMMON_H_ */
7 changes: 7 additions & 0 deletions libkernelflinger/android.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,13 @@ static inline EFI_STATUS handover_jump(EFI_HANDLE image,

boot:

#ifdef USE_TRUSTY
/*
* Called after ExitBootService.
*/
trusty_late_init();
#endif

#if __LP64__
/* The 64-bit kernel entry is 512 bytes after the start. */
kernel_start += 512;
Expand Down
14 changes: 14 additions & 0 deletions libkernelflinger/trusty_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,17 @@ EFI_STATUS load_tos_image(OUT VOID **tosimage)

return EFI_SUCCESS;
}

static VOID activate_vtd(VOID)
{
#define VMCALL_ACTIVATE_VTD 0x56544400ULL // "VTD"
asm volatile ("vmcall" : : "a"(VMCALL_ACTIVATE_VTD));
}

/*
* This function is designed to run after bootloader triggered ExitBootService.
*/
VOID trusty_late_init(VOID)
{
activate_vtd();
}

0 comments on commit 2f70202

Please sign in to comment.