Skip to content

Conversation

@ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Sep 30, 2025

This PR

  • refactors Hypervisor trait. It's now a minimal trait for common functionality of a minimal Vm. It abstracts over differences in kvm, mshv, whp. This traits only knows things like set/get registers, run, but nothing about guest functions or hyperlight specifics.
  • Introduces HyperlightVm struct. This is a new struct that contains the dyn Hypervisor above, as well as things like guest_ptr, rsp, memory-regions, gdb connections, etc. HyperlightVm knows about initialization, dispatching guest calls, gdb-debugging etc, guest-tracing, which Hypervisor trait doesn't. All code that was previously duplicated in kvm/mshv/whp now lives in HyperlightVm.

When reviewing, new file hyperlight_vm.rs should be compared against old kvm.rs, hyperv_linux.rs, hyperv_windows.rs. Note: this PR should not modify/introduce new code (as best as possible). It primarily just moves code around and factors out duplicate code.

Closes #465, #904

@ludfjig ludfjig force-pushed the vm_trait_new branch 3 times, most recently from 81f0d54 to 62fad87 Compare October 22, 2025 19:44
@ludfjig ludfjig added the kind/refactor For PRs that restructure or remove code without adding new functionality. label Oct 22, 2025
@ludfjig ludfjig force-pushed the vm_trait_new branch 17 times, most recently from 1562f26 to edc7f00 Compare October 24, 2025 20:15
@ludfjig ludfjig force-pushed the vm_trait_new branch 4 times, most recently from f6337f9 to 350b8e0 Compare October 28, 2025 18:05
@ludfjig ludfjig marked this pull request as ready for review October 28, 2025 18:39
@ludfjig ludfjig marked this pull request as draft November 19, 2025 19:07
@ludfjig ludfjig force-pushed the vm_trait_new branch 18 times, most recently from fa21515 to 0a033d6 Compare November 25, 2025 22:43
@ludfjig ludfjig changed the title Introduce new Vm trait Trim Hypervisor trait Nov 25, 2025
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
trait

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
}

#[cfg(test)]
mod tests {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed these tests are removed (on purpose). Turns out it does not even run the CODE below... I am planning on re-adding some unit tests in next PR

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor For PRs that restructure or remove code without adding new functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rethink driver API

3 participants