[PATCH v2] drm/amdkfd: Replace pr_err with dev_err

2023-08-26 Thread Asad Kamal
Replace pr_err with dev_err to show the bus-id of
failing device with kfd queue errors

Signed-off-by: Asad Kamal 
Reviewed-by: Lijo Lazar 
---
 .../drm/amd/amdkfd/kfd_device_queue_manager.c | 116 +++---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h |   2 +-
 2 files changed, 71 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index b166f30f083e..cd6cfffd6436 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -232,8 +232,8 @@ static int add_queue_mes(struct device_queue_manager *dqm, 
struct queue *q,
 
queue_type = convert_to_mes_queue_type(q->properties.type);
if (queue_type < 0) {
-   pr_err("Queue type not supported with MES, queue:%d\n",
-   q->properties.type);
+   dev_err(adev->dev, "Queue type not supported with MES, 
queue:%d\n",
+   q->properties.type);
return -EINVAL;
}
queue_input.queue_type = (uint32_t)queue_type;
@@ -244,9 +244,9 @@ static int add_queue_mes(struct device_queue_manager *dqm, 
struct queue *q,
r = adev->mes.funcs->add_hw_queue(&adev->mes, &queue_input);
amdgpu_mes_unlock(&adev->mes);
if (r) {
-   pr_err("failed to add hardware queue to MES, doorbell=0x%x\n",
+   dev_err(adev->dev, "failed to add hardware queue to MES, 
doorbell=0x%x\n",
q->properties.doorbell_off);
-   pr_err("MES might be in unrecoverable state, issue a GPU 
reset\n");
+   dev_err(adev->dev, "MES might be in unrecoverable state, issue 
a GPU reset\n");
kfd_hws_hang(dqm);
}
 
@@ -272,9 +272,9 @@ static int remove_queue_mes(struct device_queue_manager 
*dqm, struct queue *q,
amdgpu_mes_unlock(&adev->mes);
 
if (r) {
-   pr_err("failed to remove hardware queue from MES, 
doorbell=0x%x\n",
+   dev_err(adev->dev, "failed to remove hardware queue from MES, 
doorbell=0x%x\n",
q->properties.doorbell_off);
-   pr_err("MES might be in unrecoverable state, issue a GPU 
reset\n");
+   dev_err(adev->dev, "MES might be in unrecoverable state, issue 
a GPU reset\n");
kfd_hws_hang(dqm);
}
 
@@ -284,6 +284,7 @@ static int remove_queue_mes(struct device_queue_manager 
*dqm, struct queue *q,
 static int remove_all_queues_mes(struct device_queue_manager *dqm)
 {
struct device_process_node *cur;
+   struct device *dev = dqm->dev->adev->dev;
struct qcm_process_device *qpd;
struct queue *q;
int retval = 0;
@@ -294,7 +295,7 @@ static int remove_all_queues_mes(struct 
device_queue_manager *dqm)
if (q->properties.is_active) {
retval = remove_queue_mes(dqm, q, qpd);
if (retval) {
-   pr_err("%s: Failed to remove queue %d 
for dev %d",
+   dev_err(dev, "%s: Failed to remove 
queue %d for dev %d",
__func__,
q->properties.queue_id,
dqm->dev->id);
@@ -443,6 +444,7 @@ static int allocate_vmid(struct device_queue_manager *dqm,
struct qcm_process_device *qpd,
struct queue *q)
 {
+   struct device *dev = dqm->dev->adev->dev;
int allocated_vmid = -1, i;
 
for (i = dqm->dev->vm_info.first_vmid_kfd;
@@ -454,7 +456,7 @@ static int allocate_vmid(struct device_queue_manager *dqm,
}
 
if (allocated_vmid < 0) {
-   pr_err("no more vmid to allocate\n");
+   dev_err(dev, "no more vmid to allocate\n");
return -ENOSPC;
}
 
@@ -510,10 +512,12 @@ static void deallocate_vmid(struct device_queue_manager 
*dqm,
struct qcm_process_device *qpd,
struct queue *q)
 {
+   struct device *dev = dqm->dev->adev->dev;
+
/* On GFX v7, CP doesn't flush TC at dequeue */
if (q->device->adev->asic_type == CHIP_HAWAII)
if (flush_texture_cache_nocpsch(q->device, qpd))
-   pr_err("Failed to flush TC\n");
+   dev_err(dev, "Failed to flush TC\n");
 
kfd_flush_tlb(qpd_to_pdd(qpd), TLB_FLUSH_LEGACY);
 
@@ -708,7 +712,7 @@ static int dbgdev_wave_reset_wavefronts(struct kfd_node 
*dev, struct kfd_process
pr_debug("Killing all process wavefronts\n");
 
if (!dev->kfd2kgd->get_atc_vmid_pasid_mapping_info) {
-   pr_err("no vmid pasid mapping supported \n");
+   dev_err(dev->adev->dev, "no vmid pasid ma

Re: [PATCH v2] drm/amdkfd: Replace pr_err with dev_err

2023-08-28 Thread Felix Kuehling



On 2023-08-26 09:41, Asad Kamal wrote:

Replace pr_err with dev_err to show the bus-id of
failing device with kfd queue errors

Signed-off-by: Asad Kamal 
Reviewed-by: Lijo Lazar 


Reviewed-by: Felix Kuehling 



---
  .../drm/amd/amdkfd/kfd_device_queue_manager.c | 116 +++---
  drivers/gpu/drm/amd/amdkfd/kfd_priv.h |   2 +-
  2 files changed, 71 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index b166f30f083e..cd6cfffd6436 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -232,8 +232,8 @@ static int add_queue_mes(struct device_queue_manager *dqm, 
struct queue *q,
  
  	queue_type = convert_to_mes_queue_type(q->properties.type);

if (queue_type < 0) {
-   pr_err("Queue type not supported with MES, queue:%d\n",
-   q->properties.type);
+   dev_err(adev->dev, "Queue type not supported with MES, 
queue:%d\n",
+   q->properties.type);
return -EINVAL;
}
queue_input.queue_type = (uint32_t)queue_type;
@@ -244,9 +244,9 @@ static int add_queue_mes(struct device_queue_manager *dqm, 
struct queue *q,
r = adev->mes.funcs->add_hw_queue(&adev->mes, &queue_input);
amdgpu_mes_unlock(&adev->mes);
if (r) {
-   pr_err("failed to add hardware queue to MES, doorbell=0x%x\n",
+   dev_err(adev->dev, "failed to add hardware queue to MES, 
doorbell=0x%x\n",
q->properties.doorbell_off);
-   pr_err("MES might be in unrecoverable state, issue a GPU 
reset\n");
+   dev_err(adev->dev, "MES might be in unrecoverable state, issue a GPU 
reset\n");
kfd_hws_hang(dqm);
}
  
@@ -272,9 +272,9 @@ static int remove_queue_mes(struct device_queue_manager *dqm, struct queue *q,

amdgpu_mes_unlock(&adev->mes);
  
  	if (r) {

-   pr_err("failed to remove hardware queue from MES, 
doorbell=0x%x\n",
+   dev_err(adev->dev, "failed to remove hardware queue from MES, 
doorbell=0x%x\n",
q->properties.doorbell_off);
-   pr_err("MES might be in unrecoverable state, issue a GPU 
reset\n");
+   dev_err(adev->dev, "MES might be in unrecoverable state, issue a GPU 
reset\n");
kfd_hws_hang(dqm);
}
  
@@ -284,6 +284,7 @@ static int remove_queue_mes(struct device_queue_manager *dqm, struct queue *q,

  static int remove_all_queues_mes(struct device_queue_manager *dqm)
  {
struct device_process_node *cur;
+   struct device *dev = dqm->dev->adev->dev;
struct qcm_process_device *qpd;
struct queue *q;
int retval = 0;
@@ -294,7 +295,7 @@ static int remove_all_queues_mes(struct 
device_queue_manager *dqm)
if (q->properties.is_active) {
retval = remove_queue_mes(dqm, q, qpd);
if (retval) {
-   pr_err("%s: Failed to remove queue %d for 
dev %d",
+   dev_err(dev, "%s: Failed to remove queue %d 
for dev %d",
__func__,
q->properties.queue_id,
dqm->dev->id);
@@ -443,6 +444,7 @@ static int allocate_vmid(struct device_queue_manager *dqm,
struct qcm_process_device *qpd,
struct queue *q)
  {
+   struct device *dev = dqm->dev->adev->dev;
int allocated_vmid = -1, i;
  
  	for (i = dqm->dev->vm_info.first_vmid_kfd;

@@ -454,7 +456,7 @@ static int allocate_vmid(struct device_queue_manager *dqm,
}
  
  	if (allocated_vmid < 0) {

-   pr_err("no more vmid to allocate\n");
+   dev_err(dev, "no more vmid to allocate\n");
return -ENOSPC;
}
  
@@ -510,10 +512,12 @@ static void deallocate_vmid(struct device_queue_manager *dqm,

struct qcm_process_device *qpd,
struct queue *q)
  {
+   struct device *dev = dqm->dev->adev->dev;
+
/* On GFX v7, CP doesn't flush TC at dequeue */
if (q->device->adev->asic_type == CHIP_HAWAII)
if (flush_texture_cache_nocpsch(q->device, qpd))
-   pr_err("Failed to flush TC\n");
+   dev_err(dev, "Failed to flush TC\n");
  
  	kfd_flush_tlb(qpd_to_pdd(qpd), TLB_FLUSH_LEGACY);
  
@@ -708,7 +712,7 @@ static int dbgdev_wave_reset_wavefronts(struct kfd_node *dev, struct kfd_process

pr_debug("Killing all process wavefronts\n");
  
  	if (!dev->kfd2kgd->get_atc_vmid_pasid_mapping_info) {

-   pr_err("no vmid pasid mapping supp