drm/amdgpu: Add documentation to some parts of the AMDGPU ring and wb
Subsystems (2)
PATCH 1/1 drm/amdgpu: Add documentation to some parts of the AMDGPU ring and wb
Add some random documentation associated with the ring buffer manipulations and writeback.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 29 ++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 37 ++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +28 -1
@@ -522,9 +522,36 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv);struct amdgpu_wb {struct amdgpu_bo *wb_obj; + +/** +* @wb: +* +* Pointer to the first writeback slot. In terms of CPU address +* this value can be access directly by using the offset as an +* index. For the GPU address, it is necessary to use gpu_addr and +* the offset. +*/ volatile uint32_t *wb; + +/** +* @gpu_addr: +* +* Writeback base address in the GPU. +*/ uint64_t gpu_addr; -u32 num_wb;/* Number of wb slots actually reserved for amdgpu. */ + +/** +* @num_wb: +* +* Number of writeback slots actually reserved for amdgpu. +*/ +u32 num_wb; + +/** +* @used: +* +* Track the writeback slot already used. +*/ unsigned long used[DIV_ROUND_UP (AMDGPU_MAX_WB ,BITS_PER_LONG )];spinlock_t lock; };
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +37 -0
@@ -241,6 +241,9 @@ struct amdgpu_ring_funcs {bool (*is_guilty)(struct amdgpu_ring *ring); }; +/** +* amdgpu_ring - Holds ring information +*/ struct amdgpu_ring {struct amdgpu_device *adev;const struct amdgpu_ring_funcs *funcs;
@@ -255,10 +258,44 @@ struct amdgpu_ring {u64 wptr;u64 wptr_old;unsigned ring_size; + +/** +* @max_dw: +* +* Maximum number of DWord for ring allocation. This information is +* provided at the ring initialization time, and each IP block can +* specify a specific value. +*/ unsigned max_dw; + +/** +* @count_dw: +* +* Count DWords: this value starts with the maximum amount of DWords +* supported by the ring. This value is updated based on the ring +* manipulation. +*/ int count_dw;uint64_t gpu_addr; + +/** +* @ptr_mask: +* +* Some IPs provide support for 64-bit pointers and others for 32-bit +* only; this behavior is component-specific and defined by the field +* support_64bit_ptr. If the IP block supports 64-bits, the mask +* 0xffffffffffffffff is set; otherwise, this value assumes buf_mask. +* Notice that this field is used to keep wptr under a valid range. +*/ uint64_t ptr_mask; + +/** +* @buf_mask: +* +* Buffer mask is a value used to keep wptr count under its +* thresholding. Buffer mask initialized during the ring buffer +* initialization time, and it is defined as (ring_size / 4) -1. +*/ uint32_t buf_mask;u32 idx;u32 xcc_id;
Signature · 1 line
2.49.0
Quoted 14 lines · Rodrigo Siqueira
Add some random documentation associated with the ring buffer manipulations and writeback.
Signed-off-by Rodrigo Siqueira <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 29 ++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 37 ++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu.h int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv); · line 530
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6
-0@@ -522,9 +522,36 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv);struct amdgpu_wb {struct amdgpu_bo *wb_obj; + +/** +* @wb: +* +* Pointer to the first writeback slot. In terms of CPU address +* this value can be access directly by using the offset as an
'accessed' not 'access '
right?
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6
-0+* index. For the GPU address, it is necessary to use gpu_addr and +* the offset. +*/ volatile uint32_t *wb; + +/** +* @gpu_addr:
drivers/gpu/drm/amd/amdgpu/amdgpu.h int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv); · line 546
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +8
-1+* +* Writeback base address in the GPU. +*/ uint64_t gpu_addr; -u32 num_wb;/* Number of wb slots actually reserved for amdgpu. */ + +/** +* @num_wb: +* +* Number of writeback slots actually reserved for amdgpu.
I don't think you need the word actually
Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +8
-0+*/ +u32 num_wb; + +/** +* @used: +* +* Track the writeback slot already used. +*/ unsigned long used[DIV_ROUND_UP (AMDGPU_MAX_WB ,BITS_PER_LONG )];spinlock_t lock; };drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +3
-0@@ -241,6 +241,9 @@ struct amdgpu_ring_funcs {bool (*is_guilty)(struct amdgpu_ring *ring); }; +/** +* amdgpu_ring - Holds ring information +*/ struct amdgpu_ring {struct amdgpu_device *adev;const struct amdgpu_ring_funcs *funcs;
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h struct amdgpu_ring { · line 265
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +5
-0@@ -255,10 +258,44 @@ struct amdgpu_ring {u64 wptr;u64 wptr_old;unsigned ring_size; + +/** +* @max_dw: +* +* Maximum number of DWord for ring allocation. This information is
DWords
Quoted 36 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +29
-0+* provided at the ring initialization time, and each IP block can +* specify a specific value. +*/ unsigned max_dw; + +/** +* @count_dw: +* +* Count DWords: this value starts with the maximum amount of DWords +* supported by the ring. This value is updated based on the ring +* manipulation. +*/ int count_dw;uint64_t gpu_addr; + +/** +* @ptr_mask: +* +* Some IPs provide support for 64-bit pointers and others for 32-bit +* only; this behavior is component-specific and defined by the field +* support_64bit_ptr. If the IP block supports 64-bits, the mask +* 0xffffffffffffffff is set; otherwise, this value assumes buf_mask. +* Notice that this field is used to keep wptr under a valid range. +*/ uint64_t ptr_mask; + +/** +* @buf_mask: +* +* Buffer mask is a value used to keep wptr count under its +* thresholding. Buffer mask initialized during the ring buffer +* initialization time, and it is defined as (ring_size / 4) -1. +*/ uint32_t buf_mask;u32 idx;u32 xcc_id;
Quoted 112 lines · Mario Limonciello
Quoted 14 lines · Rodrigo Siqueira
Add some random documentation associated with the ring buffer manipulations and writeback.
Signed-off-by Rodrigo Siqueira <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 29 ++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 37 ++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu.h int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv); · line 529
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6
-0@@ -522,9 +522,36 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv);struct amdgpu_wb {struct amdgpu_bo *wb_obj; + +/** +* @wb: +* +* Pointer to the first writeback slot. In terms of CPU address +* this value can be access directly by using the offset as an 'accessed' not 'access '
right?
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6
-0+* index. For the GPU address, it is necessary to use gpu_addr and +* the offset. +*/ volatile uint32_t *wb; + +/** +* @gpu_addr: drivers/gpu/drm/amd/amdgpu/amdgpu.h int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv); · line 546
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +8
-1+* +* Writeback base address in the GPU. +*/ uint64_t gpu_addr; -u32 num_wb;/* Number of wb slots actually reserved for amdgpu. */ + +/** +* @num_wb: +* +* Number of writeback slots actually reserved for amdgpu. I don't think you need the word actually
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +8
-0+*/ +u32 num_wb; + +/** +* @used: +* +* Track the writeback slot already used. +*/ unsigned long used[DIV_ROUND_UP (AMDGPU_MAX_WB ,BITS_PER_LONG )];spinlock_t lock; };drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +3
-0@@ -241,6 +241,9 @@ struct amdgpu_ring_funcs {bool (*is_guilty)(struct amdgpu_ring *ring); }; +/** +* amdgpu_ring - Holds ring information +*/ struct amdgpu_ring {struct amdgpu_device *adev;const struct amdgpu_ring_funcs *funcs;drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h struct amdgpu_ring { · line 265
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +5
-0@@ -255,10 +258,44 @@ struct amdgpu_ring {u64 wptr;u64 wptr_old;unsigned ring_size; + +/** +* @max_dw: +* +* Maximum number of DWord for ring allocation. This information is DWords
Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +24
-0+* provided at the ring initialization time, and each IP block can +* specify a specific value. +*/ unsigned max_dw; + +/** +* @count_dw: +* +* Count DWords: this value starts with the maximum amount of DWords +* supported by the ring. This value is updated based on the ring +* manipulation. +*/ int count_dw;uint64_t gpu_addr; + +/** +* @ptr_mask: +* +* Some IPs provide support for 64-bit pointers and others for 32-bit +* only; this behavior is component-specific and defined by the field +* support_64bit_ptr. If the IP block supports 64-bits, the mask +* 0xffffffffffffffff is set; otherwise, this value assumes buf_mask. +* Notice that this field is used to keep wptr under a valid range. +*/ uint64_t ptr_mask; + +/** +* @buf_mask:
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h struct amdgpu_ring { · line 301
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +5
-0+* +* Buffer mask is a value used to keep wptr count under its +* thresholding. Buffer mask initialized during the ring buffer +* initialization time, and it is defined as (ring_size / 4) -1. +*/ uint32_t buf_mask;u32 idx;u32 xcc_id;
Thanks Mario, I'll send a V2 with your suggestions.
Signature · 1 line
Rodrigo Siqueira