Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp864258rwb; Thu, 18 Aug 2022 13:46:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR5kX5vzzsOaTt59xeixG9Pgods5H/vKlTImbOi348qa1cEp/hgSIaA9hBuIIRZiMhXTE7/R X-Received: by 2002:a17:906:4795:b0:738:5b91:6e7 with SMTP id cw21-20020a170906479500b007385b9106e7mr2750882ejc.716.1660855584770; Thu, 18 Aug 2022 13:46:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660855584; cv=none; d=google.com; s=arc-20160816; b=fxGWYB2SF3Wxi2YZmsab7UnKbaZaFZm7z2mLd8Fon+lCPFnjgk6DQYWudv0qgtYm98 lgnRQH2GNtn+Bq34/uOAL9bhEVouWPyh1F6pHFYi0TGciTQxsVZvPZgytO9nSj9a7GXd 7SUkUMeFPEb0VctSG0iL9G86d2Tnnq0EComSruCjQMJ7tRAG+6WMjmExbcPpVu3vOPi4 V+QDEe1mKHgmFgiK6fdTmEljSO2PZpJ19pSEbkpI1rA1OIJ+MFmH5PAmab0lJ1B3oxAX 2e+lhfi9jCoWvSeF/D0rOMQjQPDo/xFclTIHt0gnG3gZuvhaczJNOV7Z/0lPS2NnyvWg jE/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Zjal31pio/4HU2RAjvphbmY0ZR1i1UoN7g5gEWFxqyM=; b=mandeVeiTRnXqDCQ8vLcEQsjnGrAubzNeYlcLxM5U9UdsF7utW1O+2HhD5OfzV+KH7 9LqcVwg6qq6Lu3j2l6XDEcSwIPqRfWx1rRxyaUZwP5DTRV9wYMZJsckxgIFEOrThK4mL rIkL6SqJGU7QvZ/vbaKKmtitpRiErQVCIwJvFgfOVYLPFCol+PmCAQPJoaidueF428C1 p02LOJMIweSUCHgClKKOi/rGy8Yoz27MKhJOvkImUYm15+wXsG0Pqujg/hiG+YbpgjUr 9zH2cd2bO6c4qWSN1SoDfz0ltbJAU7UY2Pu55isId7QWnKkJAudiZJ14ZAi5k4PlZduA /AkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=JND7XcAd; 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=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu13-20020a170906eecd00b0072b7c7bc036si1872005ejb.78.2022.08.18.13.45.58; Thu, 18 Aug 2022 13:46:24 -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=@quicinc.com header.s=qcppdkim1 header.b=JND7XcAd; 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=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345945AbiHRUXy (ORCPT + 99 others); Thu, 18 Aug 2022 16:23:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345936AbiHRUXX (ORCPT ); Thu, 18 Aug 2022 16:23:23 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04000D11D0; Thu, 18 Aug 2022 13:23:08 -0700 (PDT) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27IFrp8X004931; Thu, 18 Aug 2022 20:22:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=Zjal31pio/4HU2RAjvphbmY0ZR1i1UoN7g5gEWFxqyM=; b=JND7XcAdpYctMrFXoaGEdQDSv6G0PuxJWsPXbY+lcb1UjUH60Rpi7JMGxwlVKGFXlvqq oLxtjkImPOy+R0IS2bN5KcLIV4JXkmQHBv0POnGxR3+pSzyly3SpmxguAkMgqgm9IbSs Ed8984/vziIMVUeKPx9X+9xY7sSAIG+RGc/3Ny3ZHsPUQbcwSZT6tjnYYmMPkghdnrgH 1995LkYDKJr5jUAZhs6+WVJZa1KeZIpiEMcPoZwSTr4MggVLgwLWCOY8QJj2pU58IQKY o3wi1fItGXWnfw9zoOAHlYhxWqHN8tSV6aEzxNjUsR43DyyyDPodpDvil1wxkdnPmZGf Qw== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3j1hbqajk1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 20:22:59 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 27IKMwL3006078 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 20:22:58 GMT Received: from hyd-lnxbld559.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 18 Aug 2022 13:22:52 -0700 From: Akhil P Oommen To: freedreno , , , Rob Clark , Bjorn Andersson , "Dmitry Baryshkov" CC: Jordan Crouse , Matthias Kaehlcke , Jonathan Marek , Douglas Anderson , Akhil P Oommen , "Abhinav Kumar" , Chia-I Wu , "Daniel Vetter" , David Airlie , Philipp Zabel , Sean Paul , Subject: [PATCH v5 5/7] drm/msm/a6xx: Ensure CX collapse during gpu recovery Date: Fri, 19 Aug 2022 01:52:13 +0530 Message-ID: <20220819015030.v5.5.I176567525af2b9439a7e485d0ca130528666a55c@changeid> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1660854135-1667-1-git-send-email-quic_akhilpo@quicinc.com> References: <1660854135-1667-1-git-send-email-quic_akhilpo@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: QXofy9Rzdd5eNSNd35_RfbKChX6qzviG X-Proofpoint-ORIG-GUID: QXofy9Rzdd5eNSNd35_RfbKChX6qzviG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-18_14,2022-08-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 adultscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208180074 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Because there could be transient votes from other drivers/tz/hyp which may keep the cx gdsc enabled, we should poll until cx gdsc collapses. We can use the reset framework to poll for cx gdsc collapse from gpucc clk driver. This feature requires support from the platform's gpucc driver. Signed-off-by: Akhil P Oommen Reviewed-by: Dmitry Baryshkov Reviewed-by: Philipp Zabel --- Changes in v5: - Replace devm_reset_control_get_optional() with devm_reset_control_get_optional_exclusive() (Philipp) Changes in v3: - Use reset interface from gpucc driver to poll for cx gdsc collapse https://patchwork.freedesktop.org/series/106860/ drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++++ drivers/gpu/drm/msm/msm_gpu.c | 4 ++++ drivers/gpu/drm/msm/msm_gpu.h | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 0c8f19e..0ec4fcd 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -10,6 +10,7 @@ #include #include +#include #include #define GPU_PAS_ID 13 @@ -1229,6 +1230,9 @@ static void a6xx_recover(struct msm_gpu *gpu) /* And the final one from recover worker */ pm_runtime_put_sync(&gpu->pdev->dev); + /* Call into gpucc driver to poll for cx gdsc collapse */ + reset_control_reset(gpu->cx_collapse); + pm_runtime_use_autosuspend(&gpu->pdev->dev); if (active_submits) diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 07e55a6..2b6f9d4 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -14,6 +14,7 @@ #include #include #include +#include #include /* @@ -903,6 +904,9 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, if (IS_ERR(gpu->gpu_cx)) gpu->gpu_cx = NULL; + gpu->cx_collapse = devm_reset_control_get_optional_exclusive(&pdev->dev, + "cx_collapse"); + gpu->pdev = pdev; platform_set_drvdata(pdev, &gpu->adreno_smmu); diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h index 6def008..ab59fd2 100644 --- a/drivers/gpu/drm/msm/msm_gpu.h +++ b/drivers/gpu/drm/msm/msm_gpu.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "msm_drv.h" #include "msm_fence.h" @@ -268,6 +269,9 @@ struct msm_gpu { bool hw_apriv; struct thermal_cooling_device *cooling; + + /* To poll for cx gdsc collapse during gpu recovery */ + struct reset_control *cx_collapse; }; static inline struct msm_gpu *dev_to_gpu(struct device *dev) -- 2.7.4