Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp521625pxk; Thu, 1 Oct 2020 08:04:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsy08iR1U3+adzKyElXSXMeBzwLPUhVkawCWw8G4j4izZVDGaDnfdr+NdXOlzb85o6AA5Z X-Received: by 2002:a17:906:1644:: with SMTP id n4mr9011759ejd.332.1601564697183; Thu, 01 Oct 2020 08:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601564697; cv=none; d=google.com; s=arc-20160816; b=gOG3lRosutAUst+ZGD7NeCzcLePor+a/+XOTQj15DiOD1sHcKxYLLc82OFfWhEomLm HCPq1I61DMj5tsZwtmNnyuRz9TTER62tmIS5bIiHbKyzywPcjXS3yQJo3DDNlQvNDvZC q5GVHykqBh3kc+QV5tcjIYimhdxLaILazrf30q/UjAJjgBMoa3N7RcTXCLS8MeQWTlGf p04w+1B5AuiLPwMEkolk3NbhpVEwH8D62li62NJBycQAAJ612Gi0QWI6wb7TUCQvIJwU ekCXxF+N2dTwg6xmS4ifPvH1PW/zfDr+mWK4VdK4T4lMapNsNQyyTGZS1ZzUML4yYSEb lebg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=qeO+HST8Alt8TTHfAd+E1LMm1PbcT+IkG0owx3Xzuxk=; b=VAwFWyNtD+jTu6DXz5CxqlqsYWwNz6awu6EOhbcdEWUMqdN+SLQXt57o7LuTIFfZnW uy7Qs9EMvPoh1ZVlK8DZpc7SAZDpAxxT7MnzRhR+QQOppOZ2joFjt2eOCHXQXPed/Bps R2Wo8zh18LCQSt8yvbB+6yM+LgvaS4nNCU4Ebj0gbTpPQUFvCQnwwo7BpNwjBIBY/ezg EImD92jnUDdEWL0kpvVxvDljtnWqtoOFdAFl5xpnIQuiffMiYsLh7kPPGtelDcptNrV0 zOTgnOH+0Zx/x/oRB/VCBaU7WsUFmDLgvCgp7fGs0ZW2MrRa4wHtcSsZuv10PkO2uOHN 68pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=l4+iFFCo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si3723877eds.533.2020.10.01.08.04.23; Thu, 01 Oct 2020 08:04:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=l4+iFFCo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732431AbgJAPDS (ORCPT + 99 others); Thu, 1 Oct 2020 11:03:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732299AbgJAPDS (ORCPT ); Thu, 1 Oct 2020 11:03:18 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE3F3C0613D0 for ; Thu, 1 Oct 2020 08:03:17 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id z4so6203378wrr.4 for ; Thu, 01 Oct 2020 08:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=qeO+HST8Alt8TTHfAd+E1LMm1PbcT+IkG0owx3Xzuxk=; b=l4+iFFCo1+l+g+ES34C57Um09yEXm62T8GVoyj/mbmgZC4sT3AtzcOdB3TG5VDMcwj 47ebk2RTFRJ/ELF6NF/Oyoz1m1ar+X0P1zvMEdx6IUqVNP+SzgbNPgw9xzJpIC0NHwXa U+Vfv1l3Itd4k5x9aOQatCFzKDID2eXx7K8J1S3H0IWKlO37wz/hvxbdQihPJHuMq5OH iqWT6ruU8SENR2NZCqf2MEX80Gq+zMcS7rqCY1vrF1WeYXpjZyCyPB2V25flvHGRrMPF o9AKA3zhYSYamY7UmZL2V2O/OIW5IKG3DS+y6mDKbQveaN0HPLC+7C2xeRxlU5uWDoko h+zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qeO+HST8Alt8TTHfAd+E1LMm1PbcT+IkG0owx3Xzuxk=; b=Le8dc8HmL6JR4lpGWE3/iLoaAYJxMw2md3ZLPzqhe5DEeyjeu1MuKGRNSnorzsvWE1 6TkZJ+Xy94XLcHDuoj5rUft+Vn3dtv3eXXTb10RbE82ihSDmPxr3YKss8SJ6o7jfpa0o hUITfrgKNLwfE2JLge8a8rBrIZjLcYw8GfRxQ9N5P2yv9+AdHM4ttoAli8Dq1hDiV67b DXw1vFKnDZZQT9C0/iioIuGnX7JyzKjIsIh8HAqmYZZ/Y3cBxA6PzuRPHLUdxocEfhld ZD9tgpe2PXF0KQkv1Mq2OH8XDK4O1BzSJc7X74KGEXO8uvAls7hqZr5QPEeIYt/kpMKc Yk6w== X-Gm-Message-State: AOAM533mSaZ2BZ+4zf1qZPxgKxUUky5mEBiN71q2JLp48hZ68TNbmqjQ EfFNa1W5Q0Dk8wZUNTCVspSmCk4aoZzsNg== X-Received: by 2002:adf:ef4f:: with SMTP id c15mr10141733wrp.390.1601564596429; Thu, 01 Oct 2020 08:03:16 -0700 (PDT) Received: from ziggy.stardust ([213.195.119.110]) by smtp.gmail.com with ESMTPSA id d19sm379727wmd.0.2020.10.01.08.03.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Oct 2020 08:03:14 -0700 (PDT) Subject: Re: [PATCH v2] soc: mediatek: Check if power domains can be powered on at boot time To: Nicolas Boichat Cc: Daniel Kurtz , Sascha Hauer , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org References: <20200928113107.v2.1.I5e6f8c262031d0451fe7241b744f4f3111c1ce71@changeid> From: Matthias Brugger Message-ID: Date: Thu, 1 Oct 2020 17:03:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200928113107.v2.1.I5e6f8c262031d0451fe7241b744f4f3111c1ce71@changeid> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/09/2020 05:31, Nicolas Boichat wrote: > In the error case, where a power domain cannot be powered on > successfully at boot time (in mtk_register_power_domains), > pm_genpd_init would still be called with is_off=false, and the > system would later try to disable the power domain again, triggering > warnings as disabled clocks are disabled again (and other potential > issues). > > Also print a warning splat in that case, as this should never > happen. > > Fixes: c84e358718a66f7 ("soc: Mediatek: Add SCPSYS power domain driver") > Signed-off-by: Nicolas Boichat Applied to v5.10-tmp/soc which will be v5.10-next/soc as soon as v5.10-rc1 gets published. Nicolas can you please make sure that similar logic will be part of the series Enric is working on? Thanks a lot. Matthias > --- > > Changes in v2: > - Add WARN_ON if the domain can't be powered on, to make it more > obvious that this should not happen (there is already an error > message). > > drivers/soc/mediatek/mtk-scpsys.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c > index f669d3754627..ca75b14931ec 100644 > --- a/drivers/soc/mediatek/mtk-scpsys.c > +++ b/drivers/soc/mediatek/mtk-scpsys.c > @@ -524,6 +524,7 @@ static void mtk_register_power_domains(struct platform_device *pdev, > for (i = 0; i < num; i++) { > struct scp_domain *scpd = &scp->domains[i]; > struct generic_pm_domain *genpd = &scpd->genpd; > + bool on; > > /* > * Initially turn on all domains to make the domains usable > @@ -531,9 +532,9 @@ static void mtk_register_power_domains(struct platform_device *pdev, > * software. The unused domains will be switched off during > * late_init time. > */ > - genpd->power_on(genpd); > + on = !WARN_ON(genpd->power_on(genpd) < 0); > > - pm_genpd_init(genpd, NULL, false); > + pm_genpd_init(genpd, NULL, !on); > } > > /* >