Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Stephan Gerhold <stephan.gerhold@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Daniel Lezcano <daniel.lezcano@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>,
	Sudeep Holla <sudeep.holla@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Jack Matthews <jack@jackmatthe.ws>
Subject: Re: [PATCH 0/2] clocksource/drivers/arm_arch_timer_mmio: Restore support for early init
Date: Thu, 11 Jun 2026 14:57:42 +0100	[thread overview]
Message-ID: <87qzmd89ih.wl-maz@kernel.org> (raw)
In-Reply-To: <aip2Pnmi-LJPKwW7@linaro.org>

On Thu, 11 Jun 2026 09:47:58 +0100,
Stephan Gerhold <stephan.gerhold@linaro.org> wrote:
> 
> On Thu, Jun 11, 2026 at 08:59:19AM +0100, Marc Zyngier wrote:
> > On Wed, 10 Jun 2026 18:53:09 +0100,
> > Stephan Gerhold <stephan.gerhold@linaro.org> wrote:
> > > 
> > > Jack reported a regression for some single-core Qualcomm platforms (e.g.
> > > MDM9625, MDM9607) that no longer boot because no timers can be found during
> > > early boot [1].
> > 
> > Again, this is *not* a regression. These machines were *never*
> > supported upstream.
> > 
> 
> Sorry, I'll reword this next time. MDM9607 does have all required
> drivers and compatibles upstream already and is just missing the actual
> DT so it does feel somewhat supported to me, but I'm fine treating this
> as a feature extension without stable backporting etc.

"Supported" has a different definition for me. Cortex-A5 without the
A9-style TWD was so far never seen in the wild. The Generic MMIO timer
was introduced way after Cortex-A5 shipped, and was designed to work
with the CPU timers, making this QCOM contraption a franken-hack.

So calling this supported is very much pushing the boundaries of what
was supposed to be put together.

>
> > > These platforms rely on an obscure timer setup where the
> > > global Arm MMIO timer (arm,armv7-timer-mem) is used as the only available
> > > timer for the CPU. This setup used to work fine until commit 0f67b56d84b4
> > > ("clocksource/drivers/arm_arch_timer_mmio: Switch over to standalone
> > > driver") when the early timer initialization using TIMER_OF_DECLARE() was
> > > removed when moving to the standalone MMIO driver.
> > > 
> > > There doesn't seem to be any other usable CPU timer on those platforms, so
> > > this series restores the early timer support using TIMER_OF_DECLARE()
> > > inside the new standalone arm_arch_timer_mmio driver. This is pretty ugly,
> > > but I could not think of a better solution so far. I tried to keep the
> > > ugliness for the two probe paths as limited as possible. :-)
> > > 
> > > If someone has a better idea how to solve this, I would be happy to try it.
> > 
> > I would suggest finding out what is the latest point in the init
> > sequence where the timer can be probed without preventing boot.
> > 
> 
> It doesn't get far without having any timer:
> 
> [    0.000000] timer_probe: no matching timers found
> [    0.000000] entering initcall level: console
> [    0.000000] calling  con_init+0x0/0x354 @ 0
> [    0.000000] Console: colour dummy device 80x30
> [    0.000000] initcall con_init+0x0/0x354 returned 0 after 0 usecs
> [    0.000000] sched_clock: 32 bits at 300 Hz, resolution 3333333ns, wraps every 7158278824300949ns
> [    0.000000] Calibrating delay loop... 
> <board hangs>
>

This is nothing that "lpj=[some value]" on the command line can't help
getting past.

> If you look at start_kernel() in init/main.c it's basically time_init()
> that would normally probe the TIMER_OF_DECLARE() timers and
> calibrate_delay() that needs some timer to finish. There is also
> random_init() that comes directly after time_init(), which already wants
> to have access to timestamp counters. I don't see any other suitable
> place to hook into. :-/

None of that should be a problem. I can boot a hacked arm64 kernel
without any timer all the way to the point where it is waiting for a
tick to enter the scheduler and run userspace. There's no reason why
32bit can't do something similar. Heck, 32bit doesn't even have a
standard timer to rely on, so that's very much possible to do.

Can you at least give it a try?

> 
> I also don't see any other timer we could use, at least for MDM9625.
> It's a single-core Cortex-A5 and the downstream kernel defines only the
> arm,armv7-timer-mem, which seems to be used for everything... (The
> situation for MDM9607 is a bit different, but not any less messy,
> unfortunately.)

MDM9607 appears to be a Cortex-A7, so it *definitely* has all the
bells and whistles that we need. The DT I found doesn't make describe
the timer, but it is absolutely part of the CPU.

As for the A5, if we can't get this machine to use the driver as is
without butchering it and going 15 years back in time, then I'd rather
hack together a minimal driver that only this contraption will make
use of, and be done with it.

	M.

-- 
Jazz isn't dead. It just smells funny.


      reply	other threads:[~2026-06-11 13:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10 17:53 [PATCH 0/2] clocksource/drivers/arm_arch_timer_mmio: Restore support for early init Stephan Gerhold
2026-06-10 17:53 ` [PATCH 1/2] clocksource/drivers/arm_arch_timer_mmio: Refactor " Stephan Gerhold
2026-06-10 17:53 ` [PATCH 2/2] clocksource/drivers/arm_arch_timer_mmio: Restore support " Stephan Gerhold
2026-06-11  7:59 ` [PATCH 0/2] " Marc Zyngier
2026-06-11  8:47   ` Stephan Gerhold
2026-06-11 13:57     ` Marc Zyngier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87qzmd89ih.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=daniel.lezcano@kernel.org \
    --cc=jack@jackmatthe.ws \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=stephan.gerhold@linaro.org \
    --cc=sudeep.holla@kernel.org \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox