|
@@ -525,10 +525,21 @@ set_hcr:
|
|
msr hcr_el2, x0
|
|
msr hcr_el2, x0
|
|
isb
|
|
isb
|
|
|
|
|
|
- /* Generic timers. */
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Allow Non-secure EL1 and EL0 to access physical timer and counter.
|
|
|
|
+ * This is not necessary for VHE, since the host kernel runs in EL2,
|
|
|
|
+ * and EL0 accesses are configured in the later stage of boot process.
|
|
|
|
+ * Note that when HCR_EL2.E2H == 1, CNTHCTL_EL2 has the same bit layout
|
|
|
|
+ * as CNTKCTL_EL1, and CNTKCTL_EL1 accessing instructions are redefined
|
|
|
|
+ * to access CNTHCTL_EL2. This allows the kernel designed to run at EL1
|
|
|
|
+ * to transparently mess with the EL0 bits via CNTKCTL_EL1 access in
|
|
|
|
+ * EL2.
|
|
|
|
+ */
|
|
|
|
+ cbnz x2, 1f
|
|
mrs x0, cnthctl_el2
|
|
mrs x0, cnthctl_el2
|
|
orr x0, x0, #3 // Enable EL1 physical timers
|
|
orr x0, x0, #3 // Enable EL1 physical timers
|
|
msr cnthctl_el2, x0
|
|
msr cnthctl_el2, x0
|
|
|
|
+1:
|
|
msr cntvoff_el2, xzr // Clear virtual offset
|
|
msr cntvoff_el2, xzr // Clear virtual offset
|
|
|
|
|
|
#ifdef CONFIG_ARM_GIC_V3
|
|
#ifdef CONFIG_ARM_GIC_V3
|