RE: [PATCH v3 1/2] KVM: VMX: Cleanup VMX basic information defines and usages

From: Li, Xin3
Date: Fri Jan 12 2024 - 04:53:58 EST


> >> @@ -6964,7 +6975,7 @@ static void nested_vmx_setup_basic(struct
> nested_vmx_msrs *msrs)
> >> VMCS12_REVISION |
> >> VMX_BASIC_TRUE_CTLS |
> >> ((u64)VMCS12_SIZE << VMX_BASIC_VMCS_SIZE_SHIFT) |
> >> - (VMX_BASIC_MEM_TYPE_WB <<
> VMX_BASIC_MEM_TYPE_SHIFT);
> >> + (MEM_TYPE_WB << VMX_BASIC_MEM_TYPE_SHIFT);
> >>
> >
> > ... here, we can remove the two _SHIFT but define below instead:
> >
> > #define VMX_BASIC_VMCS12_SIZE ((u64)VMCS12_SIZE << 32)
> > #define VMX_BASIC_MEM_TYPE_WB (MEM_TYPE_WB << 50)
>
> I personally don't like such names, unless we can name them in a better way.
>
> >
> > And use above two macros in nested_vmx_setup_basic()?

A second thought on this, I agree this is better. And I will post v4.

Thanks!
Xin