linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: takahiro.akashi@linaro.org (AKASHI Takahiro)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v14 08/16] arm64: cpufeature: add MMFR0 helper functions
Date: Fri,  7 Sep 2018 17:00:32 +0900	[thread overview]
Message-ID: <20180907080040.4967-3-takahiro.akashi@linaro.org> (raw)
In-Reply-To: <20180907080040.4967-1-takahiro.akashi@linaro.org>

Those helper functions for MMFR0 register will be used later by kexec_file
loader.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Reviewed-by: James Morse <james.morse@arm.com>
---
 arch/arm64/include/asm/cpufeature.h | 48 +++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index 1717ba1db35d..cd90b5252d6d 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -486,11 +486,59 @@ static inline bool system_supports_32bit_el0(void)
 	return cpus_have_const_cap(ARM64_HAS_32BIT_EL0);
 }
 
+static inline bool system_supports_4kb_granule(void)
+{
+	u64 mmfr0;
+	u32 val;
+
+	mmfr0 =	read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1);
+	val = cpuid_feature_extract_unsigned_field(mmfr0,
+						ID_AA64MMFR0_TGRAN4_SHIFT);
+
+	return val == ID_AA64MMFR0_TGRAN4_SUPPORTED;
+}
+
+static inline bool system_supports_64kb_granule(void)
+{
+	u64 mmfr0;
+	u32 val;
+
+	mmfr0 =	read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1);
+	val = cpuid_feature_extract_unsigned_field(mmfr0,
+						ID_AA64MMFR0_TGRAN64_SHIFT);
+
+	return val == ID_AA64MMFR0_TGRAN64_SUPPORTED;
+}
+
+static inline bool system_supports_16kb_granule(void)
+{
+	u64 mmfr0;
+	u32 val;
+
+	mmfr0 =	read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1);
+	val = cpuid_feature_extract_unsigned_field(mmfr0,
+						ID_AA64MMFR0_TGRAN16_SHIFT);
+
+	return val == ID_AA64MMFR0_TGRAN16_SUPPORTED;
+}
+
 static inline bool system_supports_mixed_endian_el0(void)
 {
 	return id_aa64mmfr0_mixed_endian_el0(read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1));
 }
 
+static inline bool system_supports_mixed_endian(void)
+{
+	u64 mmfr0;
+	u32 val;
+
+	mmfr0 =	read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1);
+	val = cpuid_feature_extract_unsigned_field(mmfr0,
+						ID_AA64MMFR0_BIGENDEL_SHIFT);
+
+	return val == 0x1;
+}
+
 static inline bool system_supports_fpsimd(void)
 {
 	return !cpus_have_const_cap(ARM64_HAS_NO_FPSIMD);
-- 
2.18.0

  parent reply	other threads:[~2018-09-07  8:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-07  8:00 [PATCH v14 06/16] of/fdt: add helper functions for handling properties AKASHI Takahiro
2018-09-07  8:00 ` [PATCH v14 07/16] arm64: add image head flag definitions AKASHI Takahiro
2018-09-07  8:00 ` AKASHI Takahiro [this message]
2018-09-07  8:00 ` [PATCH v14 09/16] arm64: enable KEXEC_FILE config AKASHI Takahiro
2018-09-07  8:00 ` [PATCH v14 10/16] arm64: kexec_file: load initrd and device-tree AKASHI Takahiro
2018-09-07  8:00 ` [PATCH v14 11/16] arm64: kexec_file: allow for loading Image-format kernel AKASHI Takahiro
2018-09-07  8:00 ` [PATCH v14 12/16] arm64: kexec_file: add crash dump support AKASHI Takahiro
2018-09-07  8:00 ` [PATCH v14 13/16] arm64: kexec_file: invoke the kernel without purgatory AKASHI Takahiro
2018-09-07  8:00 ` [PATCH v14 14/16] include: pe.h: remove message[] from mz header definition AKASHI Takahiro
2018-09-07  8:00 ` [PATCH v14 15/16] arm64: kexec_file: add kernel signature verification support AKASHI Takahiro
2018-09-07  8:00 ` [PATCH v14 16/16] arm64: kexec_file: add kaslr support AKASHI Takahiro
2018-09-07 19:53 ` [PATCH v14 06/16] of/fdt: add helper functions for handling properties Frank Rowand
2018-09-10  2:38   ` AKASHI Takahiro
2018-09-14  1:42     ` Frank Rowand
2018-09-14  1:26   ` Frank Rowand
2018-09-14 17:19     ` Frank Rowand
2018-09-26  5:57       ` AKASHI Takahiro
2018-09-26  8:10         ` Frank Rowand

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=20180907080040.4967-3-takahiro.akashi@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --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).