On 5 September 2016 at 10:58, Suzuki K Poulose <suzuki.poulose@xxxxxxx> wrote:
+/*
+ * read_ctr - read CTR_EL0. If the system has mismatched
+ * cache line sizes, provide the system wide safe value.
+ */
+ .macro read_ctr, reg
+alternative_if_not ARM64_MISMATCHED_CACHE_LINE_SIZE
+ mrs \reg, ctr_el0 // read CTR
+ nop
+ nop
+alternative_else
+ adr_l \reg, arm64_ftr_reg_ctrel0 // Read system wide safe CTR value
+ ldr \reg, [\reg, #ARM64_FTR_SYSVAL] // from arm64_ftr_reg_ctrel0.sys_val
You should be able to use
ldr_l \reg, arm64_ftr_reg_ctrel0 + ARM64_FTR_SYSVAL
here, and save one instruction.