mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rikard Falkeborn <rikard.falkeborn@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kan Liang <kan.liang@linux.intel.com>,
	Alexander Antonov <alexander.antonov@linux.intel.com>,
	Rikard Falkeborn <rikard.falkeborn@gmail.com>
Subject: [PATCH 4/4] perf/x86/intel/uncore: Constify unmodified static extra_reg structs
Date: Sat,  5 Jun 2021 17:56:53 +0200	[thread overview]
Message-ID: <20210605155653.21850-5-rikard.falkeborn@gmail.com> (raw)
In-Reply-To: <20210605155653.21850-1-rikard.falkeborn@gmail.com>

These are never modified, so make them const to allow the compiler to
put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 arch/x86/events/intel/uncore_nhmex.c |  6 +++---
 arch/x86/events/intel/uncore_snbep.c | 20 ++++++++++----------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/x86/events/intel/uncore_nhmex.c b/arch/x86/events/intel/uncore_nhmex.c
index 5f7c27d7f428..b4567489580d 100644
--- a/arch/x86/events/intel/uncore_nhmex.c
+++ b/arch/x86/events/intel/uncore_nhmex.c
@@ -525,7 +525,7 @@ enum {
 	EXTRA_REG_NHMEX_M_ZDP_CTL_FVC,
 };
 
-static struct extra_reg nhmex_uncore_mbox_extra_regs[] = {
+static const struct extra_reg nhmex_uncore_mbox_extra_regs[] = {
 	MBOX_INC_SEL_EXTAR_REG(0x0, DSP),
 	MBOX_INC_SEL_EXTAR_REG(0x4, MSC_THR),
 	MBOX_INC_SEL_EXTAR_REG(0x5, MSC_THR),
@@ -755,7 +755,7 @@ static void nhmex_mbox_put_constraint(struct intel_uncore_box *box, struct perf_
 	}
 }
 
-static int nhmex_mbox_extra_reg_idx(struct extra_reg *er)
+static int nhmex_mbox_extra_reg_idx(const struct extra_reg *er)
 {
 	if (er->idx < EXTRA_REG_NHMEX_M_ZDP_CTL_FVC)
 		return er->idx;
@@ -767,7 +767,7 @@ static int nhmex_mbox_hw_config(struct intel_uncore_box *box, struct perf_event
 	struct intel_uncore_type *type = box->pmu->type;
 	struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
 	struct hw_perf_event_extra *reg2 = &event->hw.branch_reg;
-	struct extra_reg *er;
+	const struct extra_reg *er;
 	unsigned msr;
 	int reg_idx = 0;
 	/*
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 507bb83e1463..77b342637688 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -882,7 +882,7 @@ static struct intel_uncore_type snbep_uncore_ubox = {
 	.format_group	= &snbep_uncore_ubox_format_group,
 };
 
-static struct extra_reg snbep_uncore_cbox_extra_regs[] = {
+static const struct extra_reg snbep_uncore_cbox_extra_regs[] = {
 	SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN,
 				  SNBEP_CBO_PMON_CTL_TID_EN, 0x1),
 	SNBEP_CBO_EVENT_EXTRA_REG(0x0334, 0xffff, 0x4),
@@ -999,7 +999,7 @@ snbep_cbox_get_constraint(struct intel_uncore_box *box, struct perf_event *event
 static int snbep_cbox_hw_config(struct intel_uncore_box *box, struct perf_event *event)
 {
 	struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
-	struct extra_reg *er;
+	const struct extra_reg *er;
 	int idx = 0;
 
 	for (er = snbep_uncore_cbox_extra_regs; er->msr; er++) {
@@ -1653,7 +1653,7 @@ static struct intel_uncore_type ivbep_uncore_ubox = {
 	.format_group	= &ivbep_uncore_ubox_format_group,
 };
 
-static struct extra_reg ivbep_uncore_cbox_extra_regs[] = {
+static const struct extra_reg ivbep_uncore_cbox_extra_regs[] = {
 	SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN,
 				  SNBEP_CBO_PMON_CTL_TID_EN, 0x1),
 	SNBEP_CBO_EVENT_EXTRA_REG(0x1031, 0x10ff, 0x2),
@@ -1725,7 +1725,7 @@ ivbep_cbox_get_constraint(struct intel_uncore_box *box, struct perf_event *event
 static int ivbep_cbox_hw_config(struct intel_uncore_box *box, struct perf_event *event)
 {
 	struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
-	struct extra_reg *er;
+	const struct extra_reg *er;
 	int idx = 0;
 
 	for (er = ivbep_uncore_cbox_extra_regs; er->msr; er++) {
@@ -2121,7 +2121,7 @@ static struct event_constraint knl_uncore_cha_constraints[] = {
 	EVENT_CONSTRAINT_END
 };
 
-static struct extra_reg knl_uncore_cha_extra_regs[] = {
+static const struct extra_reg knl_uncore_cha_extra_regs[] = {
 	SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN,
 				  SNBEP_CBO_PMON_CTL_TID_EN, 0x1),
 	SNBEP_CBO_EVENT_EXTRA_REG(0x3d, 0xff, 0x2),
@@ -2153,7 +2153,7 @@ static int knl_cha_hw_config(struct intel_uncore_box *box,
 			     struct perf_event *event)
 {
 	struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
-	struct extra_reg *er;
+	const struct extra_reg *er;
 	int idx = 0;
 
 	for (er = knl_uncore_cha_extra_regs; er->msr; er++) {
@@ -2637,7 +2637,7 @@ static struct event_constraint hswep_uncore_cbox_constraints[] = {
 	EVENT_CONSTRAINT_END
 };
 
-static struct extra_reg hswep_uncore_cbox_extra_regs[] = {
+static const struct extra_reg hswep_uncore_cbox_extra_regs[] = {
 	SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN,
 				  SNBEP_CBO_PMON_CTL_TID_EN, 0x1),
 	SNBEP_CBO_EVENT_EXTRA_REG(0x0334, 0xffff, 0x4),
@@ -2708,7 +2708,7 @@ hswep_cbox_get_constraint(struct intel_uncore_box *box, struct perf_event *event
 static int hswep_cbox_hw_config(struct intel_uncore_box *box, struct perf_event *event)
 {
 	struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
-	struct extra_reg *er;
+	const struct extra_reg *er;
 	int idx = 0;
 
 	for (er = hswep_uncore_cbox_extra_regs; er->msr; er++) {
@@ -3547,7 +3547,7 @@ static struct event_constraint skx_uncore_chabox_constraints[] = {
 	EVENT_CONSTRAINT_END
 };
 
-static struct extra_reg skx_uncore_cha_extra_regs[] = {
+static const struct extra_reg skx_uncore_cha_extra_regs[] = {
 	SNBEP_CBO_EVENT_EXTRA_REG(0x0334, 0xffff, 0x4),
 	SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4),
 	SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4),
@@ -3593,7 +3593,7 @@ skx_cha_get_constraint(struct intel_uncore_box *box, struct perf_event *event)
 static int skx_cha_hw_config(struct intel_uncore_box *box, struct perf_event *event)
 {
 	struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
-	struct extra_reg *er;
+	const struct extra_reg *er;
 	int idx = 0;
 
 	for (er = skx_uncore_cha_extra_regs; er->msr; er++) {
-- 
2.31.1


      parent reply	other threads:[~2021-06-05 15:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-05 15:56 [PATCH 0/4] perf/x86/intel: Constify static structs Rikard Falkeborn
2021-06-05 15:56 ` [PATCH 1/4] perf/x86/intel/uncore: Constify intel_uncore_ops Rikard Falkeborn
2021-06-07 19:09   ` Liang, Kan
2021-06-08 19:17     ` Rikard Falkeborn
2021-06-08 19:50       ` Liang, Kan
2021-06-05 15:56 ` [PATCH 2/4] perf/x86/intel: Constify static attribute_group structs Rikard Falkeborn
2021-06-05 15:56 ` [PATCH 3/4] perf/x86/intel/uncore: Constify freerunning_counters Rikard Falkeborn
2021-06-05 15:56 ` Rikard Falkeborn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210605155653.21850-5-rikard.falkeborn@gmail.com \
    --to=rikard.falkeborn@gmail.com \
    --cc=acme@kernel.org \
    --cc=alexander.antonov@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®