drm/amdgpu: prepare map process for multi-process debug devices

Unlike single process debug devices, multi-process debug devices allow
debug mode setting per-VMID (non-device-global).

Because the HWS manages PASID-VMID mapping, the new MAP_PROCESS API allows
the KFD to forward the required SPI debug register write requests.

To request a new debug mode setting change, the KFD must be able to
preempt all queues then remap all queues with these new setting
requests for MAP_PROCESS to take effect.

Note that by default, trap enablement in non-debug mode must be disabled
for performance reasons for multi-process debug devices due to setup
overhead in FW.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Jonathan Kim
2022-04-04 13:38:11 -04:00
committed by Alex Deucher
parent 97ae3c8cce
commit 0de4ec9a03
6 changed files with 87 additions and 0 deletions

View File

@@ -36,6 +36,7 @@
#include "kfd_kernel_queue.h"
#include "amdgpu_amdkfd.h"
#include "mes_api_def.h"
#include "kfd_debug.h"
/* Size of the per-pipe EOP queue */
#define CIK_HPD_EOP_BYTES_LOG2 11
@@ -2594,6 +2595,56 @@ out_unlock:
return r;
}
int debug_lock_and_unmap(struct device_queue_manager *dqm)
{
int r;
if (dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS) {
pr_err("Unsupported on sched_policy: %i\n", dqm->sched_policy);
return -EINVAL;
}
if (!kfd_dbg_is_per_vmid_supported(dqm->dev))
return 0;
dqm_lock(dqm);
r = unmap_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0, 0, false);
if (r)
dqm_unlock(dqm);
return r;
}
int debug_map_and_unlock(struct device_queue_manager *dqm)
{
int r;
if (dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS) {
pr_err("Unsupported on sched_policy: %i\n", dqm->sched_policy);
return -EINVAL;
}
if (!kfd_dbg_is_per_vmid_supported(dqm->dev))
return 0;
r = map_queues_cpsch(dqm);
dqm_unlock(dqm);
return r;
}
int debug_refresh_runlist(struct device_queue_manager *dqm)
{
int r = debug_lock_and_unmap(dqm);
if (r)
return r;
return debug_map_and_unlock(dqm);
}
#if defined(CONFIG_DEBUG_FS)
static void seq_reg_dump(struct seq_file *m,