From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: unlisted-recipients:; (no To-header on input)
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
Andi Shyti <andi.shyti@linux.intel.com>,
Chris Wilson <chris.p.wilson@intel.com>,
Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
Jani Nikula <jani.nikula@linux.intel.com>,
John Harrison <John.C.Harrison@Intel.com>,
Jonathan Corbet <corbet@lwn.net>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Matthew Brost <matthew.brost@intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
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 [thread overview]
Message-ID: <997567dcc2b5942afde093d92d0666948e66d83a.1662708705.git.mchehab@kernel.org> (raw)
In-Reply-To: <cover.1662708705.git.mchehab@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 <mchehab@kernel.org>
---
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
next prev parent reply other threads:[~2022-09-09 7:38 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-09 7:34 [PATCH v3 00/37] drm/i915: fix kernel-doc issues Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 01/37] drm/i915: fix kernel-doc trivial warnings on i915/*.[ch] files Mauro Carvalho Chehab
2022-09-16 14:03 ` [Intel-gfx] " Gwan-gyeong Mun
2022-09-26 9:19 ` Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 02/37] drm/i915: display: fix kernel-doc markup warnings Mauro Carvalho Chehab
2022-09-16 12:35 ` [Intel-gfx] " Gwan-gyeong Mun
2022-09-09 7:34 ` [PATCH v3 03/37] drm/i915: gt: fix some Kernel-doc issues Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 04/37] drm/i915: gvt: fix kernel-doc trivial warnings Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 05/37] drm/i915: gem: fix some Kernel-doc issues Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 06/37] drm/i915: intel_wakeref.h: fix some kernel-doc markups Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 07/37] drm/i915: i915_gem_ttm: fix a kernel-doc markup Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 08/37] drm/i915: i915_gem_ttm_pm.c: fix kernel-doc markups Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 09/37] drm/i915: gem: add kernel-doc description for some function parameters Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 10/37] drm/i915: i915_gpu_error.c: document dump_flags Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 11/37] drm/i915: document kernel-doc trivial issues Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 12/37] drm/i915: intel_dp_link_training.c: fix kernel-doc markup Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 13/37] drm/i915: intel_fb: fix a kernel-doc issue with Sphinx Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 14/37] drm/i915: skl_scaler: fix return value kernel-doc markup Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 15/37] drm/i915: intel_pm.c: fix some ascii artwork at kernel-doc Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 16/37] drm/i915: i915_gem_region.h: fix i915_gem_apply_to_region_ops doc Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 17/37] drm/i915: i915_gem_wait.c: fix a kernel-doc markup Mauro Carvalho Chehab
2022-09-12 1:22 ` Andi Shyti
2022-09-09 7:34 ` [PATCH v3 18/37] drm/i915: fix i915_gem_ttm_move.c DOC: markup Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 19/37] drm/i915: stop using kernel-doc markups for something else Mauro Carvalho Chehab
2022-09-12 1:23 ` Andi Shyti
2022-09-12 15:09 ` Matt Roper
2022-09-12 16:47 ` Mauro Carvalho Chehab
2022-09-12 17:19 ` Matt Roper
2022-09-26 8:25 ` [Intel-gfx] " Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 20/37] drm/i915: dvo_ch7xxx.c: use SPDX header Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 21/37] drm/i915: dvo_sil164.c: " Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 22/37] drm/i915: i915_vma_resource.c: fix some kernel-doc markups Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 23/37] drm/i915: i915_gem.c fix a kernel-doc issue Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 24/37] drm/i915: i915_scatterlist.h: fix some kernel-doc markups Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 25/37] drm/i915: i915_deps: use a shorter title markup Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 26/37] docs: gpu: i915.rst: display: add kernel-doc markups Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 27/37] docs: gpu: i915.rst: gt: add more " Mauro Carvalho Chehab
2022-09-09 9:06 ` [Intel-gfx] " Rodrigo Vivi
2022-09-26 9:45 ` Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 28/37] docs: gpu: i915.rst: GuC: " Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 29/37] docs: gpu: i915.rst: GVT: " Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 30/37] docs: gpu: i915.rst: PM: " Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 31/37] docs: gpu: i915.rst: GEM/TTM: " Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 32/37] docs: gpu: i915.rst: add the remaining kernel-doc markup files Mauro Carvalho Chehab
2022-09-09 9:10 ` [Intel-gfx] " Rodrigo Vivi
2022-09-09 7:34 ` [PATCH v3 33/37] drm/i915 i915_gem_object_types.h: document struct i915_lut_handle Mauro Carvalho Chehab
2022-09-12 1:25 ` Andi Shyti
2022-09-09 7:34 ` [PATCH v3 34/37] drm/i915: document struct drm_i915_gem_object Mauro Carvalho Chehab
2022-09-09 7:34 ` Mauro Carvalho Chehab [this message]
2022-09-09 9:12 ` [PATCH v3 35/37] drm/i915: add descriptions for some RPM macros at intel_gt_pm.h Rodrigo Vivi
2022-09-12 1:27 ` Andi Shyti
2022-09-09 7:34 ` [PATCH v3 36/37] drm/i915: add GuC functions to the documentation Mauro Carvalho Chehab
2022-09-09 7:34 ` [PATCH v3 37/37] drm/i915: be consistent with kernel-doc function declaration Mauro Carvalho Chehab
2022-09-09 9:13 ` Rodrigo Vivi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=997567dcc2b5942afde093d92d0666948e66d83a.1662708705.git.mchehab@kernel.org \
--to=mchehab@kernel.org \
--cc=John.C.Harrison@Intel.com \
--cc=airlied@linux.ie \
--cc=andi.shyti@linux.intel.com \
--cc=chris.p.wilson@intel.com \
--cc=corbet@lwn.net \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=mripard@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®