Commit 1b18cf33 authored by Tomer Tayar's avatar Tomer Tayar Committed by Oded Gabbay

habanalabs: make print of engines idle mask more readable

The engines idle mask was increased to be an array of 4 u64 entries.
To make the print of this mask more readable, remove the "0x" prefix,
and zero-pad each u64 to 16 bytes if either it isn't zero or if any of
the higher-order u64's is not zero.
Signed-off-by: default avatarTomer Tayar <ttayar@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent 893afb24
...@@ -386,6 +386,23 @@ bool hl_ctrl_device_operational(struct hl_device *hdev, ...@@ -386,6 +386,23 @@ bool hl_ctrl_device_operational(struct hl_device *hdev,
} }
} }
static void print_idle_status_mask(struct hl_device *hdev, const char *message,
u64 idle_mask[HL_BUSY_ENGINES_MASK_EXT_SIZE])
{
u32 pad_width[HL_BUSY_ENGINES_MASK_EXT_SIZE] = {};
BUILD_BUG_ON(HL_BUSY_ENGINES_MASK_EXT_SIZE != 4);
pad_width[3] = idle_mask[3] ? 16 : 0;
pad_width[2] = idle_mask[2] || pad_width[3] ? 16 : 0;
pad_width[1] = idle_mask[1] || pad_width[2] ? 16 : 0;
pad_width[0] = idle_mask[0] || pad_width[1] ? 16 : 0;
dev_err(hdev->dev, "%s (mask %0*llx_%0*llx_%0*llx_%0*llx)\n",
message, pad_width[3], idle_mask[3], pad_width[2], idle_mask[2],
pad_width[1], idle_mask[1], pad_width[0], idle_mask[0]);
}
static void hpriv_release(struct kref *ref) static void hpriv_release(struct kref *ref)
{ {
u64 idle_mask[HL_BUSY_ENGINES_MASK_EXT_SIZE] = {0}; u64 idle_mask[HL_BUSY_ENGINES_MASK_EXT_SIZE] = {0};
...@@ -416,9 +433,8 @@ static void hpriv_release(struct kref *ref) ...@@ -416,9 +433,8 @@ static void hpriv_release(struct kref *ref)
device_is_idle = hdev->asic_funcs->is_device_idle(hdev, idle_mask, device_is_idle = hdev->asic_funcs->is_device_idle(hdev, idle_mask,
HL_BUSY_ENGINES_MASK_EXT_SIZE, NULL); HL_BUSY_ENGINES_MASK_EXT_SIZE, NULL);
if (!device_is_idle) { if (!device_is_idle) {
dev_err(hdev->dev, print_idle_status_mask(hdev, "device is not idle after user context is closed",
"device not idle after user context is closed (0x%llx_%llx_%llx_%llx)\n", idle_mask);
idle_mask[3], idle_mask[2], idle_mask[1], idle_mask[0]);
reset_device = true; reset_device = true;
} }
...@@ -1673,9 +1689,8 @@ int hl_device_reset(struct hl_device *hdev, u32 flags) ...@@ -1673,9 +1689,8 @@ int hl_device_reset(struct hl_device *hdev, u32 flags)
/* If device is not idle fail the reset process */ /* If device is not idle fail the reset process */
if (!hdev->asic_funcs->is_device_idle(hdev, idle_mask, if (!hdev->asic_funcs->is_device_idle(hdev, idle_mask,
HL_BUSY_ENGINES_MASK_EXT_SIZE, NULL)) { HL_BUSY_ENGINES_MASK_EXT_SIZE, NULL)) {
dev_err(hdev->dev, "device is not idle (mask 0x%llx_%llx_%llx_%llx) after reset\n", print_idle_status_mask(hdev, "device is not idle after reset", idle_mask);
idle_mask[3], idle_mask[2], idle_mask[1], idle_mask[0]);
rc = -EIO; rc = -EIO;
goto out_err; goto out_err;
} }
......
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