vmm: Refactor storage of CPU-dependent per-vCPU data.
authorJohn Baldwin <jhb@FreeBSD.org>
Fri, 18 Nov 2022 17:59:21 +0000 (09:59 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 18 Nov 2022 18:25:35 +0000 (10:25 -0800)
commit1aa5150479bf35c90c6770e6ea90e8462cfb6bf9
tree82b1b318cd399f40b4db78b87e601ac623f7bb30
parent73abae4493782e44a3382b15f5563c3f400bf51f
vmm: Refactor storage of CPU-dependent per-vCPU data.

Rather than storing static arrays of per-vCPU data in the CPU-specific
per-VM structure, adopt a more dynamic model similar to that used to
manage CPU-specific per-VM data.

That is, add new vmmops methods to init and cleanup a single vCPU.
The init method returns a pointer that is stored in 'struct vcpu' as a
cookie pointer.  This cookie pointer is now passed to other vmmops
callbacks in place of the integer index.  The index is now only used
in KTR traces and when calling back into the CPU-independent layer.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37151
13 files changed:
sys/amd64/include/vmm.h
sys/amd64/vmm/amd/svm.c
sys/amd64/vmm/amd/svm.h
sys/amd64/vmm/amd/svm_msr.c
sys/amd64/vmm/amd/svm_msr.h
sys/amd64/vmm/amd/svm_softc.h
sys/amd64/vmm/amd/vmcb.c
sys/amd64/vmm/amd/vmcb.h
sys/amd64/vmm/intel/vmx.c
sys/amd64/vmm/intel/vmx.h
sys/amd64/vmm/intel/vmx_msr.c
sys/amd64/vmm/intel/vmx_msr.h
sys/amd64/vmm/vmm.c