Page MenuHomeFreeBSD

vmm: Consolidate vm and vcpu definitions
Needs ReviewPublic

Authored by markj on Tue, Nov 4, 4:40 PM.
Tags
None
Referenced Files
F134853117: D53584.diff
Tue, Nov 4, 9:48 PM
F134801254: D53584.id.diff
Tue, Nov 4, 5:03 PM
F134801191: D53584.id165836.diff
Tue, Nov 4, 5:03 PM
F134801188: D53584.diff
Tue, Nov 4, 5:03 PM
F134801084: D53584.id165836.diff
Tue, Nov 4, 5:02 PM
F134801056: D53584.id.diff
Tue, Nov 4, 5:02 PM
F134800844: D53584.diff
Tue, Nov 4, 5:01 PM

Details

Reviewers
andrew
manu
Group Reviewers
bhyve
Summary

There is quite a lot of duplication of code between amd64, arm64 and
riscv with respect to VM and vCPU state management. This is a bit
tricky to resolve since struct vm and struct vcpu are private to vmm.c
and both structures contain a mix of machine-dependent and
machine-independent fields.

To allow deduplication without also introducing a lot of churn, follow
the approach of struct pcpu and 1) lift the definitions of those
structures into a new header, sys/dev/vmm/vmm_vm.h, and 2) define
machine-dependent macros, VMM_VM_MD_FIELDS and VMM_VCPU_MD_FIELDS which
lay out the machine-dependent fields.

One disadvantage of this approach is that the two structures are now
exposed to other compilation units, but I think this is not a major
problem.

No functional change intended. A follow-up change will move a good deal
of machine/vmm/vmm.c into sys/dev/vmm/vmm_vm.c.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68415
Build 65298: arc lint + arc unit