Received: by 10.223.164.221 with SMTP id h29csp2583157wrb; Thu, 2 Nov 2017 13:31:17 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QZsfF6LLPHKzUtxxV+eRIs9GlUeRnqGI/6H2/lnVYclLuN6V99sn+sZtVSOEn42WSUKXJD X-Received: by 10.98.155.10 with SMTP id r10mr5262434pfd.66.1509654677476; Thu, 02 Nov 2017 13:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509654677; cv=none; d=google.com; s=arc-20160816; b=jLOWMA/fiRcPrixPE2ukZcv1Fqg66oRrpyCwrNVVdqoDxNbaE4GhjISIt5tag1DC9A +Me/XJFjbJXiZL0pbEtN4P4j4mfjeELNPXfLGjl1IhPtfeO3E2CDxGU/cPywaR793KWk eLDRLZhL23xxEVaiEoQB/4RvcDhzLBl4Qj/wtZaRqi3vjpaDz9M3rO04NYEVuW2qvmWc jisZWdmi+rHbcXIJ98dF4i3jR4N48mi62U9TCm8j2ZePB8Uf/Hl7pjo1tNdeAbbeZ4cP Ls1MY8MfIDvU1iZbtJdOcGHSq29sU3H/kEUlij3acY3hkV/uNKyRSipnoGv+YxqOP4LD UPqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Pptzi8dYYf10R2TeS0sIJYlwi8J94X5DgFKU3x+GjOk=; b=aAnGCPrn1wbsXxpKeH5i5nKNiX+HUFNH1XYDWsGsfXJycEI3/vNVJpD4JIcpocoCje Hx6l6V0hUCCJo/6k1x2HOfG6ZinmTj3l4kj9h8RCqh97xgx2tS5Hc/d8iKHDclVKnjxo XFRWLXpX1w3ijLW27A6QM8OeT0l535bLm0mJpzXs/t2B1XEqjniVLYLhwXmda9fWFZsR jiySeMTBDooouiKk4a+jUSlxHkfnhtcneC9/ls/5UZXhC3BeF3ZqOO2C8sh16mNErSdq U8x1BZvMBSoVeoyNBcl58i2nObvWnmIrmOgRF4GC/wL7hixzeHwjdqXnPEt/hL5TcBmj xySA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f16si4272490pgt.658.2017.11.02.13.31.04; Thu, 02 Nov 2017 13:31:17 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964922AbdKBUaa (ORCPT + 99 others); Thu, 2 Nov 2017 16:30:30 -0400 Received: from mga11.intel.com ([192.55.52.93]:31294 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964854AbdKBUaY (ORCPT ); Thu, 2 Nov 2017 16:30:24 -0400 Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Nov 2017 13:30:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,335,1505804400"; d="scan'208";a="145287051" Received: from otc-lr-04.jf.intel.com ([10.54.39.138]) by orsmga004.jf.intel.com with ESMTP; 02 Nov 2017 13:30:22 -0700 From: kan.liang@intel.com To: tglx@linutronix.de, peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: acme@kernel.org, eranian@google.com, ak@linux.intel.com, Kan Liang Subject: [PATCH V4 6/8] perf/x86/intel/uncore: SKX support for IIO free running counters Date: Thu, 2 Nov 2017 13:29:51 -0700 Message-Id: <1509654593-4446-6-git-send-email-kan.liang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509654593-4446-1-git-send-email-kan.liang@intel.com> References: <1509654593-4446-1-git-send-email-kan.liang@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang As of Skylake Server, there are a number of free-running counters in each IIO Box that collect counts for per box IO clocks and per Port Input/Output x BW/Utilization. The free running counter is read-only and always active. Counting will be suspended only when the IIO Box is powered down. There are three types of IIO free running counters on Skylake server, IO CLOCKS counter, BANDWIDTH counters and UTILIZATION counters. IO CLOCKS counter is to count IO clocks. BANDWIDTH counters are to count inbound(PCIe->CPU)/outbound(CPU->PCIe) bandwidth. UTILIZATION counters are to count input/output utilization. The bit width of the free running counters is 36-bits. Signed-off-by: Kan Liang --- No changes since V3 arch/x86/events/intel/uncore_snbep.c | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index db1fe37..4ee1e86 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c @@ -3459,6 +3459,61 @@ static struct intel_uncore_ops skx_uncore_iio_ops = { .read_counter = uncore_msr_read_counter, }; +enum perf_uncore_iio_freerunning_type_id { + SKX_IIO_MSR_IOCLK = 0, + SKX_IIO_MSR_BW = 1, + SKX_IIO_MSR_UTIL = 2, + + SKX_IIO_FREERUNNING_TYPE_MAX, +}; + + +static struct freerunning_counters skx_iio_freerunning[] = { + [SKX_IIO_MSR_IOCLK] = { 0xa45, 0x1, 0x20, 1, 36 }, + [SKX_IIO_MSR_BW] = { 0xb00, 0x1, 0x10, 8, 36 }, + [SKX_IIO_MSR_UTIL] = { 0xb08, 0x1, 0x10, 8, 36 }, +}; + +static struct uncore_event_desc skx_uncore_iio_events[] = { + /* Free-Running IO CLOCKS Counter */ + INTEL_UNCORE_EVENT_DESC(ioclk, "event=0xff,umask=0x10"), + /* Free-Running IIO BANDWIDTH Counters */ + INTEL_UNCORE_EVENT_DESC(bw_in_port0, "event=0xff,umask=0x20"), + INTEL_UNCORE_EVENT_DESC(bw_in_port0.scale, "3.814697266e-6"), + INTEL_UNCORE_EVENT_DESC(bw_in_port0.unit, "MiB"), + INTEL_UNCORE_EVENT_DESC(bw_in_port1, "event=0xff,umask=0x21"), + INTEL_UNCORE_EVENT_DESC(bw_in_port1.scale, "3.814697266e-6"), + INTEL_UNCORE_EVENT_DESC(bw_in_port1.unit, "MiB"), + INTEL_UNCORE_EVENT_DESC(bw_in_port2, "event=0xff,umask=0x22"), + INTEL_UNCORE_EVENT_DESC(bw_in_port2.scale, "3.814697266e-6"), + INTEL_UNCORE_EVENT_DESC(bw_in_port2.unit, "MiB"), + INTEL_UNCORE_EVENT_DESC(bw_in_port3, "event=0xff,umask=0x23"), + INTEL_UNCORE_EVENT_DESC(bw_in_port3.scale, "3.814697266e-6"), + INTEL_UNCORE_EVENT_DESC(bw_in_port3.unit, "MiB"), + INTEL_UNCORE_EVENT_DESC(bw_out_port0, "event=0xff,umask=0x24"), + INTEL_UNCORE_EVENT_DESC(bw_out_port0.scale, "3.814697266e-6"), + INTEL_UNCORE_EVENT_DESC(bw_out_port0.unit, "MiB"), + INTEL_UNCORE_EVENT_DESC(bw_out_port1, "event=0xff,umask=0x25"), + INTEL_UNCORE_EVENT_DESC(bw_out_port1.scale, "3.814697266e-6"), + INTEL_UNCORE_EVENT_DESC(bw_out_port1.unit, "MiB"), + INTEL_UNCORE_EVENT_DESC(bw_out_port2, "event=0xff,umask=0x26"), + INTEL_UNCORE_EVENT_DESC(bw_out_port2.scale, "3.814697266e-6"), + INTEL_UNCORE_EVENT_DESC(bw_out_port2.unit, "MiB"), + INTEL_UNCORE_EVENT_DESC(bw_out_port3, "event=0xff,umask=0x27"), + INTEL_UNCORE_EVENT_DESC(bw_out_port3.scale, "3.814697266e-6"), + INTEL_UNCORE_EVENT_DESC(bw_out_port3.unit, "MiB"), + /* Free-running IIO UTILIZATION Counters */ + INTEL_UNCORE_EVENT_DESC(util_in_port0, "event=0xff,umask=0x30"), + INTEL_UNCORE_EVENT_DESC(util_out_port0, "event=0xff,umask=0x31"), + INTEL_UNCORE_EVENT_DESC(util_in_port1, "event=0xff,umask=0x32"), + INTEL_UNCORE_EVENT_DESC(util_out_port1, "event=0xff,umask=0x33"), + INTEL_UNCORE_EVENT_DESC(util_in_port2, "event=0xff,umask=0x34"), + INTEL_UNCORE_EVENT_DESC(util_out_port2, "event=0xff,umask=0x35"), + INTEL_UNCORE_EVENT_DESC(util_in_port3, "event=0xff,umask=0x36"), + INTEL_UNCORE_EVENT_DESC(util_out_port3, "event=0xff,umask=0x37"), + { /* end: all zeroes */ }, +}; + static struct intel_uncore_type skx_uncore_iio = { .name = "iio", .num_counters = 4, @@ -3470,8 +3525,11 @@ static struct intel_uncore_type skx_uncore_iio = { .event_mask_ext = SKX_IIO_PMON_RAW_EVENT_MASK_EXT, .box_ctl = SKX_IIO0_MSR_PMON_BOX_CTL, .msr_offset = SKX_IIO_MSR_OFFSET, + .num_freerunning_types = SKX_IIO_FREERUNNING_TYPE_MAX, + .freerunning = skx_iio_freerunning, .constraints = skx_uncore_iio_constraints, .ops = &skx_uncore_iio_ops, + .event_descs = skx_uncore_iio_events, .format_group = &skx_uncore_iio_format_group, }; -- 2.7.4 From 1582945565854648242@xxx Thu Nov 02 09:22:10 +0000 2017 X-GM-THRID: 1582945565854648242 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread