From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755930AbdBQHgi (ORCPT ); Fri, 17 Feb 2017 02:36:38 -0500 Received: from mx2.suse.de ([195.135.220.15]:59366 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755599AbdBQHge (ORCPT ); Fri, 17 Feb 2017 02:36:34 -0500 From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org Cc: boris.ostrovsky@oracle.com, hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com, Juergen Gross Subject: [PATCH 2/2] x86/xen: use capabilities instead of fake cpuid values Date: Fri, 17 Feb 2017 08:36:25 +0100 Message-Id: <20170217073625.13418-3-jgross@suse.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170217073625.13418-1-jgross@suse.com> References: <20170217073625.13418-1-jgross@suse.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When running as pv domain xen_cpuid() is being used instead of native_cpuid(). In xen_cpuid() the aperf/mperf feature is indicated as not being present by special casing the related cpuid leaf. Instead of delivering fake cpuid values clear the cpu capability bit for aperf/mperf instead. Signed-off-by: Juergen Gross --- arch/x86/xen/enlighten.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 83399ce..0eebb75 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -301,9 +301,6 @@ xen_running_on_version_or_later(unsigned int major, unsigned int minor) return false; } -#define CPUID_THERM_POWER_LEAF 6 -#define APERFMPERF_PRESENT 0 - static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0; static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0; @@ -337,11 +334,6 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, *dx = cpuid_leaf5_edx_val; return; - case CPUID_THERM_POWER_LEAF: - /* Disabling APERFMPERF for kernel usage */ - maskecx = ~(1 << APERFMPERF_PRESENT); - break; - case 0xb: /* Suppress extended topology stuff */ maskebx = 0; @@ -462,6 +454,9 @@ static void __init xen_init_cpuid_mask(void) if (xen_check_mwait()) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT % 32)); + /* Disable APERFMPERF feature. */ + setup_clear_cpu_cap(X86_FEATURE_APERFMPERF); + /* Disable DCA feature. */ setup_clear_cpu_cap(X86_FEATURE_DCA); } -- 2.10.2