On 23/06/2018 01:35, Liran Alon wrote: > Signed-off-by: Liran Alon <liran.alon@xxxxxxxxxx> > Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx> > --- > arch/x86/kvm/vmx.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 162e9517faa8..9a0cf93ce8a7 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -4527,6 +4527,16 @@ static inline int vmcs_field_readonly(unsigned long field) > return (vmcs_field_type(field) == VMCS_FIELD_TYPE_READ_ONLY_DATA); > } > > +static inline unsigned long encode_vmcs_field(enum vmcs_field_width width, > + enum vmcs_field_type type, > + unsigned short index, > + bool high) > +{ > + WARN_ON(index >= 1u << 9); > + index &= (1u << 9) - 1; > + return (width << 13) | (type << 10) | (index << 1) | (high ? 1 : 0); > +} > + > static void init_vmcs_shadow_fields(void) > { > int i, j; > Just put all these utility functions in the same patch that needs them. Paolo