Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1495354ybh; Thu, 23 Jul 2020 10:13:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8bq0CQngwdDeSiMbgNhjC7O1kK/GLZYp3F+xSDP3fFF4imCyWb3zdBJ4pqAU0TyKV/HN/ X-Received: by 2002:a05:6402:1bdd:: with SMTP id ch29mr5151291edb.134.1595524416819; Thu, 23 Jul 2020 10:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595524416; cv=none; d=google.com; s=arc-20160816; b=k3zds4HwTjvtd8mbrFlERA4jtXyeRbPPBJm4qssc+j59vK0nVMdf5c7MZVh8jaQK7y krO1BsLb/ujlD2KfRl55d1qcpPviFDhLKCpDDmeM9Qsf5obEu3oAyVCq72GIQ+c42or9 pJTD+dMn5ePoVODZyjZxLxQLvrIA+nWLY6OkUP/s0QBHEMnDh4GY6931qnlDsBrbV7nK y15KoMkvXP7wbXkdXCBR0LqxQwOBX3N5qzGOaELZfNFzPvKqh3w1At7fHEHbpeJA8vXp Au2mXnQQ2yHK6kawLRFwEW0sx7N48L1Q2/5iGN4kPlcW2xDgSBml524lVUcXCWAxhNwP kXAw== 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:ironport-sdr:ironport-sdr; bh=8t5GMYlvzNkhDTtPcbGEAImaCP7pWvlEY20OdoqUC6o=; b=U/g1Ow+C5ICgfhXUEh9kRTG8jDPDu4oAvAv7TAAKttyNaN8JSpo1rnK8vh6EDklay6 zKBi+IwoKI/DDstQ2zgL/hrXmdZ4NbQlpV+stlutfd+imgJztA4DCeXh/1IUg7wCQRHa wL6K4ccSeS1JR/Gn+CrHkP5sQbwFIK79yBdTpafelynhw8ol/zWaqosfZbDG4pE6nhCa PJzzoaUOa9CQxSdZqiE0YbmLMlEUQalgNpmpPD1rWBP9bLZC1vYb12uwwq7s3fNzNJpk fqPEzPQfs/hqRQEVeJBYn5aqHpaG9Osg9WIqa1M50nxuvTfv9KKYM2znYFIR/8C3GKn/ D6xA== 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 s3si2311665edq.57.2020.07.23.10.13.14; Thu, 23 Jul 2020 10:13:36 -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 S1730178AbgGWRMX (ORCPT + 99 others); Thu, 23 Jul 2020 13:12:23 -0400 Received: from mga05.intel.com ([192.55.52.43]:6614 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729961AbgGWRLu (ORCPT ); Thu, 23 Jul 2020 13:11:50 -0400 IronPort-SDR: qq0mtHZZQI5DYKLfxFOf0XqnPgpOl+HZmkm1PFXUS0RWep089jRD5gZ9AcUCiE8b06NPh6dt25 AIw4c+T99kLQ== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="235456811" X-IronPort-AV: E=Sophos;i="5.75,387,1589266800"; d="scan'208";a="235456811" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 10:11:50 -0700 IronPort-SDR: A4L2pHgH9/ipRircwVSktSzo3ExRr/mR2KFKZGa+OhgjaLCrQniMb7+ZRFFMEeDH7kksUucs2N HF4Smk9jgFAg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,387,1589266800"; d="scan'208";a="488904296" Received: from labuser-ice-lake-client-platform.jf.intel.com ([10.54.55.65]) by fmsmga005.fm.intel.com with ESMTP; 23 Jul 2020 10:11:49 -0700 From: kan.liang@linux.intel.com To: peterz@infradead.org, acme@redhat.com, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: jolsa@kernel.org, eranian@google.com, alexander.shishkin@linux.intel.com, ak@linux.intel.com, like.xu@linux.intel.com, Kan Liang Subject: [PATCH V7 09/14] perf/x86: Add a macro for RDPMC offset of fixed counters Date: Thu, 23 Jul 2020 10:11:12 -0700 Message-Id: <20200723171117.9918-10-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200723171117.9918-1-kan.liang@linux.intel.com> References: <20200723171117.9918-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 RDPMC base offset of fixed counters is hard-code. Use a meaningful name to replace the magic number to improve the readability of the code. Signed-off-by: Kan Liang --- arch/x86/events/core.c | 3 ++- arch/x86/include/asm/perf_event.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 53fcf0a2b025..ebf723f33794 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -1151,7 +1151,8 @@ static inline void x86_assign_hw_event(struct perf_event *event, hwc->config_base = MSR_ARCH_PERFMON_FIXED_CTR_CTRL; hwc->event_base = MSR_ARCH_PERFMON_FIXED_CTR0 + (idx - INTEL_PMC_IDX_FIXED); - hwc->event_base_rdpmc = (idx - INTEL_PMC_IDX_FIXED) | 1<<30; + hwc->event_base_rdpmc = (idx - INTEL_PMC_IDX_FIXED) | + INTEL_PMC_FIXED_RDPMC_BASE; break; default: diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index 000cab7818b5..964ba312c249 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h @@ -196,6 +196,9 @@ struct x86_pmu_capability { * Fixed-purpose performance events: */ +/* RDPMC offset for Fixed PMCs */ +#define INTEL_PMC_FIXED_RDPMC_BASE (1 << 30) + /* * All the fixed-mode PMCs are configured via this single MSR: */ -- 2.17.1