Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp756989imi; Fri, 22 Jul 2022 08:48:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tA4O2WM7hNrDaDIVa7xZgpJtSz2grviS5DdBr+2mPb6wA9kPbNZzPs8mLfVkVDbdzRBZRN X-Received: by 2002:a17:90b:b12:b0:1f2:3345:44ec with SMTP id bf18-20020a17090b0b1200b001f2334544ecmr276043pjb.29.1658504912235; Fri, 22 Jul 2022 08:48:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658504912; cv=none; d=google.com; s=arc-20160816; b=vUXyGjRohsVMLO4qRJzmMGblX0/ANxhttKn675vDujRjfcjqnGLqYJmihPa3taTwZg eFuKQ0tU+Lp4TOH8f/AJJiyW+TPza3E384blbkjrP/5eyWG0leXTAObfruidgsdS0q0u TGxcrPgt0t/4EqUu5dqF1kLB97dFgHjAW7BpWz4N+yUhX6Sgd30JZKAJZ4TX1+8uhIxk J5OS+vJCuk0JQBDZRn28hyoJhkxgI0jQQjS6JN95eiT7m0bKmE7DQfi5q4pAuEBJcUaJ UCEW0wyCl7rSAsfT2lXwcEozXfpGSW4gvVPWV05gsaMAyZAjuahpATMxkj5i+5LL6kIO jwPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=91TgSgSA/YJ92ess13xjquT9UadVbNK7ich3jTvC5qI=; b=EUHe5h6LZbCPaMm/ycwcyPORonde568sWeg2mxYzW0RDGKT3SknUViQ90OAQxiKKC4 vFnSagJ/cjmLv1eZN63TXF2jGDLLFjsHO/2HfwcLpTAxztD3YDbHhTLK1mwZRYhTNF8D Ma2PELZf9cMnUtzAvKo0Gs9ijsDEScNMwED0L7NrlSxhczQ/auwnR+XImuTo6rfSAPlj jsZbiNbPMwOD6XpyvNU3vKHbYjrbfdhVO12zG0YBRb3G3pj/pnTMHy/zf7C5iWq/ev27 DfbMrPTQhs4IO7Fwwydls2Bd8YaUybPz5l0mvnjPs1bErIds28q/Gr/M/xAq4y2GnsXd vaAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="k/TFir2d"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k13-20020a170902ba8d00b0016bf13b2efcsi5301056pls.123.2022.07.22.08.48.15; Fri, 22 Jul 2022 08:48:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="k/TFir2d"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233598AbiGVP1q (ORCPT + 99 others); Fri, 22 Jul 2022 11:27:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231178AbiGVP1o (ORCPT ); Fri, 22 Jul 2022 11:27:44 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01F459F050; Fri, 22 Jul 2022 08:27:43 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id d16so6966102wrv.10; Fri, 22 Jul 2022 08:27:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=91TgSgSA/YJ92ess13xjquT9UadVbNK7ich3jTvC5qI=; b=k/TFir2d6KAVi3xNxGUZuwCh/ybufbrNaeiH3SeOXE+3Cj6IUDA0NhAjhrSsJOPn8V WFM1U/tGr+K90lpQ+BiLn9ciICmiGj+8hT2H9d67MEfZgGHXvfxKJlwP4xW/EVhHjfJ+ UaxibEcgJ/3Yj5dxKkcD+oTXGzWRJMKJPyEXQc88EIJGJc2V366zNJ6XXxKxId/snIUQ j8gXQi9CCaTu1exkGoZRw5cpQxmhjHBdG82ie8fthDyijBDdSM8HBTVoud6O23HMLJm8 hEN53vuJ0zAIxgkyq2d0UDgH2RqtMHaUIR8LNTLACioSRku209F4g4t9PNX8fFF/9RpU x8SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=91TgSgSA/YJ92ess13xjquT9UadVbNK7ich3jTvC5qI=; b=O1gubIcM7ZNRk+LS5+nzamVaGo5+Pmx0jIbSy4GPDDiyqt0zsKpy9AZHVFZi8ltK/K knKgpeC8U/4rDfixsyissR5TeKex12KrKQprFt+zgpgryw+2cR+vKciGEN+i7Sncz2TW CR1huiboXZYo0BpJYewji/e41n/xN45/XhmWxYeSMfElnLE8WJoAVNyQU+Vf/rbLHqdL pEk0iSzLmLnHQxIavbvV8hgw4qdi8E+UzjWqIT0guw449NGym8ifl+1jehAVd2woEmPW nvBm1DnSK5dT4flSZThk/We/foOPaS9cWtSC9NfNRNv7HfQcqoE/f7ODVsesv7JlgNK4 nQyg== X-Gm-Message-State: AJIora86MTsPiD64sHmNKasln8y+uW7qkh54aA0cjKl3xKXoMwnyA7Qd eZqPi625lfmVxVMHIyFIMEJrlKrbcn6m+WGmz5jwmcOz X-Received: by 2002:a05:6000:18a3:b0:21d:c651:4de7 with SMTP id b3-20020a05600018a300b0021dc6514de7mr288256wri.679.1658503661395; Fri, 22 Jul 2022 08:27:41 -0700 (PDT) MIME-Version: 1.0 References: <1657346375-1461-1-git-send-email-quic_akhilpo@quicinc.com> <20220709112837.v2.5.I7291c830ace04fce07e6bd95a11de4ba91410f7b@changeid> <0c050434-27ca-1099-d93d-8ad6ace3396e@quicinc.com> <698d3279-6a02-9b1e-a3bd-627b6afbc57e@quicinc.com> <1e39d008-f8e5-eea5-90f4-78293bf2c580@quicinc.com> In-Reply-To: <1e39d008-f8e5-eea5-90f4-78293bf2c580@quicinc.com> From: Rob Clark Date: Fri, 22 Jul 2022 08:28:03 -0700 Message-ID: Subject: Re: [Freedreno] [PATCH v2 5/7] arm64: dts: qcom: sc7280: Update gpu register list To: Akhil P Oommen Cc: Rajendra Nayak , Stephen Boyd , Doug Anderson , Taniya Das , Bjorn Andersson , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Jonathan Marek , linux-arm-msm , Andy Gross , dri-devel , Rob Herring , Matthias Kaehlcke , Krzysztof Kozlowski , Jordan Crouse , freedreno , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 21, 2022 at 9:04 AM Akhil P Oommen wrote: > > On 7/20/2022 11:34 AM, Akhil P Oommen wrote: > > On 7/19/2022 3:26 PM, Rajendra Nayak wrote: > >> > >> > >> On 7/19/2022 12:49 PM, Stephen Boyd wrote: > >>> Quoting Akhil P Oommen (2022-07-18 23:37:16) > >>>> On 7/19/2022 11:19 AM, Stephen Boyd wrote: > >>>>> Quoting Akhil P Oommen (2022-07-18 21:07:05) > >>>>>> On 7/14/2022 11:10 AM, Akhil P Oommen wrote: > >>>>>>> IIUC, qcom gdsc driver doesn't ensure hardware is collapsed > >>>>>>> since they > >>>>>>> are vote-able switches. Ideally, we should ensure that the hw has > >>>>>>> collapsed for gpu recovery because there could be transient > >>>>>>> votes from > >>>>>>> other subsystems like hypervisor using their vote register. > >>>>>>> > >>>>>>> I am not sure how complex the plumbing to gpucc driver would be > >>>>>>> to allow > >>>>>>> gpu driver to check hw status. OTOH, with this patch, gpu driver > >>>>>>> does a > >>>>>>> read operation on a gpucc register which is in always-on domain. > >>>>>>> That > >>>>>>> means we don't need to vote any resource to access this register. > >>> > >>> Reading between the lines here, you're saying that you have to read the > >>> gdsc register to make sure that the gdsc is in some state? Can you > >>> clarify exactly what you're doing? And how do you know that something > >>> else in the kernel can't cause the register to change after it is read? > >>> It certainly seems like we can't be certain because there is voting > >>> involved. > > From gpu driver, cx_gdscr.bit[31] (power off status) register can be > > polled to ensure that it *collapsed at least once*. We don't need to > > care if something turns ON gdsc after that. > > > >> > >> yes, this looks like the best case effort to get the gpu to recover, but > >> the kernel driver really has no control to make sure this condition can > >> always be met (because it depends on other entities like hyp, > >> trustzone etc right?) > >> Why not just put a worst case polling delay? > > > > I didn't get you entirely. Where do you mean to keep the polling delay? > >> > >>> > >>>>>>> > >>>>>>> Stephen/Rajendra/Taniya, any suggestion? > >>>>> Why can't you assert a gpu reset signal with the reset APIs? This > >>>>> series > >>>>> seems to jump through a bunch of hoops to get the gdsc and power > >>>>> domain > >>>>> to "reset" when I don't know why any of that is necessary. Can't we > >>>>> simply assert a reset to the hardware after recovery completes so the > >>>>> device is back into a good known POR (power on reset) state? > >>>> That is because there is no register interface to reset GPU CX domain. > >>>> The recommended sequence from HW design folks is to collapse both > >>>> cx and > >>>> gx gdsc to properly reset gpu/gmu. > >>>> > >>> > >>> Ok. One knee jerk reaction is to treat the gdsc as a reset then and > >>> possibly mux that request along with any power domain on/off so that if > >>> the reset is requested and the power domain is off nothing happens. > >>> Otherwise if the power domain is on then it manually sequences and > >>> controls the two gdscs so that the GPU is reset and then restores the > >>> enable state of the power domain. > > It would be fatal to asynchronously pull the plug on CX gdsc > > forcefully because there might be another gpu/smmu driver thread > > accessing registers in cx domain. > > > > -Akhil. > > > But, we can move the cx collapse polling to gpucc and expose it to gpu > driver using 'reset' framework. I am not very familiar with clk driver, > but I did a rough prototype here (untested): > https://zerobin.net/?d34b5f958be3b9b8#NKGzdPy9fgcuOqXZ/XqjI7b8JWcivqe+oSTf4yWHSOU= > > If this approach is acceptable, I will send it out as a separate series. > I'm not super familiar w/ reset framework, but this approach seems like it would avoid needing to play games with working around runpm as well. So that seems like a cleaner approach. BR, -R