linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 3/6] arm64: kernel: Add cpufeature 'enable' callback
Date: Tue, 21 Jul 2015 13:23:28 +0100	[thread overview]
Message-ID: <1437481411-1595-4-git-send-email-james.morse@arm.com> (raw)
In-Reply-To: <1437481411-1595-1-git-send-email-james.morse@arm.com>

This patch adds an 'enable()' callback to cpu capability/feature
detection, allowing features that require some setup or configuration
to get this opportunity once the feature has been detected.

Signed-off-by: James Morse <james.morse@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/include/asm/cpufeature.h | 1 +
 arch/arm64/kernel/cpufeature.c      | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index 9fafa7537997..484fa9425314 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -34,6 +34,7 @@ struct arm64_cpu_capabilities {
 	const char *desc;
 	u16 capability;
 	bool (*matches)(const struct arm64_cpu_capabilities *);
+	void (*enable)(void);
 	union {
 		struct {	/* To be used for erratum handling only */
 			u32 midr_model;
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 5ad86ceac010..650ffc28bedc 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -55,6 +55,12 @@ void check_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
 			pr_info("%s %s\n", info, caps[i].desc);
 		cpus_set_cap(caps[i].capability);
 	}
+
+	/* second pass allows enable() to consider interacting capabilities */
+	for (i = 0; caps[i].desc; i++) {
+		if (cpus_have_cap(caps[i].capability) && caps[i].enable)
+			caps[i].enable();
+	}
 }
 
 void check_local_cpu_features(void)
-- 
2.1.4

  parent reply	other threads:[~2015-07-21 12:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21 12:23 [PATCH v3 0/6] arm64: kernel: Add support for Privileged Access Never James Morse
2015-07-21 12:23 ` [PATCH v3 1/6] arm64: kernel: Add cpuid_feature_extract_field() for 4bit sign extension James Morse
2015-07-21 12:32   ` Catalin Marinas
2015-07-21 12:23 ` [PATCH v3 2/6] arm64: kernel: preparatory: Move config_sctlr_el1 James Morse
2015-07-21 12:23 ` James Morse [this message]
2015-07-21 12:23 ` [PATCH v3 4/6] arm64: kernel: Add min_field_value and use '>=' for feature detection James Morse
2015-07-21 12:33   ` Catalin Marinas
2015-07-21 12:23 ` [PATCH v3 5/6] arm64: kernel: Add optional CONFIG_ parameter to ALTERNATIVE() James Morse
2015-07-21 12:23 ` [PATCH v3 6/6] arm64: kernel: Add support for Privileged Access Never James Morse
2015-07-21 12:38   ` Catalin Marinas
2015-07-22 17:01     ` Will Deacon
2015-07-22 18:04       ` James Morse
2015-07-22 18:14         ` Will Deacon
2015-07-23  7:58           ` James Morse
2015-07-22 18:05       ` [PATCH v4] " James Morse
2015-07-23 13:07         ` Will Deacon
2015-07-24 15:14           ` James Morse
2015-07-24 16:56             ` Will Deacon
2015-07-23 12:00     ` [PATCH v3 6/6] " Will Deacon

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=1437481411-1595-4-git-send-email-james.morse@arm.com \
    --to=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).