Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21847773ybl; Mon, 6 Jan 2020 12:31:17 -0800 (PST) X-Google-Smtp-Source: APXvYqzU0wGVT35FNhRbWBLC2/J/0vwKgh+L4Jh9k50Sc+HdoX7QhTlc4nEa6lJnF6Dj4ndYX9RD X-Received: by 2002:a05:6830:194:: with SMTP id q20mr121947246ota.92.1578342677225; Mon, 06 Jan 2020 12:31:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578342677; cv=none; d=google.com; s=arc-20160816; b=AiveKp6OwTaPob5WWlo6M9ze4PqLHaMVeo0zMOmPpM0vwOo1r1W400jpyXRdV4RKzW /rp7qVqz+oTPnAX+1jTwXYWt0pZwFLWAEy2nOm5TtMMfMxBeQsx7nD8ah0l6/I3eRDY9 IFIeNY+uC1VLFdAz7apcVwgaosW2+s+XAJJXWP8I5u0A+Vjg8RguKve3tIuS0ZuPIn5u 94jgymRq7oMcewN3M2QMAvpv70lH0/K+6dLyt3UNUdlaYqtQ2d0m0B+nD4liLFZKIKga /Y/rH6rzcjPjPw0HUdHoHKtyqE9u9Y0/zNhKRHhicWJPjs9sOlIzPgMTDRfqDJId+mJl ZEeg== 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; bh=hBtLhhDU2KVz75ZdbEhs/y8M/+0kLL9oInt/+InF4FU=; b=YvtDHfJYjFEbqjprw1ZNLzVob7zOiqrFiojx9RtWMUMrfB5triINCTeNlzRHbXmSxv PsHEtpGmd7st3AsIRYpUfJ3zV50be9qEzBQtT1k6D+cuymgOc0ZXTdmJ5CMi/XMAzPzB OtOn8iRMH2NsLZGw4idzeBeu2tiFU79fSTLaPmmI+DfPCS2MKxpMUcynG3JghIPsRv8A 3to/Na+tqhLyDAvUV8y1IzIA0Ogb9hy2pQ/jqeF3wA9U9S97IC4m6n9tylwQcsf7Z4Py Q0OskyUrEIGdetzjq4H/r7v4/8R2AwKxJCKmbp5qrShWtDA3NUotumxTTSQAaFL5wKwM YebQ== 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 z1si36464044otp.70.2020.01.06.12.31.04; Mon, 06 Jan 2020 12:31:17 -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 S1726937AbgAFUaT (ORCPT + 99 others); Mon, 6 Jan 2020 15:30:19 -0500 Received: from mga03.intel.com ([134.134.136.65]:10708 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726739AbgAFUaS (ORCPT ); Mon, 6 Jan 2020 15:30:18 -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 orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jan 2020 12:30:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,403,1571727600"; d="scan'208";a="245699408" Received: from labuser-ice-lake-client-platform.jf.intel.com ([10.54.55.50]) by fmsmga004.fm.intel.com with ESMTP; 06 Jan 2020 12:30:17 -0800 From: kan.liang@linux.intel.com To: peterz@infradead.org, acme@redhat.com, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, jolsa@kernel.org, eranian@google.com, alexander.shishkin@linux.intel.com, ak@linux.intel.com, Kan Liang Subject: [PATCH V5 RESEND 01/14] perf/x86/intel: Introduce the fourth fixed counter Date: Mon, 6 Jan 2020 12:29:06 -0800 Message-Id: <20200106202919.2943-2-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200106202919.2943-1-kan.liang@linux.intel.com> References: <20200106202919.2943-1-kan.liang@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang The fourth fixed counter, TOPDOWN.SLOTS, is introduced in Ice Lake. Add MSR address and macros for the new fixed counter, which will be used in the following patch. Add comments to explain the event encoding rules for fixed counters. Signed-off-by: Kan Liang --- Changes since V4: - Add description regarding to event-code naming for fixed counters arch/x86/include/asm/perf_event.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index ee26e9215f18..55a4d05ba6ec 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h @@ -146,12 +146,22 @@ struct x86_pmu_capability { */ /* - * All 3 fixed-mode PMCs are configured via this single MSR: + * All fixed-mode PMCs are configured via this single MSR: */ #define MSR_ARCH_PERFMON_FIXED_CTR_CTRL 0x38d /* - * The counts are available in three separate MSRs: + * There is no event-code assigned to fixed-mode PMCs. + * For the fixed-mode PMC which has an equivalent event on general-purpose PMCs, + * using the event-code of the equivalent event for the fixed-mode PMC. + * E.g. Instr_Retired.Any, CPU_CLK_Unhalted.Core + * + * For the fixed-mode PMCs which doesn't have an equivalent event, + * using pseudo-encoding, e.g. CPU_CLK_Unhalted.Ref, TOPDOWN.SLOTS. + * The event-code for fixed-mode PMCs must be 0x00. + * The umask-code is 0x0X. X indicates the index of the fixed counter. + * + * The counts are available in separate MSRs: */ /* Instr_Retired.Any: */ @@ -162,11 +172,16 @@ struct x86_pmu_capability { #define MSR_ARCH_PERFMON_FIXED_CTR1 0x30a #define INTEL_PMC_IDX_FIXED_CPU_CYCLES (INTEL_PMC_IDX_FIXED + 1) -/* CPU_CLK_Unhalted.Ref: */ +/* CPU_CLK_Unhalted.Ref: event=0x00,umask=0x3 (pseudo-encoding) */ #define MSR_ARCH_PERFMON_FIXED_CTR2 0x30b #define INTEL_PMC_IDX_FIXED_REF_CYCLES (INTEL_PMC_IDX_FIXED + 2) #define INTEL_PMC_MSK_FIXED_REF_CYCLES (1ULL << INTEL_PMC_IDX_FIXED_REF_CYCLES) +/* TOPDOWN.SLOTS: event=0x00,umask=0x4 (pseudo-encoding) */ +#define MSR_ARCH_PERFMON_FIXED_CTR3 0x30c +#define INTEL_PMC_IDX_FIXED_SLOTS (INTEL_PMC_IDX_FIXED + 3) +#define INTEL_PMC_MSK_FIXED_SLOTS (1ULL << INTEL_PMC_IDX_FIXED_SLOTS) + /* * We model BTS tracing as another fixed-mode PMC. * -- 2.17.1