From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BE40C43457 for ; Fri, 9 Oct 2020 18:37:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7E8E222B9 for ; Fri, 9 Oct 2020 18:37:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="i2SNn6sN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732724AbgJIShP (ORCPT ); Fri, 9 Oct 2020 14:37:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730130AbgJISgm (ORCPT ); Fri, 9 Oct 2020 14:36:42 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63246C0613D5 for ; Fri, 9 Oct 2020 11:36:42 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id b19so4870185pld.0 for ; Fri, 09 Oct 2020 11:36:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RXaGCdzadhTSxJ90I/Q7ZO/dbk1lXiLeLP1YwXiDqbc=; b=i2SNn6sNaeePDINrDzF4Un/NDOxiB/WDjhMRR7QYro6nFfGDoYlgKzGa8iPs4M7m8b l/EdsCwFS7iNoU+1E5p429Nek58Q2uxCYySkwzwFS13mkgGopfmG7U/C3eZyPcnNVc4f QzdpUiLdxijdg8o32oY/xuVkpM01gyTBN0X5U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RXaGCdzadhTSxJ90I/Q7ZO/dbk1lXiLeLP1YwXiDqbc=; b=tZsAlbRwuapGa4WhKR8gR8dN67pSeaeRYo7xgHkA56w4NK78vn2sqfKBmmS0I+GzK0 +45S43mkcRWISDqcA+OIbaVnHCdOUNBboANPdByX3x3CSHVugzmO8ayz4TLhELsecO5U EzPdt7BRiHnpCkQp7OJf3vJ74U1R27q/z2HToRJBObkhWNKUr9eYcL2mLi3EteaXY++x Ux9t0XE4UmTWPzjIuMPkh0fPf1xkFWZQhKc/8gXuh4mm9mjJJJtSUiqQNmjvXkS7eqmY XhkRv/gGAWzUdPD/PbEeoDSrN2VbR2zwy+e6wfU81/EsuZ90enzsBXg5uK3RLMNk5UwH sG9g== X-Gm-Message-State: AOAM532iRVQXf0jR12XiD1xkHFFPNBXiKMDaCCLf0MRA/U80JHoRMF4q bzR5WBRCSPqnW8+nOcp6Kj6vFQ== X-Google-Smtp-Source: ABdhPJwDW/lNdv+r3y/iNReVvFRv6ckaeyTfiWYvv2Vr4ysFwwuvuddVKMCxbkvFjq8v7CAlF3fLxQ== X-Received: by 2002:a17:902:7687:b029:d2:8d1f:1079 with SMTP id m7-20020a1709027687b02900d28d1f1079mr13523250pll.2.1602268601939; Fri, 09 Oct 2020 11:36:41 -0700 (PDT) Received: from localhost ([2620:15c:202:1:f693:9fff:fef4:e70a]) by smtp.gmail.com with ESMTPSA id bj17sm12423393pjb.15.2020.10.09.11.36.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Oct 2020 11:36:41 -0700 (PDT) Date: Fri, 9 Oct 2020 11:36:40 -0700 From: mka@chromium.org To: Akhil P Oommen Cc: freedreno@lists.freedesktop.org, robh@kernel.org, robdclark@gmail.com, linux-arm-msm@vger.kernel.org, dri-devel@freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [2/2] drm/msm: Add support for GPU cooling Message-ID: <20201009183640.GB1292413@google.com> References: <1602176947-17385-2-git-send-email-akhilpo@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1602176947-17385-2-git-send-email-akhilpo@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Hi Akhil, On Thu, Oct 08, 2020 at 10:39:07PM +0530, Akhil P Oommen wrote: > Register GPU as a devfreq cooling device so that it can be passively > cooled by the thermal framework. > > Signed-off-by: Akhil P Oommen > --- > drivers/gpu/drm/msm/msm_gpu.c | 13 ++++++++++++- > drivers/gpu/drm/msm/msm_gpu.h | 2 ++ > 2 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c > index 55d1648..93ffd66 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 > #include > > @@ -107,9 +108,18 @@ static void msm_devfreq_init(struct msm_gpu *gpu) > if (IS_ERR(gpu->devfreq.devfreq)) { > DRM_DEV_ERROR(&gpu->pdev->dev, "Couldn't initialize GPU devfreq\n"); > gpu->devfreq.devfreq = NULL; > + return; > } > > devfreq_suspend_device(gpu->devfreq.devfreq); > + > + gpu->cooling = of_devfreq_cooling_register(gpu->pdev->dev.of_node, > + gpu->devfreq.devfreq); > + if (IS_ERR(gpu->cooling)) { > + DRM_DEV_ERROR(&gpu->pdev->dev, > + "Couldn't register GPU cooling device\n"); > + gpu->cooling = NULL; > + } > } > > static int enable_pwrrail(struct msm_gpu *gpu) > @@ -926,7 +936,6 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, > > msm_devfreq_init(gpu); > > - > gpu->aspace = gpu->funcs->create_address_space(gpu, pdev); > > if (gpu->aspace == NULL) > @@ -1005,4 +1014,6 @@ void msm_gpu_cleanup(struct msm_gpu *gpu) > gpu->aspace->mmu->funcs->detach(gpu->aspace->mmu); > msm_gem_address_space_put(gpu->aspace); > } > + > + devfreq_cooling_unregister(gpu->cooling); Resources should be released in reverse order, otherwise the cooling device could use resources that have already been freed. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECA03C433DF for ; Fri, 9 Oct 2020 18:36:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8AE0C22284 for ; Fri, 9 Oct 2020 18:36:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="i2SNn6sN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8AE0C22284 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C72F26ED81; Fri, 9 Oct 2020 18:36:43 +0000 (UTC) Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by gabe.freedesktop.org (Postfix) with ESMTPS id 638DD6ECEE for ; Fri, 9 Oct 2020 18:36:42 +0000 (UTC) Received: by mail-pl1-x643.google.com with SMTP id o8so4868260pll.4 for ; Fri, 09 Oct 2020 11:36:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RXaGCdzadhTSxJ90I/Q7ZO/dbk1lXiLeLP1YwXiDqbc=; b=i2SNn6sNaeePDINrDzF4Un/NDOxiB/WDjhMRR7QYro6nFfGDoYlgKzGa8iPs4M7m8b l/EdsCwFS7iNoU+1E5p429Nek58Q2uxCYySkwzwFS13mkgGopfmG7U/C3eZyPcnNVc4f QzdpUiLdxijdg8o32oY/xuVkpM01gyTBN0X5U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RXaGCdzadhTSxJ90I/Q7ZO/dbk1lXiLeLP1YwXiDqbc=; b=s67TSu2M+M59BMpuTwBVKlrJD5jSR+Ik1H5SwIC8FrVMCYpS0fkHVb5RBr+3yO9lkh w1SgxeEGQURa/qA5tSnSJLS9mDZ3ehw5jBqNeFdWBt+KpRLU1eTk3zom8Fszi9YkkL1P z7XnDiCC2ihRkMvQ5U5Ttn4WZp64/suA7hgDrSbOmc1N2vqQmOK/VatFnqctZnfKu952 3aBxzpfglFukcmiT6nXVsqcIpvVTxXY1u5WXJrCvTmOSn166y6vcfleXWcsRmhnfX6GP y0nlSfmVQFlKDj3VhFErZXb9//4YR1YuiWvAmJk4Ykc6iAkyuMPQ6F0kYv0P1XqSmYw1 ZU7w== X-Gm-Message-State: AOAM530g5BIy3pCRXZD5q7YB4quTJ3iHFvJW6c6iPdy+3Up77FRoeShP Id26bKLhsOlyvy/q5K320kQxLA== X-Google-Smtp-Source: ABdhPJwDW/lNdv+r3y/iNReVvFRv6ckaeyTfiWYvv2Vr4ysFwwuvuddVKMCxbkvFjq8v7CAlF3fLxQ== X-Received: by 2002:a17:902:7687:b029:d2:8d1f:1079 with SMTP id m7-20020a1709027687b02900d28d1f1079mr13523250pll.2.1602268601939; Fri, 09 Oct 2020 11:36:41 -0700 (PDT) Received: from localhost ([2620:15c:202:1:f693:9fff:fef4:e70a]) by smtp.gmail.com with ESMTPSA id bj17sm12423393pjb.15.2020.10.09.11.36.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Oct 2020 11:36:41 -0700 (PDT) Date: Fri, 9 Oct 2020 11:36:40 -0700 From: mka@chromium.org To: Akhil P Oommen Subject: Re: [2/2] drm/msm: Add support for GPU cooling Message-ID: <20201009183640.GB1292413@google.com> References: <1602176947-17385-2-git-send-email-akhilpo@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1602176947-17385-2-git-send-email-akhilpo@codeaurora.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@freedesktop.org, freedreno@lists.freedesktop.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Akhil, On Thu, Oct 08, 2020 at 10:39:07PM +0530, Akhil P Oommen wrote: > Register GPU as a devfreq cooling device so that it can be passively > cooled by the thermal framework. > > Signed-off-by: Akhil P Oommen > --- > drivers/gpu/drm/msm/msm_gpu.c | 13 ++++++++++++- > drivers/gpu/drm/msm/msm_gpu.h | 2 ++ > 2 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c > index 55d1648..93ffd66 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 > #include > > @@ -107,9 +108,18 @@ static void msm_devfreq_init(struct msm_gpu *gpu) > if (IS_ERR(gpu->devfreq.devfreq)) { > DRM_DEV_ERROR(&gpu->pdev->dev, "Couldn't initialize GPU devfreq\n"); > gpu->devfreq.devfreq = NULL; > + return; > } > > devfreq_suspend_device(gpu->devfreq.devfreq); > + > + gpu->cooling = of_devfreq_cooling_register(gpu->pdev->dev.of_node, > + gpu->devfreq.devfreq); > + if (IS_ERR(gpu->cooling)) { > + DRM_DEV_ERROR(&gpu->pdev->dev, > + "Couldn't register GPU cooling device\n"); > + gpu->cooling = NULL; > + } > } > > static int enable_pwrrail(struct msm_gpu *gpu) > @@ -926,7 +936,6 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, > > msm_devfreq_init(gpu); > > - > gpu->aspace = gpu->funcs->create_address_space(gpu, pdev); > > if (gpu->aspace == NULL) > @@ -1005,4 +1014,6 @@ void msm_gpu_cleanup(struct msm_gpu *gpu) > gpu->aspace->mmu->funcs->detach(gpu->aspace->mmu); > msm_gem_address_space_put(gpu->aspace); > } > + > + devfreq_cooling_unregister(gpu->cooling); Resources should be released in reverse order, otherwise the cooling device could use resources that have already been freed. _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel