On 10.08.2017 21:38, Bandan Das wrote: > David Hildenbrand <david@xxxxxxxxxx> writes: > >> Don't use shifts, tag them correctly as EPTP and use better matching >> names (PWL vs. GAW). > > Fair enough. This reminds me, I also don't particularly like the vmx->nested.nested... > accesses that are spread all throughout :) Me too, I got a bunch of patches lying around that abstract VMX features into something like X86 features. #define VMX_FEATURE_BASIC_INOUT (0*32 + 18) #define VMX_FEATURE_PREEMPTION_TIMER (1*32 + 6) #define VMX_FEATURE_POSTED_INTR (1*32 + 7) #define VMX_FEATURE_TPR_SHADOW (2*32 + 21) #define VMX_FEATURE_MSR_BITMAP (2*32 + 28) #define VMX_FEATURE_SECONDARY_EXEC_CTRLS (2*32 + 31) #define VMX_FEATURE_VIRTUALIZE_APIC_ACCESSES (3*32 + 0) ... #define VMX_FEATURE_EXIT_LOAD_IA32_PAT (4*32 + 19) ... #define VMX_FEATURE_ENTRY_LOAD_IA32_PAT (5*32 + 14) ... #define VMX_FEATURE_EPT_EXECUTE_ONLY (6*32 + 0) ... #define VMX_FEATURE_INVVPID (7*32 + 0) ... /* whether our CPU supports a certain VMX feature */ bool vmx_has(unsigned int feature); -> replaces most cpu_has_vmx_* /* whether our nested CPU is allowed to use a certain VMX feature */ bool nested_vmx_has(struct kvm_vcpu *vcpu, unsigned int feature); -> replaces most checks against vmx->nested.nested_vmx_secondary_ctls_high and friends /* whether L1 enabled a certain VMX feature for L2 */ bool nested_cpu_has(struct vmcs12 *vmcs12, unsigned int feature); -> merges/replaces most checks like nested_cpu_has/nested_cpu_has2 ... I am not yet happy with the end result. Anybody interested or has any suggestions? -- Thanks, David