Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3940213imw; Thu, 7 Jul 2022 09:57:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vXpwPvro4HfLEnt7x75qiAb7lskDnGfSPeiU4IhQJpl8VzY4l2CET0VcJ66VLihWI/APHL X-Received: by 2002:aa7:d555:0:b0:43a:1be7:9e17 with SMTP id u21-20020aa7d555000000b0043a1be79e17mr37480390edr.183.1657213064487; Thu, 07 Jul 2022 09:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657213064; cv=none; d=google.com; s=arc-20160816; b=PoY0ceZs93qG5khLc2CuQAWcXhL1OFABv26dhsx7k43tuNgojm7J458hIJ9nPma0oj E/+FPVv5n/4yFL6uopKavLoh/sRzXMbt7mVr1WKKDazWkYFKrcGBzRskaqsYXo1z7PP4 +yNzEAsvfMH3xVoWfymnb9Rqh/ELMgTYgqaZ+rxyVcFvkv2N2vgHqVhzvESehh4qo57B RV6CdxRkjrMiNx8eFBtWWQwTYB3KFVpbERYlCIOy9pIhLew+Wn3zvU6Nk94KzgCSalfs NlltjPHeorViZbvbf+h1aaHny50C3dImDXkdeAczzlvLgOx25hhM6GH2dqO2DG6s/JIx ppJw== 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=PjK+PZByDhJInr5VJSdek3gudLVUzwq0d5oNXpz6Ros=; b=k9sNSgJouj/BR0TSsI+Tlc0j9ZqWibkz0H9USTZXCCxCxJY94UjfkZmVuvq/W4nn8D Qhr7PVv5BZxWlxhNoXk+obZ9EdG/h98EGDGGvgStMLUbFTtJlwZOGiY0djOx8CJYe0F2 3gZWb2TRWecUi8qaW8yQhczjkGAVcQ4d8kAnhj3OVqEUG0ca089KcAC4GOzUJ7QfKyiN WXm0V7Pq4cpu044WR/SfFqTGdSX/PjP8DFK2t66XwlDU0Sc4HjNKDJZgMBSEnhQmqjVw quPaS6uv2XEQGCSkH2nnzLYea+Vac8Q5WpgVanBJgt0jLnV26GKs9YocAE1jM2vKNA02 FqkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b="PS2nI/in"; 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 eb8-20020a0564020d0800b00435980296cesi3030838edb.570.2022.07.07.09.57.19; Thu, 07 Jul 2022 09:57:44 -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=qcdkim header.b="PS2nI/in"; 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 S236090AbiGGQMx (ORCPT + 99 others); Thu, 7 Jul 2022 12:12:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235303AbiGGQM1 (ORCPT ); Thu, 7 Jul 2022 12:12:27 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 507BF57234; Thu, 7 Jul 2022 09:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1657210307; x=1688746307; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=PjK+PZByDhJInr5VJSdek3gudLVUzwq0d5oNXpz6Ros=; b=PS2nI/injzR/CscgBpHdyHJC1k0snF45uCk9/nT82ULJHoGLPqybNjM8 80OLEGyYVUndwW18HWZJN6SLebcZcXsEkvRF33KS3w//uaX5whh0vdRgK lGqk1AdpnFKSamVPYh3WjvnbogqFii4cj43sRBPT+gxJsIbgyZp8258qY Q=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-02.qualcomm.com with ESMTP; 07 Jul 2022 09:11:47 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2022 09:11:46 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 7 Jul 2022 09:11:45 -0700 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, 7 Jul 2022 09:11:40 -0700 From: Akhil P Oommen To: freedreno , , , Rob Clark , Bjorn Andersson CC: Jordan Crouse , Douglas Anderson , Matthias Kaehlcke , Jonathan Marek , Akhil P Oommen , Abhinav Kumar , Chia-I Wu , Daniel Vetter , David Airlie , Dmitry Baryshkov , Sean Paul , Stephen Boyd , Subject: [PATCH 3/7] drm/msm: Fix cx collapse issue during recovery Date: Thu, 7 Jul 2022 21:40:58 +0530 Message-ID: <20220707213950.3.I4ac27a0b34ea796ce0f938bb509e257516bc6f57@changeid> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1657210262-17166-1-git-send-email-quic_akhilpo@quicinc.com> References: <1657210262-17166-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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 There are some hardware logic under CX domain. For a successful recovery, we should ensure cx headswitch collapses to ensure all the stale states are cleard out. This is especially true to for a6xx family where we can GMU co-processor. Currently, cx doesn't collapse due to a devlink between gpu and its smmu. So the *struct gpu device* needs to be runtime suspended to ensure that the iommu driver removes its vote on cx gdsc. Signed-off-by: Akhil P Oommen --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 16 ++++++++++++++-- drivers/gpu/drm/msm/msm_gpu.c | 2 -- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 42ed9a3..57a7ad5 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -1210,8 +1210,20 @@ static void a6xx_recover(struct msm_gpu *gpu) */ gmu_write(&a6xx_gpu->gmu, REG_A6XX_GMU_GMU_PWR_COL_KEEPALIVE, 0); - gpu->funcs->pm_suspend(gpu); - gpu->funcs->pm_resume(gpu); + /* + * Now drop all the pm_runtime usage count to allow cx gdsc to collapse. + * First drop the usage count from all active submits + */ + for (i = gpu->active_submits; i > 0; i--) + pm_runtime_put(&gpu->pdev->dev); + + /* And the final one from recover worker */ + pm_runtime_put_sync(&gpu->pdev->dev); + + for (i = gpu->active_submits; i > 0; i--) + pm_runtime_get(&gpu->pdev->dev); + + pm_runtime_get_sync(&gpu->pdev->dev); msm_gpu_hw_init(gpu); } diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index f75ff4b..48171b6 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -444,9 +444,7 @@ static void recover_worker(struct kthread_work *work) /* retire completed submits, plus the one that hung: */ retire_submits(gpu); - pm_runtime_get_sync(&gpu->pdev->dev); gpu->funcs->recover(gpu); - pm_runtime_put_sync(&gpu->pdev->dev); /* * Replay all remaining submits starting with highest priority -- 2.7.4