Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1836246lql; Wed, 13 Mar 2024 09:23:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfZG71lB4WAfhBl3pMIiqJdwzHEhuh7YZbTL4XTCWci/5kHfTLa0mDS7FjTCTBDrIhZc71m9Kb9yswKR7wgEFJer34kUxZULuzNb0v5Q== X-Google-Smtp-Source: AGHT+IEVItK74yKVYuoaYUKvk/A8zuZ+vtQ4NVGcq2zCL5pOSerjXz4ukWPavxVKF0u/oMLUyc/E X-Received: by 2002:a05:6a20:12c1:b0:1a0:f7d0:e680 with SMTP id v1-20020a056a2012c100b001a0f7d0e680mr4741867pzg.5.1710347027432; Wed, 13 Mar 2024 09:23:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710347027; cv=pass; d=google.com; s=arc-20160816; b=WEID9rYIUuD6duUDNTNOPsMLyL7dzb8sB99zm+bJael9ODEgVaVoVZmiW6QOsUChuu KiNZ9L9ekyXACA2Y6CPGDWfLGSDzLgyYrQMxhmNEtDoL/xx/7x25DUyrmqo3moUEB5xb ABxsVbgZRvL6wT13YIH4M4ne4pjoGLimekE2UnBGcC6+U2pqQ8B5Tu5/mX53Ws+DKM3h 1ohrT3rj+h8kGDSae3d2Ggn8rvEvK9lPSipeoILtgAfBlJZKbul5YbpNpwXEZmBYlg7i EkOFZVKEVTX9fxABUVEuEvDQFBvDdF+ilIvBF0/Igd5PkfIUqeYWH9ct5PUEVHIe/PDO O2Kw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=azgghDatY9Rxnoyec+Q+8O2UeCiS6yMjUBITF9dU9ZQ=; fh=lECt2cg0EvYkVh43XjEpx0s88wgwBgB4rWij9B24mtY=; b=i40/iqFScVVikAigE2EPfEMjuKOzKIFkU55qrdirZpEqunREOEZP1TTuoil2mCGsY/ pPn0mCNhgumft9QQj28h/p3TcYdfr8MtLPmGWrOoGRwPDoNiXaluI4eva2owA95dpuri +RRRFOJV2OUz01hjRPQ189wJt47uBI7dcCk+fQHAxAyJwWVP75TnXIkebErlyZd2gyBU jEXuJ9D9dKNuiRPclez1SLuQ7pfYP761VBxTq5/RBMFtX6UPem3kyIbdqchiA0US4KNO u+snzb3PtoVv3fpVaSAN2q3f892s7OBZiPiXI3ZONKvbIzkAYrigVN61ZM/kVsJrCgpV Md6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=T8o0MjmK; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-101722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101722-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r21-20020a638f55000000b005dc788f3767si9353764pgn.620.2024.03.13.09.23.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 09:23:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=T8o0MjmK; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-101722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101722-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1DD88283C1E for ; Wed, 13 Mar 2024 16:23:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C271C482D1; Wed, 13 Mar 2024 16:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="T8o0MjmK" Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C518247F73 for ; Wed, 13 Mar 2024 16:23:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347021; cv=none; b=JxiWvvHwdIvqrl6Z0lzKKyTSmEiomQqLoY3crRNSPYkq+yBDQ2K9T+Kv1wxbpYU7g4CXMxsQiKP3Jq0elAUGwVjX8ZxYrouE9Gp/ur1vuGJpb+jhLCt3G5PeTUNme2sqlExLNVcS7K4qqQdiwFpDZJSuGleLjYJVshKURPt6Ugc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347021; c=relaxed/simple; bh=Boowo1J6tdnxaf6TrdGpUu6xqdfk+Nnc/rN7p9MrCWU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YmgOQf3ZMY6+GOoz9G1ugbTjki0TOoVvyruBlohxDsAXx1YOZmQWf8TLkaPKmH79T9M+DDJw+pWd7P3xOxE1Obs5jKHZr7+yBMc48FimbBZ8gukEpM/CSP9kbwC2Mb/9gyB2hl9f+pnoLlzdpaZUohFQ+paYeYCbsjKQJLHSVOo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=T8o0MjmK; arc=none smtp.client-ip=209.85.219.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-68ee2c0a237so505526d6.1 for ; Wed, 13 Mar 2024 09:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1710347018; x=1710951818; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=azgghDatY9Rxnoyec+Q+8O2UeCiS6yMjUBITF9dU9ZQ=; b=T8o0MjmK6VElfuH4AiZrfrAUPV/yrMguEvZESqBdpoQpfQrX7tdBT8sfdoa5kS41sn N3SnfrlywcEmorhYe677wtSBkK/212ropZuK5b2pdQ61ysR2A5OzK79mMzmjtAPX0jKI vX33Dx3fmtNf2+q2YPNu3UVdKJndMeELvgOvKKWsJcdQPhvsfqoi0qnjqjLmUdm46Q12 LyGaMRNiZnDEIuSPwi28qhBbw0pM0FRebPZH7vG7/4w2UF6/FCCWWUokUN2AQBG8DRYb 5szfRaBeK/FgdUYjhEpYZQa3ys17i2Ll8wOGg8jh4WQA/E+NHGqDus1NDzrib7XM3Plr 7WPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710347018; x=1710951818; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=azgghDatY9Rxnoyec+Q+8O2UeCiS6yMjUBITF9dU9ZQ=; b=kDGHzYZQb2mKIl05ro0Zm9dMcKJwPNduUeYML0QNBtnhdSZoxZhQmvGOp+I8TxU+r7 NdaDE0aCnww8mj5zPYXuuXkv4d2wm6WLI48b0rfdY3OsKNDKVwelNaHvSlXfHmfIclHr 3RlqiyGg7Z38nuk4O57BYUJ5nYDrfHT/5uM+xViSVQhMnecgsbKpNDZTAuycukJgoRvv fNVSHDWhWwp/nHoYogkxYe4QhWPBNLfaX97j0k8zWIMU8QEqufZwbMLhfx5GBqWRBlOk C8N7GIpf4o/SPsuSBQX+pjTrFfNZXnrBgh2MM3KHtC+sI3w0KKF40KhBN0FGvhVlkWTu 20nQ== X-Forwarded-Encrypted: i=1; AJvYcCXTTd2KygzvDpJ8gOZqX7ofLM7km6PcCK3f4oArzixvuRboxSuw7NPG53YN58ioWggn2SNfkKt6luyiKrI6YmKT3cvbYr7hC+WujPrN X-Gm-Message-State: AOJu0YyrECF/sx78Szs1iuSCabTqOSTto01LNn9HCkCGrkgxJm5MDLWK xNZ1ofJdZMiBZ/OAqQGti9gjZNr/3On37pSKn08ePtewcESqppoSQqzmIeA3gL4= X-Received: by 2002:a05:6214:1650:b0:690:9e6d:efe9 with SMTP id f16-20020a056214165000b006909e6defe9mr553361qvw.27.1710347018666; Wed, 13 Mar 2024 09:23:38 -0700 (PDT) Received: from [100.64.0.1] ([170.85.8.176]) by smtp.gmail.com with ESMTPSA id jh18-20020a0562141fd200b0068ff8d75a90sm4900672qvb.19.2024.03.13.09.23.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Mar 2024 09:23:38 -0700 (PDT) Message-ID: <3e0a75a8-2c3d-478a-9e16-f6252cae3367@sifive.com> Date: Wed, 13 Mar 2024 11:23:37 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] clocksource/drivers/timer-sun4i: Partially convert to a platform driver Content-Language: en-US To: Daniel Lezcano , Thomas Gleixner Cc: Anup Patel , Chen-Yu Tsai , Jernej Skrabec , Paul Walmsley , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sunxi@lists.linux.dev References: <20240312192519.1602493-1-samuel.holland@sifive.com> From: Samuel Holland In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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@10000000 ! >>    [    0.000000] Failed to map interrupt for /soc/timer@2050000 >>    [    0.000000] Failed to initialize '/soc/timer@2050000': -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 > > 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