Skip to content

Commit bdd2c9d

Browse files
AKASHI Takahirowildea01
authored andcommitted
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>
1 parent f56063c commit bdd2c9d

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

arch/arm64/include/asm/cpufeature.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,59 @@ static inline bool system_supports_32bit_el0(void)
486486
return cpus_have_const_cap(ARM64_HAS_32BIT_EL0);
487487
}
488488

489+
static inline bool system_supports_4kb_granule(void)
490+
{
491+
u64 mmfr0;
492+
u32 val;
493+
494+
mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1);
495+
val = cpuid_feature_extract_unsigned_field(mmfr0,
496+
ID_AA64MMFR0_TGRAN4_SHIFT);
497+
498+
return val == ID_AA64MMFR0_TGRAN4_SUPPORTED;
499+
}
500+
501+
static inline bool system_supports_64kb_granule(void)
502+
{
503+
u64 mmfr0;
504+
u32 val;
505+
506+
mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1);
507+
val = cpuid_feature_extract_unsigned_field(mmfr0,
508+
ID_AA64MMFR0_TGRAN64_SHIFT);
509+
510+
return val == ID_AA64MMFR0_TGRAN64_SUPPORTED;
511+
}
512+
513+
static inline bool system_supports_16kb_granule(void)
514+
{
515+
u64 mmfr0;
516+
u32 val;
517+
518+
mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1);
519+
val = cpuid_feature_extract_unsigned_field(mmfr0,
520+
ID_AA64MMFR0_TGRAN16_SHIFT);
521+
522+
return val == ID_AA64MMFR0_TGRAN16_SUPPORTED;
523+
}
524+
489525
static inline bool system_supports_mixed_endian_el0(void)
490526
{
491527
return id_aa64mmfr0_mixed_endian_el0(read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1));
492528
}
493529

530+
static inline bool system_supports_mixed_endian(void)
531+
{
532+
u64 mmfr0;
533+
u32 val;
534+
535+
mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1);
536+
val = cpuid_feature_extract_unsigned_field(mmfr0,
537+
ID_AA64MMFR0_BIGENDEL_SHIFT);
538+
539+
return val == 0x1;
540+
}
541+
494542
static inline bool system_supports_fpsimd(void)
495543
{
496544
return !cpus_have_const_cap(ARM64_HAS_NO_FPSIMD);

0 commit comments

Comments
 (0)