Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp187173ybx; Tue, 5 Nov 2019 22:16:52 -0800 (PST) X-Google-Smtp-Source: APXvYqx4gSy0UGhelaSoz4LJ8i+VXCQpAadmd6RLbnnkeKE11CHdqswhODp2//I6m06++14sbbEt X-Received: by 2002:a17:906:11cd:: with SMTP id o13mr251698eja.272.1573021012372; Tue, 05 Nov 2019 22:16:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573021012; cv=none; d=google.com; s=arc-20160816; b=u796F+m+NOvKiQ7alYT8JAzVmAMtA6OSU9S54sMfVcLPnUwcZ79b6+BFDu8jyTUXAS 9+tDthDJpfgZ3XGWk84JZQ6k/2OTJ5bWjYHYFMxG51ZHDkQVKCivL2HwO5wPDjepqQgA xDyPtF8sRmGvxaLyZ8SJwPgUpWpnLdO9hm/kcZh2Mvp7K7XtntAtv8CUIrITZpEpqkrF fzlBaBwjmdzRcs9WpjfeJU1ncttObS+491fnvxZaPVzP+6qVordY7hadF6OpfqrLnDa2 aKCMxFNq7671Po3/zq1vBmPiJcCIaq9wQwsHYr78QnOSfLrwVel9l7iHoEJXV42wMsh1 zzgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=yDr/WQD7hUNjgOqeUn/07ecezxS34mgb5hBrr8FxGhQ=; b=hogz27fXw8iPQCrDRyHflfoLKJiDKtdR3QTcS1LkUokbTLMJfpn9dmRiSSELtwqYhq YQYSjnUy+1bI2CEi/Ku8nPoZmEIUkPl5iUFQzarCxEpdqJky841A2vU8iZbY4HcfownR zwMYRqW8alS53cNOvDp8Up8jd3RE1QX303F9Ke3tC3kCeGssRoI5i9Pg7B7pf6p8HBOW 1t5WoW/qu/zeE+oG5ED6E0FnPTCG5Q0//Nom1WCH/VnHzG0z2zL03izj5N4fRTyj+mvp aVTR2D60fzWJE3xT5QCvzMpYT+CwjHDBG36AP3GiWzpRPRAlncEkT9h17UYyuV4gLHWJ 3u0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bo21si5274674edb.137.2019.11.05.22.16.28; Tue, 05 Nov 2019 22:16:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725992AbfKFGPr (ORCPT + 99 others); Wed, 6 Nov 2019 01:15:47 -0500 Received: from mga12.intel.com ([192.55.52.136]:2425 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725806AbfKFGPr (ORCPT ); Wed, 6 Nov 2019 01:15:47 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Nov 2019 22:15:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,272,1569308400"; d="scan'208";a="227382779" Received: from sqa-gate.sh.intel.com (HELO clx-ap-likexu.tsp.org) ([10.239.48.212]) by fmsmga004.fm.intel.com with ESMTP; 05 Nov 2019 22:15:44 -0800 From: Like Xu To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo Cc: Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, Paolo Bonzini Subject: [PATCH] perf/x86: Expose more Intel perf_capabilities to other modules Date: Tue, 5 Nov 2019 22:09:55 +0800 Message-Id: <20191105140955.22504-1-like.xu@linux.intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The vPMU feature on KVM is dependent on the native perf implementation. Now KVM needs to know more about PMU capabilities such as lbr, pebs and full_width_write to determine what features it can provide for guests. Signed-off-by: Like Xu --- arch/x86/events/core.c | 1 + arch/x86/events/perf_event.h | 19 ------------------- arch/x86/include/asm/perf_event.h | 20 ++++++++++++++++++++ 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 7b21455d7504..fe8bb51cb277 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2587,5 +2587,6 @@ void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap) cap->bit_width_fixed = x86_pmu.cntval_bits; cap->events_mask = (unsigned int)x86_pmu.events_maskl; cap->events_mask_len = x86_pmu.events_mask_len; + cap->pmu_cap = x86_pmu.intel_cap; } EXPORT_SYMBOL_GPL(perf_get_x86_pmu_capability); diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index ecacfbf4ebc1..ca1c94dd111f 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -505,25 +505,6 @@ struct extra_reg { #define EVENT_EXTRA_END EVENT_EXTRA_REG(0, 0, 0, 0, RSP_0) -union perf_capabilities { - struct { - u64 lbr_format:6; - u64 pebs_trap:1; - u64 pebs_arch_reg:1; - u64 pebs_format:4; - u64 smm_freeze:1; - /* - * PMU supports separate counter range for writing - * values > 32bit. - */ - u64 full_width_write:1; - u64 pebs_baseline:1; - u64 pebs_metrics_available:1; - u64 pebs_output_pt_available:1; - }; - u64 capabilities; -}; - struct x86_pmu_quirk { struct x86_pmu_quirk *next; void (*func)(void); diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index ee26e9215f18..7983cc8e5a15 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h @@ -131,6 +131,25 @@ union cpuid10_edx { unsigned int full; }; +union perf_capabilities { + struct { + u64 lbr_format:6; + u64 pebs_trap:1; + u64 pebs_arch_reg:1; + u64 pebs_format:4; + u64 smm_freeze:1; + /* + * PMU supports separate counter range for writing + * values > 32bit. + */ + u64 full_width_write:1; + u64 pebs_baseline:1; + u64 pebs_metrics_available:1; + u64 pebs_output_pt_available:1; + }; + u64 capabilities; +}; + struct x86_pmu_capability { int version; int num_counters_gp; @@ -139,6 +158,7 @@ struct x86_pmu_capability { int bit_width_fixed; unsigned int events_mask; int events_mask_len; + union perf_capabilities pmu_cap; }; /* -- 2.21.0