[AMD Official Use Only - General] I would recommend merging this with patch 16, but up to you. > -----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 17/24] drm/amdkfd: add setting trap pc sampling flag > > Add setting trap pc sampling flag. > > Signed-off-by: James Zhu <James.Zhu@xxxxxxx> > --- > drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 ++ > drivers/gpu/drm/amd/amdkfd/kfd_process.c | 13 +++++++++++++ > 2 files changed, 15 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > index 642558026d16..6670534f47b8 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h > @@ -1186,6 +1186,8 @@ void kfd_process_set_trap_handler(struct > qcm_process_device *qpd, > uint64_t tma_addr); > void kfd_process_set_trap_debug_flag(struct qcm_process_device *qpd, > bool enabled); > +void kfd_process_set_trap_pc_sampling_flag(struct qcm_process_device *qpd, > + enum kfd_ioctl_pc_sample_method method, > bool enabled); > > /* CWSR initialization */ > int kfd_process_init_cwsr_apu(struct kfd_process *process, struct file *filep); > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c > b/drivers/gpu/drm/amd/amdkfd/kfd_process.c > index a0b729c65a7c..d22d804f180d 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c > @@ -1454,6 +1454,19 @@ void kfd_process_set_trap_debug_flag(struct > qcm_process_device *qpd, > } > } > > +void kfd_process_set_trap_pc_sampling_flag(struct qcm_process_device *qpd, > + enum kfd_ioctl_pc_sample_method method, > bool enabled) { > + if (qpd->cwsr_kaddr) { > + volatile unsigned long *tma = > + (volatile unsigned long *)(qpd->cwsr_kaddr + > KFD_CWSR_TMA_OFFSET); > + if (enabled) > + set_bit(method, &tma[2]); > + else > + clear_bit(method, &tma[2]); > + } > +} > + > /* > * On return the kfd_process is fully operational and will be freed when the > * mm is released > -- > 2.25.1