[PATCH 16/24] drm/amdkfd: use bit operation set debug trap
James Zhu
jamesz at amd.com
Mon Nov 20 16:21:05 UTC 2023
On 2023-11-10 14:08, Yat Sin, David wrote:
> [AMD Official Use Only - General]
>
>> -----Original Message-----
>> From: Zhu, James <James.Zhu at amd.com>
>> Sent: Friday, November 3, 2023 9:12 AM
>> To: amd-gfx at lists.freedesktop.org
>> Cc: Kuehling, Felix <Felix.Kuehling at amd.com>; Greathouse, Joseph
>> <Joseph.Greathouse at amd.com>; Yat Sin, David <David.YatSin at amd.com>; Zhu,
>> James <James.Zhu at amd.com>
>> Subject: [PATCH 16/24] drm/amdkfd: use bit operation set debug trap
>>
>> 1st level TMA's 2nd byte which used for trap type setting, to use bit operation to
>> change selected bit only.
>>
>> Signed-off-by: James Zhu <James.Zhu at amd.com>
>> ---
>> drivers/gpu/drm/amd/amdkfd/kfd_process.c | 16 +++++++++++++---
>> 1 file changed, 13 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
>> b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
>> index fbf053001af9..a0b729c65a7c 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
>> @@ -1434,13 +1434,23 @@ bool kfd_process_xnack_mode(struct kfd_process
>> *p, bool supported)
>> return true;
>> }
>>
>> +/* bit offset in 1st-level TMA's 2nd byte which used for
>> +KFD_TRAP_TYPE_BIT */ enum KFD_TRAP_TYPE_BIT {
> Nit pick. New line after comment
[JZ] something wrong with your email. it is new line originally,
>> + KFD_TRAP_TYPE_DEBUG = 0, /* bit 0 for debug trap */
>> + KFD_TRAP_TYPE_HOST,
>> + KFD_TRAP_TYPE_STOCHASTIC,
>> +};
>> +
>> void kfd_process_set_trap_debug_flag(struct qcm_process_device *qpd,
>> bool enabled)
>> {
>> if (qpd->cwsr_kaddr) {
>> - uint64_t *tma =
>> - (uint64_t *)(qpd->cwsr_kaddr +
>> KFD_CWSR_TMA_OFFSET);
>> - tma[2] = enabled;
>> + volatile unsigned long *tma =
>> + (volatile unsigned long *)(qpd->cwsr_kaddr +
>> KFD_CWSR_TMA_OFFSET);
>> + if (enabled)
>> + set_bit(KFD_TRAP_TYPE_DEBUG, &tma[2]);
>> + else
>> + clear_bit(KFD_TRAP_TYPE_DEBUG, &tma[2]);
>> }
>> }
>>
>> --
>> 2.25.1
More information about the amd-gfx
mailing list