Commit db5d175
feat(opentmk): opentmk framework with first testcase (#1210)
OpenTMK framework for testing guest-based scenarios with a HCL.
The above diagram illustrates relation between abstract modules.
<img width="975" height="681" alt="image"
src="https://github.com/user-attachments/assets/fd35cf31-7de0-472c-8ab5-5d99591353d1"
/>
### UEFI Executor Design Decisions:
1. Allocator
a. The allocator today switches between UEFI Runtime Allocator and
LockedHeapAllocator.
b. The decision to switch between the two allocator is to allow more
control over which sections of the memory map is for the heap, this is
helpful so that we know we are using a memory section which will not be
used by UEFI runtime services after exit boot services. Using the UEFI
allocator is important so that we can allocate any object before we call
main. If a panic occurs before main, we need to allocate strings in the
Panic handler. UEFI allocator can’t be used after exit boot services.
2. Panic Handler
a. The panic handler today logs the panic info as string using the
logger module and then loops. The test driver is informed of the panic
and the test driver terminates the VM.
b. Improvement planned to shutdown the VM.
c. Today we use our own interrupt handler, using ud2 causes an
fainterrupt but that does not cause a triple fault.
3. Test Configuration Handler
a. In scope for a task being tracked
### Platform Design Decisions
ARM64 implementation is a placeholder and out of scope, the work is
tacked by <ADO WI>. The work is mostly around implementing Interrupt
handling, VP bring up (just the implementation for default context), TPM
specific changes and end-to-end testing.
1. HvCall
a. Platform/hyperv/arch houses all the modules which require a platform
specific implementation.
b. VTL calls/return need to be handled carefully, as many of the
general-purpose register values are not preserved across VTL switch. The
requires us to push all the values to stack before a switch and restore
back when we return. We also need to handle this carefully when VTL
switch happens because of secure intercepts.
c. Tests which require for secure intercepts to happen must use macro:
create_function_with_restore to isolate the violating function.
2. Hyper-V platform test context implementation
a. Today we hardcode the value for how many VPs are present. Earlier I
had tried constructing the heuristics to read the CPU topology from
CPU-ID but they returned differently for Intel and AMD. I intend to use
ACPI table to construct this information/take the values as input in
test configuration in the next set of improvements.
b. The AP bring up in start_on_vp takes care of everything related to
enabling the VTLs and scheduling the VpExecutor object. Working on
changing the name as suggested in the PR. This change is mostly for
simplicity, for complex tests where the heuristic has to be tested for
boundary testing I recommend authoring a test with direct dependency on
platform and calling the hypercall interface (HvCall is a pub field in
HvTestCtx) without using the generic interface of the platform traits.
3. X86_64 Interrupt Management
a. We depend on the x86_64 crate to provide structure and helpers, along
with x86-interrupt ABI.
b. Since custom ABI is a nightly feature, we keep the feature behind the
nightly feature flag.
c. We are tracking a task to move to naked functions as a part of the
improvements.
4. TPM
a. We currently use a duplicated module of protocol module from tpm
crate, we can’t depend on tpm crate since it links to openssl which we
want to avoid, apart from that we we can’t readily move the protocol
because of some coupling between the protocol module and the errors
struct from tpm ref crate. I’ll work on decoupling the modules once we
are ok with other changes in this PR. I feel it may be better to take
the decoupling in a follow up PR, since there are a lot of changes in
this PR, isolating the PR to not touch TPM implementation will help
reduce risk of breaking anything in the TPM crate.
5. Serial Port on AMD64
a. We have a separate implementation which is building on top of
minimal_rt, the major reasons are to facilitate multiple process writing
logs at the same time (by implementing locks) and to write to COM1/COM2
instead of the default COM3.
---------
Co-authored-by: Matt LaFayette (Kurjanowicz) <[email protected]>1 parent c85e6e7 commit db5d175
File tree
76 files changed
+9000
-34
lines changed- flowey
- flowey_cli
- flowey_core
- flowey_hvlite
- flowey_lib_common
- flowey_lib_hvlite
- openhcl
- openhcl_attestation_protocol
- underhill_attestation
- underhill_core
- opentmk
- src
- arch
- aarch64
- x86_64
- devices
- tpm
- platform
- hyperv
- arch
- aarch64
- x86_64
- tests
- hyperv
- uefi
- petri
- support
- nostd_spin_channel
- src
- serde_helpers
- vmm_tests/vmm_tests
- vm
- devices
- firmware
- hyperv_secure_boot_templates
- hyperv_uefi_custom_vars_json
- get
- get_protocol
- guest_emulation_device
- guest_emulation_log
- guest_emulation_transport
- underhill_config
- vtl2_settings_proto
- storage/disklayer_sqlite
- loader
- igvmfilegen_config
- igvmfilegen
- vmgs/vmgstool
- xsync/xsync
- xtask
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
76 files changed
+9000
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3769 | 3769 | | |
3770 | 3770 | | |
3771 | 3771 | | |
| 3772 | + | |
| 3773 | + | |
| 3774 | + | |
| 3775 | + | |
| 3776 | + | |
| 3777 | + | |
| 3778 | + | |
| 3779 | + | |
| 3780 | + | |
3772 | 3781 | | |
3773 | 3782 | | |
3774 | 3783 | | |
| |||
4622 | 4631 | | |
4623 | 4632 | | |
4624 | 4633 | | |
| 4634 | + | |
| 4635 | + | |
| 4636 | + | |
| 4637 | + | |
| 4638 | + | |
| 4639 | + | |
| 4640 | + | |
| 4641 | + | |
4625 | 4642 | | |
4626 | 4643 | | |
4627 | 4644 | | |
| |||
5073 | 5090 | | |
5074 | 5091 | | |
5075 | 5092 | | |
| 5093 | + | |
| 5094 | + | |
| 5095 | + | |
| 5096 | + | |
| 5097 | + | |
| 5098 | + | |
| 5099 | + | |
| 5100 | + | |
| 5101 | + | |
| 5102 | + | |
| 5103 | + | |
| 5104 | + | |
| 5105 | + | |
| 5106 | + | |
| 5107 | + | |
| 5108 | + | |
| 5109 | + | |
| 5110 | + | |
| 5111 | + | |
| 5112 | + | |
| 5113 | + | |
| 5114 | + | |
5076 | 5115 | | |
5077 | 5116 | | |
5078 | 5117 | | |
| |||
6844 | 6883 | | |
6845 | 6884 | | |
6846 | 6885 | | |
| 6886 | + | |
| 6887 | + | |
| 6888 | + | |
| 6889 | + | |
| 6890 | + | |
| 6891 | + | |
| 6892 | + | |
| 6893 | + | |
| 6894 | + | |
| 6895 | + | |
| 6896 | + | |
| 6897 | + | |
6847 | 6898 | | |
6848 | 6899 | | |
6849 | 6900 | | |
| |||
9445 | 9496 | | |
9446 | 9497 | | |
9447 | 9498 | | |
| 9499 | + | |
| 9500 | + | |
| 9501 | + | |
| 9502 | + | |
| 9503 | + | |
| 9504 | + | |
9448 | 9505 | | |
9449 | 9506 | | |
9450 | 9507 | | |
| |||
10178 | 10235 | | |
10179 | 10236 | | |
10180 | 10237 | | |
| 10238 | + | |
| 10239 | + | |
| 10240 | + | |
| 10241 | + | |
| 10242 | + | |
| 10243 | + | |
| 10244 | + | |
| 10245 | + | |
| 10246 | + | |
| 10247 | + | |
| 10248 | + | |
| 10249 | + | |
10181 | 10250 | | |
10182 | 10251 | | |
10183 | 10252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
| 131 | + | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
| |||
467 | 470 | | |
468 | 471 | | |
469 | 472 | | |
| 473 | + | |
470 | 474 | | |
471 | 475 | | |
472 | 476 | | |
| 477 | + | |
473 | 478 | | |
474 | 479 | | |
475 | 480 | | |
| |||
506 | 511 | | |
507 | 512 | | |
508 | 513 | | |
509 | | - | |
510 | | - | |
| 514 | + | |
| 515 | + | |
511 | 516 | | |
512 | 517 | | |
513 | 518 | | |
| |||
517 | 522 | | |
518 | 523 | | |
519 | 524 | | |
| 525 | + | |
520 | 526 | | |
521 | 527 | | |
522 | 528 | | |
| |||
544 | 550 | | |
545 | 551 | | |
546 | 552 | | |
| 553 | + | |
547 | 554 | | |
548 | 555 | | |
549 | 556 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
| 20 | + | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
0 commit comments