Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp70976lql; Fri, 12 Apr 2024 04:15:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVbarDPvSnorolOiRp50Efn8yynEPboRwljV5Rcmx7h0e1a4mCLqmfu5jznJ66l+2+H+yisgAmSj8xkbfnAKRake68kQ7uScHaYOviCXQ== X-Google-Smtp-Source: AGHT+IHivEAQWyz/g1Lue3aZl98ORcde8NgT4Tdii+0hd/TjGFLdpMwUcs+1wPa2itdSaxrmX1gY X-Received: by 2002:a05:6358:7b95:b0:183:4d62:6b45 with SMTP id n21-20020a0563587b9500b001834d626b45mr2167453rwg.9.1712920556716; Fri, 12 Apr 2024 04:15:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712920556; cv=pass; d=google.com; s=arc-20160816; b=eu3WtjuvP68/ijaAbpS4UEY2BiOoihkQ2yS62yoAgfaSZO5Sdx4p+/iM6cVgB0b2PO BOAcXzZrvgt76dkEfU1XUYih/GzF6LdkVWNfRn8LbERn23cD+zDciFBPij2QV8fSpG8M NLV6Ma0qTxmTUTGyJDtceMpuP/Ev4gD5r8c05Jy0ghmGmkN85GyM/mmdK4YrmuOJ9htS QoUw0lNuvLkgSikayhHMo18uWb0KFCSOJv7ANWpqabX60pQ+fpMKimfjfTj+TDd5dqN7 don+sFT7PzFrE4QkPzWupk6P7qtoQyjEmcf5FYYeUWOKuS0yuOApOnc9UusRX8Om2c1X rZWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=+WKE9nZBcXA36QYNF70EQgVWpqyE2qptSPUnfSkOVlI=; fh=ZtarhArclynpM4R6AXmXpy9Qgfn2ziFTbuqhygQOacc=; b=LeVkzK0K0NRPVSV+Nukyxax2u1UPmRsD4X+TF8Qv7ptdJ38adHNQ4TXmo2xiXksi9C pVT7XCP9GioUQaNFYKjR+EC9S1VPyYmHikz/iONTaQX0UxurxaVtA3me5lSfriehaFth 8WHnFQs6JVT7Ooy9qWOIRH4Yy2p49OEA/9Wawcwwk4VrfnqCMJjbZwf2FBihsyiF1XWI Gy3SZSZLGc2nMXEuh8MNVF6Hl6eLe2tvhKyx+bCbbKt/pbPJBHatK+tf3Z/w4UwEko30 A8kebuvJRBMQh0DWw4RwqrUQZKHHz9sjx0NvTymuGphg+SgRtIQDx+gqouqsHlw8SfKY +3jg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bifuBWKo; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-142558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142558-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t18-20020a63eb12000000b005f0a525cc3dsi3018766pgh.486.2024.04.12.04.15.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 04:15:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bifuBWKo; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-142558-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142558-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C2A7EB227DE for ; Fri, 12 Apr 2024 11:15:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 812C853818; Fri, 12 Apr 2024 11:15:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bifuBWKo" Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (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 3E8AF5336D for ; Fri, 12 Apr 2024 11:15:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712920529; cv=none; b=UOKKe4Y5hI3GfPOZlDEY8ExVmScKkIkhLblMcb/QSXgNCHQFUQgVjkDeOAqXfnB7yWoasC6FyfN/zgnB6RW15butut4lzj4IItRrPZXUscmLQ51GptF8XrhF81VhGJvNzxv/VheOpEQTsKcLXtWvCii09iIK3+gMa6OjY/9AcbY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712920529; c=relaxed/simple; bh=E/uUvnAayS2kUpJvbMbwdVkr1FtYoVzqWi03CDEIUz8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=DgGainBAttEMyh25D0X4i7B0pZAFfAPqkq7yQOWvb+6WR54VXFZzs3DbrlhZFKeSgU+pJ05sVlAj5o3aNNWd2EzAbIMH9QOKCsGSPfav1bop88U9apd+Kk4aZ7J5cVzYuAzAmDLbnmBSxTFpecncUoDkjbiBbzwY9zqmU42QfkM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=bifuBWKo; arc=none smtp.client-ip=209.85.128.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-61874a5b8ecso7547717b3.0 for ; Fri, 12 Apr 2024 04:15:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712920527; x=1713525327; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+WKE9nZBcXA36QYNF70EQgVWpqyE2qptSPUnfSkOVlI=; b=bifuBWKoqEXsBcEm2jmBN5t75IYOcC8H5WVqonQq9fdP97++mGrx5zzp3GK4SGwz5V B5Bs7BJyG+srVqx2g5olPzboCxYHKOX8RkVv6jgwSy9boFUTDFT34eeuHaowynPMgIBn FALx7sRsip+pT8Agb+hChX8bK9I92A7KZwaMW1jWsQe6XPUeFoYSTT9Itlj9NVjaQUVJ w3dvYwZoYK+7bv8L+2Rc2KXjO/FrmHpEMq0DTke226ZBuCeK6XR+PkmtQgXWbPZN7F6Q +i6vLDGYbcrxZsu4OQcLsmedmO83WBMOjmqPxwPSFtKw9Jc8nu1fkSgVQTtEDCkzrIK3 OTDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712920527; x=1713525327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+WKE9nZBcXA36QYNF70EQgVWpqyE2qptSPUnfSkOVlI=; b=d6lbboWuJBBjAc5Cc4Bz1gp/UWDRbE6RpLsybwA8dFLl1TbXcN3hLY565wJOIHfw98 c/xgfa/yu+MX/MrIM9vzpOQMfgxjQo35qh+TDQXs2TbxLMfPp7+tgRxyhDAwtl4B17NI 3pYThPEyTDs00mfSmRe3BT+6p1UNs84JFziyQlKuqK3O4a5uZcSyavP7JroIfWzqtSNC Cx0ODgPj4fWzGnJ1rTJO6aZ34jx7y1lEzb59u9rGh9umEAF2Wlm86ef/RAqjAaYAh7io +mB1jzPg/mbOvEDVnavsfpNrlQSk9uQu5ZFaPMRM8gSEdXnMuVVcSOv8D0ZYJfFTsb+g Hsmg== X-Forwarded-Encrypted: i=1; AJvYcCXNBpryr+YaIcljTvhCwXSy713+TCWyHNPfnmEA9SuJLRMsTiaUn57F7gBwpjiY4m7Ao2oggx5bnLuAvC7TelJWNYsHgUBMgCQZy1+g X-Gm-Message-State: AOJu0YzcfBW3MHnr1GDUkWGiS3wdep6ITuLZxkV6W2+YIPLWqU/nGyzf XHsbyqk46zb6TGfS2HBlNE5kjtr8aRd8gdR95Alz2L9MeG0VN4O4xHm7tRWTizNVGcitVOs3o95 Gs3Dp6h1M+pOoscDcNk9lRU6C+s67Ks4YIzXbLg== X-Received: by 2002:a25:bb8c:0:b0:dc2:4f34:c964 with SMTP id y12-20020a25bb8c000000b00dc24f34c964mr2068134ybg.23.1712920527317; Fri, 12 Apr 2024 04:15:27 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240410134044.2138310-1-claudiu.beznea.uj@bp.renesas.com> <20240410134044.2138310-10-claudiu.beznea.uj@bp.renesas.com> In-Reply-To: <20240410134044.2138310-10-claudiu.beznea.uj@bp.renesas.com> From: Ulf Hansson Date: Fri, 12 Apr 2024 13:14:51 +0200 Message-ID: Subject: Re: [PATCH RESEND v8 09/10] watchdog: rzg2l_wdt: Power on the PM domain in rzg2l_wdt_restart() To: Claudiu Cc: wim@linux-watchdog.org, linux@roeck-us.net, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, p.zabel@pengutronix.de, geert+renesas@glider.be, magnus.damm@gmail.com, biju.das.jz@bp.renesas.com, linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Claudiu Beznea Content-Type: text/plain; charset="UTF-8" On Wed, 10 Apr 2024 at 16:19, Claudiu wrote: > > From: Claudiu Beznea > > The rzg2l_wdt_restart() is called from atomic context. Calling > pm_runtime_{get_sync, resume_and_get}() or any other runtime PM resume > APIs is not an option as it may lead to issues as described in commit > e4cf89596c1f ("watchdog: rzg2l_wdt: Fix 'BUG: Invalid wait context'") > that removed the pm_runtime_get_sync() and used directly the > clk_prepare_enable() APIs. > > Starting with RZ/G3S the watchdog could be part of its own software > controlled power domain (see the initial implementation in Link section). > In case the watchdog is not used the power domain is off and accessing > watchdog registers leads to aborts. > > To solve this the patch powers on the power domain using > dev_pm_genpd_resume() API before enabling its clock. This is not > sleeping or taking any other locks as the power domain will not be > registered with GENPD_FLAG_IRQ_SAFE flags. > > Link: https://lore.kernel.org/all/20240208124300.2740313-1-claudiu.beznea.uj@bp.renesas.com > Signed-off-by: Claudiu Beznea > --- > > Changes in v8: > - none, this patch is new > > drivers/watchdog/rzg2l_wdt.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c > index c8c20cfb97a3..98e5e9914a5d 100644 > --- a/drivers/watchdog/rzg2l_wdt.c > +++ b/drivers/watchdog/rzg2l_wdt.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -164,6 +165,17 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev, > struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); > int ret; > > + /* > + * The device may be part of a power domain that is currently > + * powered off. We need to power it up before accessing registers. > + * We don't undo the dev_pm_genpd_resume() as the device need to > + * be up for the reboot to happen. Also, as we are in atomic context > + * here there is no need to increment PM runtime usage counter > + * (to make sure pm_runtime_active() doesn't return wrong code). > + */ > + if (!pm_runtime_active(wdev->parent)) > + dev_pm_genpd_resume(wdev->parent); > + I doubt this is the correct solution, but I may be wrong. Unless this is invoked at the syscore stage? > clk_prepare_enable(priv->pclk); > clk_prepare_enable(priv->osc_clk); > > -- > 2.39.2 > > Can you redirectly me to the complete series, so I can have a better overview of the problem? Kind regards Uffe