arm64: cpufeature: add MMFR0 helper functions
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> Signed-off-by: Will Deacon <will.deacon@arm.com>
This commit is contained in:
committed by
Will Deacon
parent
f56063c51f
commit
bdd2c9d1c3
@@ -486,11 +486,59 @@ static inline bool system_supports_32bit_el0(void)
|
|||||||
return cpus_have_const_cap(ARM64_HAS_32BIT_EL0);
|
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)
|
static inline bool system_supports_mixed_endian_el0(void)
|
||||||
{
|
{
|
||||||
return id_aa64mmfr0_mixed_endian_el0(read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1));
|
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)
|
static inline bool system_supports_fpsimd(void)
|
||||||
{
|
{
|
||||||
return !cpus_have_const_cap(ARM64_HAS_NO_FPSIMD);
|
return !cpus_have_const_cap(ARM64_HAS_NO_FPSIMD);
|
||||||
|
|||||||
Reference in New Issue
Block a user