From: "Christian König" <christian.koenig@amd.com>
To: Sunil Khatri <sunil.khatri@amd.com>,
Felix Kuehling <felix.kuehling@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
amd-gfx@lists.freedesktop.org
Subject: Re: [Patch v2] drm/amdgpu: add the kernel docs for alloc/free/valid range
Date: Wed, 15 Oct 2025 13:16:14 +0200 [thread overview]
Message-ID: <2c49cdc8-799b-42b4-a9d1-e48db5c1bec1@amd.com> (raw)
In-Reply-To: <20251014115420.522595-1-sunil.khatri@amd.com>
On 14.10.25 13:54, Sunil Khatri wrote:
> add kernel docs for the functions related to hmm_range.
>
> functions:
> amdgpu_hmm_range_valid
> amdgpu_hmm_range_alloc
> amdgpu_hmm_range_free
>
> Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c | 33 +++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c
> index 04f02e0c8bb3..d6f903a2d573 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c
> @@ -227,6 +227,19 @@ int amdgpu_hmm_range_get_pages(struct mmu_interval_notifier *notifier,
> return r;
> }
>
> +/**
> + * amdgpu_hmm_range_valid - check if an HMM range is still valid
> + * @range: pointer to the &struct amdgpu_hmm_range to validate
> + *
> + * Determines whether the given HMM range @range is still valid by
> + * checking for invalidations via the MMU notifier sequence. This is
> + * typically used to verify that the range has not been invalidated
> + * by concurrent address space updates before it is accessed.
> + *
> + * Return:
> + * * true if @range is valid and can be used safely
> + * * false if @range is NULL or has been invalidated
> + */
> bool amdgpu_hmm_range_valid(struct amdgpu_hmm_range *range)
> {
> if (!range)
> @@ -236,6 +249,17 @@ bool amdgpu_hmm_range_valid(struct amdgpu_hmm_range *range)
> range->hmm_range.notifier_seq);
> }
>
> +/**
> + * amdgpu_hmm_range_alloc - allocate and initialize an AMDGPU HMM range
> + * @bo: optional buffer object to associate with this HMM range
> + *
> + * Allocates memory for amdgpu_hmm_range and associates it with the @bo passed.
> + * The reference count of the @bo is incremented.
> + *
> + * Return:
> + * Pointer to a newly allocated struct amdgpu_hmm_range on success,
> + * or NULL if memory allocation fails.
> + */
> struct amdgpu_hmm_range *amdgpu_hmm_range_alloc(struct amdgpu_bo *bo)
> {
> struct amdgpu_hmm_range *range;
> @@ -248,6 +272,15 @@ struct amdgpu_hmm_range *amdgpu_hmm_range_alloc(struct amdgpu_bo *bo)
> return range;
> }
>
> +/**
> + * amdgpu_hmm_range_free - release an AMDGPU HMM range
> + * @range: pointer to the range object to free
> + *
> + * Releases all resources held by @range, including the associated
> + * hmm_pfns and the dropping reference of associated bo if any.
> + *
> + * Return: void
> + */
> void amdgpu_hmm_range_free(struct amdgpu_hmm_range *range)
> {
> if (!range)
prev parent reply other threads:[~2025-10-15 11:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 11:54 [Patch v2] drm/amdgpu: add the kernel docs for alloc/free/valid range Sunil Khatri
2025-10-15 11:16 ` Christian König [this message]
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=2c49cdc8-799b-42b4-a9d1-e48db5c1bec1@amd.com \
--to=christian.koenig@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=felix.kuehling@amd.com \
--cc=sunil.khatri@amd.com \
/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