Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running TrustVisor in L2 #21

Merged
merged 441 commits into from
Dec 4, 2022
Merged

Support running TrustVisor in L2 #21

merged 441 commits into from
Dec 4, 2022

Conversation

lxylxy123456
Copy link
Owner

@lxylxy123456 lxylxy123456 commented Dec 4, 2022

High level design

  • When playing with page tables, hypapp needs to handle EPT12.
    • For TrustVisor, PAL needs to disable EPT12 for the guest.
    • When walking page table (L2 guest physical -> XMHF physical), need to walk EPT12, then EPT01.
  • After hypapp changes EPT01 / EPT12, XMHF automatically merge them to EPT02.
  • When flushing TLB, hypapp specifies flag to indicate which is changed.
  • Do not change EPTP (due to race condition discovered)
  • When not quiescing, software walk of EPT may need to retry if
    vcpu->vmx_ept_changed = true

New events hypapp need to handle:

  • tv_app_handle_nest_entry: guest transition from L1 to L2
  • tv_app_handle_nest_exit: guest transition from L2 to L1

New XMHF interfaces for hypapp:

  • VCPU_nested: return whether CPU in nested virtualization
  • xmhf_nested_arch_x86vmx_get_ept12: get / set EPT12
  • VCPU_disable_nested_interrupt_exit: disable external interrupt exiting
  • VCPU_disable_nested_timer_exit: disable VMX preemption timer
  • VCPU_disable_memory_bitmap: disable features that use physical memory bitmap

Modified XMHF interfaces for hypapp:

  • VCPU_*: if running in nested virtualization, will return L2 state
  • xmhf_memprot_flushmappings: removed
  • xmhf_memprot_flushmappings_localtlb: flush current CPU's TLB, added flags
  • xmhf_memprot_flushmappings_alltlb: flush current CPU's TLB, added flags

@lxylxy123456 lxylxy123456 self-assigned this Dec 4, 2022
@lxylxy123456 lxylxy123456 merged commit dbc905e into xmhf64 Dec 4, 2022
lxylxy123456 added a commit that referenced this pull request Dec 4, 2022
Support running TrustVisor in L2

High level design
* When playing with page tables, hypapp needs to handle EPT12.
	* For TrustVisor, PAL needs to disable EPT12 for the guest.
	* When walking page table (L2 guest physical -> XMHF physical), need to
	  walk EPT12, then EPT01.
* After hypapp changes EPT01 / EPT12, XMHF automatically merge them to EPT02.
* When flushing TLB, hypapp specifies flag to indicate which is changed.
* Do not change EPTP (due to race condition discovered)
* When not quiescing, software walk of EPT may need to retry if
  `vcpu->vmx_ept_changed = true`

New events hypapp need to handle:
* `tv_app_handle_nest_entry`: guest transition from L1 to L2
* `tv_app_handle_nest_exit`: guest transition from L2 to L1

New XMHF interfaces for hypapp:
* `VCPU_nested`: return whether CPU in nested virtualization
* `xmhf_nested_arch_x86vmx_get_ept12`: get / set EPT12
* `VCPU_disable_nested_interrupt_exit`: disable external interrupt exiting
* `VCPU_disable_nested_timer_exit`: disable VMX preemption timer
* `VCPU_disable_memory_bitmap`: disable features that use physical memory bitmap

Modified XMHF interfaces for hypapp:
* `VCPU_*`: if running in nested virtualization, will return L2 state
* `xmhf_memprot_flushmappings`: removed
* `xmhf_memprot_flushmappings_localtlb`: flush current CPU's TLB, added flags
* `xmhf_memprot_flushmappings_alltlb`: flush current CPU's TLB, added flags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant