From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Adalber=20Laz=C4=83r?= Subject: [RFC PATCH v4 06/18] kvm: vmx: export the availability of EPT views Date: Mon, 18 Dec 2017 21:06:30 +0200 Message-ID: <20171218190642.7790-7-alazar@bitdefender.com> References: <20171218190642.7790-1-alazar@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: linux-mm@kvack.org, Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Xiao Guangrong , =?UTF-8?q?Mihai=20Don=C8=9Bu?= , Adalbert Lazar To: kvm@vger.kernel.org Return-path: Received: from mx02.bbu.dsd.mx.bitdefender.com ([91.199.104.133]:54736 "EHLO mx02.buh.bitdefender.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933848AbdLRTHP (ORCPT ); Mon, 18 Dec 2017 14:07:15 -0500 In-Reply-To: <20171218190642.7790-1-alazar@bitdefender.com> Sender: kvm-owner@vger.kernel.org List-ID: From: Adalbert Lazar This is used to validate the KVMI_GET_PAGE_ACCESS and KVMI_SET_PAGE_ACCESS commands when the guest introspection tool selects a different EPT view. Signed-off-by: Adalbert Lazăr --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx.c | 2 ++ arch/x86/kvm/x86.c | 3 +++ 3 files changed, 6 insertions(+) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 239eb628f8fb..2cf03ed181e6 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1162,6 +1162,7 @@ extern u64 kvm_max_tsc_scaling_ratio; extern u64 kvm_default_tsc_scaling_ratio; extern u64 kvm_mce_cap_supported; +extern bool kvm_eptp_switching_supported; enum emulation_result { EMULATE_DONE, /* no further processing */ diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 5487e0242030..093a2e1f7ea6 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -6898,6 +6898,8 @@ static __init int hardware_setup(void) kvm_x86_ops->cancel_hv_timer = NULL; } + kvm_eptp_switching_supported = cpu_has_vmx_vmfunc(); + kvm_set_posted_intr_wakeup_handler(wakeup_handler); kvm_mce_cap_supported |= MCG_LMCE_P; diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 4b0c3692386d..e7db70ac1f82 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -138,6 +138,9 @@ module_param(lapic_timer_advance_ns, uint, S_IRUGO | S_IWUSR); static bool __read_mostly vector_hashing = true; module_param(vector_hashing, bool, S_IRUGO); +bool __read_mostly kvm_eptp_switching_supported; +EXPORT_SYMBOL_GPL(kvm_eptp_switching_supported); + #define KVM_NR_SHARED_MSRS 16 struct kvm_shared_msrs_global {