Commit 6027b1bf authored by Yong Zhao's avatar Yong Zhao Committed by Alex Deucher

drm/amdkfd: Use hex print format for pasid

Since KFD pasid starts from 0x8000 (32768 in decimal), it is better
perceived as a hex number. Meanwhile, change the pasid type from
unsigned int to uint16_t to be consistent throughout the code.
Signed-off-by: default avatarYong Zhao <Yong.Zhao@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d19eb6ac
...@@ -282,7 +282,7 @@ static int kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p, ...@@ -282,7 +282,7 @@ static int kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p,
goto err_bind_process; goto err_bind_process;
} }
pr_debug("Creating queue for PASID %d on gpu 0x%x\n", pr_debug("Creating queue for PASID 0x%x on gpu 0x%x\n",
p->pasid, p->pasid,
dev->id); dev->id);
...@@ -332,7 +332,7 @@ static int kfd_ioctl_destroy_queue(struct file *filp, struct kfd_process *p, ...@@ -332,7 +332,7 @@ static int kfd_ioctl_destroy_queue(struct file *filp, struct kfd_process *p,
int retval; int retval;
struct kfd_ioctl_destroy_queue_args *args = data; struct kfd_ioctl_destroy_queue_args *args = data;
pr_debug("Destroying queue id %d for pasid %d\n", pr_debug("Destroying queue id %d for pasid 0x%x\n",
args->queue_id, args->queue_id,
p->pasid); p->pasid);
...@@ -378,7 +378,7 @@ static int kfd_ioctl_update_queue(struct file *filp, struct kfd_process *p, ...@@ -378,7 +378,7 @@ static int kfd_ioctl_update_queue(struct file *filp, struct kfd_process *p,
properties.queue_percent = args->queue_percentage; properties.queue_percent = args->queue_percentage;
properties.priority = args->queue_priority; properties.priority = args->queue_priority;
pr_debug("Updating queue id %d for pasid %d\n", pr_debug("Updating queue id %d for pasid 0x%x\n",
args->queue_id, p->pasid); args->queue_id, p->pasid);
mutex_lock(&p->mutex); mutex_lock(&p->mutex);
...@@ -855,7 +855,7 @@ static int kfd_ioctl_get_process_apertures(struct file *filp, ...@@ -855,7 +855,7 @@ static int kfd_ioctl_get_process_apertures(struct file *filp,
struct kfd_process_device_apertures *pAperture; struct kfd_process_device_apertures *pAperture;
struct kfd_process_device *pdd; struct kfd_process_device *pdd;
dev_dbg(kfd_device, "get apertures for PASID %d", p->pasid); dev_dbg(kfd_device, "get apertures for PASID 0x%x", p->pasid);
args->num_of_nodes = 0; args->num_of_nodes = 0;
...@@ -913,7 +913,7 @@ static int kfd_ioctl_get_process_apertures_new(struct file *filp, ...@@ -913,7 +913,7 @@ static int kfd_ioctl_get_process_apertures_new(struct file *filp,
uint32_t nodes = 0; uint32_t nodes = 0;
int ret; int ret;
dev_dbg(kfd_device, "get apertures for PASID %d", p->pasid); dev_dbg(kfd_device, "get apertures for PASID 0x%x", p->pasid);
if (args->num_of_nodes == 0) { if (args->num_of_nodes == 0) {
/* Return number of nodes, so that user space can alloacate /* Return number of nodes, so that user space can alloacate
...@@ -1905,7 +1905,7 @@ static int kfd_mmio_mmap(struct kfd_dev *dev, struct kfd_process *process, ...@@ -1905,7 +1905,7 @@ static int kfd_mmio_mmap(struct kfd_dev *dev, struct kfd_process *process,
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
pr_debug("Process %d mapping mmio page\n" pr_debug("pasid 0x%x mapping mmio page\n"
" target user address == 0x%08llX\n" " target user address == 0x%08llX\n"
" physical address == 0x%08llX\n" " physical address == 0x%08llX\n"
" vm_flags == 0x%04lX\n" " vm_flags == 0x%04lX\n"
......
...@@ -786,7 +786,7 @@ int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p) ...@@ -786,7 +786,7 @@ int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p)
(dev->kgd, vmid)) { (dev->kgd, vmid)) {
if (dev->kfd2kgd->get_atc_vmid_pasid_mapping_pasid if (dev->kfd2kgd->get_atc_vmid_pasid_mapping_pasid
(dev->kgd, vmid) == p->pasid) { (dev->kgd, vmid) == p->pasid) {
pr_debug("Killing wave fronts of vmid %d and pasid %d\n", pr_debug("Killing wave fronts of vmid %d and pasid 0x%x\n",
vmid, p->pasid); vmid, p->pasid);
break; break;
} }
...@@ -794,7 +794,7 @@ int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p) ...@@ -794,7 +794,7 @@ int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p)
} }
if (vmid > last_vmid_to_scan) { if (vmid > last_vmid_to_scan) {
pr_err("Didn't find vmid for pasid %d\n", p->pasid); pr_err("Didn't find vmid for pasid 0x%x\n", p->pasid);
return -EFAULT; return -EFAULT;
} }
......
...@@ -96,7 +96,7 @@ bool kfd_dbgmgr_create(struct kfd_dbgmgr **ppmgr, struct kfd_dev *pdev) ...@@ -96,7 +96,7 @@ bool kfd_dbgmgr_create(struct kfd_dbgmgr **ppmgr, struct kfd_dev *pdev)
long kfd_dbgmgr_register(struct kfd_dbgmgr *pmgr, struct kfd_process *p) long kfd_dbgmgr_register(struct kfd_dbgmgr *pmgr, struct kfd_process *p)
{ {
if (pmgr->pasid != 0) { if (pmgr->pasid != 0) {
pr_debug("H/W debugger is already active using pasid %d\n", pr_debug("H/W debugger is already active using pasid 0x%x\n",
pmgr->pasid); pmgr->pasid);
return -EBUSY; return -EBUSY;
} }
...@@ -117,7 +117,7 @@ long kfd_dbgmgr_unregister(struct kfd_dbgmgr *pmgr, struct kfd_process *p) ...@@ -117,7 +117,7 @@ long kfd_dbgmgr_unregister(struct kfd_dbgmgr *pmgr, struct kfd_process *p)
{ {
/* Is the requests coming from the already registered process? */ /* Is the requests coming from the already registered process? */
if (pmgr->pasid != p->pasid) { if (pmgr->pasid != p->pasid) {
pr_debug("H/W debugger is not registered by calling pasid %d\n", pr_debug("H/W debugger is not registered by calling pasid 0x%x\n",
p->pasid); p->pasid);
return -EINVAL; return -EINVAL;
} }
...@@ -134,7 +134,7 @@ long kfd_dbgmgr_wave_control(struct kfd_dbgmgr *pmgr, ...@@ -134,7 +134,7 @@ long kfd_dbgmgr_wave_control(struct kfd_dbgmgr *pmgr,
{ {
/* Is the requests coming from the already registered process? */ /* Is the requests coming from the already registered process? */
if (pmgr->pasid != wac_info->process->pasid) { if (pmgr->pasid != wac_info->process->pasid) {
pr_debug("H/W debugger support was not registered for requester pasid %d\n", pr_debug("H/W debugger support was not registered for requester pasid 0x%x\n",
wac_info->process->pasid); wac_info->process->pasid);
return -EINVAL; return -EINVAL;
} }
...@@ -147,7 +147,7 @@ long kfd_dbgmgr_address_watch(struct kfd_dbgmgr *pmgr, ...@@ -147,7 +147,7 @@ long kfd_dbgmgr_address_watch(struct kfd_dbgmgr *pmgr,
{ {
/* Is the requests coming from the already registered process? */ /* Is the requests coming from the already registered process? */
if (pmgr->pasid != adw_info->process->pasid) { if (pmgr->pasid != adw_info->process->pasid) {
pr_debug("H/W debugger support was not registered for requester pasid %d\n", pr_debug("H/W debugger support was not registered for requester pasid 0x%x\n",
adw_info->process->pasid); adw_info->process->pasid);
return -EINVAL; return -EINVAL;
} }
......
...@@ -580,7 +580,7 @@ static int evict_process_queues_nocpsch(struct device_queue_manager *dqm, ...@@ -580,7 +580,7 @@ static int evict_process_queues_nocpsch(struct device_queue_manager *dqm,
goto out; goto out;
pdd = qpd_to_pdd(qpd); pdd = qpd_to_pdd(qpd);
pr_info_ratelimited("Evicting PASID %u queues\n", pr_info_ratelimited("Evicting PASID 0x%x queues\n",
pdd->process->pasid); pdd->process->pasid);
/* Mark all queues as evicted. Deactivate all active queues on /* Mark all queues as evicted. Deactivate all active queues on
...@@ -622,7 +622,7 @@ static int evict_process_queues_cpsch(struct device_queue_manager *dqm, ...@@ -622,7 +622,7 @@ static int evict_process_queues_cpsch(struct device_queue_manager *dqm,
goto out; goto out;
pdd = qpd_to_pdd(qpd); pdd = qpd_to_pdd(qpd);
pr_info_ratelimited("Evicting PASID %u queues\n", pr_info_ratelimited("Evicting PASID 0x%x queues\n",
pdd->process->pasid); pdd->process->pasid);
/* Mark all queues as evicted. Deactivate all active queues on /* Mark all queues as evicted. Deactivate all active queues on
...@@ -668,7 +668,7 @@ static int restore_process_queues_nocpsch(struct device_queue_manager *dqm, ...@@ -668,7 +668,7 @@ static int restore_process_queues_nocpsch(struct device_queue_manager *dqm,
goto out; goto out;
} }
pr_info_ratelimited("Restoring PASID %u queues\n", pr_info_ratelimited("Restoring PASID 0x%x queues\n",
pdd->process->pasid); pdd->process->pasid);
/* Update PD Base in QPD */ /* Update PD Base in QPD */
...@@ -740,7 +740,7 @@ static int restore_process_queues_cpsch(struct device_queue_manager *dqm, ...@@ -740,7 +740,7 @@ static int restore_process_queues_cpsch(struct device_queue_manager *dqm,
goto out; goto out;
} }
pr_info_ratelimited("Restoring PASID %u queues\n", pr_info_ratelimited("Restoring PASID 0x%x queues\n",
pdd->process->pasid); pdd->process->pasid);
/* Update PD Base in QPD */ /* Update PD Base in QPD */
......
...@@ -852,8 +852,8 @@ static void lookup_events_by_type_and_signal(struct kfd_process *p, ...@@ -852,8 +852,8 @@ static void lookup_events_by_type_and_signal(struct kfd_process *p,
if (type == KFD_EVENT_TYPE_MEMORY) { if (type == KFD_EVENT_TYPE_MEMORY) {
dev_warn(kfd_device, dev_warn(kfd_device,
"Sending SIGSEGV to HSA Process with PID %d ", "Sending SIGSEGV to process %d (pasid 0x%x)",
p->lead_thread->pid); p->lead_thread->pid, p->pasid);
send_sig(SIGSEGV, p->lead_thread, 0); send_sig(SIGSEGV, p->lead_thread, 0);
} }
...@@ -861,13 +861,13 @@ static void lookup_events_by_type_and_signal(struct kfd_process *p, ...@@ -861,13 +861,13 @@ static void lookup_events_by_type_and_signal(struct kfd_process *p,
if (send_signal) { if (send_signal) {
if (send_sigterm) { if (send_sigterm) {
dev_warn(kfd_device, dev_warn(kfd_device,
"Sending SIGTERM to HSA Process with PID %d ", "Sending SIGTERM to process %d (pasid 0x%x)",
p->lead_thread->pid); p->lead_thread->pid, p->pasid);
send_sig(SIGTERM, p->lead_thread, 0); send_sig(SIGTERM, p->lead_thread, 0);
} else { } else {
dev_err(kfd_device, dev_err(kfd_device,
"HSA Process (PID %d) got unhandled exception", "Process %d (pasid 0x%x) got unhandled exception",
p->lead_thread->pid); p->lead_thread->pid, p->pasid);
} }
} }
} }
......
...@@ -160,7 +160,7 @@ static void iommu_pasid_shutdown_callback(struct pci_dev *pdev, int pasid) ...@@ -160,7 +160,7 @@ static void iommu_pasid_shutdown_callback(struct pci_dev *pdev, int pasid)
if (!p) if (!p)
return; return;
pr_debug("Unbinding process %d from IOMMU\n", pasid); pr_debug("Unbinding process 0x%x from IOMMU\n", pasid);
mutex_lock(kfd_get_dbgmgr_mutex()); mutex_lock(kfd_get_dbgmgr_mutex());
...@@ -194,7 +194,7 @@ static int iommu_invalid_ppr_cb(struct pci_dev *pdev, int pasid, ...@@ -194,7 +194,7 @@ static int iommu_invalid_ppr_cb(struct pci_dev *pdev, int pasid,
struct kfd_dev *dev; struct kfd_dev *dev;
dev_warn_ratelimited(kfd_device, dev_warn_ratelimited(kfd_device,
"Invalid PPR device %x:%x.%x pasid %d address 0x%lX flags 0x%X", "Invalid PPR device %x:%x.%x pasid 0x%x address 0x%lX flags 0x%X",
PCI_BUS_NUM(pdev->devfn), PCI_BUS_NUM(pdev->devfn),
PCI_SLOT(pdev->devfn), PCI_SLOT(pdev->devfn),
PCI_FUNC(pdev->devfn), PCI_FUNC(pdev->devfn),
...@@ -235,7 +235,7 @@ static int kfd_bind_processes_to_device(struct kfd_dev *kfd) ...@@ -235,7 +235,7 @@ static int kfd_bind_processes_to_device(struct kfd_dev *kfd)
err = amd_iommu_bind_pasid(kfd->pdev, p->pasid, err = amd_iommu_bind_pasid(kfd->pdev, p->pasid,
p->lead_thread); p->lead_thread);
if (err < 0) { if (err < 0) {
pr_err("Unexpected pasid %d binding failure\n", pr_err("Unexpected pasid 0x%x binding failure\n",
p->pasid); p->pasid);
mutex_unlock(&p->mutex); mutex_unlock(&p->mutex);
break; break;
......
...@@ -689,7 +689,7 @@ struct kfd_process { ...@@ -689,7 +689,7 @@ struct kfd_process {
/* Use for delayed freeing of kfd_process structure */ /* Use for delayed freeing of kfd_process structure */
struct rcu_head rcu; struct rcu_head rcu;
unsigned int pasid; uint16_t pasid;
unsigned int doorbell_index; unsigned int doorbell_index;
/* /*
......
...@@ -408,7 +408,7 @@ static void kfd_process_destroy_pdds(struct kfd_process *p) ...@@ -408,7 +408,7 @@ static void kfd_process_destroy_pdds(struct kfd_process *p)
list_for_each_entry_safe(pdd, temp, &p->per_device_data, list_for_each_entry_safe(pdd, temp, &p->per_device_data,
per_device_list) { per_device_list) {
pr_debug("Releasing pdd (topology id %d) for process (pasid %d)\n", pr_debug("Releasing pdd (topology id %d) for process (pasid 0x%x)\n",
pdd->dev->id, p->pasid); pdd->dev->id, p->pasid);
if (pdd->drm_file) { if (pdd->drm_file) {
...@@ -1030,7 +1030,7 @@ static void evict_process_worker(struct work_struct *work) ...@@ -1030,7 +1030,7 @@ static void evict_process_worker(struct work_struct *work)
*/ */
flush_delayed_work(&p->restore_work); flush_delayed_work(&p->restore_work);
pr_debug("Started evicting pasid %d\n", p->pasid); pr_debug("Started evicting pasid 0x%x\n", p->pasid);
ret = kfd_process_evict_queues(p); ret = kfd_process_evict_queues(p);
if (!ret) { if (!ret) {
dma_fence_signal(p->ef); dma_fence_signal(p->ef);
...@@ -1039,9 +1039,9 @@ static void evict_process_worker(struct work_struct *work) ...@@ -1039,9 +1039,9 @@ static void evict_process_worker(struct work_struct *work)
queue_delayed_work(kfd_restore_wq, &p->restore_work, queue_delayed_work(kfd_restore_wq, &p->restore_work,
msecs_to_jiffies(PROCESS_RESTORE_TIME_MS)); msecs_to_jiffies(PROCESS_RESTORE_TIME_MS));
pr_debug("Finished evicting pasid %d\n", p->pasid); pr_debug("Finished evicting pasid 0x%x\n", p->pasid);
} else } else
pr_err("Failed to evict queues of pasid %d\n", p->pasid); pr_err("Failed to evict queues of pasid 0x%x\n", p->pasid);
} }
static void restore_process_worker(struct work_struct *work) static void restore_process_worker(struct work_struct *work)
...@@ -1056,7 +1056,7 @@ static void restore_process_worker(struct work_struct *work) ...@@ -1056,7 +1056,7 @@ static void restore_process_worker(struct work_struct *work)
* lifetime of this thread, kfd_process p will be valid * lifetime of this thread, kfd_process p will be valid
*/ */
p = container_of(dwork, struct kfd_process, restore_work); p = container_of(dwork, struct kfd_process, restore_work);
pr_debug("Started restoring pasid %d\n", p->pasid); pr_debug("Started restoring pasid 0x%x\n", p->pasid);
/* Setting last_restore_timestamp before successful restoration. /* Setting last_restore_timestamp before successful restoration.
* Otherwise this would have to be set by KGD (restore_process_bos) * Otherwise this would have to be set by KGD (restore_process_bos)
...@@ -1072,7 +1072,7 @@ static void restore_process_worker(struct work_struct *work) ...@@ -1072,7 +1072,7 @@ static void restore_process_worker(struct work_struct *work)
ret = amdgpu_amdkfd_gpuvm_restore_process_bos(p->kgd_process_info, ret = amdgpu_amdkfd_gpuvm_restore_process_bos(p->kgd_process_info,
&p->ef); &p->ef);
if (ret) { if (ret) {
pr_debug("Failed to restore BOs of pasid %d, retry after %d ms\n", pr_debug("Failed to restore BOs of pasid 0x%x, retry after %d ms\n",
p->pasid, PROCESS_BACK_OFF_TIME_MS); p->pasid, PROCESS_BACK_OFF_TIME_MS);
ret = queue_delayed_work(kfd_restore_wq, &p->restore_work, ret = queue_delayed_work(kfd_restore_wq, &p->restore_work,
msecs_to_jiffies(PROCESS_BACK_OFF_TIME_MS)); msecs_to_jiffies(PROCESS_BACK_OFF_TIME_MS));
...@@ -1082,9 +1082,9 @@ static void restore_process_worker(struct work_struct *work) ...@@ -1082,9 +1082,9 @@ static void restore_process_worker(struct work_struct *work)
ret = kfd_process_restore_queues(p); ret = kfd_process_restore_queues(p);
if (!ret) if (!ret)
pr_debug("Finished restoring pasid %d\n", p->pasid); pr_debug("Finished restoring pasid 0x%x\n", p->pasid);
else else
pr_err("Failed to restore queues of pasid %d\n", p->pasid); pr_err("Failed to restore queues of pasid 0x%x\n", p->pasid);
} }
void kfd_suspend_all_processes(void) void kfd_suspend_all_processes(void)
...@@ -1098,7 +1098,7 @@ void kfd_suspend_all_processes(void) ...@@ -1098,7 +1098,7 @@ void kfd_suspend_all_processes(void)
cancel_delayed_work_sync(&p->restore_work); cancel_delayed_work_sync(&p->restore_work);
if (kfd_process_evict_queues(p)) if (kfd_process_evict_queues(p))
pr_err("Failed to suspend process %d\n", p->pasid); pr_err("Failed to suspend process 0x%x\n", p->pasid);
dma_fence_signal(p->ef); dma_fence_signal(p->ef);
dma_fence_put(p->ef); dma_fence_put(p->ef);
p->ef = NULL; p->ef = NULL;
...@@ -1181,7 +1181,7 @@ int kfd_debugfs_mqds_by_process(struct seq_file *m, void *data) ...@@ -1181,7 +1181,7 @@ int kfd_debugfs_mqds_by_process(struct seq_file *m, void *data)
int idx = srcu_read_lock(&kfd_processes_srcu); int idx = srcu_read_lock(&kfd_processes_srcu);
hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) { hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) {
seq_printf(m, "Process %d PASID %d:\n", seq_printf(m, "Process %d PASID 0x%x:\n",
p->lead_thread->tgid, p->pasid); p->lead_thread->tgid, p->pasid);
mutex_lock(&p->mutex); mutex_lock(&p->mutex);
......
...@@ -53,7 +53,7 @@ static int find_available_queue_slot(struct process_queue_manager *pqm, ...@@ -53,7 +53,7 @@ static int find_available_queue_slot(struct process_queue_manager *pqm,
pr_debug("The new slot id %lu\n", found); pr_debug("The new slot id %lu\n", found);
if (found >= KFD_MAX_NUM_OF_QUEUES_PER_PROCESS) { if (found >= KFD_MAX_NUM_OF_QUEUES_PER_PROCESS) {
pr_info("Cannot open more queues for process with pasid %d\n", pr_info("Cannot open more queues for process with pasid 0x%x\n",
pqm->process->pasid); pqm->process->pasid);
return -ENOMEM; return -ENOMEM;
} }
...@@ -298,7 +298,7 @@ int pqm_create_queue(struct process_queue_manager *pqm, ...@@ -298,7 +298,7 @@ int pqm_create_queue(struct process_queue_manager *pqm,
} }
if (retval != 0) { if (retval != 0) {
pr_err("Pasid %d DQM create queue %d failed. ret %d\n", pr_err("Pasid 0x%x DQM create queue %d failed. ret %d\n",
pqm->process->pasid, type, retval); pqm->process->pasid, type, retval);
goto err_create_queue; goto err_create_queue;
} }
...@@ -377,7 +377,7 @@ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid) ...@@ -377,7 +377,7 @@ int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid)
dqm = pqn->q->device->dqm; dqm = pqn->q->device->dqm;
retval = dqm->ops.destroy_queue(dqm, &pdd->qpd, pqn->q); retval = dqm->ops.destroy_queue(dqm, &pdd->qpd, pqn->q);
if (retval) { if (retval) {
pr_err("Pasid %d destroy queue %d failed, ret %d\n", pr_err("Pasid 0x%x destroy queue %d failed, ret %d\n",
pqm->process->pasid, pqm->process->pasid,
pqn->q->properties.queue_id, retval); pqn->q->properties.queue_id, retval);
if (retval != -ETIME) if (retval != -ETIME)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment