drm/amdgpu: Apply IH Ptr mask after updating IH Read Ptr
Subsystems (2)
PATCH 1/1 drm/amdgpu: Apply IH Ptr mask after updating IH Read Ptr
Apply IH Ptr mask immediately after updating to IH Read ptr. Ideally the operation to update and mask should be atomic. This will ensure that Read Ptr points to a valid index in the IH ring buffer.
Signed-off-by Ramesh Errabolu <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/cik_ih.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/cz_ih.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/iceland_ih.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/si_ih.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/tonga_ih.c | 5 ++++- 6 files changed, 24 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c +4 -1
@@ -280,8 +280,11 @@ void amdgpu_ih_decode_iv_helper(struct amdgpu_device *adev, entry->src_data[2 ] = dw[6 ]; entry->src_data[3 ] = dw[7 ]; -/* wptr/rptr are in bytes! */ +/* Apply IH Ptr mask after adding sizeof(Intrpt) +* bytes to IH Read ptr +*/ ih->rptr +=32 ; + ih->rptr &= ih->ptr_mask; } uint64_t amdgpu_ih_decode_iv_ts_helper(struct amdgpu_ih_ring *ih, u32 rptr,
drivers/gpu/drm/amd/amdgpu/cik_ih.c +4 -1
@@ -265,8 +265,11 @@ static void cik_ih_decode_iv(struct amdgpu_device *adev, entry->vmid = (dw[2 ] >>8 ) &0xff ; entry->pasid = (dw[2 ] >>16 ) &0xffff ; -/* wptr/rptr are in bytes! */ +/* Apply IH Ptr mask after adding sizeof(Intrpt) +* bytes to IH Read ptr +*/ ih->rptr +=16 ; + ih->rptr &= ih->ptr_mask; }/**
drivers/gpu/drm/amd/amdgpu/cz_ih.c +4 -1
@@ -256,8 +256,11 @@ static void cz_ih_decode_iv(struct amdgpu_device *adev, entry->vmid = (dw[2 ] >>8 ) &0xff ; entry->pasid = (dw[2 ] >>16 ) &0xffff ; -/* wptr/rptr are in bytes! */ +/* Apply IH Ptr mask after adding sizeof(Intrpt) +* bytes to IH Read ptr +*/ ih->rptr +=16 ; + ih->rptr &= ih->ptr_mask; }/**
drivers/gpu/drm/amd/amdgpu/iceland_ih.c +4 -1
@@ -255,8 +255,11 @@ static void iceland_ih_decode_iv(struct amdgpu_device *adev, entry->vmid = (dw[2 ] >>8 ) &0xff ; entry->pasid = (dw[2 ] >>16 ) &0xffff ; -/* wptr/rptr are in bytes! */ +/* Apply IH Ptr mask after adding sizeof(Intrpt) +* bytes to IH Read ptr +*/ ih->rptr +=16 ; + ih->rptr &= ih->ptr_mask; }/**
drivers/gpu/drm/amd/amdgpu/si_ih.c +4 -0
@@ -147,7 +147,11 @@ static void si_ih_decode_iv(struct amdgpu_device *adev, entry->ring_id = dw[2 ] &0xff ; entry->vmid = (dw[2 ] >>8 ) &0xff ; +/* Apply IH Ptr mask after adding sizeof(Intrpt) +* bytes to IH Read ptr +*/ ih->rptr +=16 ; + ih->rptr &= ih->ptr_mask; } static void si_ih_set_rptr(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/tonga_ih.c +4 -1
@@ -259,8 +259,11 @@ static void tonga_ih_decode_iv(struct amdgpu_device *adev, entry->vmid = (dw[2 ] >>8 ) &0xff ; entry->pasid = (dw[2 ] >>16 ) &0xffff ; -/* wptr/rptr are in bytes! */ +/* Apply IH Ptr mask after adding sizeof(Intrpt) +* bytes to IH Read ptr +*/ ih->rptr +=16 ; + ih->rptr &= ih->ptr_mask; }/**
Signature · 1 line
2.34.1