Skip to contentSkip to conversation

arm64: Use EL2 virtual timer when running VHE

PATCH Applied Marc Zyngier 14 participants 51 messages May 23 – Nov 17

Subsystems (24)
lore
Share & tools
lore

Marc Zyngier

author maintainer
#0 lore raw

v3 cover arm64: Use EL2 virtual timer when running VHE

This is the third version of the series initially posted at [1], which

- updates the ACPI GTDT parsing to deal the v3 layout and the EL2 virtual timer,
- moves the architected timer driver to use it when running VHE,
- fixes a number of DTs to reflect the reality of the HW.

This results in significant performance uplift in deeper nested virt scenarios, at no overhead to the host.

Patches based on -rc3, tested on Amlogic SM1, QC X1E, Ampere Altra, and Apple M2, as well as KVM NV guests.

* From v2 [2]:

- Add more consistency checks to the GTDT parsing

- Match the virtual counter when using the KVM PTP backend

- Drop a number of changes to Qualcomm DTs, being only tangentially related and that will be posted separately

- Fix the Realtek Kent platform, which had the GICv3 maintenance interrupt advertised as the EL2 virtual timer

- Collected TBs and RBs, with thanks

* From v1 [2]:

- Now also using the EL2 virtual counter, which further improve things when running at a deeper nesting level

- Updated consistency checks for the platform timers when finding a GTDTv3

- Collected ABs and RBs, with thanks

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

Marc Zyngier (17):
ACPI: GTDT: Account for GTDTv3 size when walking the platform timer
descriptors
ACPI: GTDT: Parse information related to the EL2 virtual timer clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when
running VHE
dt-bindings: timer: arm,arch_timer: Fix requirements for interrupt
description
arm64: dts: allwinner: Add EL2 virtual timer interrupt
arm64: dts: amlogic: Add EL2 virtual timer interrupt
arm64: dts: bst: Add EL2 virtual timer interrupt
arm64: dts: exynos: Add EL2 virtual timer interrupt
arm64: dts: freescale: Add EL2 virtual timer interrupt
arm64: dts: intel: Add EL2 virtual timer interrupt
arm64: dts: mediatek: Add EL2 virtual timer interrupt
arm64: dts: nvidia: Add EL2 virtual timer interrupt
arm64: dts: qcom: Add EL2 virtual timer interrupt
arm64: dts: realtek: Add EL2 virtual timer interrupt
arm64: dts: rockchip: Add EL2 virtual timer interrupt
arm64: dts: sprd: Add EL2 virtual timer interrupt
arm64: dts: xilinx: Add EL2 virtual timer interrupt

 .../bindings/timer/arm,arch_timer.yaml        | 21 +++----
 .../arm64/boot/dts/allwinner/sun55i-a523.dtsi |  3 +-
 .../boot/dts/amlogic/amlogic-a4-common.dtsi   |  8 ---
 arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi   |  8 +++
 arch/arm64/boot/dts/amlogic/amlogic-a5.dtsi   |  9 +++
 arch/arm64/boot/dts/amlogic/amlogic-s6.dtsi   |  3 +-
 arch/arm64/boot/dts/amlogic/amlogic-s7.dtsi   |  3 +-
 arch/arm64/boot/dts/amlogic/amlogic-s7d.dtsi  |  3 +-
 .../boot/dts/amlogic/meson-g12-common.dtsi    | 13 -----
 arch/arm64/boot/dts/amlogic/meson-g12.dtsi    |  9 +++
 arch/arm64/boot/dts/amlogic/meson-sm1.dtsi    | 10 ++++
 arch/arm64/boot/dts/bst/bstc1200.dtsi         |  3 +-
 arch/arm64/boot/dts/exynos/axis/artpec9.dtsi  |  3 +-
 arch/arm64/boot/dts/exynos/exynos2200.dtsi    |  3 +-
 arch/arm64/boot/dts/exynos/exynos990.dtsi     |  3 +-
 arch/arm64/boot/dts/exynos/exynosautov9.dtsi  |  3 +-
 arch/arm64/boot/dts/exynos/google/gs101.dtsi  |  3 +-
 .../boot/dts/freescale/imx91_93_common.dtsi   |  3 +-
 arch/arm64/boot/dts/freescale/imx94.dtsi      |  3 +-
 arch/arm64/boot/dts/freescale/imx95.dtsi      |  3 +-
 arch/arm64/boot/dts/freescale/imx952.dtsi     |  3 +-
 arch/arm64/boot/dts/freescale/s32n79.dtsi     |  3 +-
 .../arm64/boot/dts/intel/socfpga_agilex5.dtsi |  3 +-
 arch/arm64/boot/dts/mediatek/mt6779.dtsi      |  3 +-
 arch/arm64/boot/dts/mediatek/mt8186.dtsi      |  3 +-
 arch/arm64/boot/dts/mediatek/mt8188.dtsi      |  3 +-
 arch/arm64/boot/dts/mediatek/mt8192.dtsi      |  3 +-
 arch/arm64/boot/dts/mediatek/mt8195.dtsi      |  3 +-
 arch/arm64/boot/dts/nvidia/tegra194.dtsi      |  2 +
 arch/arm64/boot/dts/nvidia/tegra234.dtsi      |  3 +-
 arch/arm64/boot/dts/qcom/eliza.dtsi           |  3 +-
 arch/arm64/boot/dts/qcom/hamoa.dtsi           |  3 +-
 arch/arm64/boot/dts/qcom/kaanapali.dtsi       |  3 +-
 arch/arm64/boot/dts/qcom/kodiak.dtsi          |  3 +-
 arch/arm64/boot/dts/qcom/lemans.dtsi          |  3 +-
 arch/arm64/boot/dts/qcom/monaco.dtsi          |  3 +-
 arch/arm64/boot/dts/qcom/sar2130p.dtsi        |  3 +-
 arch/arm64/boot/dts/qcom/sc8280xp.dtsi        |  3 +-
 arch/arm64/boot/dts/qcom/sm4450.dtsi          |  3 +-
 arch/arm64/boot/dts/qcom/sm8250.dtsi          |  3 +-
 arch/arm64/boot/dts/qcom/sm8350.dtsi          |  3 +-
 arch/arm64/boot/dts/qcom/sm8450.dtsi          |  3 +-
 arch/arm64/boot/dts/qcom/sm8550.dtsi          |  3 +-
 arch/arm64/boot/dts/qcom/sm8650.dtsi          |  3 +-
 arch/arm64/boot/dts/qcom/sm8750.dtsi          |  3 +-
 arch/arm64/boot/dts/realtek/kent.dtsi         |  2 +-
 arch/arm64/boot/dts/realtek/rtd16xx.dtsi      |  3 +-
 arch/arm64/boot/dts/rockchip/rk356x-base.dtsi |  3 +-
 arch/arm64/boot/dts/sprd/sc9863a.dtsi         |  3 +-
 arch/arm64/boot/dts/sprd/ums512.dtsi          |  3 +-
 arch/arm64/boot/dts/sprd/ums9620.dtsi         |  3 +-
 arch/arm64/boot/dts/xilinx/versal-net.dtsi    |  3 +-
 drivers/acpi/arm64/gtdt.c                     | 42 +++++++++++++-
 drivers/clocksource/arm_arch_timer.c          | 55 +++++++++++--------
 54 files changed, 206 insertions(+), 102 deletions(-)
Signature · 1 line
2.47.3
author maintainer
#1 lore raw

PATCH v3 1/17 ACPI: GTDT: Account for GTDTv3 size when walking the platform timer descriptors

Since ARMv8.1, the architecture has grown an EL2-private virtual timer. This has been described in ACPI since ACPI v6.3 and revision 3 of the GTDT table.

An aditional structure was added in ACPICA, though in a rather bizarre way, and merged in v5.1 as 8f5a14d053100 ("ACPICA: ACPI 6.3:
add GTDT Revision 3 support").

Finally plug the table parsing in GTDT, and correct the parsing of the platform timer subtables to account for the expanded size of the base table. This also comes with some extra sanitisation of the table, in the unlikely case someone got it wrong...

---
 drivers/acpi/arm64/gtdt.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/acpi/arm64/gtdt.c +20 -2
index ffc867bac2d60..950d5efdf85ea 100644
@@ -34,14 +34,25 @@ struct acpi_gtdt_descriptor {
 	void *platform_timer;
 };
 
+struct gtdt_v3 {
+	struct acpi_table_gtdt	gtdt_v2;
+	struct acpi_gtdt_el2	el2_vtimer;
+};
+
 static struct acpi_gtdt_descriptor acpi_gtdt_desc __initdata;
 
 static __init bool platform_timer_valid(void *platform_timer)
 {
 	struct acpi_gtdt_header *gh = platform_timer;
+	void *platform_timer_begin;
 
-	return (platform_timer >= (void *)(acpi_gtdt_desc.gtdt + 1) &&
-		platform_timer < acpi_gtdt_desc.gtdt_end &&
+	if (acpi_gtdt_desc.gtdt->header.revision >= 3)
+		platform_timer_begin = container_of(acpi_gtdt_desc.gtdt, struct gtdt_v3, gtdt_v2) + 1;
+	else
+		platform_timer_begin = acpi_gtdt_desc.gtdt + 1;
+
+	return (platform_timer >= platform_timer_begin &&
+		platform_timer + sizeof(*gh) <= acpi_gtdt_desc.gtdt_end &&
 		gh->length != 0 &&
 		platform_timer + gh->length <= acpi_gtdt_desc.gtdt_end);
 }
@@ -166,6 +177,13 @@ int __init acpi_gtdt_init(struct acpi_table_header *table,
 	u32 cnt = 0;
 
 	gtdt = container_of(table, struct acpi_table_gtdt, header);
+
+	if ((gtdt->header.revision >= 3 && gtdt->header.length < sizeof(struct gtdt_v3)) ||
+	    (gtdt->header.revision == 2 && gtdt->header.length < sizeof(*gtdt))) {
+		pr_err(FW_BUG "GTDT with invalid size %d\n", gtdt->header.length);
+		return -EINVAL;
+	}
+
 	acpi_gtdt_desc.gtdt = gtdt;
 	acpi_gtdt_desc.gtdt_end = (void *)table + table->length;
 	acpi_gtdt_desc.platform_timer = NULL;
Signature · 1 line
2.47.3
author maintainer
#6 lore raw

PATCH v3 2/17 ACPI: GTDT: Parse information related to the EL2 virtual timer

In reply to Marc Zyngier

Now that we have a way to identify GTDTv3, allow the information related to the EL2 virtual timer to be retrieved by the interface used by the architected timer driver.

---
 drivers/acpi/arm64/gtdt.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/acpi/arm64/gtdt.c +20 -0
index 950d5efdf85ea..00158c8aa6d90 100644
@@ -41,6 +41,14 @@ struct gtdt_v3 {
 
 static struct acpi_gtdt_descriptor acpi_gtdt_desc __initdata;
 
+static __init struct acpi_gtdt_el2 *gtdt_to_el2_vtimer(struct acpi_table_gtdt *gtdt)
+{
+	if (gtdt->header.revision < 3)
+		return NULL;
+
+	return &container_of(gtdt, struct gtdt_v3, gtdt_v2)->el2_vtimer;
+}
+
 static __init bool platform_timer_valid(void *platform_timer)
 {
 	struct acpi_gtdt_header *gh = platform_timer;
@@ -112,6 +120,7 @@ static int __init map_gt_gsi(u32 interrupt, u32 flags)
 int __init acpi_gtdt_map_ppi(int type)
 {
 	struct acpi_table_gtdt *gtdt = acpi_gtdt_desc.gtdt;
+	struct acpi_gtdt_el2 *el2_vtimer = gtdt_to_el2_vtimer(gtdt);
 
 	switch (type) {
 	case ARCH_TIMER_PHYS_NONSECURE_PPI:
@@ -124,6 +133,12 @@ int __init acpi_gtdt_map_ppi(int type)
 	case ARCH_TIMER_HYP_PPI:
 		return map_gt_gsi(gtdt->non_secure_el2_interrupt,
 				  gtdt->non_secure_el2_flags);
+	case ARCH_TIMER_HYP_VIRT_PPI:
+		if (el2_vtimer && el2_vtimer->virtual_el2_timer_gsiv)
+			return map_gt_gsi(el2_vtimer->virtual_el2_timer_gsiv,
+					  el2_vtimer->virtual_el2_timer_flags);
+
+		return 0;
 	default:
 		pr_err("Failed to map timer interrupt: invalid type.\n");
 	}
@@ -141,6 +156,7 @@ int __init acpi_gtdt_map_ppi(int type)
 bool __init acpi_gtdt_c3stop(int type)
 {
 	struct acpi_table_gtdt *gtdt = acpi_gtdt_desc.gtdt;
+	struct acpi_gtdt_el2 *el2_vtimer = gtdt_to_el2_vtimer(gtdt);
 
 	switch (type) {
 	case ARCH_TIMER_PHYS_NONSECURE_PPI:
@@ -152,6 +168,10 @@ bool __init acpi_gtdt_c3stop(int type)
 	case ARCH_TIMER_HYP_PPI:
 		return !(gtdt->non_secure_el2_flags & ACPI_GTDT_ALWAYS_ON);
 
+	case ARCH_TIMER_HYP_VIRT_PPI:
+		return el2_vtimer && el2_vtimer->virtual_el2_timer_gsiv &&
+		       !(el2_vtimer->virtual_el2_timer_flags & ACPI_GTDT_ALWAYS_ON);
+
 	default:
 		pr_err("Failed to get c3stop info: invalid type.\n");
 	}
Signature · 1 line
2.47.3
author maintainer
#9 lore raw

PATCH v3 3/17 clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE

In reply to Marc Zyngier

When running with at EL2 with VHE enabled, the architecture provides two EL2 timer/counters, dubbed physical and virtual. Apart from their names, they are strictly identical.

However, they don't get virtualised the same way, specially when it comes to adding arbitrary offsets to the timers. When running as a guest, the host CNTVOFF_EL2 does apply to the guest's view of CNTHV*_El2. This is not true for CNTPOFF_EL2 and CNTHP*_EL2, as the architecture is broken past the first level of virtualisation (it lacks some essential mechanisms to be usable, despite what the ARM ARM pretends).

This means that when running as a L2 guest hypervisor, using the physical timer results in traps to L0, which are then forwarded to L1 in order to emulate the offset, leading to even worse performance due to massive trap amplification (the combination of register and ERET trapping is absolutely lethal).

Switch the arch timer code to using the virtual timer when running in VHE by default, only using the physical timer if the interrupt is not correctly described in the firmware tables (which seems to be an unfortunately common case). This comes as no impact on bare-metal, and slightly improves the situation in the virtualised case.

---
 drivers/clocksource/arm_arch_timer.c | 55 +++++++++++++++++-----------
 1 file changed, 33 insertions(+), 22 deletions(-)
drivers/clocksource/arm_arch_timer.c +33 -22
index 90aeff44a2764..4adf756423de9 100644
@@ -688,6 +688,7 @@ static void __arch_timer_setup(struct clock_event_device *clk)
 	clk->irq = arch_timer_ppi[arch_timer_uses_ppi];
 	switch (arch_timer_uses_ppi) {
 	case ARCH_TIMER_VIRT_PPI:
+	case ARCH_TIMER_HYP_VIRT_PPI:
 		clk->set_state_shutdown = arch_timer_shutdown_virt;
 		clk->set_state_oneshot_stopped = arch_timer_shutdown_virt;
 		sne = erratum_handler(set_next_event_virt);
@@ -879,7 +880,7 @@ static void __init arch_timer_banner(void)
 	pr_info("cp15 timer running at %lu.%02luMHz (%s).\n",
 		(unsigned long)arch_timer_rate / 1000000,
 		(unsigned long)(arch_timer_rate / 10000) % 100,
-		(arch_timer_uses_ppi == ARCH_TIMER_VIRT_PPI) ? "virt" : "phys");
+		arch_timer_ppi_names[arch_timer_uses_ppi]);
 }
 
 u32 arch_timer_get_rate(void)
@@ -912,7 +913,8 @@ static void __init arch_counter_register(void)
 	int width;
 
 	if ((IS_ENABLED(CONFIG_ARM64) && !is_hyp_mode_available()) ||
-	    arch_timer_uses_ppi == ARCH_TIMER_VIRT_PPI) {
+	    arch_timer_uses_ppi == ARCH_TIMER_VIRT_PPI ||
+	    arch_timer_uses_ppi == ARCH_TIMER_HYP_VIRT_PPI) {
 		if (arch_timer_counter_has_wa()) {
 			rd = arch_counter_get_cntvct_stable;
 			scr = raw_counter_get_cntvct_stable;
@@ -1023,6 +1025,7 @@ static int __init arch_timer_register(void)
 	ppi = arch_timer_ppi[arch_timer_uses_ppi];
 	switch (arch_timer_uses_ppi) {
 	case ARCH_TIMER_VIRT_PPI:
+	case ARCH_TIMER_HYP_VIRT_PPI:
 		err = request_percpu_irq(ppi, arch_timer_handler_virt,
 					 "arch_timer", arch_timer_evt);
 		break;
@@ -1090,25 +1093,34 @@ static int __init arch_timer_common_init(void)
 /**
  * arch_timer_select_ppi() - Select suitable PPI for the current system.
  *
- * If HYP mode is available, we know that the physical timer
- * has been configured to be accessible from PL1. Use it, so
- * that a guest can use the virtual timer instead.
+ * On AArch32, if HYP mode is available, we know that the physical
+ * timer has been configured to be accessible from PL1. Use it, so
+ * that a guest can use the virtual timer instead (though KVM host
+ * support has long been removed).
  *
- * On ARMv8.1 with VH extensions, the kernel runs in HYP. VHE
- * accesses to CNTP_*_EL1 registers are silently redirected to
- * their CNTHP_*_EL2 counterparts, and use a different PPI
- * number.
+ * On ARMv8.1 with FEAT_VHE, the kernel runs in EL2. Accesses to
+ * CNTV_*_EL1 registers are silently redirected to their CNTHV_*_EL2
+ * counterparts, and the timer uses a different PPI number. Similar
+ * thing happen when using the EL2 physical timer. Note that a bunch
+ * of DTs out there omit the virtual EL2 timer, so fallback gracefully
+ * on the physical timer.
+ *
+ * Without VHE, if no interrupt provided for virtual timer, we'll have
+ * to stick to the physical timer. It'd better be accessible...
  *
- * If no interrupt provided for virtual timer, we'll have to
- * stick to the physical timer. It'd better be accessible...
  * For arm64 we never use the secure interrupt.
  *
  * Return: a suitable PPI type for the current system.
  */
 static enum arch_timer_ppi_nr __init arch_timer_select_ppi(void)
 {
-	if (is_kernel_in_hyp_mode())
+	if (is_kernel_in_hyp_mode()) {
+		if (arch_timer_ppi[ARCH_TIMER_HYP_VIRT_PPI])
+			return ARCH_TIMER_HYP_VIRT_PPI;
+
+		pr_warn_once(FW_BUG "VHE-capable CPU without EL2 virtual timer interrupt\n");
 		return ARCH_TIMER_HYP_PPI;
+	}
 
 	if (!is_hyp_mode_available() && arch_timer_ppi[ARCH_TIMER_VIRT_PPI])
 		return ARCH_TIMER_VIRT_PPI;
@@ -1200,14 +1212,9 @@ static int __init arch_timer_acpi_init(struct acpi_table_header *table)
 	if (ret)
 		return ret;
 
-	arch_timer_ppi[ARCH_TIMER_PHYS_NONSECURE_PPI] =
-		acpi_gtdt_map_ppi(ARCH_TIMER_PHYS_NONSECURE_PPI);
-
-	arch_timer_ppi[ARCH_TIMER_VIRT_PPI] =
-		acpi_gtdt_map_ppi(ARCH_TIMER_VIRT_PPI);
-
-	arch_timer_ppi[ARCH_TIMER_HYP_PPI] =
-		acpi_gtdt_map_ppi(ARCH_TIMER_HYP_PPI);
+	/* The GTDT parser can't be bothered with the secure timer */
+	for (int i = ARCH_TIMER_PHYS_NONSECURE_PPI; i < ARCH_TIMER_MAX_TIMER_PPI; i++)
+		arch_timer_ppi[i] = acpi_gtdt_map_ppi(i);
 
 	arch_timer_populate_kvm_info();
 
@@ -1253,10 +1260,14 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts,
 	if (!IS_ENABLED(CONFIG_HAVE_ARM_SMCCC_DISCOVERY))
 		return -EOPNOTSUPP;
 
-	if (arch_timer_uses_ppi == ARCH_TIMER_VIRT_PPI)
+	switch (arch_timer_uses_ppi) {
+	case ARCH_TIMER_VIRT_PPI:
+	case ARCH_TIMER_HYP_VIRT_PPI:
 		ptp_counter = KVM_PTP_VIRT_COUNTER;
-	else
+		break;
+	default:
 		ptp_counter = KVM_PTP_PHYS_COUNTER;
+	}
 
 	arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID,
 			     ptp_counter, &hvc_res);
Signature · 1 line
2.47.3
author maintainer
#17 lore raw

PATCH v3 4/17 dt-bindings: timer: arm,arch_timer: Fix requirements for interrupt description

In reply to Marc Zyngier

The arm,arch_timer DT binding is extremely imprecise in describing the requirements for interrupts.

Follow the architecture by making it explicit that:
- the EL1 secure timer irq is required if EL3 is implemented
- the EL1 physical timer irq is always required
- the EL1 virtual timer irq is always required
- the EL2 physical timer irq is required if EL2 is implemented
- the EL2 virtual timer irq is required if FEAT_VHE is implemented

The consequence of the above is that the minimum number of interrupts to be described is 2, and not 1.

Finally, clean up the description which made the assumption that the timers are plugged into a GIC (unfortunately, that's not always true), drop the MMIO nonsense that has long be moved to a separate binding, and use the architectural terminology to describe the various interrupts.

---
 .../bindings/timer/arm,arch_timer.yaml        | 21 +++++++------------
 1 file changed, 8 insertions(+), 13 deletions(-)
Documentation/devicetree/bindings/timer/arm,arch_timer.yaml +8 -13
index c5fc3b6c8bd0b..c65e48a155ab6 100644
@@ -10,13 +10,8 @@ maintainers:
   - Marc Zyngier <[email protected]>
   - Mark Rutland <[email protected]>
 description: |+
-  ARM cores may have a per-core architected timer, which provides per-cpu timers,
-  or a memory mapped architected timer, which provides up to 8 frames with a
-  physical and optional virtual timer per frame.
-
-  The per-core architected timer is attached to a GIC to deliver its
-  per-processor interrupts via PPIs. The memory mapped timer is attached to a GIC
-  to deliver its interrupts via SPIs.
+  The per-core architected timer is expected to deliver per-CPU interrupts
+  (commonly to a GIC to deliver its per-processor interrupts as PPIs).
 
 properties:
   compatible:
@@ -33,13 +28,13 @@ properties:
           - const: arm,armv7-timer
 
   interrupts:
-    minItems: 1
+    minItems: 2
     items:
-      - description: secure timer irq
-      - description: non-secure timer irq
-      - description: virtual timer irq
-      - description: hypervisor timer irq
-      - description: hypervisor virtual timer irq
+      - description: EL1 secure physical timer irq, if EL3 is implemented
+      - description: EL1 non-secure physical timer irq
+      - description: EL1 virtual timer irq
+      - description: EL2 physical timer irq, if EL2 is implemented
+      - description: EL2 virtual timer irq, if FEAT_VHE is implemented
 
   interrupt-names:
     oneOf:
Signature · 1 line
2.47.3
author maintainer
#20 lore raw

PATCH v3 5/17 arm64: dts: allwinner: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

The ARMv8.2 based CPUs used in the A523 SoC (and derivatives) are missing the EL2 virtual timer interrupt. Add it.

---
 arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +2 -1
index 5afa8d92acbfb..d3c47966e8fc8 100644
@@ -101,7 +101,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_HIGH>;
 	};
 
 	soc {
Signature · 1 line
2.47.3
author maintainer
#21 lore raw

PATCH v3 6/17 arm64: dts: amlogic: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

The ARMv8.2 based CPUs used in a number of Amlogic SoCs are missing the EL2 virtual timer interrupt. Add it.

This requires some surgery in the "common" files to move the timer node to locations that makes it possible to add the interrupt only where it is actually implemented.

---
 arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi |  8 --------
 arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi        |  8 ++++++++
 arch/arm64/boot/dts/amlogic/amlogic-a5.dtsi        |  9 +++++++++
 arch/arm64/boot/dts/amlogic/amlogic-s6.dtsi        |  3 ++-
 arch/arm64/boot/dts/amlogic/amlogic-s7.dtsi        |  3 ++-
 arch/arm64/boot/dts/amlogic/amlogic-s7d.dtsi       |  3 ++-
 arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi  | 13 -------------
 arch/arm64/boot/dts/amlogic/meson-g12.dtsi         |  9 +++++++++
 arch/arm64/boot/dts/amlogic/meson-sm1.dtsi         | 10 ++++++++++
 9 files changed, 42 insertions(+), 24 deletions(-)
arch/arm64/boot/dts/amlogic/amlogic-a4-common.dtsi +0 -8
index 54d7a2d56ef64..6f559e4dd9ee9 100644
@@ -7,14 +7,6 @@
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/gpio/gpio.h>
 / {
-	timer {
-		compatible = "arm,armv8-timer";
-		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
-	};
-
 	psci {
 		compatible = "arm,psci-1.0";
 		method = "smc";
arch/arm64/boot/dts/amlogic/amlogic-a4.dtsi +8 -0
index fce45933fa28b..c28fc7fcbae7f 100644
@@ -86,6 +86,14 @@ pwrc: power-controller {
 			#power-domain-cells = <1>;
 		};
 	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+	};
 };
 
 &apb {
arch/arm64/boot/dts/amlogic/amlogic-a5.dtsi +9 -0
index 2b12d8284594f..c22c0acb4807e 100644
@@ -49,6 +49,15 @@ pwrc: power-controller {
 			#power-domain-cells = <1>;
 		};
 	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 12 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+	};
 };
 
 &apb {
arch/arm64/boot/dts/amlogic/amlogic-s6.dtsi +2 -1
index ab3acef2b147e..853d32929ff46 100644
@@ -56,7 +56,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 
 	psci {
arch/arm64/boot/dts/amlogic/amlogic-s7.dtsi +2 -1
index a3faf4d188e11..bfaac5f3e22da 100644
@@ -94,7 +94,8 @@ timer {
 		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 12 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
 	};
 
 	psci {
arch/arm64/boot/dts/amlogic/amlogic-s7d.dtsi +2 -1
index 0c4417bcd6827..32d8683059964 100644
@@ -58,7 +58,8 @@ timer {
 		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 12 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
 	};
 
 	psci {
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +0 -13
index 00609d2da6743..a911a5181a88d 100644
@@ -2579,19 +2579,6 @@ map {
 		};
 	};
 
-	timer {
-		compatible = "arm,armv8-timer";
-		interrupts = <GIC_PPI 13
-			(GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 14
-			(GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 11
-			(GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 10
-			(GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>;
-		arm,no-tick-in-suspend;
-	};
-
 	xtal: xtal-clk {
 		compatible = "fixed-clock";
 		clock-frequency = <24000000>;
arch/arm64/boot/dts/amlogic/meson-g12.dtsi +9 -0
index 664912d1beaab..866fc07d1b0ae 100644
@@ -43,6 +43,15 @@ tdmif_c: audio-controller-2 {
 		clock-names = "sclk", "lrclk", "mclk";
 		status = "disabled";
 	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>;
+		arm,no-tick-in-suspend;
+	};
 };
 
 &apb {
arch/arm64/boot/dts/amlogic/meson-sm1.dtsi +10 -0
index 8f5b850b1774f..77c72936ffdd3 100644
@@ -128,6 +128,16 @@ l2: l2-cache0 {
 		};
 	};
 
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 12 (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>;
+		arm,no-tick-in-suspend;
+	};
+
 	cpu_opp_table: opp-table {
 		compatible = "operating-points-v2";
 		opp-shared;
Signature · 1 line
2.47.3
author maintainer
#22 lore raw

PATCH v3 7/17 arm64: dts: bst: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

The ARMv8.2 based CPUs used in the bst c1200 SoC are missing the EL2 virtual timer interrupt. Add it.

---
 arch/arm64/boot/dts/bst/bstc1200.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/bst/bstc1200.dtsi +2 -1
index dd13c6bfc3c89..104ecf76ced10 100644
@@ -92,6 +92,7 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 };
Signature · 1 line
2.47.3
author maintainer
#23 lore raw

PATCH v3 8/17 arm64: dts: exynos: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

A bunch of Samsung SoCs are missing the EL2 virtual timer interrupt despite using ARMv8.1+ CPUs. Add the missing interrupt, except for those broken designs where the interrupt is documented as not being wired.

---
 arch/arm64/boot/dts/exynos/axis/artpec9.dtsi | 3 ++-
 arch/arm64/boot/dts/exynos/exynos2200.dtsi   | 3 ++-
 arch/arm64/boot/dts/exynos/exynos990.dtsi    | 3 ++-
 arch/arm64/boot/dts/exynos/exynosautov9.dtsi | 3 ++-
 arch/arm64/boot/dts/exynos/google/gs101.dtsi | 3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/exynos/axis/artpec9.dtsi +2 -1
index f8ed43c6e8258..cd46aaf056287 100644
@@ -272,6 +272,7 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 };
arch/arm64/boot/dts/exynos/exynos2200.dtsi +2 -1
index 6487ccb58ae76..59662f9bdb98f 100644
@@ -1911,7 +1911,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW 0>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW 0>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW 0>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW 0>;
 		/*
 		 * Non-updatable, broken stock Samsung bootloader does not
 		 * configure CNTFRQ_EL0
arch/arm64/boot/dts/exynos/exynos990.dtsi +2 -1
index f8e2a31b4b751..2e6fb24a3c928 100644
@@ -405,7 +405,8 @@ timer {
 		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>;
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 12 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>;
 
 		/*
 		 * Non-updatable, broken stock Samsung bootloader does not
arch/arm64/boot/dts/exynos/exynosautov9.dtsi +2 -1
index 66628cb32776e..2c34a2b30ad02 100644
@@ -148,7 +148,8 @@ timer {
 		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>;
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 12 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>;
 	};
 
 	fixed-rate-clocks {
arch/arm64/boot/dts/exynos/google/gs101.dtsi +2 -1
index d085f9fb0f62a..86933f22647b7 100644
@@ -1856,7 +1856,8 @@ timer {
 		   <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW) 0>,
 		   <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW) 0>,
 		   <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW) 0>,
-		   <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW) 0>;
+		   <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW) 0>,
+		   <GIC_PPI 12 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW) 0>;
 	};
 };
 
Signature · 1 line
2.47.3
author maintainer
#25 lore raw

PATCH v3 9/17 arm64: dts: freescale: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

The ARMv8.2 based CPUs used in a number of NXP/FSL SoCs are missing the EL2 virtual timer interrupt. Add it.

---
 arch/arm64/boot/dts/freescale/imx91_93_common.dtsi | 3 ++-
 arch/arm64/boot/dts/freescale/imx94.dtsi           | 3 ++-
 arch/arm64/boot/dts/freescale/imx95.dtsi           | 3 ++-
 arch/arm64/boot/dts/freescale/imx952.dtsi          | 3 ++-
 arch/arm64/boot/dts/freescale/s32n79.dtsi          | 3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/freescale/imx91_93_common.dtsi +2 -1
index 46a5d2df074d5..679b9a6f7160f 100644
@@ -82,7 +82,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 		clock-frequency = <24000000>;
 		arm,no-tick-in-suspend;
 		interrupt-parent = <&gic>;
arch/arm64/boot/dts/freescale/imx94.dtsi +2 -1
index c460ece6070f8..7431ce293625b 100644
@@ -147,7 +147,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 		clock-frequency = <24000000>;
 		interrupt-parent = <&gic>;
 		arm,no-tick-in-suspend;
arch/arm64/boot/dts/freescale/imx95.dtsi +2 -1
index 71394871d8dd0..e318048dc755b 100644
@@ -524,7 +524,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 		clock-frequency = <24000000>;
 		arm,no-tick-in-suspend;
 		interrupt-parent = <&gic>;
arch/arm64/boot/dts/freescale/imx952.dtsi +2 -1
index b30707837f353..7c65956bc72dc 100644
@@ -298,7 +298,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 		clock-frequency = <24000000>;
 		arm,no-tick-in-suspend;
 		interrupt-parent = <&gic>;
arch/arm64/boot/dts/freescale/s32n79.dtsi +2 -1
index 94ab58783fdc8..fb40abec4c5cd 100644
@@ -357,6 +357,7 @@ timer: timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 };
Signature · 1 line
2.47.3
author maintainer
#26 lore raw

PATCH v3 10/17 arm64: dts: intel: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

The ARMv8.2 based CPUs used in the agilex5 SoC are missing the EL2 virtual timer interrupt. Add it.

---
 arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi +2 -1
index 02e62d954e949..6db2d48b9bad3 100644
@@ -155,7 +155,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 
 	usbphy0: usbphy {
Signature · 1 line
2.47.3
author maintainer
#27 lore raw

PATCH v3 11/17 arm64: dts: mediatek: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

The ARMv8.1+ based CPUs used in a number of Mediatek SoCs are missing the EL2 virtual timer interrupt. Add it.

---
 arch/arm64/boot/dts/mediatek/mt6779.dtsi | 3 ++-
 arch/arm64/boot/dts/mediatek/mt8186.dtsi | 3 ++-
 arch/arm64/boot/dts/mediatek/mt8188.dtsi | 3 ++-
 arch/arm64/boot/dts/mediatek/mt8192.dtsi | 3 ++-
 arch/arm64/boot/dts/mediatek/mt8195.dtsi | 3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/mediatek/mt6779.dtsi +2 -1
index 70f3375916e8c..106df7603d533 100644
@@ -108,7 +108,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW 0>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW 0>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW 0>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW 0>;
 	};
 
 	soc {
arch/arm64/boot/dts/mediatek/mt8186.dtsi +2 -1
index b91f88ffae0e8..a4621ce370d8e 100644
@@ -815,7 +815,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW 0>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW 0>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW 0>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW 0>;
 	};
 
 	soc {
arch/arm64/boot/dts/mediatek/mt8188.dtsi +2 -1
index 75133794cec38..614e75f46c72d 100644
@@ -918,7 +918,8 @@ timer: timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH 0>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH 0>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH 0>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH 0>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_HIGH 0>;
 		clock-frequency = <13000000>;
 	};
 
arch/arm64/boot/dts/mediatek/mt8192.dtsi +2 -1
index 9f8f115edd4cc..873c4fae6afc9 100644
@@ -328,7 +328,8 @@ timer: timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH 0>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH 0>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH 0>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH 0>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_HIGH 0>;
 		clock-frequency = <13000000>;
 	};
 
arch/arm64/boot/dts/mediatek/mt8195.dtsi +2 -1
index c72e34c57629d..3c9a7a08612b9 100644
@@ -451,7 +451,8 @@ timer: timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH 0>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH 0>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH 0>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH 0>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_HIGH 0>;
 	};
 
 	soc {
Signature · 1 line
2.47.3
author maintainer
#31 lore raw

PATCH v3 12/17 arm64: dts: nvidia: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

The ARMv8.2 based CPUs used in a number of nvidia SoCs are missing the EL2 virtual timer interrupt. Add it.

---
 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 2 ++
 arch/arm64/boot/dts/nvidia/tegra234.dtsi | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +2 -0
index 849694f751d90..45cc180ac9973 100644
@@ -3163,6 +3163,8 @@ timer {
 			     <GIC_PPI 11
 				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 10
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 12
 				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
 		interrupt-parent = <&gic>;
 		always-on;
arch/arm64/boot/dts/nvidia/tegra234.dtsi +2 -1
index 04a95b6658caa..ab9813f9ba30c 100644
@@ -5872,7 +5872,8 @@ timer {
 		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 12 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
 		interrupt-parent = <&gic>;
 		always-on;
 	};
Signature · 1 line
2.47.3
author maintainer
#36 lore raw

PATCH v3 13/17 arm64: dts: qcom: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

The ARMv8.1+ based CPUs used in a number of Qualcomm SoCs are missing the EL2 virtual timer interrupt. Add it when it is obvious that the PPI layout is the "standard" one.

---
 arch/arm64/boot/dts/qcom/eliza.dtsi     | 3 ++-
 arch/arm64/boot/dts/qcom/hamoa.dtsi     | 3 ++-
 arch/arm64/boot/dts/qcom/kaanapali.dtsi | 3 ++-
 arch/arm64/boot/dts/qcom/kodiak.dtsi    | 3 ++-
 arch/arm64/boot/dts/qcom/lemans.dtsi    | 3 ++-
 arch/arm64/boot/dts/qcom/monaco.dtsi    | 3 ++-
 arch/arm64/boot/dts/qcom/sar2130p.dtsi  | 3 ++-
 arch/arm64/boot/dts/qcom/sc8280xp.dtsi  | 3 ++-
 arch/arm64/boot/dts/qcom/sm4450.dtsi    | 3 ++-
 arch/arm64/boot/dts/qcom/sm8250.dtsi    | 3 ++-
 arch/arm64/boot/dts/qcom/sm8350.dtsi    | 3 ++-
 arch/arm64/boot/dts/qcom/sm8450.dtsi    | 3 ++-
 arch/arm64/boot/dts/qcom/sm8550.dtsi    | 3 ++-
 arch/arm64/boot/dts/qcom/sm8650.dtsi    | 3 ++-
 arch/arm64/boot/dts/qcom/sm8750.dtsi    | 3 ++-
 15 files changed, 30 insertions(+), 15 deletions(-)
arch/arm64/boot/dts/qcom/eliza.dtsi +2 -1
index 4a7a0ac40ce62..7267e0ec44b2b 100644
@@ -1880,6 +1880,7 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 };
arch/arm64/boot/dts/qcom/hamoa.dtsi +2 -1
index 051dee0764167..cc638b9162c25 100644
@@ -8982,7 +8982,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 
 	thermal_zones: thermal-zones {
arch/arm64/boot/dts/qcom/kaanapali.dtsi +2 -1
index 7cc326aa1a1aa..149275828f1bc 100644
@@ -6953,7 +6953,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 
 	tpdm-cdsp-llm {
arch/arm64/boot/dts/qcom/kodiak.dtsi +2 -1
index 988ca5f7c8a0e..8e0a1ca0125d1 100644
@@ -7876,6 +7876,7 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 };
arch/arm64/boot/dts/qcom/lemans.dtsi +2 -1
index fe6e763518230..cd9c964e884f3 100644
@@ -8585,7 +8585,8 @@ arch_timer: timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 
 	turing-llm-tpdm {
arch/arm64/boot/dts/qcom/monaco.dtsi +2 -1
index 7b1d57460f1e6..38e54b91f0d81 100644
@@ -8312,6 +8312,7 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 };
arch/arm64/boot/dts/qcom/sar2130p.dtsi +2 -1
index d65ad0df68652..11ea2330f3ac5 100644
@@ -3165,7 +3165,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 
 	thermal-zones {
arch/arm64/boot/dts/qcom/sc8280xp.dtsi +2 -1
index 761f229e8f472..e5fc52e6f613e 100644
@@ -7043,6 +7043,7 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 };
arch/arm64/boot/dts/qcom/sm4450.dtsi +2 -1
index 696e2e0841ad9..c7890f5ab8f13 100644
@@ -681,6 +681,7 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 };
arch/arm64/boot/dts/qcom/sm8250.dtsi +2 -1
index 7076720413ab2..ad44ab7d89fdb 100644
@@ -6293,7 +6293,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 
 	thermal-zones {
arch/arm64/boot/dts/qcom/sm8350.dtsi +2 -1
index c830953156ec6..63081dcc94aac 100644
@@ -4542,6 +4542,7 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 };
arch/arm64/boot/dts/qcom/sm8450.dtsi +2 -1
index 03bf30b53f289..e7a890dc2e57f 100644
@@ -6327,7 +6327,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 		clock-frequency = <19200000>;
 	};
 };
arch/arm64/boot/dts/qcom/sm8550.dtsi +2 -1
index 912525e9bca6f..4958b653678ae 100644
@@ -6806,6 +6806,7 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW 0>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW 0>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW 0>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW 0>;
 	};
 };
arch/arm64/boot/dts/qcom/sm8650.dtsi +2 -1
index 1604bc8cff373..24714688b50af 100644
@@ -8599,6 +8599,7 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW 0>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW 0>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW 0>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW 0>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW 0>;
 	};
 };
arch/arm64/boot/dts/qcom/sm8750.dtsi +2 -1
index 18fb52c14acd7..e9192b806f9f0 100644
@@ -6796,7 +6796,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 
 	tpdm-cdsp-llm {
Signature · 1 line
2.47.3
author maintainer
#37 lore raw

PATCH v3 14/17 arm64: dts: realtek: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

The ARMv8.2 based CPUs used in a number of Realtek SoCs are missing the EL2 virtual timer interrupt. Add it.

Furthermore, the "kent" platform appears to assign PPI9 to both the EL2 virtual timer and the GIC Maintenance Interrupt, which can't be right. Attempt a fix by setting the former to PPI12, as PPI9 is traditionally wired to the GIC itself.

---
 arch/arm64/boot/dts/realtek/kent.dtsi    | 2 +-
 arch/arm64/boot/dts/realtek/rtd16xx.dtsi | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/realtek/kent.dtsi +1 -1
index ae006ce244205..4147e4269247a 100644
@@ -23,7 +23,7 @@ timer {
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI  9 IRQ_TYPE_LEVEL_HIGH>;
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_HIGH>;
 	};
 
 	cpus {
arch/arm64/boot/dts/realtek/rtd16xx.dtsi +2 -1
index 3a7f6e35b7f74..43b13d133c324 100644
@@ -105,7 +105,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
 	};
 
 	arm_pmu: pmu {
Signature · 1 line
2.47.3
author maintainer
#41 lore raw

PATCH v3 15/17 arm64: dts: rockchip: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

The ARMv8.2 based CPUs used in a number of Rockchip SoCs are missing the EL2 virtual timer interrupt. Add it.

---
 arch/arm64/boot/dts/rockchip/rk356x-base.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk356x-base.dtsi +2 -1
index 64bdd8b7754b5..a5832895bd392 100644
@@ -195,7 +195,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>,
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>,
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH>;
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_HIGH>;
 		arm,no-tick-in-suspend;
 	};
 
Signature · 1 line
2.47.3
author maintainer
#42 lore raw

PATCH v3 16/17 arm64: dts: sprd: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

The ARMv8.2 based CPUs used in a number of Unisoc SoCs are missing the EL2 virtual timer interrupt. Add it.

---
 arch/arm64/boot/dts/sprd/sc9863a.dtsi | 3 ++-
 arch/arm64/boot/dts/sprd/ums512.dtsi  | 3 ++-
 arch/arm64/boot/dts/sprd/ums9620.dtsi | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/sprd/sc9863a.dtsi +2 -1
index 31799579d7f2e..18e61c25aa36f 100644
@@ -130,7 +130,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>, /* Physical Secure PPI */
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH>, /* Physical Non-Secure PPI */
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>, /* Virtual PPI */
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH>; /* Hipervisor PPI */
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH>, /* Hypervisor physical PPI */
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_HIGH>; /* Hypervisor virtual PPI */
 	};
 
 	pmu {
arch/arm64/boot/dts/sprd/ums512.dtsi +2 -1
index efa14309cc4ef..4105647aabd17 100644
@@ -133,7 +133,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>, /* Physical Secure PPI */
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH>, /* Physical Non-Secure PPI */
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>, /* Virtual PPI */
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH>; /* Hipervisor PPI */
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH>, /* Hypervisor physical PPI */
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_HIGH>; /* Hypervisor virtual PPI */
 	};
 
 	pmu-a55 {
arch/arm64/boot/dts/sprd/ums9620.dtsi +2 -1
index 2458071320c9b..037e3401d4991 100644
@@ -141,7 +141,8 @@ timer {
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>, /* Physical Secure PPI */
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH>, /* Physical Non-Secure PPI */
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>, /* Virtual PPI */
-			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH>; /* Hipervisor PPI */
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH>, /* Hypervisor physical PPI */
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_HIGH>; /* Hypervisor virtual PPI */
 	};
 
 	pmu-a55 {
Signature · 1 line
2.47.3
author maintainer
#43 lore raw

PATCH v3 17/17 arm64: dts: xilinx: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

The ARMv8.2 based CPUs used in the versal SoC are missing the EL2 virtual timer interrupt. Add it.

---
 arch/arm64/boot/dts/xilinx/versal-net.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/xilinx/versal-net.dtsi +2 -1
index 15f767608e67f..0aac93675ad77 100644
@@ -728,7 +728,8 @@ fpga: fpga-region {
 
 	timer: timer {
 		compatible = "arm,armv8-timer";
-		interrupts = <1 13 4>, <1 14 4>, <1 11 4>, <1 10 4>;
+		interrupts = <1 13 4>, <1 14 4>, <1 11 4>, <1 10 4>,
+			     <1 12 4>;
 	};
 
 	versal_fpga: versal-fpga {
Signature · 1 line
2.47.3
#38 lore raw

Re: [PATCH v3 14/17] arm64: dts: realtek: Add EL2 virtual timer interrupt

In reply to Marc Zyngier
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] The EL2 virtual timer interrupt (PPI 12) in `kent.dtsi` is incorrectly configured with an…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The EL2 virtual timer interrupt (PPI 12) in kent.dtsi is incorrectly configured with an active-high trigger type (IRQ_TYPE_LEVEL_HIGH). --

commit f079ad98f64e8cdedfbfede9fd625a2762e0efa9
Author: Marc Zyngier <[email protected]>

arm64: dts: realtek: Add EL2 virtual timer interrupt

This commit adds the missing EL2 virtual timer interrupt for ARMv8.2 based Realtek SoCs. It also addresses a conflict on the kent platform by changing the EL2 virtual timer assignment from PPI9 to PPI12.

arch/arm64/boot/dts/realtek/kent.dtsi timer { · line 26

Quoted 10 lines
arch/arm64/boot/dts/realtek/kent.dtsi +1 -1
index ae006ce244205..4147e4269247a 100644
@@ -23,7 +23,7 @@ timer {
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
-			     <GIC_PPI  9 IRQ_TYPE_LEVEL_HIGH>;
+			     <GIC_PPI 12 IRQ_TYPE_LEVEL_HIGH>;

[Severity: High]
Should this interrupt be configured as active-low?

ARM architected timer interrupts are universally active-low, as seen in the other interrupts for this timer and the newly added PPI 12 in rtd16xx.dtsi.

It appears the update changed the interrupt number but kept the IRQ_TYPE_LEVEL_HIGH polarity that was used for the GIC maintenance interrupt. Could configuring the GIC with the incorrect trigger type lead to missed EL2 virtual timer interrupts or an interrupt storm?

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=14
#18 lore raw

Re: [PATCH v3 04/17] dt-bindings: timer: arm,arch_timer: Fix requirements for interrupt description

In reply to Marc Zyngier
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The new `minItems: 2` constraint in the `interrupts` array maps to the wrong interrupts due to…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The new minItems: 2 constraint in the interrupts array maps to the wrong interrupts due to the static items list, contradicting the commit message's stated requirements. --

commit 5eb08d516ae8d3fb049e6d6f31c8f0dd7d3f7165
Author: Marc Zyngier <[email protected]>

dt-bindings: timer: arm,arch_timer: Fix requirements for interrupt description

This commit updates the arm,arch_timer binding to explicitly define the requirements for interrupts based on the architecture. It increases the minimum number of interrupts from 1 to 2, clarifies architectural terminology for the interrupts, and removes outdated descriptions.

Quoted 4 lines
Documentation/devicetree/bindings/timer/arm,arch_timer.yaml +0 -0
index c5fc3b6c8bd0b..c65e48a155ab6 100644

[ ... ]

Quoted 7 lines
Documentation/devicetree/bindings/timer/arm,arch_timer.yaml +1 -1
@@ -33,13 +28,13 @@ properties:
           - const: arm,armv7-timer
 
   interrupts:
-    minItems: 1
+    minItems: 2
     items:

Documentation/devicetree/bindings/timer/arm,arch_timer.yaml properties: · line 37

Quoted 10 lines
Documentation/devicetree/bindings/timer/arm,arch_timer.yaml +5 -5
-      - description: secure timer irq
-      - description: non-secure timer irq
-      - description: virtual timer irq
-      - description: hypervisor timer irq
-      - description: hypervisor virtual timer irq
+      - description: EL1 secure physical timer irq, if EL3 is implemented
+      - description: EL1 non-secure physical timer irq
+      - description: EL1 virtual timer irq
+      - description: EL2 physical timer irq, if EL2 is implemented
+      - description: EL2 virtual timer irq, if FEAT_VHE is implemented

[Severity: Medium]
Does changing this to minItems: 2 while keeping a static items list cause the first two provided interrupts to always be validated against the "EL1 secure physical" and "EL1 non-secure physical" descriptions?

JSON schema array validation maps elements sequentially by index. If a device tree node only provides 2 interrupts (the always-required EL1 non-secure physical and EL1 virtual timers), they will be mapped to the first two indices.

Since the EL1 secure physical timer is optional (only if EL3 is implemented), should interrupts use a oneOf block with separate lists, mirroring the existing structure of interrupt-names, to correctly model when the first element is omitted?

Quoted 3 lines
Documentation/devicetree/bindings/timer/arm,arch_timer.yaml +0 -0
   interrupt-names:
     oneOf:
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
#2 lore raw

Re: [PATCH v3 01/17] ACPI: GTDT: Account for GTDTv3 size when walking the platform timer descriptors

In reply to Marc Zyngier
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing minimum length validation for platform timer subtables can lead to out-of-bounds memory accesses when parsing malformed ACPI tables.
- [High] The patch adds size validation for GTDT revisions 2 and 3, but misses length validation for GTDT revision 1 tables. --

commit 6795242683ef78c0e32a77285ea86c559ab6c178
Author: Marc Zyngier <[email protected]>

ACPI: GTDT: Account for GTDTv3 size when walking the platform timer descriptors

This commit updates the GTDT table parsing to support the expanded size of GTDT revision 3, which includes an EL2-private virtual timer. It adjusts the platform timer start offset based on the revision and adds a length validation check for the base table.

Quoted 4 lines
drivers/acpi/arm64/gtdt.c +0 -0
@@ -34,14 +34,25 @@ struct acpi_gtdt_descriptor {

[ ... ]

Quoted 7 lines

static __init bool platform_timer_valid(void *platform_timer) {

drivers/acpi/arm64/gtdt.c +1 -2
 	struct acpi_gtdt_header *gh = platform_timer;
+	void *platform_timer_begin;
 
-	return (platform_timer >= (void *)(acpi_gtdt_desc.gtdt + 1) &&
-		platform_timer < acpi_gtdt_desc.gtdt_end &&

drivers/acpi/arm64/gtdt.c struct acpi_gtdt_descriptor { · line 58

Quoted 10 lines
drivers/acpi/arm64/gtdt.c +7 -0
+	if (acpi_gtdt_desc.gtdt->header.revision >= 3)
+		platform_timer_begin = container_of(acpi_gtdt_desc.gtdt, struct gtdt_v3, gtdt_v2) + 1;
+	else
+		platform_timer_begin = acpi_gtdt_desc.gtdt + 1;
+
+	return (platform_timer >= platform_timer_begin &&
+		platform_timer + sizeof(*gh) <= acpi_gtdt_desc.gtdt_end &&
 		gh->length != 0 &&
 		platform_timer + gh->length <= acpi_gtdt_desc.gtdt_end);
 }

[Severity: High]
This is a pre-existing issue, but does this validation fully protect against malformed ACPI tables?

While it checks that the subtable's declared length fits within the main GTDT table, it does not verify that the length is large enough to contain the specific subtable structure being parsed.

If a malformed GTDT table provides a subtable with a truncated length, parser functions like is_non_secure_watchdog() might read fields past the end of the provided table data. Could this lead to out-of-bounds memory accesses when reading fields like wd->timer_flags?

[ ... ]

drivers/acpi/arm64/gtdt.c int __init acpi_gtdt_init(struct acpi_table_header *table, · line 186

Quoted 11 lines
drivers/acpi/arm64/gtdt.c +7 -0
@@ -166,6 +177,13 @@ int __init acpi_gtdt_init(struct acpi_table_header *table,
 	u32 cnt = 0;
 
 	gtdt = container_of(table, struct acpi_table_gtdt, header);
+
+	if ((gtdt->header.revision >= 3 && gtdt->header.length < sizeof(struct gtdt_v3)) ||
+	    (gtdt->header.revision == 2 && gtdt->header.length < sizeof(*gtdt))) {
+		pr_err(FW_BUG "GTDT with invalid size %d\n", gtdt->header.length);
+		return -EINVAL;
+	}
+

[Severity: High]
This isn't a bug introduced by this patch, but since we are adding length validation for revisions 2 and 3, should we also validate the length for revision 1 tables?

If a system provides a malformed revision 1 GTDT table that is smaller than its baseline required size, the initialization could succeed. Later accesses to fields in acpi_gtdt_map_ppi() might read out-of-bounds memory.

Would it be safer to ensure all supported revisions meet their minimum required sizes?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#44 lore raw
In reply to Marc Zyngier
Quoted 8 lines · Marc Zyngier

This is the third version of the series initially posted at [1], which

- updates the ACPI GTDT parsing to deal the v3 layout and the EL2 virtual timer,
- moves the architected timer driver to use it when running VHE,
- fixes a number of DTs to reflect the reality of the HW.

Please mention here what do you expect SoC maintainer to do with this - apply individual patches, wait for dependencies, ack etc.

Best regards,
Krzysztof

author maintainer
#45 lore raw
Quoted 5 lines · Krzysztof Kozlowski
Quoted 3 lines · Marc Zyngier

This is the third version of the series initially posted at [1], which

Quoted 8 lines
Quoted 5 lines

- updates the ACPI GTDT parsing to deal the v3 layout and the EL2 virtual timer,
- moves the architected timer driver to use it when running VHE,
- fixes a number of DTs to reflect the reality of the HW.

Please mention here what do you expect SoC maintainer to do with this - apply individual patches, wait for dependencies, ack etc.

I only care about the first 3 patches (ACPI enablement, arm64 timer code), and don't have any expectation for the rest, as pointed out in the cover letter for v1.

These are all bug fixes for DTs that do not correctly describe the HW. There is therefore no dependency on anything. The patches can either be cherry picked by the individual SoC maintainers, applied globally by one of the DT maintainers, or be completely ignored.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
maintainer Applied
#24 lore raw

Re: (subset) [PATCH v3 08/17] arm64: dts: exynos: Add EL2 virtual timer interrupt

In reply to Marc Zyngier
Quoted 4 lines · Marc Zyngier

A bunch of Samsung SoCs are missing the EL2 virtual timer interrupt despite using ARMv8.1+ CPUs. Add the missing interrupt, except for those broken designs where the interrupt is documented as not being wired.

Applied, thanks!

[08/17] arm64: dts: exynos: Add EL2 virtual timer interrupt

        https://git.kernel.org/krzk/linux/c/d0298724f901d45c76f1f2193225706200f565e4

Best regards,

Signature · 1 line
Krzysztof Kozlowski <[email protected]>
maintainer Applied
#46 lore raw

Re: (subset) [PATCH v3 00/17] arm64: Use EL2 virtual timer when running VHE

In reply to Marc Zyngier
Quoted 9 lines · Marc Zyngier

This is the third version of the series initially posted at [1], which

- updates the ACPI GTDT parsing to deal the v3 layout and the EL2 virtual timer,
- moves the architected timer driver to use it when running VHE,
- fixes a number of DTs to reflect the reality of the HW.

[...]

Applied to sunxi/dt-for-7.2 in sunxi, thanks!

[05/17] arm64: dts: allwinner: Add EL2 virtual timer interrupt

        https://git.kernel.org/sunxi/linux/c/86eeca347091

Best regards,

Signature · 1 line
Chen-Yu Tsai <[email protected]>
maintainer Reviewed-by on v3 1/17
#3 lore raw

Re: [PATCH v3 01/17] ACPI: GTDT: Account for GTDTv3 size when walking the platform timer descriptors

In reply to Marc Zyngier
Quoted 55 lines · Marc Zyngier

Since ARMv8.1, the architecture has grown an EL2-private virtual timer. This has been described in ACPI since ACPI v6.3 and revision 3 of the GTDT table.

An aditional structure was added in ACPICA, though in a rather bizarre way, and merged in v5.1 as 8f5a14d053100 ("ACPICA: ACPI 6.3:
add GTDT Revision 3 support").

Finally plug the table parsing in GTDT, and correct the parsing of the platform timer subtables to account for the expanded size of the base table. This also comes with some extra sanitisation of the table, in the unlikely case someone got it wrong...

---
  drivers/acpi/arm64/gtdt.c | 22 ++++++++++++++++++++--
  1 file changed, 20 insertions(+), 2 deletions(-)
drivers/acpi/arm64/gtdt.c +13 -2
index ffc867bac2d60..950d5efdf85ea 100644
@@ -34,14 +34,25 @@ struct acpi_gtdt_descriptor {
  	void *platform_timer;
  };
 
+struct gtdt_v3 {
+	struct acpi_table_gtdt	gtdt_v2;
+	struct acpi_gtdt_el2	el2_vtimer;
+};
+
  static struct acpi_gtdt_descriptor acpi_gtdt_desc __initdata;
 
  static __init bool platform_timer_valid(void *platform_timer)
  {
  	struct acpi_gtdt_header *gh = platform_timer;
+	void *platform_timer_begin;
 
-	return (platform_timer >= (void *)(acpi_gtdt_desc.gtdt + 1) &&
-		platform_timer < acpi_gtdt_desc.gtdt_end &&
+	if (acpi_gtdt_desc.gtdt->header.revision >= 3)
+		platform_timer_begin = container_of(acpi_gtdt_desc.gtdt, struct gtdt_v3, gtdt_v2) + 1;
+	else
+		platform_timer_begin = acpi_gtdt_desc.gtdt + 1;
+
+	return (platform_timer >= platform_timer_begin &&
+		platform_timer + sizeof(*gh) <= acpi_gtdt_desc.gtdt_end &&
  		gh->length != 0 &&
  		platform_timer + gh->length <= acpi_gtdt_desc.gtdt_end);
  }
@@ -166,6 +177,13 @@ int __init acpi_gtdt_init(struct acpi_table_header *table,
  	u32 cnt = 0;
 
  	gtdt = container_of(table, struct acpi_table_gtdt, header);

drivers/acpi/arm64/gtdt.c int __init acpi_gtdt_init(struct acpi_table_header *table, · line 189

Quoted 10 lines
drivers/acpi/arm64/gtdt.c +7 -0
+
+	if ((gtdt->header.revision >= 3 && gtdt->header.length < sizeof(struct gtdt_v3)) ||
+	    (gtdt->header.revision == 2 && gtdt->header.length < sizeof(*gtdt))) {
+		pr_err(FW_BUG "GTDT with invalid size %d\n", gtdt->header.length);
+		return -EINVAL;
+	}
+
  	acpi_gtdt_desc.gtdt = gtdt;
  	acpi_gtdt_desc.gtdt_end = (void *)table + table->length;
  	acpi_gtdt_desc.platform_timer = NULL;

Thanks
Hanjun

maintainer Reviewed-by on v3 2/17
#7 lore raw

Re: [PATCH v3 02/17] ACPI: GTDT: Parse information related to the EL2 virtual timer

In reply to Marc Zyngier
Quoted 59 lines · Marc Zyngier

Now that we have a way to identify GTDTv3, allow the information related to the EL2 virtual timer to be retrieved by the interface used by the architected timer driver.

---
  drivers/acpi/arm64/gtdt.c | 20 ++++++++++++++++++++
  1 file changed, 20 insertions(+)
drivers/acpi/arm64/gtdt.c +16 -0
index 950d5efdf85ea..00158c8aa6d90 100644
@@ -41,6 +41,14 @@ struct gtdt_v3 {
 
  static struct acpi_gtdt_descriptor acpi_gtdt_desc __initdata;
 
+static __init struct acpi_gtdt_el2 *gtdt_to_el2_vtimer(struct acpi_table_gtdt *gtdt)
+{
+	if (gtdt->header.revision < 3)
+		return NULL;
+
+	return &container_of(gtdt, struct gtdt_v3, gtdt_v2)->el2_vtimer;
+}
+
  static __init bool platform_timer_valid(void *platform_timer)
  {
  	struct acpi_gtdt_header *gh = platform_timer;
@@ -112,6 +120,7 @@ static int __init map_gt_gsi(u32 interrupt, u32 flags)
  int __init acpi_gtdt_map_ppi(int type)
  {
  	struct acpi_table_gtdt *gtdt = acpi_gtdt_desc.gtdt;
+	struct acpi_gtdt_el2 *el2_vtimer = gtdt_to_el2_vtimer(gtdt);
 
  	switch (type) {
  	case ARCH_TIMER_PHYS_NONSECURE_PPI:
@@ -124,6 +133,12 @@ int __init acpi_gtdt_map_ppi(int type)
  	case ARCH_TIMER_HYP_PPI:
  		return map_gt_gsi(gtdt->non_secure_el2_interrupt,
  				  gtdt->non_secure_el2_flags);
+	case ARCH_TIMER_HYP_VIRT_PPI:
+		if (el2_vtimer && el2_vtimer->virtual_el2_timer_gsiv)
+			return map_gt_gsi(el2_vtimer->virtual_el2_timer_gsiv,
+					  el2_vtimer->virtual_el2_timer_flags);
+
+		return 0;
  	default:
  		pr_err("Failed to map timer interrupt: invalid type.\n");
  	}
@@ -141,6 +156,7 @@ int __init acpi_gtdt_map_ppi(int type)
  bool __init acpi_gtdt_c3stop(int type)
  {
  	struct acpi_table_gtdt *gtdt = acpi_gtdt_desc.gtdt;
+	struct acpi_gtdt_el2 *el2_vtimer = gtdt_to_el2_vtimer(gtdt);
 
  	switch (type) {
  	case ARCH_TIMER_PHYS_NONSECURE_PPI:

drivers/acpi/arm64/gtdt.c bool __init acpi_gtdt_c3stop(int type) · line 177

Quoted 10 lines
drivers/acpi/arm64/gtdt.c +4 -0
@@ -152,6 +168,10 @@ bool __init acpi_gtdt_c3stop(int type)
  	case ARCH_TIMER_HYP_PPI:
  		return !(gtdt->non_secure_el2_flags & ACPI_GTDT_ALWAYS_ON);
 
+	case ARCH_TIMER_HYP_VIRT_PPI:
+		return el2_vtimer && el2_vtimer->virtual_el2_timer_gsiv &&
+		       !(el2_vtimer->virtual_el2_timer_flags & ACPI_GTDT_ALWAYS_ON);
+
  	default:
  		pr_err("Failed to get c3stop info: invalid type.\n");
  	}

Thanks
Hanjun

maintainer Reviewed-by on v3 1/17
#4 lore raw

Re: [PATCH v3 01/17] ACPI: GTDT: Account for GTDTv3 size when walking the platform timer descriptors

In reply to Marc Zyngier
Quoted 8 lines · Marc Zyngier

Since ARMv8.1, the architecture has grown an EL2-private virtual timer. This has been described in ACPI since ACPI v6.3 and revision 3 of the GTDT table.

An aditional structure was added in ACPICA, though in a rather bizarre way, and merged in v5.1 as 8f5a14d053100 ("ACPICA: ACPI 6.3:
add GTDT Revision 3 support").

Quoted 6 lines

Finally plug the table parsing in GTDT, and correct the parsing of the platform timer subtables to account for the expanded size of the base table. This also comes with some extra sanitisation of the table, in the unlikely case someone got it wrong...

Signature · 2 lines
Regards,
Sudeep
#39 lore raw

RE: [PATCH v3 14/17] arm64: dts: realtek: Add EL2 virtual timer interrupt

In reply to Marc Zyngier
Quoted 22 lines

Subject: [PATCH v3 14/17] arm64: dts: realtek: Add EL2 virtual timer interrupt

The ARMv8.2 based CPUs used in a number of Realtek SoCs are missing the EL2 virtual timer interrupt. Add it.

Furthermore, the "kent" platform appears to assign PPI9 to both the EL2 virtual timer and the GIC Maintenance Interrupt, which can't be right. Attempt a fix by setting the former to PPI12, as PPI9 is traditionally wired to the GIC itself.

---
 arch/arm64/boot/dts/realtek/kent.dtsi    | 2 +-
 arch/arm64/boot/dts/realtek/rtd16xx.dtsi | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/realtek/kent.dtsi +0 -0
index ae006ce244205..4147e4269247a 100644

arch/arm64/boot/dts/realtek/kent.dtsi timer { · line 26

Quoted 5 lines
arch/arm64/boot/dts/realtek/kent.dtsi +1 -1
@@ -23,7 +23,7 @@ timer {
                             <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
                             <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
                             <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_PPI  9 IRQ_TYPE_LEVEL_HIGH>;
+                            <GIC_PPI 12 IRQ_TYPE_LEVEL_HIGH>;

Thanks for this patch. However, the 5th interrupt should be

<GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;

If you are ok with it, I will amend it when applying.

Best regards,
Yu-Chun

Quoted 20 lines
arch/arm64/boot/dts/realtek/kent.dtsi +0 -0
        };
 
        cpus {
arch/arm64/boot/dts/realtek/rtd16xx.dtsi +2 -2
index 3a7f6e35b7f74..43b13d133c324 100644
@@ -105,7 +105,8 @@ timer {
                interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
                             <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
                             <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+                            <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
+                            <GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;
        };
 
        arm_pmu: pmu {
--

2.47.3

author maintainer
#40 lore raw

Re: [PATCH v3 14/17] arm64: dts: realtek: Add EL2 virtual timer interrupt

Quoted 31 lines · Yu-Chun Lin [林祐君]
Quoted 23 lines

Subject: [PATCH v3 14/17] arm64: dts: realtek: Add EL2 virtual timer interrupt

The ARMv8.2 based CPUs used in a number of Realtek SoCs are missing the EL2 virtual timer interrupt. Add it.

Furthermore, the "kent" platform appears to assign PPI9 to both the EL2 virtual timer and the GIC Maintenance Interrupt, which can't be right. Attempt a fix by setting the former to PPI12, as PPI9 is traditionally wired to the GIC itself.

---
 arch/arm64/boot/dts/realtek/kent.dtsi    | 2 +-
 arch/arm64/boot/dts/realtek/rtd16xx.dtsi | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/realtek/kent.dtsi +0 -0
index ae006ce244205..4147e4269247a 100644

arch/arm64/boot/dts/realtek/kent.dtsi timer { · line 26

Quoted 5 lines
arch/arm64/boot/dts/realtek/kent.dtsi +1 -1
@@ -23,7 +23,7 @@ timer {
                             <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
                             <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
                             <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>,
-                            <GIC_PPI  9 IRQ_TYPE_LEVEL_HIGH>;
+                            <GIC_PPI 12 IRQ_TYPE_LEVEL_HIGH>;

Thanks for this patch. However, the 5th interrupt should be

Quoted 1 line

<GIC_PPI 12 IRQ_TYPE_LEVEL_LOW>;

I suspected as much, but it was hard to know exactly how wrong the original descriptor was, so I decided to change as little as possible. It has no material impact on the interrupt, as the GIC has no way to distinguish LEVEL_HIGH from LEVEL_LOW (it only distinguishes between LEVEL and EDGE). So this only serves as documentation.

Quoted 2 lines

If you are ok with it, I will amend it when applying.

Please go ahead.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
maintainer Applied
#47 lore raw

Re: (subset) [PATCH v3 00/17] arm64: Use EL2 virtual timer when running VHE

In reply to Marc Zyngier
Quoted 9 lines · Marc Zyngier

This is the third version of the series initially posted at [1], which

- updates the ACPI GTDT parsing to deal the v3 layout and the EL2 virtual timer,
- moves the architected timer driver to use it when running VHE,
- fixes a number of DTs to reflect the reality of the HW.

[...]

Applied, thanks!

[15/17] arm64: dts: rockchip: Add EL2 virtual timer interrupt

        commit: d8d7e7549312c50fa5dcd69a6dc6f0035e770c09

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>
author maintainer
#48 lore raw
In reply to Marc Zyngier
Quoted 9 lines · Marc Zyngier

This is the third version of the series initially posted at [1], which

- updates the ACPI GTDT parsing to deal the v3 layout and the EL2 virtual timer,
- moves the architected timer driver to use it when running VHE,
- fixes a number of DTs to reflect the reality of the HW.

Quoted 5 lines

This results in significant performance uplift in deeper nested virt scenarios, at no overhead to the host.

Patches based on -rc3, tested on Amlogic SM1, QC X1E, Ampere Altra, and Apple M2, as well as KVM NV guests.

[...]

Daniel, can you please pick the first 3 patches? Or would you rather have them routed via the arm64 tree?

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
#49 lore raw
Quoted 14 lines · Marc Zyngier
Quoted 12 lines · Marc Zyngier

This is the third version of the series initially posted at [1], which

- updates the ACPI GTDT parsing to deal the v3 layout and the EL2 virtual timer,
- moves the architected timer driver to use it when running VHE,
- fixes a number of DTs to reflect the reality of the HW.

This results in significant performance uplift in deeper nested virt scenarios, at no overhead to the host.

Quoted 7 lines
Quoted 2 lines

Patches based on -rc3, tested on Amlogic SM1, QC X1E, Ampere Altra, and Apple M2, as well as KVM NV guests.

[...]

Daniel, can you please pick the first 3 patches? Or would you rather have them routed via the arm64 tree?

I'll pick them up

Thanks

#10 lore raw

Re: [PATCH v3 03/17] clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE

In reply to Marc Zyngier

Dear All,

Quoted 18 lines · Marc Zyngier

When running with at EL2 with VHE enabled, the architecture provides two EL2 timer/counters, dubbed physical and virtual. Apart from their names, they are strictly identical.

However, they don't get virtualised the same way, specially when it comes to adding arbitrary offsets to the timers. When running as a guest, the host CNTVOFF_EL2 does apply to the guest's view of CNTHV*_El2. This is not true for CNTPOFF_EL2 and CNTHP*_EL2, as the architecture is broken past the first level of virtualisation (it lacks some essential mechanisms to be usable, despite what the ARM ARM pretends).

This means that when running as a L2 guest hypervisor, using the physical timer results in traps to L0, which are then forwarded to L1 in order to emulate the offset, leading to even worse performance due to massive trap amplification (the combination of register and ERET trapping is absolutely lethal).

Quoted 8 lines

Switch the arch timer code to using the virtual timer when running in VHE by default, only using the physical timer if the interrupt is not correctly described in the firmware tables (which seems to be an unfortunately common case). This comes as no impact on bare-metal, and slightly improves the situation in the virtualised case.

This patch landed recently in linux-next as commit d87773de9efe ("clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE"). In my tests I found that it breaks booting of RaspberryPi5 board. Reverting it on top of linux-next fixes the issue. Here is a boot log:

Booting Linux on physical CPU 0x0000000000 [0x414fd0b1]
Linux version 7.0.0+ (m.szyprowski@AMDC4653) (aarch64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #16769 SMP PREEMPT Tue Jun  9 11:57:24 CEST 2026 KASLR enabled
Machine model: Raspberry Pi 5 Model B Rev 1.0
earlycon: pl11 at MMIO 0x000000107d001000 (options '115200n8')
printk: legacy bootconsole [pl11] enabled
Reserved memory: created CMA memory pool at 0x000000003bc00000, size 64 MiB
OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
OF: reserved mem: 0x000000003bc00000..0x000000003fbfffff (65536 KiB) map reusable linux,cma
OF: reserved mem: 0x0000000000000000..0x000000000007ffff (512 KiB) nomap non-reusable atf@0
NUMA: Faking a node at [mem 0x0000000000000000-0x00000001ffffffff]
NODE_DATA(0) allocated [mem 0x1fefe0480-0x1fefe313f]
psci: probing for conduit method from DT.
psci: PSCIv1.1 detected in firmware.
psci: Using standard PSCI v0.2 function IDs
psci: MIGRATE_INFO_TYPE not supported.
psci: SMC Calling Convention v1.2
Zone ranges:
  DMA      [mem 0x0000000000000000-0x00000000ffffffff]
  DMA32    empty
  Normal   [mem 0x0000000100000000-0x00000001ffffffff]
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x0000000000000000-0x000000000007ffff]
  node   0: [mem 0x0000000000080000-0x000000003fbfffff]
  node   0: [mem 0x0000000040000000-0x00000001ffffffff]
Initmem setup node 0 [mem 0x0000000000000000-0x00000001ffffffff]
On node 0, zone DMA: 1024 pages in unavailable ranges
percpu: Embedded 36 pages/cpu s109456 r8192 d29808 u147456
Detected PIPT I-cache on CPU0
CPU features: detected: Virtualization Host Extensions
CPU features: detected: Spectre-v4
CPU features: detected: Spectre-BHB
CPU features: kernel page table isolation forced ON by KASLR
CPU features: detected: Kernel page table isolation (KPTI)
CPU features: detected: SSBS not fully self-synchronizing
alternatives: applying boot alternatives
Kernel command line: console=ttyAMA10,115200n8 earlycon root=PARTUUID=11111111-03 rw clk_ignore_unused rootdelay=2 retain_initrd
printk: log buffer data + meta data: 131072 + 458752 = 589824 bytes
Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
software IO TLB: area num 4.
software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB)
Fallback order for Node 0: 0
Built 1 zonelists, mobility grouping on.  Total pages: 2096128
Policy zone: Normal
mem auto-init: stack:off, heap alloc:off, heap free:off
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
Running RCU self tests
Running RCU synchronous self tests
rcu: Preemptible hierarchical RCU implementation.
rcu:     RCU event tracing is enabled.
rcu:     RCU lockdep checking is enabled.
rcu:     RCU restricting CPUs from NR_CPUS=512 to nr_cpu_ids=4.
 Trampoline variant of Tasks RCU enabled.
 Tracing variant of Tasks RCU enabled.
rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
Running RCU synchronous self tests
RCU Tasks: Setting shift to 2 and lim to 1 rcu_task_cb_adjust=1 rcu_task_cpu_ids=4.
NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
Root IRQ handler: gic_handle_irq
GIC: Using split EOI/Deactivate mode
rcu: srcu_init: Setting srcu_struct sizes based on contention.
arch_timer: cp15 timer running at 54.00MHz (hyp-virt).
clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns
sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 4398046511102ns
Console: colour dummy device 80x25
Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
... MAX_LOCKDEP_SUBCLASSES:  8
... MAX_LOCK_DEPTH:          48
... MAX_LOCKDEP_KEYS:        8192
... CLASSHASH_SIZE:          4096
... MAX_LOCKDEP_ENTRIES:     32768
... MAX_LOCKDEP_CHAINS:      65536
... CHAINHASH_SIZE:          32768
 memory used by lock dependency info: 6429 kB
 memory used for stack traces: 4224 kB
 per task-struct memory footprint: 1920 bytes
Calibrating delay loop (skipped), value calculated using timer frequency.. 108.00 BogoMIPS (lpj=216000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
VFS: Finished mounting rootfs on nullfs
Running RCU synchronous self tests
Running RCU synchronous self tests

(booting freezes)

Quoted 113 lines
---
 drivers/clocksource/arm_arch_timer.c | 55 +++++++++++++++++-----------
 1 file changed, 33 insertions(+), 22 deletions(-)
drivers/clocksource/arm_arch_timer.c +29 -21
index 90aeff44a2764..4adf756423de9 100644
@@ -688,6 +688,7 @@ static void __arch_timer_setup(struct clock_event_device *clk)
 	clk->irq = arch_timer_ppi[arch_timer_uses_ppi];
 	switch (arch_timer_uses_ppi) {
 	case ARCH_TIMER_VIRT_PPI:
+	case ARCH_TIMER_HYP_VIRT_PPI:
 		clk->set_state_shutdown = arch_timer_shutdown_virt;
 		clk->set_state_oneshot_stopped = arch_timer_shutdown_virt;
 		sne = erratum_handler(set_next_event_virt);
@@ -879,7 +880,7 @@ static void __init arch_timer_banner(void)
 	pr_info("cp15 timer running at %lu.%02luMHz (%s).\n",
 		(unsigned long)arch_timer_rate / 1000000,
 		(unsigned long)(arch_timer_rate / 10000) % 100,
-		(arch_timer_uses_ppi == ARCH_TIMER_VIRT_PPI) ? "virt" : "phys");
+		arch_timer_ppi_names[arch_timer_uses_ppi]);
 }
 
 u32 arch_timer_get_rate(void)
@@ -912,7 +913,8 @@ static void __init arch_counter_register(void)
 	int width;
 
 	if ((IS_ENABLED(CONFIG_ARM64) && !is_hyp_mode_available()) ||
-	    arch_timer_uses_ppi == ARCH_TIMER_VIRT_PPI) {
+	    arch_timer_uses_ppi == ARCH_TIMER_VIRT_PPI ||
+	    arch_timer_uses_ppi == ARCH_TIMER_HYP_VIRT_PPI) {
 		if (arch_timer_counter_has_wa()) {
 			rd = arch_counter_get_cntvct_stable;
 			scr = raw_counter_get_cntvct_stable;
@@ -1023,6 +1025,7 @@ static int __init arch_timer_register(void)
 	ppi = arch_timer_ppi[arch_timer_uses_ppi];
 	switch (arch_timer_uses_ppi) {
 	case ARCH_TIMER_VIRT_PPI:
+	case ARCH_TIMER_HYP_VIRT_PPI:
 		err = request_percpu_irq(ppi, arch_timer_handler_virt,
 					 "arch_timer", arch_timer_evt);
 		break;
@@ -1090,25 +1093,34 @@ static int __init arch_timer_common_init(void)
 /**
  * arch_timer_select_ppi() - Select suitable PPI for the current system.
  *
- * If HYP mode is available, we know that the physical timer
- * has been configured to be accessible from PL1. Use it, so
- * that a guest can use the virtual timer instead.
+ * On AArch32, if HYP mode is available, we know that the physical
+ * timer has been configured to be accessible from PL1. Use it, so
+ * that a guest can use the virtual timer instead (though KVM host
+ * support has long been removed).
  *
- * On ARMv8.1 with VH extensions, the kernel runs in HYP. VHE
- * accesses to CNTP_*_EL1 registers are silently redirected to
- * their CNTHP_*_EL2 counterparts, and use a different PPI
- * number.
+ * On ARMv8.1 with FEAT_VHE, the kernel runs in EL2. Accesses to
+ * CNTV_*_EL1 registers are silently redirected to their CNTHV_*_EL2
+ * counterparts, and the timer uses a different PPI number. Similar
+ * thing happen when using the EL2 physical timer. Note that a bunch
+ * of DTs out there omit the virtual EL2 timer, so fallback gracefully
+ * on the physical timer.
+ *
+ * Without VHE, if no interrupt provided for virtual timer, we'll have
+ * to stick to the physical timer. It'd better be accessible...
  *
- * If no interrupt provided for virtual timer, we'll have to
- * stick to the physical timer. It'd better be accessible...
  * For arm64 we never use the secure interrupt.
  *
  * Return: a suitable PPI type for the current system.
  */
 static enum arch_timer_ppi_nr __init arch_timer_select_ppi(void)
 {
-	if (is_kernel_in_hyp_mode())
+	if (is_kernel_in_hyp_mode()) {
+		if (arch_timer_ppi[ARCH_TIMER_HYP_VIRT_PPI])
+			return ARCH_TIMER_HYP_VIRT_PPI;
+
+		pr_warn_once(FW_BUG "VHE-capable CPU without EL2 virtual timer interrupt\n");
 		return ARCH_TIMER_HYP_PPI;
+	}
 
 	if (!is_hyp_mode_available() && arch_timer_ppi[ARCH_TIMER_VIRT_PPI])
 		return ARCH_TIMER_VIRT_PPI;
@@ -1200,14 +1212,9 @@ static int __init arch_timer_acpi_init(struct acpi_table_header *table)
 	if (ret)
 		return ret;
 
-	arch_timer_ppi[ARCH_TIMER_PHYS_NONSECURE_PPI] =
-		acpi_gtdt_map_ppi(ARCH_TIMER_PHYS_NONSECURE_PPI);
-
-	arch_timer_ppi[ARCH_TIMER_VIRT_PPI] =
-		acpi_gtdt_map_ppi(ARCH_TIMER_VIRT_PPI);
-
-	arch_timer_ppi[ARCH_TIMER_HYP_PPI] =
-		acpi_gtdt_map_ppi(ARCH_TIMER_HYP_PPI);
+	/* The GTDT parser can't be bothered with the secure timer */
+	for (int i = ARCH_TIMER_PHYS_NONSECURE_PPI; i < ARCH_TIMER_MAX_TIMER_PPI; i++)
+		arch_timer_ppi[i] = acpi_gtdt_map_ppi(i);
 
 	arch_timer_populate_kvm_info();
 
@@ -1253,10 +1260,14 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts,
 	if (!IS_ENABLED(CONFIG_HAVE_ARM_SMCCC_DISCOVERY))
 		return -EOPNOTSUPP;
 
-	if (arch_timer_uses_ppi == ARCH_TIMER_VIRT_PPI)
+	switch (arch_timer_uses_ppi) {
+	case ARCH_TIMER_VIRT_PPI:

drivers/clocksource/arm_arch_timer.c int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts, · line 1273

Quoted 10 lines
drivers/clocksource/arm_arch_timer.c +4 -1
+	case ARCH_TIMER_HYP_VIRT_PPI:
 		ptp_counter = KVM_PTP_VIRT_COUNTER;
-	else
+		break;
+	default:
 		ptp_counter = KVM_PTP_PHYS_COUNTER;
+	}
 
 	arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID,
 			     ptp_counter, &hvc_res);

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
author maintainer
#11 lore raw

Re: [PATCH v3 03/17] clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE

Quoted 29 lines · Marek Szyprowski

Dear All,

Quoted 25 lines · Marc Zyngier

When running with at EL2 with VHE enabled, the architecture provides two EL2 timer/counters, dubbed physical and virtual. Apart from their names, they are strictly identical.

However, they don't get virtualised the same way, specially when it comes to adding arbitrary offsets to the timers. When running as a guest, the host CNTVOFF_EL2 does apply to the guest's view of CNTHV*_El2. This is not true for CNTPOFF_EL2 and CNTHP*_EL2, as the architecture is broken past the first level of virtualisation (it lacks some essential mechanisms to be usable, despite what the ARM ARM pretends).

This means that when running as a L2 guest hypervisor, using the physical timer results in traps to L0, which are then forwarded to L1 in order to emulate the offset, leading to even worse performance due to massive trap amplification (the combination of register and ERET trapping is absolutely lethal).

Switch the arch timer code to using the virtual timer when running in VHE by default, only using the physical timer if the interrupt is not correctly described in the firmware tables (which seems to be an unfortunately common case). This comes as no impact on bare-metal, and slightly improves the situation in the virtualised case.

Quoted 6 lines
Quoted 1 line

This patch landed recently in linux-next as commit d87773de9efe ("clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE"). In my tests I found that it breaks booting of RaspberryPi5 board. Reverting it on top of linux-next fixes the issue. Here is a boot log:

Huh.

[...]

Quoted 3 lines

arch_timer: cp15 timer running at 54.00MHz (hyp-virt).
clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns
sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 4398046511102ns

The interrupt appears to be advertised in the DT, but doesn't seem to fire. That's obviously not going to end well. My suspicion is that either the interrupt isn't wired (that'd be hilariously abd), or is left as Group-0 by the firmware (copy-paste from RPi4).

Can you try the following hack and let me know if the kernel shouts at you?

Thanks,

	M.
drivers/irqchip/irq-gic.c +1 -0
index ec70c84e9f91d..d05791e6cc0db 100644
@@ -213,6 +213,7 @@ static void gic_eoimode1_mask_irq(struct irq_data *d)
 static void gic_unmask_irq(struct irq_data *d)
 {
 	gic_poke_irq(d, GIC_DIST_ENABLE_SET);
+	WARN_ON(!gic_peek_irq(d, GIC_DIST_ENABLE_SET));
 }
 
 static void gic_eoi_irq(struct irq_data *d)
Signature · 1 line
Without deviation from the norm, progress is not possible.
#12 lore raw

Re: [PATCH v3 03/17] clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE

Quoted 58 lines · Marc Zyngier
Quoted 26 lines · Marek Szyprowski
Quoted 25 lines · Marc Zyngier

When running with at EL2 with VHE enabled, the architecture provides two EL2 timer/counters, dubbed physical and virtual. Apart from their names, they are strictly identical.

However, they don't get virtualised the same way, specially when it comes to adding arbitrary offsets to the timers. When running as a guest, the host CNTVOFF_EL2 does apply to the guest's view of CNTHV*_El2. This is not true for CNTPOFF_EL2 and CNTHP*_EL2, as the architecture is broken past the first level of virtualisation (it lacks some essential mechanisms to be usable, despite what the ARM ARM pretends).

This means that when running as a L2 guest hypervisor, using the physical timer results in traps to L0, which are then forwarded to L1 in order to emulate the offset, leading to even worse performance due to massive trap amplification (the combination of register and ERET trapping is absolutely lethal).

Switch the arch timer code to using the virtual timer when running in VHE by default, only using the physical timer if the interrupt is not correctly described in the firmware tables (which seems to be an unfortunately common case). This comes as no impact on bare-metal, and slightly improves the situation in the virtualised case.

Quoted 6 lines
Quoted 1 line

This patch landed recently in linux-next as commit d87773de9efe ("clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE"). In my tests I found that it breaks booting of RaspberryPi5 board. Reverting it on top of linux-next fixes the issue. Here is a boot log:

Huh.

[...]

Quoted 3 lines

arch_timer: cp15 timer running at 54.00MHz (hyp-virt).
clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns
sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 4398046511102ns

The interrupt appears to be advertised in the DT, but doesn't seem to fire. That's obviously not going to end well. My suspicion is that either the interrupt isn't wired (that'd be hilariously abd), or is left as Group-0 by the firmware (copy-paste from RPi4).

Can you try the following hack and let me know if the kernel shouts at you?

Thanks,

	M.
drivers/irqchip/irq-gic.c +0 -0
index ec70c84e9f91d..d05791e6cc0db 100644

drivers/irqchip/irq-gic.c static void gic_eoimode1_mask_irq(struct irq_data *d) · line 219

Quoted 7 lines
drivers/irqchip/irq-gic.c +1 -0
@@ -213,6 +213,7 @@ static void gic_eoimode1_mask_irq(struct irq_data *d)
 static void gic_unmask_irq(struct irq_data *d)
 {
 	gic_poke_irq(d, GIC_DIST_ENABLE_SET);
+	WARN_ON(!gic_peek_irq(d, GIC_DIST_ENABLE_SET));
 }
 
 static void gic_eoi_irq(struct irq_data *d)

I've applied this change, but it doesn't trigger any warning in the boot log.

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
author maintainer
#13 lore raw

Re: [PATCH v3 03/17] clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE

Quoted 66 lines · Marek Szyprowski
Quoted 64 lines · Marc Zyngier
Quoted 26 lines · Marek Szyprowski
Quoted 25 lines · Marc Zyngier

When running with at EL2 with VHE enabled, the architecture provides two EL2 timer/counters, dubbed physical and virtual. Apart from their names, they are strictly identical.

However, they don't get virtualised the same way, specially when it comes to adding arbitrary offsets to the timers. When running as a guest, the host CNTVOFF_EL2 does apply to the guest's view of CNTHV*_El2. This is not true for CNTPOFF_EL2 and CNTHP*_EL2, as the architecture is broken past the first level of virtualisation (it lacks some essential mechanisms to be usable, despite what the ARM ARM pretends).

This means that when running as a L2 guest hypervisor, using the physical timer results in traps to L0, which are then forwarded to L1 in order to emulate the offset, leading to even worse performance due to massive trap amplification (the combination of register and ERET trapping is absolutely lethal).

Switch the arch timer code to using the virtual timer when running in VHE by default, only using the physical timer if the interrupt is not correctly described in the firmware tables (which seems to be an unfortunately common case). This comes as no impact on bare-metal, and slightly improves the situation in the virtualised case.

Quoted 6 lines
Quoted 1 line

This patch landed recently in linux-next as commit d87773de9efe ("clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE"). In my tests I found that it breaks booting of RaspberryPi5 board. Reverting it on top of linux-next fixes the issue. Here is a boot log:

Huh.

[...]

Quoted 3 lines

arch_timer: cp15 timer running at 54.00MHz (hyp-virt).
clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns
sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 4398046511102ns

The interrupt appears to be advertised in the DT, but doesn't seem to fire. That's obviously not going to end well. My suspicion is that either the interrupt isn't wired (that'd be hilariously abd), or is left as Group-0 by the firmware (copy-paste from RPi4).

Can you try the following hack and let me know if the kernel shouts at you?

Thanks,

	M.
drivers/irqchip/irq-gic.c +1 -0
index ec70c84e9f91d..d05791e6cc0db 100644
@@ -213,6 +213,7 @@ static void gic_eoimode1_mask_irq(struct irq_data *d)
 static void gic_unmask_irq(struct irq_data *d)
 {
 	gic_poke_irq(d, GIC_DIST_ENABLE_SET);
+	WARN_ON(!gic_peek_irq(d, GIC_DIST_ENABLE_SET));
 }
 
Quoted 3 lines

drivers/irqchip/irq-gic.c static void gic_eoimode1_mask_irq(struct irq_data *d) · line 219

Quoted 1 line
drivers/irqchip/irq-gic.c +0 -0
 static void gic_eoi_irq(struct irq_data *d)

I've applied this change, but it doesn't trigger any warning in the boot log.

[+ Florian]

Huh. So that really points at the timer not being wired into the GIC, Samsung style... Can you confirm that removing the EL2 virtual timer from the DT results in a booting machine?

Florian, can you please check whether PPI12 is actually the EL2 virtual timer on the RPI5 SoC?

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
#14 lore raw

Re: [PATCH v3 03/17] clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE

Quoted 67 lines · Marc Zyngier
Quoted 65 lines · Marek Szyprowski
Quoted 64 lines · Marc Zyngier
Quoted 26 lines · Marek Szyprowski
Quoted 25 lines · Marc Zyngier

When running with at EL2 with VHE enabled, the architecture provides two EL2 timer/counters, dubbed physical and virtual. Apart from their names, they are strictly identical.

However, they don't get virtualised the same way, specially when it comes to adding arbitrary offsets to the timers. When running as a guest, the host CNTVOFF_EL2 does apply to the guest's view of CNTHV*_El2. This is not true for CNTPOFF_EL2 and CNTHP*_EL2, as the architecture is broken past the first level of virtualisation (it lacks some essential mechanisms to be usable, despite what the ARM ARM pretends).

This means that when running as a L2 guest hypervisor, using the physical timer results in traps to L0, which are then forwarded to L1 in order to emulate the offset, leading to even worse performance due to massive trap amplification (the combination of register and ERET trapping is absolutely lethal).

Switch the arch timer code to using the virtual timer when running in VHE by default, only using the physical timer if the interrupt is not correctly described in the firmware tables (which seems to be an unfortunately common case). This comes as no impact on bare-metal, and slightly improves the situation in the virtualised case.

Quoted 6 lines
Quoted 1 line

This patch landed recently in linux-next as commit d87773de9efe ("clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE"). In my tests I found that it breaks booting of RaspberryPi5 board. Reverting it on top of linux-next fixes the issue. Here is a boot log:

Huh.

[...]

Quoted 3 lines

arch_timer: cp15 timer running at 54.00MHz (hyp-virt).
clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns
sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 4398046511102ns

The interrupt appears to be advertised in the DT, but doesn't seem to fire. That's obviously not going to end well. My suspicion is that either the interrupt isn't wired (that'd be hilariously abd), or is left as Group-0 by the firmware (copy-paste from RPi4).

Can you try the following hack and let me know if the kernel shouts at you?

Thanks,

	M.
drivers/irqchip/irq-gic.c +1 -0
index ec70c84e9f91d..d05791e6cc0db 100644
@@ -213,6 +213,7 @@ static void gic_eoimode1_mask_irq(struct irq_data *d)
 static void gic_unmask_irq(struct irq_data *d)
 {
 	gic_poke_irq(d, GIC_DIST_ENABLE_SET);
+	WARN_ON(!gic_peek_irq(d, GIC_DIST_ENABLE_SET));
 }
 
Quoted 7 lines
Quoted 2 lines

drivers/irqchip/irq-gic.c static void gic_eoimode1_mask_irq(struct irq_data *d) · line 219

Quoted 1 line
drivers/irqchip/irq-gic.c +0 -0
 static void gic_eoi_irq(struct irq_data *d)

I've applied this change, but it doesn't trigger any warning in the boot log.

[+ Florian]

Huh. So that really points at the timer not being wired into the GIC, Samsung style... Can you confirm that removing the EL2 virtual timer from the DT results in a booting machine?

With the following diff the board boots again:

arch/arm64/boot/dts/broadcom/bcm2712.dtsi +0 -0
index 761c59d90ffc..09ff5e9959d3 100644
@@ -678,8 +678,6 @@ IRQ_TYPE_LEVEL_LOW)>,

                             <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | -                                         IRQ_TYPE_LEVEL_LOW)>, -                            <GIC_PPI 12 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; };

Quoted 2 lines

Florian, can you please check whether PPI12 is actually the EL2 virtual timer on the RPI5 SoC?

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
author maintainer
#15 lore raw

Re: [PATCH v3 03/17] clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE

Quoted 71 lines · Marek Szyprowski
Quoted 69 lines · Marc Zyngier
Quoted 67 lines · Marek Szyprowski
Quoted 58 lines · Marc Zyngier
Quoted 26 lines · Marek Szyprowski
Quoted 25 lines · Marc Zyngier

When running with at EL2 with VHE enabled, the architecture provides two EL2 timer/counters, dubbed physical and virtual. Apart from their names, they are strictly identical.

However, they don't get virtualised the same way, specially when it comes to adding arbitrary offsets to the timers. When running as a guest, the host CNTVOFF_EL2 does apply to the guest's view of CNTHV*_El2. This is not true for CNTPOFF_EL2 and CNTHP*_EL2, as the architecture is broken past the first level of virtualisation (it lacks some essential mechanisms to be usable, despite what the ARM ARM pretends).

This means that when running as a L2 guest hypervisor, using the physical timer results in traps to L0, which are then forwarded to L1 in order to emulate the offset, leading to even worse performance due to massive trap amplification (the combination of register and ERET trapping is absolutely lethal).

Switch the arch timer code to using the virtual timer when running in VHE by default, only using the physical timer if the interrupt is not correctly described in the firmware tables (which seems to be an unfortunately common case). This comes as no impact on bare-metal, and slightly improves the situation in the virtualised case.

Quoted 6 lines
Quoted 1 line

This patch landed recently in linux-next as commit d87773de9efe ("clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE"). In my tests I found that it breaks booting of RaspberryPi5 board. Reverting it on top of linux-next fixes the issue. Here is a boot log:

Huh.

[...]

Quoted 3 lines

arch_timer: cp15 timer running at 54.00MHz (hyp-virt).
clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns
sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 4398046511102ns

The interrupt appears to be advertised in the DT, but doesn't seem to fire. That's obviously not going to end well. My suspicion is that either the interrupt isn't wired (that'd be hilariously abd), or is left as Group-0 by the firmware (copy-paste from RPi4).

Can you try the following hack and let me know if the kernel shouts at you?

Thanks,

	M.
drivers/irqchip/irq-gic.c +0 -0
index ec70c84e9f91d..d05791e6cc0db 100644

drivers/irqchip/irq-gic.c static void gic_eoimode1_mask_irq(struct irq_data *d) · line 219

Quoted 7 lines
drivers/irqchip/irq-gic.c +1 -0
@@ -213,6 +213,7 @@ static void gic_eoimode1_mask_irq(struct irq_data *d)
 static void gic_unmask_irq(struct irq_data *d)
 {
 	gic_poke_irq(d, GIC_DIST_ENABLE_SET);
+	WARN_ON(!gic_peek_irq(d, GIC_DIST_ENABLE_SET));
 }
 
 static void gic_eoi_irq(struct irq_data *d)

I've applied this change, but it doesn't trigger any warning in the boot log.

Quoted 7 lines
Quoted 5 lines

[+ Florian]

Huh. So that really points at the timer not being wired into the GIC, Samsung style... Can you confirm that removing the EL2 virtual timer from the DT results in a booting machine?

With the following diff the board boots again:

OK, so it really is the EL2 virtual timer PPI that is misbehaving. Let's see what Florian comes up with on the status of this interrupt.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
merge bot Applied
#8 lore raw

[tip: timers/clocksource] ACPI: GTDT: Parse information related to the EL2 virtual timer

In reply to Marc Zyngier
The following commit has been merged into the timers/clocksource branch of tip:

The following commit has been merged into the timers/clocksource branch of tip:

Commit-ID:     fe15af3e75298533056ce73f8e66cd3da31f2b4a
Gitweb:        https://git.kernel.org/tip/fe15af3e75298533056ce73f8e66cd3da31f2b4a
Author:        Marc Zyngier <[email protected]>
AuthorDate:    Sat, 23 May 2026 15:02:27 +01:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Wed, 03 Jun 2026 09:52:55 +02:00

ACPI: GTDT: Parse information related to the EL2 virtual timer

Now that we have a way to identify GTDTv3, allow the information related to the EL2 virtual timer to be retrieved by the interface used by the architected timer driver.

---
 drivers/acpi/arm64/gtdt.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/acpi/arm64/gtdt.c +20 -0
index 950d5ef..00158c8 100644
@@ -41,6 +41,14 @@ struct gtdt_v3 {
 
 static struct acpi_gtdt_descriptor acpi_gtdt_desc __initdata;
 
+static __init struct acpi_gtdt_el2 *gtdt_to_el2_vtimer(struct acpi_table_gtdt *gtdt)
+{
+	if (gtdt->header.revision < 3)
+		return NULL;
+
+	return &container_of(gtdt, struct gtdt_v3, gtdt_v2)->el2_vtimer;
+}
+
 static __init bool platform_timer_valid(void *platform_timer)
 {
 	struct acpi_gtdt_header *gh = platform_timer;
@@ -112,6 +120,7 @@ static int __init map_gt_gsi(u32 interrupt, u32 flags)
 int __init acpi_gtdt_map_ppi(int type)
 {
 	struct acpi_table_gtdt *gtdt = acpi_gtdt_desc.gtdt;
+	struct acpi_gtdt_el2 *el2_vtimer = gtdt_to_el2_vtimer(gtdt);
 
 	switch (type) {
 	case ARCH_TIMER_PHYS_NONSECURE_PPI:
@@ -124,6 +133,12 @@ int __init acpi_gtdt_map_ppi(int type)
 	case ARCH_TIMER_HYP_PPI:
 		return map_gt_gsi(gtdt->non_secure_el2_interrupt,
 				  gtdt->non_secure_el2_flags);
+	case ARCH_TIMER_HYP_VIRT_PPI:
+		if (el2_vtimer && el2_vtimer->virtual_el2_timer_gsiv)
+			return map_gt_gsi(el2_vtimer->virtual_el2_timer_gsiv,
+					  el2_vtimer->virtual_el2_timer_flags);
+
+		return 0;
 	default:
 		pr_err("Failed to map timer interrupt: invalid type.\n");
 	}
@@ -141,6 +156,7 @@ int __init acpi_gtdt_map_ppi(int type)
 bool __init acpi_gtdt_c3stop(int type)
 {
 	struct acpi_table_gtdt *gtdt = acpi_gtdt_desc.gtdt;
+	struct acpi_gtdt_el2 *el2_vtimer = gtdt_to_el2_vtimer(gtdt);
 
 	switch (type) {
 	case ARCH_TIMER_PHYS_NONSECURE_PPI:
@@ -152,6 +168,10 @@ bool __init acpi_gtdt_c3stop(int type)
 	case ARCH_TIMER_HYP_PPI:
 		return !(gtdt->non_secure_el2_flags & ACPI_GTDT_ALWAYS_ON);
 
+	case ARCH_TIMER_HYP_VIRT_PPI:
+		return el2_vtimer && el2_vtimer->virtual_el2_timer_gsiv &&
+		       !(el2_vtimer->virtual_el2_timer_flags & ACPI_GTDT_ALWAYS_ON);
+
 	default:
 		pr_err("Failed to get c3stop info: invalid type.\n");
 	}
merge bot Applied
#16 lore raw

[tip: timers/clocksource] clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE

In reply to Marc Zyngier
The following commit has been merged into the timers/clocksource branch of tip:

The following commit has been merged into the timers/clocksource branch of tip:

Commit-ID:     d87773de9efe1df6fe2ba379926f9df92f1a5913
Gitweb:        https://git.kernel.org/tip/d87773de9efe1df6fe2ba379926f9df92f1a5913
Author:        Marc Zyngier <[email protected]>
AuthorDate:    Sat, 23 May 2026 15:02:28 +01:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Wed, 03 Jun 2026 09:53:21 +02:00

clocksource/drivers/arm_arch_timer: Default to EL2 virtual timer when running VHE

When running with at EL2 with VHE enabled, the architecture provides two EL2 timer/counters, dubbed physical and virtual. Apart from their names, they are strictly identical.

However, they don't get virtualised the same way, specially when it comes to adding arbitrary offsets to the timers. When running as a guest, the host CNTVOFF_EL2 does apply to the guest's view of CNTHV*_El2. This is not true for CNTPOFF_EL2 and CNTHP*_EL2, as the architecture is broken past the first level of virtualisation (it lacks some essential mechanisms to be usable, despite what the ARM ARM pretends).

This means that when running as a L2 guest hypervisor, using the physical timer results in traps to L0, which are then forwarded to L1 in order to emulate the offset, leading to even worse performance due to massive trap amplification (the combination of register and ERET trapping is absolutely lethal).

Switch the arch timer code to using the virtual timer when running in VHE by default, only using the physical timer if the interrupt is not correctly described in the firmware tables (which seems to be an unfortunately common case). This comes as no impact on bare-metal, and slightly improves the situation in the virtualised case.

---
 drivers/clocksource/arm_arch_timer.c | 55 ++++++++++++++++-----------
 1 file changed, 33 insertions(+), 22 deletions(-)
drivers/clocksource/arm_arch_timer.c +33 -22
index 90aeff4..4adf756 100644
@@ -688,6 +688,7 @@ static void __arch_timer_setup(struct clock_event_device *clk)
 	clk->irq = arch_timer_ppi[arch_timer_uses_ppi];
 	switch (arch_timer_uses_ppi) {
 	case ARCH_TIMER_VIRT_PPI:
+	case ARCH_TIMER_HYP_VIRT_PPI:
 		clk->set_state_shutdown = arch_timer_shutdown_virt;
 		clk->set_state_oneshot_stopped = arch_timer_shutdown_virt;
 		sne = erratum_handler(set_next_event_virt);
@@ -879,7 +880,7 @@ static void __init arch_timer_banner(void)
 	pr_info("cp15 timer running at %lu.%02luMHz (%s).\n",
 		(unsigned long)arch_timer_rate / 1000000,
 		(unsigned long)(arch_timer_rate / 10000) % 100,
-		(arch_timer_uses_ppi == ARCH_TIMER_VIRT_PPI) ? "virt" : "phys");
+		arch_timer_ppi_names[arch_timer_uses_ppi]);
 }
 
 u32 arch_timer_get_rate(void)
@@ -912,7 +913,8 @@ static void __init arch_counter_register(void)
 	int width;
 
 	if ((IS_ENABLED(CONFIG_ARM64) && !is_hyp_mode_available()) ||
-	    arch_timer_uses_ppi == ARCH_TIMER_VIRT_PPI) {
+	    arch_timer_uses_ppi == ARCH_TIMER_VIRT_PPI ||
+	    arch_timer_uses_ppi == ARCH_TIMER_HYP_VIRT_PPI) {
 		if (arch_timer_counter_has_wa()) {
 			rd = arch_counter_get_cntvct_stable;
 			scr = raw_counter_get_cntvct_stable;
@@ -1023,6 +1025,7 @@ static int __init arch_timer_register(void)
 	ppi = arch_timer_ppi[arch_timer_uses_ppi];
 	switch (arch_timer_uses_ppi) {
 	case ARCH_TIMER_VIRT_PPI:
+	case ARCH_TIMER_HYP_VIRT_PPI:
 		err = request_percpu_irq(ppi, arch_timer_handler_virt,
 					 "arch_timer", arch_timer_evt);
 		break;
@@ -1090,25 +1093,34 @@ static int __init arch_timer_common_init(void)
 /**
  * arch_timer_select_ppi() - Select suitable PPI for the current system.
  *
- * If HYP mode is available, we know that the physical timer
- * has been configured to be accessible from PL1. Use it, so
- * that a guest can use the virtual timer instead.
+ * On AArch32, if HYP mode is available, we know that the physical
+ * timer has been configured to be accessible from PL1. Use it, so
+ * that a guest can use the virtual timer instead (though KVM host
+ * support has long been removed).
  *
- * On ARMv8.1 with VH extensions, the kernel runs in HYP. VHE
- * accesses to CNTP_*_EL1 registers are silently redirected to
- * their CNTHP_*_EL2 counterparts, and use a different PPI
- * number.
+ * On ARMv8.1 with FEAT_VHE, the kernel runs in EL2. Accesses to
+ * CNTV_*_EL1 registers are silently redirected to their CNTHV_*_EL2
+ * counterparts, and the timer uses a different PPI number. Similar
+ * thing happen when using the EL2 physical timer. Note that a bunch
+ * of DTs out there omit the virtual EL2 timer, so fallback gracefully
+ * on the physical timer.
+ *
+ * Without VHE, if no interrupt provided for virtual timer, we'll have
+ * to stick to the physical timer. It'd better be accessible...
  *
- * If no interrupt provided for virtual timer, we'll have to
- * stick to the physical timer. It'd better be accessible...
  * For arm64 we never use the secure interrupt.
  *
  * Return: a suitable PPI type for the current system.
  */
 static enum arch_timer_ppi_nr __init arch_timer_select_ppi(void)
 {
-	if (is_kernel_in_hyp_mode())
+	if (is_kernel_in_hyp_mode()) {
+		if (arch_timer_ppi[ARCH_TIMER_HYP_VIRT_PPI])
+			return ARCH_TIMER_HYP_VIRT_PPI;
+
+		pr_warn_once(FW_BUG "VHE-capable CPU without EL2 virtual timer interrupt\n");
 		return ARCH_TIMER_HYP_PPI;
+	}
 
 	if (!is_hyp_mode_available() && arch_timer_ppi[ARCH_TIMER_VIRT_PPI])
 		return ARCH_TIMER_VIRT_PPI;
@@ -1200,14 +1212,9 @@ static int __init arch_timer_acpi_init(struct acpi_table_header *table)
 	if (ret)
 		return ret;
 
-	arch_timer_ppi[ARCH_TIMER_PHYS_NONSECURE_PPI] =
-		acpi_gtdt_map_ppi(ARCH_TIMER_PHYS_NONSECURE_PPI);
-
-	arch_timer_ppi[ARCH_TIMER_VIRT_PPI] =
-		acpi_gtdt_map_ppi(ARCH_TIMER_VIRT_PPI);
-
-	arch_timer_ppi[ARCH_TIMER_HYP_PPI] =
-		acpi_gtdt_map_ppi(ARCH_TIMER_HYP_PPI);
+	/* The GTDT parser can't be bothered with the secure timer */
+	for (int i = ARCH_TIMER_PHYS_NONSECURE_PPI; i < ARCH_TIMER_MAX_TIMER_PPI; i++)
+		arch_timer_ppi[i] = acpi_gtdt_map_ppi(i);
 
 	arch_timer_populate_kvm_info();
 
@@ -1253,10 +1260,14 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts,
 	if (!IS_ENABLED(CONFIG_HAVE_ARM_SMCCC_DISCOVERY))
 		return -EOPNOTSUPP;
 
-	if (arch_timer_uses_ppi == ARCH_TIMER_VIRT_PPI)
+	switch (arch_timer_uses_ppi) {
+	case ARCH_TIMER_VIRT_PPI:
+	case ARCH_TIMER_HYP_VIRT_PPI:
 		ptp_counter = KVM_PTP_VIRT_COUNTER;
-	else
+		break;
+	default:
 		ptp_counter = KVM_PTP_PHYS_COUNTER;
+	}
 
 	arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID,
 			     ptp_counter, &hvc_res);
merge bot Applied
#19 lore raw

[tip: timers/clocksource] dt-bindings: timer: arm,arch_timer: Fix requirements for interrupt description

In reply to Marc Zyngier
The following commit has been merged into the timers/clocksource branch of tip:

The following commit has been merged into the timers/clocksource branch of tip:

Commit-ID:     6951e870868d0b4bc385cbc851b871effa595330
Gitweb:        https://git.kernel.org/tip/6951e870868d0b4bc385cbc851b871effa595330
Author:        Marc Zyngier <[email protected]>
AuthorDate:    Sat, 23 May 2026 15:02:29 +01:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Wed, 03 Jun 2026 09:53:39 +02:00

dt-bindings: timer: arm,arch_timer: Fix requirements for interrupt description

The arm,arch_timer DT binding is extremely imprecise in describing the requirements for interrupts.

Follow the architecture by making it explicit that:
- the EL1 secure timer irq is required if EL3 is implemented
- the EL1 physical timer irq is always required
- the EL1 virtual timer irq is always required
- the EL2 physical timer irq is required if EL2 is implemented
- the EL2 virtual timer irq is required if FEAT_VHE is implemented

The consequence of the above is that the minimum number of interrupts to be described is 2, and not 1.

Finally, clean up the description which made the assumption that the timers are plugged into a GIC (unfortunately, that's not always true), drop the MMIO nonsense that has long be moved to a separate binding, and use the architectural terminology to describe the various interrupts.

---
 Documentation/devicetree/bindings/timer/arm,arch_timer.yaml | 21 ++-----
 1 file changed, 8 insertions(+), 13 deletions(-)
Documentation/devicetree/bindings/timer/arm,arch_timer.yaml +8 -13
index c5fc3b6..c65e48a 100644
@@ -10,13 +10,8 @@ maintainers:
   - Marc Zyngier <[email protected]>
   - Mark Rutland <[email protected]>
 description: |+
-  ARM cores may have a per-core architected timer, which provides per-cpu timers,
-  or a memory mapped architected timer, which provides up to 8 frames with a
-  physical and optional virtual timer per frame.
-
-  The per-core architected timer is attached to a GIC to deliver its
-  per-processor interrupts via PPIs. The memory mapped timer is attached to a GIC
-  to deliver its interrupts via SPIs.
+  The per-core architected timer is expected to deliver per-CPU interrupts
+  (commonly to a GIC to deliver its per-processor interrupts as PPIs).
 
 properties:
   compatible:
@@ -33,13 +28,13 @@ properties:
           - const: arm,armv7-timer
 
   interrupts:
-    minItems: 1
+    minItems: 2
     items:
-      - description: secure timer irq
-      - description: non-secure timer irq
-      - description: virtual timer irq
-      - description: hypervisor timer irq
-      - description: hypervisor virtual timer irq
+      - description: EL1 secure physical timer irq, if EL3 is implemented
+      - description: EL1 non-secure physical timer irq
+      - description: EL1 virtual timer irq
+      - description: EL2 physical timer irq, if EL2 is implemented
+      - description: EL2 virtual timer irq, if FEAT_VHE is implemented
 
   interrupt-names:
     oneOf:
merge bot Applied
#5 lore raw

[tip: timers/clocksource] ACPI: GTDT: Account for GTDTv3 size when walking the platform timer descriptors

In reply to Marc Zyngier
The following commit has been merged into the timers/clocksource branch of tip:

The following commit has been merged into the timers/clocksource branch of tip:

Commit-ID:     002dcb3a893627fcedf12692063b80c720869ea5
Gitweb:        https://git.kernel.org/tip/002dcb3a893627fcedf12692063b80c720869ea5
Author:        Marc Zyngier <[email protected]>
AuthorDate:    Sat, 23 May 2026 15:02:26 +01:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Wed, 03 Jun 2026 09:52:23 +02:00

ACPI: GTDT: Account for GTDTv3 size when walking the platform timer descriptors

Since ARMv8.1, the architecture has grown an EL2-private virtual timer. This has been described in ACPI since ACPI v6.3 and revision 3 of the GTDT table.

An aditional structure was added in ACPICA, though in a rather bizarre way, and merged in v5.1 as 8f5a14d053100 ("ACPICA: ACPI 6.3:
add GTDT Revision 3 support").

Finally plug the table parsing in GTDT, and correct the parsing of the platform timer subtables to account for the expanded size of the base table. This also comes with some extra sanitisation of the table, in the unlikely case someone got it wrong...

---
 drivers/acpi/arm64/gtdt.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/acpi/arm64/gtdt.c +20 -2
index ffc867b..950d5ef 100644
@@ -34,14 +34,25 @@ struct acpi_gtdt_descriptor {
 	void *platform_timer;
 };
 
+struct gtdt_v3 {
+	struct acpi_table_gtdt	gtdt_v2;
+	struct acpi_gtdt_el2	el2_vtimer;
+};
+
 static struct acpi_gtdt_descriptor acpi_gtdt_desc __initdata;
 
 static __init bool platform_timer_valid(void *platform_timer)
 {
 	struct acpi_gtdt_header *gh = platform_timer;
+	void *platform_timer_begin;
 
-	return (platform_timer >= (void *)(acpi_gtdt_desc.gtdt + 1) &&
-		platform_timer < acpi_gtdt_desc.gtdt_end &&
+	if (acpi_gtdt_desc.gtdt->header.revision >= 3)
+		platform_timer_begin = container_of(acpi_gtdt_desc.gtdt, struct gtdt_v3, gtdt_v2) + 1;
+	else
+		platform_timer_begin = acpi_gtdt_desc.gtdt + 1;
+
+	return (platform_timer >= platform_timer_begin &&
+		platform_timer + sizeof(*gh) <= acpi_gtdt_desc.gtdt_end &&
 		gh->length != 0 &&
 		platform_timer + gh->length <= acpi_gtdt_desc.gtdt_end);
 }
@@ -166,6 +177,13 @@ int __init acpi_gtdt_init(struct acpi_table_header *table,
 	u32 cnt = 0;
 
 	gtdt = container_of(table, struct acpi_table_gtdt, header);
+
+	if ((gtdt->header.revision >= 3 && gtdt->header.length < sizeof(struct gtdt_v3)) ||
+	    (gtdt->header.revision == 2 && gtdt->header.length < sizeof(*gtdt))) {
+		pr_err(FW_BUG "GTDT with invalid size %d\n", gtdt->header.length);
+		return -EINVAL;
+	}
+
 	acpi_gtdt_desc.gtdt = gtdt;
 	acpi_gtdt_desc.gtdt_end = (void *)table + table->length;
 	acpi_gtdt_desc.platform_timer = NULL;
maintainer
#32 lore raw

Re: [PATCH v3 12/17] arm64: dts: nvidia: Add EL2 virtual timer interrupt

In reply to Marc Zyngier

Hi Marc,

Quoted 27 lines · Marc Zyngier

The ARMv8.2 based CPUs used in a number of nvidia SoCs are missing the EL2 virtual timer interrupt. Add it.

---
  arch/arm64/boot/dts/nvidia/tegra194.dtsi | 2 ++
  arch/arm64/boot/dts/nvidia/tegra234.dtsi | 3 ++-
  2 files changed, 4 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +2 -0
index 849694f751d90..45cc180ac9973 100644
@@ -3163,6 +3163,8 @@ timer {
  			     <GIC_PPI 11
  				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
  			     <GIC_PPI 10
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 12
  				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
  		interrupt-parent = <&gic>;
  		always-on;
arch/arm64/boot/dts/nvidia/tegra234.dtsi +0 -0
index 04a95b6658caa..ab9813f9ba30c 100644

arch/arm64/boot/dts/nvidia/tegra234.dtsi timer { · line 5879

Quoted 9 lines
arch/arm64/boot/dts/nvidia/tegra234.dtsi +2 -1
@@ -5872,7 +5872,8 @@ timer {
  		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
  			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
  			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 12 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
  		interrupt-parent = <&gic>;
  		always-on;
  	};

Sorry for the delay. I gave this a test because I observed the warning that was added on the Tegra194 and Tegra234 platforms. This change fixes the warning for Tegra234, but on Tegra194 the platforms I tested hang on boot. It appears to be similar to the issue that Marek saw on his platforms and so I am wondering if Tegra194 also doesn't have this wired up?

Was there any resolution to the issue reported by Marek?

FYI, the Tegra194 SoC has the 'NVIDIA Carmel ARM v8.2' CPUs [0].

Jon

[0] https://www.nvidia.com/en-gb/autonomous-machines/embedded-systems/jetson-xavier-series/

Signature · 1 line
nvpublic
author maintainer
#33 lore raw

Re: [PATCH v3 12/17] arm64: dts: nvidia: Add EL2 virtual timer interrupt

Hi Jon,

Quoted 39 lines · Jon Hunter

Hi Marc,

Quoted 35 lines · Marc Zyngier

The ARMv8.2 based CPUs used in a number of nvidia SoCs are missing the EL2 virtual timer interrupt. Add it.

---
  arch/arm64/boot/dts/nvidia/tegra194.dtsi | 2 ++
  arch/arm64/boot/dts/nvidia/tegra234.dtsi | 3 ++-
  2 files changed, 4 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +2 -0
index 849694f751d90..45cc180ac9973 100644
@@ -3163,6 +3163,8 @@ timer {
  			     <GIC_PPI 11
  				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
  			     <GIC_PPI 10
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 12
  				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
  		interrupt-parent = <&gic>;
  		always-on;
arch/arm64/boot/dts/nvidia/tegra234.dtsi +2 -1
index 04a95b6658caa..ab9813f9ba30c 100644
@@ -5872,7 +5872,8 @@ timer {
  		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
  			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
  			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
-			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 12 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
  		interrupt-parent = <&gic>;
  		always-on;
Quoted 8 lines

arch/arm64/boot/dts/nvidia/tegra234.dtsi timer { · line 5879

Quoted 1 line
arch/arm64/boot/dts/nvidia/tegra234.dtsi +0 -0
  	};

Sorry for the delay. I gave this a test because I observed the warning that was added on the Tegra194 and Tegra234 platforms. This change fixes the warning for Tegra234, but on Tegra194 the platforms I tested hang on boot. It appears to be similar to the issue that Marek saw on his platforms and so I am wondering if Tegra194 also doesn't have this wired up?

I think you are in a better position than me to find out. It also could be a firmware issue not making the PPI a Group-1 interrupt, and therefore not allow Linux to configure the interrupt.

Quoted 4 lines

Was there any resolution to the issue reported by Marek?

FYI, the Tegra194 SoC has the 'NVIDIA Carmel ARM v8.2' CPUs [0].

There is no resolution so far. Florian was going to check what the deal is with the Broadcom-related systems, but hasn't come back with an answer yet.

The possibilities are as follows:

- remove the interrupt for the EL2 virtual timer and live with the warning

- add a patch such as [1], which should document the reason why this is now working (and fallback to the EL2 physical timer)

I'm happy either way, as long as we know exactly what we are dealing with on each affected platform.

Thanks,

	M.

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

Signature · 1 line
Without deviation from the norm, progress is not possible.
maintainer
#34 lore raw

Re: [PATCH v3 12/17] arm64: dts: nvidia: Add EL2 virtual timer interrupt

Hi Marc,

On 30/06/2026 11:54, Marc Zyngier wrote:

...

Quoted 10 lines
Quoted 6 lines

Sorry for the delay. I gave this a test because I observed the warning that was added on the Tegra194 and Tegra234 platforms. This change fixes the warning for Tegra234, but on Tegra194 the platforms I tested hang on boot. It appears to be similar to the issue that Marek saw on his platforms and so I am wondering if Tegra194 also doesn't have this wired up?

I think you are in a better position than me to find out. It also could be a firmware issue not making the PPI a Group-1 interrupt, and therefore not allow Linux to configure the interrupt.

Yes absolutely. I will see what I can find out.

Quoted 10 lines
Quoted 3 lines

Was there any resolution to the issue reported by Marek?

FYI, the Tegra194 SoC has the 'NVIDIA Carmel ARM v8.2' CPUs [0].

There is no resolution so far. Florian was going to check what the deal is with the Broadcom-related systems, but hasn't come back with an answer yet.

The possibilities are as follows:

Quoted 8 lines

- remove the interrupt for the EL2 virtual timer and live with the warning

- add a patch such as [1], which should document the reason why this is now working (and fallback to the EL2 physical timer)

I'm happy either way, as long as we know exactly what we are dealing with on each affected platform.

I would like to get the warning fixed for Tegra234. Do you want to split that part out of your patch and then I can test and we can at least fix for that device while I see whats up with Tegra194?

Jon

Signature · 1 line
nvpublic
author maintainer
#35 lore raw

Re: [PATCH v3 12/17] arm64: dts: nvidia: Add EL2 virtual timer interrupt

Quoted 36 lines · Jon Hunter

Hi Marc,

On 30/06/2026 11:54, Marc Zyngier wrote:

...

Quoted 10 lines
Quoted 6 lines

Sorry for the delay. I gave this a test because I observed the warning that was added on the Tegra194 and Tegra234 platforms. This change fixes the warning for Tegra234, but on Tegra194 the platforms I tested hang on boot. It appears to be similar to the issue that Marek saw on his platforms and so I am wondering if Tegra194 also doesn't have this wired up?

I think you are in a better position than me to find out. It also could be a firmware issue not making the PPI a Group-1 interrupt, and therefore not allow Linux to configure the interrupt.

Yes absolutely. I will see what I can find out.

Quoted 16 lines
Quoted 3 lines

Was there any resolution to the issue reported by Marek?

FYI, the Tegra194 SoC has the 'NVIDIA Carmel ARM v8.2' CPUs [0].

There is no resolution so far. Florian was going to check what the deal is with the Broadcom-related systems, but hasn't come back with an answer yet.

The possibilities are as follows:

- remove the interrupt for the EL2 virtual timer and live with the warning

- add a patch such as [1], which should document the reason why this is now working (and fallback to the EL2 physical timer)

Quoted 6 lines
Quoted 2 lines

I'm happy either way, as long as we know exactly what we are dealing with on each affected platform.

I would like to get the warning fixed for Tegra234. Do you want to split that part out of your patch and then I can test and we can at least fix for that device while I see whats up with Tegra194?

Getting the warning fixed for Tegra234 is probably limited to fixing the DT, Feel free to lift that from my original patch and slap your name on it.

Also consider fixing most of the PPI interrupt specifiers while you're at it, because aside from the PMU, they are all awfully wrong.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Reviewed-by Tested-by on v3 11/17
#28 lore raw

Re: [PATCH v3 11/17] arm64: dts: mediatek: Add EL2 virtual timer interrupt

In reply to Marc Zyngier
Quoted 2 lines · Marc Zyngier

The ARMv8.1+ based CPUs used in a number of Mediatek SoCs are missing the EL2 virtual timer interrupt. Add it.

This patch doesn't seem to have been applied along with the rest of the series. After updating to v7.2.11 on an MT8195 board I see:

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

With this patch applied, the warning is gone and the EL2 virtual timer is used as expected:

arch_timer: cp15 timer running at 13.00MHz (hyp-virt).

author maintainer
#29 lore raw

Re: [PATCH v3 11/17] arm64: dts: mediatek: Add EL2 virtual timer interrupt

Quoted 7 lines · Tim Pambor
Quoted 2 lines · Marc Zyngier

The ARMv8.1+ based CPUs used in a number of Mediatek SoCs are missing the EL2 virtual timer interrupt. Add it.

This patch doesn't seem to have been applied along with the rest of the series.

That's the SoC maintainers' responsibility. I only look after the driver code, and rely on people spotting the warning! ;-) The fact that this has been there for two kernel releases show you how deeply these maintainers care.

Quoted 11 lines

After updating to v7.2.11 on an MT8195 board I see:

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

With this patch applied, the warning is gone and the EL2 virtual timer is used as expected:

arch_timer: cp15 timer running at 13.00MHz (hyp-virt).

Thanks!

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
#30 lore raw

Re: [PATCH v3 11/17] arm64: dts: mediatek: Add EL2 virtual timer interrupt

+cc linux-mediatek

Quoted 34 lines · Marc Zyngier
Quoted 7 lines · Tim Pambor
Quoted 2 lines · Marc Zyngier

The ARMv8.1+ based CPUs used in a number of Mediatek SoCs are missing the EL2 virtual timer interrupt. Add it.

This patch doesn't seem to have been applied along with the rest of the series.

That's the SoC maintainers' responsibility. I only look after the driver code, and rely on people spotting the warning! ;-) The fact that this has been there for two kernel releases show you how deeply these maintainers care.

Quoted 11 lines

After updating to v7.2.11 on an MT8195 board I see:

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

With this patch applied, the warning is gone and the EL2 virtual timer is used as expected:

arch_timer: cp15 timer running at 13.00MHz (hyp-virt).

Thanks!

        M.

--
Without deviation from the norm, progress is not possible.

maintainer Applied
#50 lore raw

Re: (subset) [PATCH v3 00/17] arm64: Use EL2 virtual timer when running VHE

In reply to Marc Zyngier
Quoted 9 lines · Marc Zyngier

This is the third version of the series initially posted at [1], which

- updates the ACPI GTDT parsing to deal the v3 layout and the EL2 virtual timer,
- moves the architected timer driver to use it when running VHE,
- fixes a number of DTs to reflect the reality of the HW.

[...]

Applied to v7.4-next/dts64, thanks!

[11/17] arm64: dts: mediatek: Add EL2 virtual timer interrupt

        commit: 0b3f2f7ff214827043a13549e1af6bd73f192768

Cheers,
Angelo