Re: [PATCH 16/24] drm/amdkfd: use bit operation set debug trap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2023-11-10 14:08, Yat Sin, David wrote:
[AMD Official Use Only - General]

-----Original Message-----
From: Zhu, James <James.Zhu@xxxxxxx>
Sent: Friday, November 3, 2023 9:12 AM
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
Cc: Kuehling, Felix <Felix.Kuehling@xxxxxxx>; Greathouse, Joseph
<Joseph.Greathouse@xxxxxxx>; Yat Sin, David <David.YatSin@xxxxxxx>; Zhu,
James <James.Zhu@xxxxxxx>
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@xxxxxxx>
---
  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



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux