Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2907881iog; Mon, 27 Jun 2022 05:32:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v7M1ZkFMLfphJUBYm9jgQPBQX9bSjUzk4T9zABnC5Z4nR6KO7uOmd0xxgIttfQhKSb/u3o X-Received: by 2002:a17:907:7fa9:b0:711:d214:36cd with SMTP id qk41-20020a1709077fa900b00711d21436cdmr12355329ejc.600.1656333159150; Mon, 27 Jun 2022 05:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333159; cv=none; d=google.com; s=arc-20160816; b=a5MS/XGwJJVaL9+kMCusMvEMVP5lBFFe2Q33FhIFGdBSpMvSG7sn1CDr8vzBCrknQw i0fPx8iCxMXqW6u8pBqMTJLcJJ1x3CJVz0WroeUdzDdTCkak0fuiuy7fJeFU97dkMO23 jyNxSjooXjO88KKjsvMIXrZ8pYFUJAS3mwAtapoBG+LD1z0u4ERKIvNRtDTmBxwEYsLG 4A/Fr3YfjM+3OTNKPL05kZSqjolefIkSKxrpDQ9dPtzhehYVzn83TuX+R3U/XuttG3xy MhC3q+Vv+NDzNz5DESDq2xyqLi7PPISRw6HTDjEKt+CE9sAmkdn6s4r/8JxN3ot7C9ZD VwwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0HDl7yWCoRfJjVOwfaEi4z5Y5GuqPakfTiKe0fKyjWA=; b=LtBDiAZN7ze0guMp3iqVf1dTQ5zIY1ozXQRo1xuJemHurfiaVKN2dpJG/un80pdh65 DsYD9gmUfqt/dbfnCxpOVkWCRWIFMj/7S6EvOuwMC3MY9Vbs9yA6UyhbnnsH9yZ2pISB iTsU+eoixud02N0Rc1b33QHG0xzXzAr3H3cd2FY857mxXL39ZuqFEVPmmbDfEzJiU9mH LByUQ1xLzglidK7r68sku7w63YEUBHDxul70EuBbSq/TApZN/CAcDGRleaOlewMeSxBR vst3ISfvDkJlgFepWZusnRXSBxFsS0PEaN6zdkwQFZrdeghtxKrZQjA/pCztqJ8DjC/Z TQnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tWoPRse+; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l25-20020a1709062a9900b0071216b08163si10072440eje.264.2022.06.27.05.32.14; Mon, 27 Jun 2022 05:32:39 -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=@linuxfoundation.org header.s=korg header.b=tWoPRse+; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238092AbiF0LuO (ORCPT + 99 others); Mon, 27 Jun 2022 07:50:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238154AbiF0Lrx (ORCPT ); Mon, 27 Jun 2022 07:47:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C061BC3F; Mon, 27 Jun 2022 04:39:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CDDD6B8111B; Mon, 27 Jun 2022 11:39:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E061C3411D; Mon, 27 Jun 2022 11:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329986; bh=TPUh7iX5vNlOlZ/R9f6sa8AJcNfkI5+7JZxh5LNL6ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tWoPRse+5HQ4jqTIfmG4ElsDMCGmV78JDFL+tGUh4XmBZxkkxgh/pCWv2bXvLUwp8 DwcFgfrtFTfLA/RMIbhBsEMkINOLIDu8Jg9i2/Iqhs04N2Ua+DpiFxFKDYtZabSVRG gEANSQYMhtI3fKHx43srNQ96ETH+u7RAE8wVHWBU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maximilian Luz , Bjorn Andersson , Rob Clark , Rob Clark , Sasha Levin Subject: [PATCH 5.18 043/181] drm/msm: Fix double pm_runtime_disable() call Date: Mon, 27 Jun 2022 13:20:16 +0200 Message-Id: <20220627111945.811504398@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111944.553492442@linuxfoundation.org> References: <20220627111944.553492442@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Maximilian Luz [ Upstream commit ce0db505bc0c51ef5e9ba446c660de7e26f78f29 ] Following commit 17e822f7591f ("drm/msm: fix unbalanced pm_runtime_enable in adreno_gpu_{init, cleanup}"), any call to adreno_unbind() will disable runtime PM twice, as indicated by the call trees below: adreno_unbind() -> pm_runtime_force_suspend() -> pm_runtime_disable() adreno_unbind() -> gpu->funcs->destroy() [= aNxx_destroy()] -> adreno_gpu_cleanup() -> pm_runtime_disable() Note that pm_runtime_force_suspend() is called right before gpu->funcs->destroy() and both functions are called unconditionally. With recent addition of the eDP AUX bus code, this problem manifests itself when the eDP panel cannot be found yet and probing is deferred. On the first probe attempt, we disable runtime PM twice as described above. This then causes any later probe attempt to fail with [drm:adreno_load_gpu [msm]] *ERROR* Couldn't power up the GPU: -13 preventing the driver from loading. As there seem to be scenarios where the aNxx_destroy() functions are not called from adreno_unbind(), simply removing pm_runtime_disable() from inside adreno_unbind() does not seem to be the proper fix. This is what commit 17e822f7591f ("drm/msm: fix unbalanced pm_runtime_enable in adreno_gpu_{init, cleanup}") intended to fix. Therefore, instead check whether runtime PM is still enabled, and only disable it in that case. Fixes: 17e822f7591f ("drm/msm: fix unbalanced pm_runtime_enable in adreno_gpu_{init, cleanup}") Signed-off-by: Maximilian Luz Tested-by: Bjorn Andersson Reviewed-by: Rob Clark Link: https://lore.kernel.org/r/20220606211305.189585-1-luzmaximilian@gmail.com Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index 1219f71629a5..1ced7b108f2c 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c @@ -1002,7 +1002,8 @@ void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu) for (i = 0; i < ARRAY_SIZE(adreno_gpu->info->fw); i++) release_firmware(adreno_gpu->fw[i]); - pm_runtime_disable(&priv->gpu_pdev->dev); + if (pm_runtime_enabled(&priv->gpu_pdev->dev)) + pm_runtime_disable(&priv->gpu_pdev->dev); msm_gpu_cleanup(&adreno_gpu->base); } -- 2.35.1