Skip to contentSkip to conversation

clocksource/drivers/arm_arch_timer: Mark EL2 virtual timer broken for Tegra194/234

PATCH In review Jon Hunter 3 participants 3 messages Jul 22 – Jul 23

Subsystems (3)
lore
Share & tools
lore

Jon Hunter

author maintainer
#0 lore raw

PATCH 1/1 clocksource/drivers/arm_arch_timer: Mark EL2 virtual timer broken for Tegra194/234

The following warning is being observed on Tegra194 and Tegra234 platforms ...

arch_timer: [Firmware Bug]: VHE-capable CPU without EL2 virtual timer
interrupt

Adding the missing EL2 virtual timer in device-tree for Tegra194 and Tegra234 is causing boot issues for both devices.

The Tegra194 device includes a GIC-400 which defines PPIs for sec-phys, phys, virt and hyp-phys timer interrupts (per the dt-binding arm,arch_timer.yaml) but there is no PPI hyp-virt (EL2 virtual) timer and hence this is not supported for this device.

The Tegra234 device does have a PPI for the EL2 virtual timer, but during CPU idle transitions into low-power states this timer is not preserved currently by firmware and hence causes boot issues when CPU idle is enabled.

Avoid the warning for Tegra194 and Tegra234 devices by marking the EL2 virtual timer as broken.

---
 drivers/clocksource/arm_arch_timer.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/clocksource/arm_arch_timer.c +14 -0
index 4adf756423de..b9ccb560ff8f 100644
@@ -1090,6 +1090,17 @@ static int __init arch_timer_common_init(void)
 	return arch_timer_arch_init();
 }
 
+static bool __init has_broken_el2_vtimer(void)
+{
+	static const char * const broken_el2_vtimer[] __initconst = {
+		"nvidia,tegra194",
+		"nvidia,tegra234",
+		NULL
+	};
+
+	return of_machine_compatible_match(broken_el2_vtimer);
+}
+
 /**
  * arch_timer_select_ppi() - Select suitable PPI for the current system.
  *
@@ -1115,6 +1126,9 @@ static int __init arch_timer_common_init(void)
 static enum arch_timer_ppi_nr __init arch_timer_select_ppi(void)
 {
 	if (is_kernel_in_hyp_mode()) {
+		if (has_broken_el2_vtimer())
+			return ARCH_TIMER_HYP_PPI;
+
 		if (arch_timer_ppi[ARCH_TIMER_HYP_VIRT_PPI])
 			return ARCH_TIMER_HYP_VIRT_PPI;
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 14 lines · Jon Hunter

The following warning is being observed on Tegra194 and Tegra234 platforms ...

arch_timer: [Firmware Bug]: VHE-capable CPU without EL2 virtual timer
interrupt

Adding the missing EL2 virtual timer in device-tree for Tegra194 and Tegra234 is causing boot issues for both devices.

The Tegra194 device includes a GIC-400 which defines PPIs for sec-phys, phys, virt and hyp-phys timer interrupts (per the dt-binding arm,arch_timer.yaml) but there is no PPI hyp-virt (EL2 virtual) timer and hence this is not supported for this device.

Quoted 8 lines

The Tegra234 device does have a PPI for the EL2 virtual timer, but during CPU idle transitions into low-power states this timer is not preserved currently by firmware and hence causes boot issues when CPU idle is enabled.

Avoid the warning for Tegra194 and Tegra234 devices by marking the EL2 virtual timer as broken.

You may need to build on top of [1]

Signature · 4 lines
Regards,
Sudeep

[1] https://lore.kernel.org/all/[email protected]/
maintainer
#2 lore raw
In reply to Jon Hunter
Quoted 20 lines · Jon Hunter

The following warning is being observed on Tegra194 and Tegra234 platforms ...

arch_timer: [Firmware Bug]: VHE-capable CPU without EL2 virtual timer
interrupt

Adding the missing EL2 virtual timer in device-tree for Tegra194 and Tegra234 is causing boot issues for both devices.

The Tegra194 device includes a GIC-400 which defines PPIs for sec-phys, phys, virt and hyp-phys timer interrupts (per the dt-binding arm,arch_timer.yaml) but there is no PPI hyp-virt (EL2 virtual) timer and hence this is not supported for this device.

The Tegra234 device does have a PPI for the EL2 virtual timer, but during CPU idle transitions into low-power states this timer is not preserved currently by firmware and hence causes boot issues when CPU idle is enabled.

Quoted 4 lines

Avoid the warning for Tegra194 and Tegra234 devices by marking the EL2 virtual timer as broken.

This isn't what I suggested at [1]. The warnings are *required*, because these systems are not compliant to the specification. Full timer support was not optional last time I checked.

Thanks,

	M.

[1] https://lore.kernel.org/all/[email protected]/

Signature · 1 line
Without deviation from the norm, progress is not possible.