linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Raphael Gault <raphael.gault@arm.com>
To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: mark.rutland@arm.com, raph.gault+kdev@gmail.com,
	peterz@infradead.org, catalin.marinas@arm.com,
	will.deacon@arm.com, acme@kernel.org,
	Raphael Gault <raphael.gault@arm.com>,
	mingo@redhat.com
Subject: [PATCH v4 2/7] arm64: cpu: Add accessor for boot_cpu_data
Date: Thu, 22 Aug 2019 15:42:15 +0100	[thread overview]
Message-ID: <20190822144220.27860-3-raphael.gault@arm.com> (raw)
In-Reply-To: <20190822144220.27860-1-raphael.gault@arm.com>

Mark boot_cpu_data as read-only after initialization.
Define accessor to read boot_cpu_data from outside of boot_cpu_data.

Signed-off-by: Raphael Gault <raphael.gault@arm.com>
---
 arch/arm64/include/asm/cpu.h | 2 +-
 arch/arm64/kernel/cpuinfo.c  | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/cpu.h b/arch/arm64/include/asm/cpu.h
index d72d995b7e25..6abc2faf1a64 100644
--- a/arch/arm64/include/asm/cpu.h
+++ b/arch/arm64/include/asm/cpu.h
@@ -62,5 +62,5 @@ void __init cpuinfo_store_boot_cpu(void);
 void __init init_cpu_features(struct cpuinfo_arm64 *info);
 void update_cpu_features(int cpu, struct cpuinfo_arm64 *info,
 				 struct cpuinfo_arm64 *boot);
-
+struct cpuinfo_arm64 *get_boot_cpu_data(void);
 #endif /* __ASM_CPU_H */
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 876055e37352..ffa00b3a148b 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -31,7 +31,7 @@
  * values depending on configuration at or after reset.
  */
 DEFINE_PER_CPU(struct cpuinfo_arm64, cpu_data);
-static struct cpuinfo_arm64 boot_cpu_data;
+static struct cpuinfo_arm64 boot_cpu_data __ro_after_init;
 
 static char *icache_policy_str[] = {
 	[0 ... ICACHE_POLICY_PIPT]	= "RESERVED/UNKNOWN",
@@ -395,4 +395,9 @@ void __init cpuinfo_store_boot_cpu(void)
 	init_cpu_features(&boot_cpu_data);
 }
 
+struct cpuinfo_arm64 *get_boot_cpu_data(void)
+{
+	return &boot_cpu_data;
+}
+
 device_initcall(cpuinfo_regs_init);
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-08-22 14:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22 14:42 [PATCH v4 0/7] arm64: Enable access to pmu registers by user-space Raphael Gault
2019-08-22 14:42 ` [PATCH v4 1/7] perf: arm64: Add test to check userspace access to hardware counters Raphael Gault
2019-08-27 11:17   ` Jonathan Cameron
2020-06-03 16:19     ` Rob Herring
2019-08-22 14:42 ` Raphael Gault [this message]
2019-08-22 14:42 ` [PATCH v4 3/7] arm64: cpufeature: Add feature to detect homogeneous systems Raphael Gault
2019-08-22 14:42 ` [PATCH v4 4/7] arm64: pmu: Add hook to handle pmu-related undefined instructions Raphael Gault
2019-08-22 14:42 ` [PATCH v4 5/7] arm64: pmu: Add function implementation to update event index in userpage Raphael Gault
2019-08-22 14:42 ` [PATCH v4 6/7] arm64: perf: Enable pmu counter direct access for perf event on armv8 Raphael Gault
2019-08-22 16:39   ` Jonathan Cameron
2019-08-22 14:42 ` [PATCH v4 7/7] Documentation: arm64: Document PMU counters access from userspace Raphael Gault

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=20190822144220.27860-3-raphael.gault@arm.com \
    --to=raphael.gault@arm.com \
    --cc=acme@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=raph.gault+kdev@gmail.com \
    --cc=will.deacon@arm.com \
    /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;
as well as URLs for NNTP newsgroup(s).