mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Samuel Holland <samuel@sholland.org>
To: Palmer Dabbelt <palmer@rivosinc.com>, linux-riscv@lists.infradead.org
Cc: daniel.lezcano@linaro.org, tglx@linutronix.de,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	aou@eecs.berkeley.edu, linux-kernel@vger.kernel.org,
	linux@rivosinc.com
Subject: Re: [PATCH] clocksource/drivers/riscv: Refuse to probe on T-Head
Date: Thu, 9 Feb 2023 17:35:53 -0600	[thread overview]
Message-ID: <87a0a7c9-6069-b043-2fc2-8d1bc05ddb1a@sholland.org> (raw)
In-Reply-To: <20230209232302.25658-1-palmer@rivosinc.com>

Hi Palmer,

On 2/9/23 17:23, Palmer Dabbelt wrote:
> From: Palmer Dabbelt <palmer@rivosinc.com>
> 
> As of d9f15a9de44a ("Revert "clocksource/drivers/riscv: Events are
> stopped during CPU suspend"") this driver no longer functions correctly
> for the T-Head firmware.  That shouldn't impact any users, as we've got

The current situation is that the C9xx CLINT binding was just accepted,
so the CLINT is not yet described in any devicetree. So at least with
upstream OpenSBI, which needs the CLINT DT node, the SBI timer extension
never worked at all.

> a functioning driver that's higher priority, but let's just be safe and
> ban it from probing at all.
> 
> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
> ---
> This feel super ugly to me, but I'm not sure how to do this more
> cleanly.  I'm not even sure if it's necessary, but I just ran back into
> the driver reviewing some other patches so I figured I'd say something.

This is not necessary as long as we add the riscv,timer node with the
riscv,timer-cannot-wake-cpu property before we add the CLINT node. So it
should not be a problem for any C9xx platform going forward.

Regards,
Samuel

> ---
>  drivers/clocksource/timer-riscv.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c
> index a0d66fabf073..d2d0236d1ae6 100644
> --- a/drivers/clocksource/timer-riscv.c
> +++ b/drivers/clocksource/timer-riscv.c
> @@ -139,6 +139,22 @@ static int __init riscv_timer_init_dt(struct device_node *n)
>  	if (cpuid != smp_processor_id())
>  		return 0;
>  
> +	/*
> +	 * The T-Head firmware does not route timer interrups to the core
> +	 * during non-retentive suspend.  This is allowed by the specifications
> +	 * (no interrupts are required to wake up the core during non-retentive
> +	 * suspend), but most systems don't behave that way and Linux just
> +	 * assumes that interrupts work.
> +	 *
> +	 * There's another timer for the T-Head sytems that behave this way
> +	 * that is already probed by default, but just to be sure skip
> +	 * initializing the SBI driver as it'll just break things later.
> +	 */
> +	if (sbi_get_mvendorid() == THEAD_VENDOR_ID) {
> +		pr_debug_once("Skipping SBI timer on T-Head due to missed wakeups");
> +		return 0;
> +	}
> +
>  	domain = NULL;
>  	child = of_get_compatible_child(n, "riscv,cpu-intc");
>  	if (!child) {


  reply	other threads:[~2023-02-09 23:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09 23:23 Palmer Dabbelt
2023-02-09 23:35 ` Samuel Holland [this message]
2023-02-09 23:39   ` Palmer Dabbelt
2023-02-09 23:40 ` Conor Dooley
2023-02-09 23:48   ` Palmer Dabbelt

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=87a0a7c9-6069-b043-2fc2-8d1bc05ddb1a@sholland.org \
    --to=samuel@sholland.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux@rivosinc.com \
    --cc=palmer@dabbelt.com \
    --cc=palmer@rivosinc.com \
    --cc=paul.walmsley@sifive.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®