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

bm: trigger vmcall to activate VT-d in eVMM #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_ */
10 changes: 10 additions & 0 deletions libkernelflinger/android.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
#ifdef USE_FIRSTSTAGE_MOUNT
#include "firststage_mount.h"
#endif
#ifdef USE_TRUSTY
#include "trusty_common.h"
#endif

#include "uefi_utils.h"

Expand Down Expand Up @@ -467,6 +470,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();
}