Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp432689pxb; Wed, 14 Apr 2021 20:21:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhZKcWjfzmowOCfb8fGtB8oLlu28wCUHMuM3rcgjhiEcRpnYJWuP3Cq8BN1xzKwRVJ2xqW X-Received: by 2002:a17:907:9709:: with SMTP id jg9mr1172570ejc.276.1618456910524; Wed, 14 Apr 2021 20:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618456910; cv=none; d=google.com; s=arc-20160816; b=tFcbg5wo4+Vxi+i3sqrTM2oXFABykUy6qZIT7CIQGG98PwoU8DaVWSXwUCnOruZJSP UsAj8vbdnhOMc97pR0BuhXowyKqjyWUFKxCwrw8H4Pwjbu46XMp2EvTKRpBK3I7khyHj fKMQ2r2j3nZXkpy6mrcHb1Hb+5yp9pC0HEwNf3jQhdUiPxNzxSREu7L2UBIKyMcVQXWA x8JAX2yY+xOLyMtqO5cnmNPw9BGlRtjcRZgDwpAmJ5abIrBWY/gS55vFiy8AFjTm+BuR ryNR5ZfpkIHQGIZwDGv8HuVvoQED6N1+rqzt1NcBPXweWthw+nh3hzaP/rZ0z+Smc70x urHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=D4vUBJwLoGXrMwhO5EAQicTgVqMhl2asqslBGg2DaHI=; b=Omf+wMbntqE9ZgsSX50kMHXhnESaJevfWOYswsNPQGzF1t2yTj+gLnqiSLX0+bQBu8 MBCspZ8I3hGyqW+U2tAWueeDY12LeJ0/nmYr+PJ6fO7P7JoS1P3N+vND5bUugi/KBOw9 NJUl6in7nkjr30GE4hf/6BpDTHsz+g9rFcJ7dx2m/OgsS0IRIOTUStq27CHEO/JS+D2w kNU0zwH+VJIAkF01IgfoBD6SWOGV5TpsxsRz1f43OreaON80EHTxpBM5UK6mr0lANKY/ 9nCtYLnDty6A9TNuoTm/Pd0N9Q2DwWBDu5vqb3r9kw3Pt/FQ5o6CU01JNm0+KgeDZHI/ Xoxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id a20si1020990ejf.345.2021.04.14.20.21.27; Wed, 14 Apr 2021 20:21:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229767AbhDODUt (ORCPT + 99 others); Wed, 14 Apr 2021 23:20:49 -0400 Received: from mga11.intel.com ([192.55.52.93]:1119 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbhDODUs (ORCPT ); Wed, 14 Apr 2021 23:20:48 -0400 IronPort-SDR: pT0yoJZqlpIJMgk8pYWxHS1Ic8LeL3fjWVU25eOD7eUyXyORucQA1o7lxJFRdxg8fMRnY0Y9oM 8Zk07IOEfvcQ== X-IronPort-AV: E=McAfee;i="6200,9189,9954"; a="191592805" X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="191592805" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 20:20:26 -0700 IronPort-SDR: vTAQYnfuyIiOu6Yc4YFaqavlN/PFmeGmgbUPYV++vlSraIA+75JjI9H+3xyf/Y0u2v4uXmw8Id VN3hW4Nw64zw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="425013858" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by orsmga008.jf.intel.com with ESMTP; 14 Apr 2021 20:20:22 -0700 From: Like Xu To: peterz@infradead.org, Paolo Bonzini , Sean Christopherson Cc: andi@firstfloor.org, kan.liang@linux.intel.com, wei.w.wang@intel.com, eranian@google.com, liuxiangdong5@huawei.com, Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Like Xu Subject: [PATCH v5 01/16] perf/x86/intel: Add EPT-Friendly PEBS for Ice Lake Server Date: Thu, 15 Apr 2021 11:20:01 +0800 Message-Id: <20210415032016.166201-2-like.xu@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210415032016.166201-1-like.xu@linux.intel.com> References: <20210415032016.166201-1-like.xu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new hardware facility supporting guest PEBS is only available on Intel Ice Lake Server platforms for now. KVM will check this field through perf_get_x86_pmu_capability() instead of hard coding the cpu models in the KVM code. If it is supported, the guest PBES capability will be exposed to the guest. Signed-off-by: Like Xu --- arch/x86/events/core.c | 1 + arch/x86/events/intel/core.c | 1 + arch/x86/events/perf_event.h | 3 ++- arch/x86/include/asm/perf_event.h | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 18df17129695..06bef6ba8a9b 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2776,5 +2776,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->pebs_vmx = x86_pmu.pebs_vmx; } EXPORT_SYMBOL_GPL(perf_get_x86_pmu_capability); diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 7bbb5bb98d8c..591d60cc8436 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -5574,6 +5574,7 @@ __init int intel_pmu_init(void) case INTEL_FAM6_ICELAKE_X: case INTEL_FAM6_ICELAKE_D: + x86_pmu.pebs_vmx = 1; pmem = true; fallthrough; case INTEL_FAM6_ICELAKE_L: diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index 53b2b5fc23bc..85dc4e1d4514 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -729,7 +729,8 @@ struct x86_pmu { pebs_prec_dist :1, pebs_no_tlb :1, pebs_no_isolation :1, - pebs_block :1; + pebs_block :1, + pebs_vmx :1; int pebs_record_size; int pebs_buffer_size; int max_pebs_events; diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index 544f41a179fb..6a6e707905be 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h @@ -192,6 +192,7 @@ struct x86_pmu_capability { int bit_width_fixed; unsigned int events_mask; int events_mask_len; + unsigned int pebs_vmx :1; }; /* -- 2.30.2