Skip to content

Commit cb9fb5f

Browse files
committed
KVM: nVMX: Update VMCS12_REVISION comment to state it should never change
Rewrite the comment above VMCS12_REVISION to unequivocally state that the ID must never change. KVM_{G,S}ET_NESTED_STATE have been officially supported for some time now, i.e. changing VMCS12_REVISION would break userspace. Opportunistically add a blurb to the CHECK_OFFSET() comment to make it explicitly clear that new fields are allowed, i.e. that the restriction on the layout is all about backwards compatibility. No functional change intended. Cc: Jim Mattson <[email protected]> Reviewed-by: Jim Mattson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 02b0d3b commit cb9fb5f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

arch/x86/kvm/vmx/vmcs12.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,13 @@ struct __packed vmcs12 {
188188
};
189189

190190
/*
191-
* VMCS12_REVISION is an arbitrary id that should be changed if the content or
192-
* layout of struct vmcs12 is changed. MSR_IA32_VMX_BASIC returns this id, and
193-
* VMPTRLD verifies that the VMCS region that L1 is loading contains this id.
191+
* VMCS12_REVISION is KVM's arbitrary ID for the layout of struct vmcs12. KVM
192+
* enumerates this value to L1 via MSR_IA32_VMX_BASIC, and checks the revision
193+
* ID during nested VMPTRLD to verify that L1 is loading a VMCS that adhere's
194+
* to KVM's virtual CPU definition.
194195
*
195-
* IMPORTANT: Changing this value will break save/restore compatibility with
196-
* older kvm releases.
196+
* DO NOT change this value, as it will break save/restore compatibility with
197+
* older KVM releases.
197198
*/
198199
#define VMCS12_REVISION 0x11e57ed0
199200

@@ -206,7 +207,8 @@ struct __packed vmcs12 {
206207
#define VMCS12_SIZE KVM_STATE_NESTED_VMX_VMCS_SIZE
207208

208209
/*
209-
* For save/restore compatibility, the vmcs12 field offsets must not change.
210+
* For save/restore compatibility, the vmcs12 field offsets must not change,
211+
* although appending fields and/or filling gaps is obviously allowed.
210212
*/
211213
#define CHECK_OFFSET(field, loc) \
212214
ASSERT_STRUCT_OFFSET(struct vmcs12, field, loc)

0 commit comments

Comments
 (0)