drm/amdgpu: add the kernel docs for alloc/free/valid range
Subsystems (2)
PATCH 1/1 drm/amdgpu: add the kernel docs for alloc/free/valid range
add kernel docs for the functions related to hmm_range.
functions:amdgpu_hmm_range_validamdgpu_hmm_range_allocamdgpu_hmm_range_free
--- drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +35 -0
@@ -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,19 @@ 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: 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. +* In case the @bo is passed as NULL, caller is responsible of taking care of +* the reference of associated bo. +* +* 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 +274,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. +* +* Return: void +*/ void amdgpu_hmm_range_free (struct amdgpu_hmm_range *range) {if (!range)
Signature · 1 line
2.34.1
Christian König
maintainerQuoted 37 lines · Sunil Khatri
add kernel docs for the functions related to
hmm_range.functions:
amdgpu_hmm_range_validamdgpu_hmm_range_allocamdgpu_hmm_range_freeSigned-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +13
-0@@ -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)
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c bool amdgpu_hmm_range_valid(struct amdgpu_hmm_range *range) · line 254
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +3
-0@@ -236,6 +249,19 @@ 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: buffer object to associate with this HMM range
"optional buffer object to ass.."
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c bool amdgpu_hmm_range_valid(struct amdgpu_hmm_range *range) · line 259
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +5
-0+* +* Allocates memory for amdgpu_hmm_range and associates it with the @bo passed. +* The reference count of the @bo is incremented. +* In case the @bo is passed as NULL, caller is responsible of taking care of +* the reference of associated bo.
I would drop that sentence, when NULL is passed in there is most likely no BO to reference.
Thanks,
Christian.
Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +5
-0+* +* 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) {drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +9
-0struct amdgpu_hmm_range *range;@@ -248,6 +274,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. +* +* Return: void +*/ void amdgpu_hmm_range_free (struct amdgpu_hmm_range *range) {if (!range)
Quoted 41 lines · Christian König
Quoted 40 lines · Sunil Khatri
add kernel docs for the functions related to
hmm_range.functions:
amdgpu_hmm_range_validamdgpu_hmm_range_allocamdgpu_hmm_range_freeSigned-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +13
-0@@ -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,19 @@ bool amdgpu_hmm_range_valid(struct amdgpu_hmm_range *range) range->hmm_range.notifier_seq); }
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c bool amdgpu_hmm_range_valid(struct amdgpu_hmm_range *range) · line 254
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +3
-0+/** +* amdgpu_hmm_range_alloc - allocate and initialize an AMDGPU HMM range +* @bo: buffer object to associate with this HMM range "optional buffer object to ass.."
Sure
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c bool amdgpu_hmm_range_valid(struct amdgpu_hmm_range *range) · line 259
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +5
-0+* +* Allocates memory for amdgpu_hmm_range and associates it with the @bo passed. +* The reference count of the @bo is incremented. +* In case the @bo is passed as NULL, caller is responsible of taking care of +* the reference of associated bo. I would drop that sentence, when NULL is passed in there is most likely no BO to reference.
Thanks,
Christian.
Sure will make that change and send V2
regards
Sunil khatri
Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c +14
-0+* +* 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 +274,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. +* +* Return: void +*/ void amdgpu_hmm_range_free (struct amdgpu_hmm_range *range) {if (!range)