Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1614249rwn; Fri, 9 Sep 2022 00:54:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR4GMw4tTHcRh0mLVIjTKCkhn1iVCbbyNMyTRkDAPVWizEbpEAE/MIsbNPpg4FUH4j5jqeqC X-Received: by 2002:a05:6512:1293:b0:494:9bf8:d71e with SMTP id u19-20020a056512129300b004949bf8d71emr4225001lfs.558.1662710051962; Fri, 09 Sep 2022 00:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662710051; cv=none; d=google.com; s=arc-20160816; b=AhkPQ6Y+jirsd7SK4topwjHvTsX7FmYgOUOaTcgTNQzHWUwbQ+B5q28dRVCbRXrFgj Ttsoty1Cn35IIoyfdRcUyCyrngXn4PQC817LasbyLk+tcRJ+bqOYMEqU4FIZw0V4NHl6 gs1nmmTLx4w7HZsQJYZGOlupbiHKMAv37cSyzTfIX6V5qsInLkOgV6KxkoFh7fX19qlw RdjOReEDv03+g/suMUiOCm7+F2hK9UU9mH4DWEyebhgvQUiTwqZLIdafj5Umb0urk0YL vyQk60zyBv51/IX7AQSE4Q+NEEME3pzGRqXDx8hNjzNXi7sjhtrsgNBwIzZqK3snEfLG fwvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=oFuoNWb6smW8r9cQ1YYUGobRK2DD5iMUVL9ENWVrWEw=; b=SPZdMla45KdKHVw9eXeZoizo5Fwsvv1QWohKSITIWYhsCJTiSqr6OBgy87eMp5n1oY NQJvqtWNILAhbT0DgCYnwvNnuzaZ8UMkZcx9EIDfHXXG0QMFfPEFtIqgDn/em/JpI4em 1rMgKeNmOOOl2HowEg/2PIveB3awIaxzQthAxH++iDKR24Kbkilj5eqdU7ThrVhii+T/ oEgTA9EsCZ7bMLivmH+Ki0vZF9Dro0Ur7H1hIsfHaM1AokT/dsB5TxZ6IpSOz/m82Kqb nbIFIqW230edJaNHuKrw6k33OXO37X7BsXEICjmagXAf4R0yma8QGESrvA8TRo/2lLpn VCxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=neYdglhM; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t9-20020a19dc09000000b00497a9783cffsi516911lfg.252.2022.09.09.00.53.42; Fri, 09 Sep 2022 00:54:11 -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=fail header.i=@kernel.org header.s=k20201202 header.b=neYdglhM; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231470AbiIIHii (ORCPT + 99 others); Fri, 9 Sep 2022 03:38:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231451AbiIIHhR (ORCPT ); Fri, 9 Sep 2022 03:37:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C730DFFD; Fri, 9 Sep 2022 00:35:30 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 1428E61F18; Fri, 9 Sep 2022 07:35:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73D0BC433D7; Fri, 9 Sep 2022 07:35:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662708901; bh=mx5m4W9+rdgIoXtdj6jbmkTk0F02+LuCdNxfXOHm9IM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=neYdglhMQDQLCT7D0utjejJwIG0jgf1mkOw1zGaOZb+DAoo5wET86qgH8etJlRac9 Mbji4Ow248ahJkXdspRMD3VLAGT9VS46aalps+tSXbsoSQHwDqrtm98r9NI5aaei3n VtjXAaXGON19KsPuLjbOitce6oOQAsjgS99tN+zFT4b77HZtwFLa3ef/EAehdAGKn4 K5stHLWtRxI3oqjezRo6+NBcroFNvawPjoFevKl5lJxBc8icCKV+H14cM/UchRsA8y 1El/3ybrDCl8eMOhKhQIktnHb9dTkBsgXMsYSL6BgdMtoHjux6TX0qSnXterXQRhx4 Oqhi3J4LyXWsQ== Received: from mchehab by mail.kernel.org with local (Exim 4.95) (envelope-from ) id 1oWYXH-007FHr-LM; Fri, 09 Sep 2022 09:34:47 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , "Rodrigo Vivi" , Andi Shyti , Chris Wilson , Daniel Vetter , David Airlie , Jani Nikula , John Harrison , Jonathan Corbet , Joonas Lahtinen , Maarten Lankhorst , Matthew Brost , Maxime Ripard , Thomas Zimmermann , Tvrtko Ursulin , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 35/37] drm/i915: add descriptions for some RPM macros at intel_gt_pm.h Date: Fri, 9 Sep 2022 09:34:42 +0200 Message-Id: <997567dcc2b5942afde093d92d0666948e66d83a.1662708705.git.mchehab@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The intel_gt_pm.h file contains some convenient macros to be used in GT code in order to get/put runtime PM references and for checking them. Add descriptions based on the ones at intel_wakeref.h and intel_runtime_pm.c. Signed-off-by: Mauro Carvalho Chehab --- To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH v3 00/37] at: https://lore.kernel.org/all/cover.1662708705.git.mchehab@kernel.org/ Documentation/gpu/i915.rst | 2 ++ drivers/gpu/drm/i915/gt/intel_gt_pm.h | 51 +++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/Documentation/gpu/i915.rst b/Documentation/gpu/i915.rst index 7f5cd01ed398..59c532fe0332 100644 --- a/Documentation/gpu/i915.rst +++ b/Documentation/gpu/i915.rst @@ -446,6 +446,8 @@ Graphics Translation Tables Other GT functionality ---------------------- +.. kernel-doc:: drivers/gpu/drm/i915/gt/intel_gt_pm.h + .. kernel-doc:: drivers/gpu/drm/i915/gt/intel_context.h .. kernel-doc:: drivers/gpu/drm/i915/gt/intel_gsc.h diff --git a/drivers/gpu/drm/i915/gt/intel_gt_pm.h b/drivers/gpu/drm/i915/gt/intel_gt_pm.h index 6c9a46452364..7847e15d102e 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt_pm.h +++ b/drivers/gpu/drm/i915/gt/intel_gt_pm.h @@ -11,21 +11,57 @@ #include "intel_gt_types.h" #include "intel_wakeref.h" +/** + * intel_gt_pm_is_awake: Query whether the runtime PM is awake held + * + * @gt: pointer to the graphics engine + * + * Returns: true if a runtime pm reference is currently held and the GT is + * awake. + */ static inline bool intel_gt_pm_is_awake(const struct intel_gt *gt) { return intel_wakeref_is_active(>->wakeref); } +/** + * intel_gt_pm_get: grab a runtime PM reference ensuring that GT is powered up + * @gt: pointer to the graphics engine + * + * Any runtime pm reference obtained by this function must have a symmetric + * call to intel_gt_pm_put() to release the reference again. + * + * Note that this is allowed to fail, in which case the runtime-pm wakeref + * will be released and the acquisition unwound. + */ static inline void intel_gt_pm_get(struct intel_gt *gt) { intel_wakeref_get(>->wakeref); } +/** + * __intel_gt_pm_get: Acquire the runtime PM reference again + * @gt: pointer to the graphics engine which contains the wakeref + * + * Increment the PM reference counter, only valid if it is already held by + * the caller. + * + * See intel_gt_pm_get(). + */ static inline void __intel_gt_pm_get(struct intel_gt *gt) { __intel_wakeref_get(>->wakeref); } +/** + * intel_gt_pm_get_if_awake: Acquire the runtime PM reference if active + * @gt: pointer to the graphics engine which contains the PM reference + * + * Acquire a hold on the PM reference, but only if the GT is already + * active. + * + * Returns: true if the wakeref was acquired, false otherwise. + */ static inline bool intel_gt_pm_get_if_awake(struct intel_gt *gt) { return intel_wakeref_get_if_active(>->wakeref); @@ -36,6 +72,14 @@ static inline void intel_gt_pm_might_get(struct intel_gt *gt) intel_wakeref_might_get(>->wakeref); } +/** + * intel_gt_pm_put: Release the runtime PM reference + * @gt: pointer to the graphics engine which contains the PM reference + * + * Release our hold on the runtime PM for GT. + * + * It might power down the GT right away if this is the last reference. + */ static inline void intel_gt_pm_put(struct intel_gt *gt) { intel_wakeref_put(>->wakeref); @@ -51,6 +95,13 @@ static inline void intel_gt_pm_might_put(struct intel_gt *gt) intel_wakeref_might_put(>->wakeref); } +/** + * with_intel_gt_pm - get a GT reference ensuring that GT is powered up, + * run some code and then put the reference away. + * + * @gt: pointer to the gt + * @tmp: pointer to a temporary wakeref. + */ #define with_intel_gt_pm(gt, tmp) \ for (tmp = 1, intel_gt_pm_get(gt); tmp; \ intel_gt_pm_put(gt), tmp = 0) -- 2.37.3