From: David Hildenbrand Subject: Re: [PATCH v1 1/2] KVM: VMX: cleanup EPTP definitions Date: Thu, 10 Aug 2017 21:53:34 +0200 Message-ID: References: <20170810133512.13442-1-david@redhat.com> <20170810133512.13442-2-david@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= To: Bandan Das Return-path: Received: from mx1.redhat.com ([209.132.183.28]:58206 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752979AbdHJTxi (ORCPT ); Thu, 10 Aug 2017 15:53:38 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 99F1BC0B2A41 for ; Thu, 10 Aug 2017 19:53:38 +0000 (UTC) In-Reply-To: Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 10.08.2017 21:38, Bandan Das wrote: > David Hildenbrand 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