Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp5262rwb; Wed, 17 Aug 2022 21:22:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR4hEr0cSHgLMEFS6ofYVPK8oevao7iJm85R5pcpwoQRh4SHfT7Zy0x4GHIqpGsM2k9BQDji X-Received: by 2002:a17:90b:4c8d:b0:1f5:409b:b017 with SMTP id my13-20020a17090b4c8d00b001f5409bb017mr7070306pjb.52.1660796560115; Wed, 17 Aug 2022 21:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660796560; cv=none; d=google.com; s=arc-20160816; b=ZZ+kL82MljUNalF+1cKSGfgy8Lyk+nOK7+Xv40gAhl9p5Iej4LSGSqTUL/pIZN6K2g kf36o8vl01PChzUw2W/4Ofk4PRyhaMEC4JS9VtxGNcEd2FZByPf5VfKFbWGL+PRixctJ JzNVi2uGrlk6xVbrPP8wVwbCphd7g//CxjIlVpQwVuFagTLEARSb4xr1z/+oo788istk kQRURC2dSVWh0ihz7Akd/I0SBDFfxW4NyOtAzpfz1WnZ2f0BYUSDultoZYzTFaJRORTQ ckeS4+7BX26zPlfrf8w6XJ+tXlPG6UuPZcZuXiQEqZEzUk4e/27b4cYeyXncUtcShKfS /J5g== 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=MyxUgDp6lUpeiLrgyDYC9f7nGqrvjafl4OordNjIGj4=; b=W9q9acxCHcJ+LrFj0h9q+JnXTBOB6n6yiIfQYHCeIp0IDw7LU/b4P/Rc70vDeCSshG p+BMqwRxKf/H9AfNZtk1HLh+enfX0PDFQ3vGEZvDdNCMfVe2sD1HLRxmx1rmGmh/N40L AirfWorLMcfSvF+ag7hyea3FdJkH5Wktz7i5sTJ+ES7NvL9IulrxZ5S6grtsrrRo7VyV kfBl+BiTM4+H6N3wnIgV8ZgNErWdyyWA0gEMHyH9KRslwmgmzUOjnWNHDjOx/yLTehRD C0Hk0I+UXLv75/RrQf+qo2PXqaP/+Kyu0vRj4XsxLjZ8jZxvoIwkdNTCrC0NGWXbSY30 r+uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=BfeKlopd; 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 nl7-20020a17090b384700b001f30b528291si743266pjb.168.2022.08.17.21.22.29; Wed, 17 Aug 2022 21:22:40 -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=BfeKlopd; 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 S243258AbiHRESF (ORCPT + 99 others); Thu, 18 Aug 2022 00:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243173AbiHRERh (ORCPT ); Thu, 18 Aug 2022 00:17:37 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1C4A979F1; Wed, 17 Aug 2022 21:17:32 -0700 (PDT) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27I2wAvw014008; Thu, 18 Aug 2022 04:17:23 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=MyxUgDp6lUpeiLrgyDYC9f7nGqrvjafl4OordNjIGj4=; b=BfeKlopd5SFqzYsh1+Smuk1NFz78Si26yiv4QbJVzGLMEJtIiogdWw6Z7ZN+x2AK1W0h T+tNSAi/VEEoBtMkYRsKx6pIFAr99JQlPeiJhUkDUxzfWLKRYJwx6D7pxuNAGHmNOMLK xMrNQfg/Cai4Qa66oObv7/xzQ9CbVE/1KiiI+NUJquUC5sfQ8nzO8L8EoFsCNPX2AVeG YJmDGYo71uaEwHw2h5DaajPqOEgRRSv2COdbugqeyiUkWlqXKwluld4tYenTHdtv2R9H dnPLSkBTW/Tk+GzF1MqobhfYBJ9eqSzoYaBGTAzxSlALNrenaZiNxD3fMacIj8EBrrE9 3A== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3j13v1j9tr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 04:17:22 +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 27I4HLAq018273 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Aug 2022 04:17:21 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; Wed, 17 Aug 2022 08:14:55 -0700 From: Akhil P Oommen To: freedreno , , , Rob Clark , Bjorn Andersson , "Dmitry Baryshkov" CC: Matthias Kaehlcke , Jonathan Marek , Jordan Crouse , Douglas Anderson , Akhil P Oommen , "Abhinav Kumar" , Chia-I Wu , "Daniel Vetter" , David Airlie , Philipp Zabel , Sean Paul , Subject: [PATCH v4 5/7] drm/msm/a6xx: Ensure CX collapse during gpu recovery Date: Wed, 17 Aug 2022 20:44:18 +0530 Message-ID: <20220817204224.v4.5.I176567525af2b9439a7e485d0ca130528666a55c@changeid> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1660749261-7602-1-git-send-email-quic_akhilpo@quicinc.com> References: <1660749261-7602-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: uV-BRckdtCu_53-9pwH0SBcMXY-6pIAE X-Proofpoint-ORIG-GUID: uV-BRckdtCu_53-9pwH0SBcMXY-6pIAE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-18_02,2022-08-16_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 mlxscore=0 clxscore=1015 malwarescore=0 mlxlogscore=999 bulkscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208180014 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 --- (no changes since v3) 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..4a57627 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(&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