From nobody Sat Jun 13 23:46:37 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C8EE30D412; Sat, 13 Jun 2026 14:33:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781361205; cv=none; b=gGBatMLsqPEX9vsc/dZVkMa11l4v6TotkqzklKh3rPelsbj40QofJFm7pbHkClHtO7kR5gU6ruCgLLehyJtr/IEkiP6qNMNUR2cwK4R3X7eqiqxtDlDXE1wCaS9daRRjWvdlOX61Yj3BtYkZeyYQjWq5BXM70qe4FydgLLmzCZo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781361205; c=relaxed/simple; bh=D4R/CfeV+ajfdTm6royeSvbJ2eJEYy9vK/yEaz8lLtk=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=sqeyvWzNUD8qflGlRlj2VguX+5jb+927NYDHzF9TdkUB9is4qIv7u6VK/VWOco5rnkZalNqsZkW8V7rZpCM+z+pdl8pxbBhrosFBln0xnAoo5bIP7AJL7zgdV7HR4U7n2Q4msxe4wWSF9T0j6sD7ya+CrVy1ArfrU2CjU/QbDD4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=gttiESkH; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=L31+AyEq; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="gttiESkH"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="L31+AyEq" Date: Sat, 13 Jun 2026 14:33:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1781361194; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6r0Kz8/vkuqFLfPdW4fMR+u5e0mLfaX1AD7NQxnhvsc=; b=gttiESkHDSkK9+BAWx0wiLm+WdNqhVoXeaxwMk+VoaXIBxcf5GgMiWDm+mECC7uPTrVAtQ R2qvgH3HN+TtBj8DHDzF67JyEbS0L0NZqkq1C8Ww+vmeOk8yfEI4eZ498XE112dUVshAfI O4epE4c9r2SFNMylzUL3fgWdEHHmJJmoissX4QXg9/gH2MdylLiQ6/GlHMdbhWAjdG2ppf 2rx0syOC7N8Ko5s2Mj/6/9mlEkaw8rTdIojXGntdrb+VyF6N1a/hfsYQ/kGcYNbndQOKo9 WnTo3WA65DGySS1aOHi7NuTqihnwoDkg/HWOnxYdGfuUhk/ao/kPL2L5e+blbg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1781361194; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6r0Kz8/vkuqFLfPdW4fMR+u5e0mLfaX1AD7NQxnhvsc=; b=L31+AyEqvs58WeRHlvBW15sOrYCBtNwfJEw+uzmz4yxcjOR2T9A/Vs1Tajk0b/I30LR4NX kXuQ2/lx9o2WgKBA== From: "tip-bot2 for Marc Zyngier" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/clocksource] ACPI: GTDT: Account for GTDTv3 size when walking the platform timer descriptors Cc: Sudeep Holla , Marc Zyngier , Daniel Lezcano , Hanjun Guo , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260523140242.586031-2-maz@kernel.org> References: <20260523140242.586031-2-maz@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178136119267.1650852.16071987607519809785.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/clocksource branch of = tip: Commit-ID: 002dcb3a893627fcedf12692063b80c720869ea5 Gitweb: https://git.kernel.org/tip/002dcb3a893627fcedf12692063b80c72= 0869ea5 Author: Marc Zyngier AuthorDate: Sat, 23 May 2026 15:02:26 +01:00 Committer: Daniel Lezcano CommitterDate: Wed, 03 Jun 2026 09:52:23 +02:00 ACPI: GTDT: Account for GTDTv3 size when walking the platform timer descrip= tors 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... Suggested-by: Sudeep Holla Signed-off-by: Marc Zyngier Signed-off-by: Daniel Lezcano Reviewed-by: Hanjun Guo Reviewed-by: Sudeep Holla Link: https://patch.msgid.link/20260523140242.586031-2-maz@kernel.org --- drivers/acpi/arm64/gtdt.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/arm64/gtdt.c b/drivers/acpi/arm64/gtdt.c index ffc867b..950d5ef 100644 --- a/drivers/acpi/arm64/gtdt.c +++ b/drivers/acpi/arm64/gtdt.c @@ -34,14 +34,25 @@ struct acpi_gtdt_descriptor { void *platform_timer; }; =20 +struct gtdt_v3 { + struct acpi_table_gtdt gtdt_v2; + struct acpi_gtdt_el2 el2_vtimer; +}; + static struct acpi_gtdt_descriptor acpi_gtdt_desc __initdata; =20 static __init bool platform_timer_valid(void *platform_timer) { struct acpi_gtdt_header *gh =3D platform_timer; + void *platform_timer_begin; =20 - return (platform_timer >=3D (void *)(acpi_gtdt_desc.gtdt + 1) && - platform_timer < acpi_gtdt_desc.gtdt_end && + if (acpi_gtdt_desc.gtdt->header.revision >=3D 3) + platform_timer_begin =3D container_of(acpi_gtdt_desc.gtdt, struct gtdt_v= 3, gtdt_v2) + 1; + else + platform_timer_begin =3D acpi_gtdt_desc.gtdt + 1; + + return (platform_timer >=3D platform_timer_begin && + platform_timer + sizeof(*gh) <=3D acpi_gtdt_desc.gtdt_end && gh->length !=3D 0 && platform_timer + gh->length <=3D acpi_gtdt_desc.gtdt_end); } @@ -166,6 +177,13 @@ int __init acpi_gtdt_init(struct acpi_table_header *ta= ble, u32 cnt =3D 0; =20 gtdt =3D container_of(table, struct acpi_table_gtdt, header); + + if ((gtdt->header.revision >=3D 3 && gtdt->header.length < sizeof(struct = gtdt_v3)) || + (gtdt->header.revision =3D=3D 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 =3D gtdt; acpi_gtdt_desc.gtdt_end =3D (void *)table + table->length; acpi_gtdt_desc.platform_timer =3D NULL;