lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3e0a75a8-2c3d-478a-9e16-f6252cae3367@sifive.com>
Date: Wed, 13 Mar 2024 11:23:37 -0500
From: Samuel Holland <samuel.holland@...ive.com>
To: Daniel Lezcano <daniel.lezcano@...aro.org>,
 Thomas Gleixner <tglx@...utronix.de>
Cc: Anup Patel <apatel@...tanamicro.com>, Chen-Yu Tsai <wens@...e.org>,
 Jernej Skrabec <jernej.skrabec@...il.com>,
 Paul Walmsley <paul.walmsley@...ive.com>,
 Samuel Holland <samuel@...lland.org>, linux-arm-kernel@...ts.infradead.org,
 linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
 linux-sunxi@...ts.linux.dev
Subject: Re: [PATCH] clocksource/drivers/timer-sun4i: Partially convert to a
 platform driver

On 2024-03-13 10:29 AM, Daniel Lezcano wrote:
> On 12/03/2024 20:25, Samuel Holland wrote:
>> Commit 8ec99b033147 ("irqchip/sifive-plic: Convert PLIC driver into a
>> platform driver") broke the MMIO timer on the Allwinner D1 SoC because
>> the IRQ domain is no longer available when timer_probe() is called:
>>
>>    [    0.000000] irq: no irq domain found for interrupt-controller@...00000 !
>>    [    0.000000] Failed to map interrupt for /soc/timer@...0000
>>    [    0.000000] Failed to initialize '/soc/timer@...0000': -22
>>
>> Fix this by wrapping the timer initialization in a platform driver.
>> builtin_platform_driver_probe() must be used because the driver uses
>> timer_of_init(), which is marked as __init. Only convert the sun8i
>> variants of the hardware, because some older SoCs still need the timer
>> probed early for sched_clock().
>>
>> Fixes: 8ec99b033147 ("irqchip/sifive-plic: Convert PLIC driver into a platform
>> driver")
>> Signed-off-by: Samuel Holland <samuel.holland@...ive.com>
> 
> Why EPROBE_DEFER in thermal-of can not fix the issue?
> 
> I mean can't we check if of_irq_get_byname() returns EPROBE_DEFER and then
> return this value?

EPROBE_DEFER would not help either before or after this patch.

Before this patch, the driver uses TIMER_OF_DECLARE, which means the timer gets
initialized from the loop in timer_probe(). That function does not retry if the
initialization function returns EPROBE_DEFER. And timer_probe() is only meant to
be called once, before any platform drivers are registered.

It does not help after this patch either, because __platform_driver_probe() also
requires the probe to succeed the first time. This is needed to ensure the probe
function runs before __init memory is discarded. (To support deferred probing in
timer-of, none of the functions could be marked as __init.)

But that is okay, because if both the irqchip and the timer use platform
drivers, fw_devlink ensures they are probed in the right order. So this patch
reliably allows the timer to probe successfully.

Regards,
Samuel


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ