From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94654C4453A for ; Wed, 22 Jul 2026 20:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=n2UyvVxwi6nb8Gck/NJhelSg7PUIFLLdwXt/Q4oFRJI=; b=KhISlZOKrk+SWzefKrnZ9GVipZ H3JYRCSI18WOcgwqrnmcXpcVm0mpciNhopDOKuq1p1V6vnIR8TW2m3FoAG82j67yFSFo5HYgla/DH G3PxlKtld15/9b029/M8F3xHv1NS1nKQou9d2/IVM6d5TmOqKgdBuJC/j3q/1/Qrm/+SJZeCf2E69 pJesXXulbExRCU3tfZfPyAQOnX8nz8oKXvThzTpKOVhHKCFMp1/Wx5YzmR4VbyfkMw6/mHo7KqYIx 7s4LqXz+irD4oW9IVKinL+MiyVZrnBVGHZ0h9ymkwKXEex0QnKvmp27cIYnayCRott38IRgKIprV/ 55QUF3PQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wmdRO-0000000Chmn-3MFC; Wed, 22 Jul 2026 20:21:19 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wmdRN-0000000ChmQ-2505 for linux-arm-kernel@lists.infradead.org; Wed, 22 Jul 2026 20:21:17 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id D417A40E46; Wed, 22 Jul 2026 20:21:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6EEA1F000E9; Wed, 22 Jul 2026 20:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784751676; bh=n2UyvVxwi6nb8Gck/NJhelSg7PUIFLLdwXt/Q4oFRJI=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=CzHaLII+nRvAcI3VKD4XImX+tvfNT8mknfqiKBz2jpl6YMPlm+kEyENt/j/1Ncquj a+cvz27AKn7A1jgBx1oEOJCSZnX5cSO8ZOplLXiK5duv8CDROrm26V197bo3GHJdp2 jZ02vogO40wz4YryYDi2WVlmMvT1gb8jpURWjRfmhHINQTF/hXTCFMa7E3wYrUQ8WK LeaCz53SdAvMPdfP+/QRflLiyZClHDPjhFfyzi+6e9sSpR8TbSMzMpZ9hArObrq0LO JgPdlPsSkZEELKvHklr1O7SHTidCUSQd+QvxdmtbhiyiRvHvZiifHVXg2JHnB8dJax lgJsgo8dvAVlg== Received: from 91-161-240-24.subs.proxad.net ([91.161.240.24] helo=lobster-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wmdRK-00000007lEN-2ptI; Wed, 22 Jul 2026 20:21:14 +0000 Date: Wed, 22 Jul 2026 21:22:37 +0100 Message-ID: <878q72rcz6.wl-maz@kernel.org> From: Marc Zyngier To: Jon Hunter Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, John , Daniel Drake , Marek Szyprowski , Florian Fainelli , Daniel Lezcano , Thomas Gleixner , Mark Rutland , "linux-tegra@vger.kernel.org" Subject: Re: [PATCH] clocksource/drivers/arm_arch_timer: Workaround bcm2712 broken EL2 virtual timer In-Reply-To: <325e86ea-d4d3-4c84-ae9b-f4a08c9b071b@nvidia.com> References: <20260710080958.491620-1-maz@kernel.org> <325e86ea-d4d3-4c84-ae9b-f4a08c9b071b@nvidia.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 91.161.240.24 X-SA-Exim-Rcpt-To: jonathanh@nvidia.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, therealgraysky@proton.me, dan@reactivated.net, m.szyprowski@samsung.com, florian.fainelli@broadcom.com, daniel.lezcano@linaro.org, tglx@linutronix.de, mark.rutland@arm.com, linux-tegra@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 22 Jul 2026 15:14:39 +0100, Jon Hunter wrote: > > > On 10/07/2026 09:09, Marc Zyngier wrote: > > It appears that the bcm2712 SoC found in the relatively popular > > RPi5 has a broken EL2 virtual timer. > > > > We do not know the reason why the timer isn't working (the timer > > is ticking, but the interrupt never fires), and the SoC vendor > > doesn't communicate on the reason why this isn't working, leaving > > users and maintainers in the dark. > > > > Paper over the issue by detecting the broken HW, falling back to > > the physical timer instead, and let the user know about it. > > Also taint the kernel as the machine is definitely not compliant > > with the spec, and we don't know what else is wrong with it. > > > > Reported-by: John > > Reported-by: Daniel Drake > > Reported-by: Marek Szyprowski > > Signed-off-by: Marc Zyngier > > Cc: Florian Fainelli > > Cc: Daniel Lezcano > > Cc: Thomas Gleixner > > Cc: Mark Rutland > > --- > > drivers/clocksource/arm_arch_timer.c | 24 +++++++++++++++++++++++- > > 1 file changed, 23 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c > > index 4adf756423de9..7b4a98df6962b 100644 > > --- a/drivers/clocksource/arm_arch_timer.c > > +++ b/drivers/clocksource/arm_arch_timer.c > > @@ -1090,6 +1090,27 @@ static int __init arch_timer_common_init(void) > > return arch_timer_arch_init(); > > } > > +static bool __init has_broken_el2_vtimer(void) > > +{ > > + /* > > + * SoCs described here have been found to be broken, though no > > + * explanation has been volunteered by the vendor. Let the user know > > + * we're papering over the vendor's lack of communication. > > + */ > > + static const char * const broken_el2_vtimer[] __initconst = { > > + "brcm,bcm2712", > > + NULL > > + }; > > + > > + if (of_machine_compatible_match(broken_el2_vtimer)) { > > + add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK); > > + pr_warn_once(HW_ERR "Known broken EL2 virtual timer, ignoring it\n"); > > After this change you will now get two warnings; the above and the > below. Is this what you want? Absolutely. > > > + return true; > > + } > > + > > + return false; > > +} > > + > > /** > > * arch_timer_select_ppi() - Select suitable PPI for the current system. > > * > > @@ -1115,7 +1136,8 @@ static int __init arch_timer_common_init(void) > > static enum arch_timer_ppi_nr __init arch_timer_select_ppi(void) > > { > > if (is_kernel_in_hyp_mode()) { > > - if (arch_timer_ppi[ARCH_TIMER_HYP_VIRT_PPI]) > > + if (arch_timer_ppi[ARCH_TIMER_HYP_VIRT_PPI] && > > + !has_broken_el2_vtimer()) > > return ARCH_TIMER_HYP_VIRT_PPI; > > pr_warn_once(FW_BUG "VHE-capable CPU without EL2 > > virtual timer interrupt\n"); > > > I have posted something similar for Tegra [0], but because this is not > expected to work, I wanted to avoid the warnings here. We test for "not expected to work"? In which parallel universe is that a thing? > kernel warnings and ideally we would not warn if is known not to > work. We could always display an info level print if it is needed. No. These warnings are required because the HW is broken, and violates the basics of the architecture, which the kernel relies on. That's important information that needs to be captured, and that's why the kernel also gets tainted. This applies to any implementation that hasn't been bothered to follow the spec. Don't worry, you're in good company. M. -- Jazz isn't dead. It just smells funny.