* [PATCH 2/4] habanalabs: improve readability of engines idle mask print
2023-02-20 9:19 [PATCH 1/4] habanalabs: organize hl_device structure comment Oded Gabbay
@ 2023-02-20 9:19 ` Oded Gabbay
2023-02-20 9:19 ` [PATCH 3/4] habanalabs: change hw_fini to return int to indicate error Oded Gabbay
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Oded Gabbay @ 2023-02-20 9:19 UTC (permalink / raw)
To: dri-devel; +Cc: Tomer Tayar
From: Tomer Tayar <ttayar@habana.ai>
Remove leading zeroes when printing the idle mask to make it clearer.
Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
drivers/accel/habanalabs/common/device.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c
index a5f5ee102823..e544d00fe376 100644
--- a/drivers/accel/habanalabs/common/device.c
+++ b/drivers/accel/habanalabs/common/device.c
@@ -380,18 +380,17 @@ 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]);
+ if (idle_mask[3])
+ dev_err(hdev->dev, "%s (mask %#llx_%016llx_%016llx_%016llx)\n",
+ message, idle_mask[3], idle_mask[2], idle_mask[1], idle_mask[0]);
+ else if (idle_mask[2])
+ dev_err(hdev->dev, "%s (mask %#llx_%016llx_%016llx)\n",
+ message, idle_mask[2], idle_mask[1], idle_mask[0]);
+ else if (idle_mask[1])
+ dev_err(hdev->dev, "%s (mask %#llx_%016llx)\n",
+ message, idle_mask[1], idle_mask[0]);
+ else
+ dev_err(hdev->dev, "%s (mask %#llx)\n", message, idle_mask[0]);
}
static void hpriv_release(struct kref *ref)
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/4] habanalabs: change hw_fini to return int to indicate error
2023-02-20 9:19 [PATCH 1/4] habanalabs: organize hl_device structure comment Oded Gabbay
2023-02-20 9:19 ` [PATCH 2/4] habanalabs: improve readability of engines idle mask print Oded Gabbay
@ 2023-02-20 9:19 ` Oded Gabbay
2023-02-20 9:19 ` [PATCH 4/4] habanalabs/gaudi2: remove unneeded irq_handler variable Oded Gabbay
2023-02-24 17:05 ` [PATCH 1/4] habanalabs: organize hl_device structure comment Stanislaw Gruszka
3 siblings, 0 replies; 5+ messages in thread
From: Oded Gabbay @ 2023-02-20 9:19 UTC (permalink / raw)
To: dri-devel; +Cc: Dafna Hirschfeld
From: Dafna Hirschfeld <dhirschfeld@habana.ai>
We later use cpucp packet for soft reset which might fail
so we should be able propagate the failure case.
Signed-off-by: Dafna Hirschfeld <dhirschfeld@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
drivers/accel/habanalabs/common/habanalabs.h | 2 +-
drivers/accel/habanalabs/gaudi/gaudi.c | 5 +++--
drivers/accel/habanalabs/gaudi2/gaudi2.c | 5 +++--
drivers/accel/habanalabs/goya/goya.c | 5 +++--
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/accel/habanalabs/common/habanalabs.h b/drivers/accel/habanalabs/common/habanalabs.h
index de4ff525cbcb..597c7f1037d1 100644
--- a/drivers/accel/habanalabs/common/habanalabs.h
+++ b/drivers/accel/habanalabs/common/habanalabs.h
@@ -1576,7 +1576,7 @@ struct hl_asic_funcs {
int (*sw_init)(struct hl_device *hdev);
int (*sw_fini)(struct hl_device *hdev);
int (*hw_init)(struct hl_device *hdev);
- void (*hw_fini)(struct hl_device *hdev, bool hard_reset, bool fw_reset);
+ int (*hw_fini)(struct hl_device *hdev, bool hard_reset, bool fw_reset);
void (*halt_engines)(struct hl_device *hdev, bool hard_reset, bool fw_reset);
int (*suspend)(struct hl_device *hdev);
int (*resume)(struct hl_device *hdev);
diff --git a/drivers/accel/habanalabs/gaudi/gaudi.c b/drivers/accel/habanalabs/gaudi/gaudi.c
index a276a2a4a46d..26287084a9e0 100644
--- a/drivers/accel/habanalabs/gaudi/gaudi.c
+++ b/drivers/accel/habanalabs/gaudi/gaudi.c
@@ -4069,7 +4069,7 @@ static int gaudi_hw_init(struct hl_device *hdev)
return rc;
}
-static void gaudi_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset)
+static int gaudi_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset)
{
struct cpu_dyn_regs *dyn_regs =
&hdev->fw_loader.dynamic_loader.comm_desc.cpu_dyn_regs;
@@ -4079,7 +4079,7 @@ static void gaudi_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset
if (!hard_reset) {
dev_err(hdev->dev, "GAUDI doesn't support soft-reset\n");
- return;
+ return 0;
}
if (hdev->pldm) {
@@ -4216,6 +4216,7 @@ static void gaudi_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset
hdev->device_cpu_is_halted = false;
}
+ return 0;
}
static int gaudi_suspend(struct hl_device *hdev)
diff --git a/drivers/accel/habanalabs/gaudi2/gaudi2.c b/drivers/accel/habanalabs/gaudi2/gaudi2.c
index 2f51a121909b..5a225f23961b 100644
--- a/drivers/accel/habanalabs/gaudi2/gaudi2.c
+++ b/drivers/accel/habanalabs/gaudi2/gaudi2.c
@@ -5885,7 +5885,7 @@ static void gaudi2_get_soft_rst_done_indication(struct hl_device *hdev, u32 poll
reg_val);
}
-static void gaudi2_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset)
+static int gaudi2_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset)
{
struct gaudi2_device *gaudi2 = hdev->asic_specific;
u32 poll_timeout_us, reset_sleep_ms;
@@ -5951,7 +5951,7 @@ static void gaudi2_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_rese
gaudi2_get_soft_rst_done_indication(hdev, poll_timeout_us);
if (!gaudi2)
- return;
+ return 0;
gaudi2->dec_hw_cap_initialized &= ~(HW_CAP_DEC_MASK);
gaudi2->tpc_hw_cap_initialized &= ~(HW_CAP_TPC_MASK);
@@ -5978,6 +5978,7 @@ static void gaudi2_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_rese
HW_CAP_PDMA_MASK | HW_CAP_EDMA_MASK | HW_CAP_MME_MASK |
HW_CAP_ROT_MASK);
}
+ return 0;
}
static int gaudi2_suspend(struct hl_device *hdev)
diff --git a/drivers/accel/habanalabs/goya/goya.c b/drivers/accel/habanalabs/goya/goya.c
index c5a22a8e0957..7a45ab3ca43a 100644
--- a/drivers/accel/habanalabs/goya/goya.c
+++ b/drivers/accel/habanalabs/goya/goya.c
@@ -2783,7 +2783,7 @@ static int goya_hw_init(struct hl_device *hdev)
return rc;
}
-static void goya_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset)
+static int goya_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset)
{
struct goya_device *goya = hdev->asic_specific;
u32 reset_timeout_ms, cpu_timeout_ms, status;
@@ -2839,7 +2839,7 @@ static void goya_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset)
HW_CAP_GOLDEN | HW_CAP_TPC);
WREG32(mmGIC_DISTRIBUTOR__5_GICD_SETSPI_NSR,
GOYA_ASYNC_EVENT_ID_SOFT_RESET);
- return;
+ return 0;
}
/* Chicken bit to re-initiate boot sequencer flow */
@@ -2858,6 +2858,7 @@ static void goya_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset)
memset(goya->events_stat, 0, sizeof(goya->events_stat));
}
+ return 0;
}
int goya_suspend(struct hl_device *hdev)
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 4/4] habanalabs/gaudi2: remove unneeded irq_handler variable
2023-02-20 9:19 [PATCH 1/4] habanalabs: organize hl_device structure comment Oded Gabbay
2023-02-20 9:19 ` [PATCH 2/4] habanalabs: improve readability of engines idle mask print Oded Gabbay
2023-02-20 9:19 ` [PATCH 3/4] habanalabs: change hw_fini to return int to indicate error Oded Gabbay
@ 2023-02-20 9:19 ` Oded Gabbay
2023-02-24 17:05 ` [PATCH 1/4] habanalabs: organize hl_device structure comment Stanislaw Gruszka
3 siblings, 0 replies; 5+ messages in thread
From: Oded Gabbay @ 2023-02-20 9:19 UTC (permalink / raw)
To: dri-devel; +Cc: Tomer Tayar
From: Tomer Tayar <ttayar@habana.ai>
'irq_handler' in gaudi2_enable_msix(), is just assigned with a function
name and then used when calling request_threaded_irq().
Remove the variable and use the function name directly as an argument.
Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
drivers/accel/habanalabs/gaudi2/gaudi2.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/accel/habanalabs/gaudi2/gaudi2.c b/drivers/accel/habanalabs/gaudi2/gaudi2.c
index 5a225f23961b..2021ef9d4702 100644
--- a/drivers/accel/habanalabs/gaudi2/gaudi2.c
+++ b/drivers/accel/habanalabs/gaudi2/gaudi2.c
@@ -3974,7 +3974,6 @@ static int gaudi2_enable_msix(struct hl_device *hdev)
struct asic_fixed_properties *prop = &hdev->asic_prop;
struct gaudi2_device *gaudi2 = hdev->asic_specific;
int rc, irq, i, j, user_irq_init_cnt;
- irq_handler_t irq_handler;
struct hl_cq *cq;
if (gaudi2->hw_cap_initialized & HW_CAP_MSIX)
@@ -4024,10 +4023,9 @@ static int gaudi2_enable_msix(struct hl_device *hdev)
i++, j++, user_irq_init_cnt++) {
irq = pci_irq_vector(hdev->pdev, i);
- irq_handler = hl_irq_handler_user_interrupt;
-
- rc = request_threaded_irq(irq, irq_handler, hl_irq_user_interrupt_thread_handler,
- IRQF_ONESHOT, gaudi2_irq_name(i), &hdev->user_interrupt[j]);
+ rc = request_threaded_irq(irq, hl_irq_handler_user_interrupt,
+ hl_irq_user_interrupt_thread_handler, IRQF_ONESHOT,
+ gaudi2_irq_name(i), &hdev->user_interrupt[j]);
if (rc) {
dev_err(hdev->dev, "Failed to request IRQ %d", irq);
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/4] habanalabs: organize hl_device structure comment
2023-02-20 9:19 [PATCH 1/4] habanalabs: organize hl_device structure comment Oded Gabbay
` (2 preceding siblings ...)
2023-02-20 9:19 ` [PATCH 4/4] habanalabs/gaudi2: remove unneeded irq_handler variable Oded Gabbay
@ 2023-02-24 17:05 ` Stanislaw Gruszka
3 siblings, 0 replies; 5+ messages in thread
From: Stanislaw Gruszka @ 2023-02-24 17:05 UTC (permalink / raw)
To: Oded Gabbay; +Cc: Sagiv Ozeri, dri-devel
On Mon, Feb 20, 2023 at 11:19:36AM +0200, Oded Gabbay wrote:
> From: Sagiv Ozeri <sozeri@habana.ai>
>
> Make the comments align with the order of the fields in the structure
>
> Signed-off-by: Sagiv Ozeri <sozeri@habana.ai>
> Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> for the whole series.
^ permalink raw reply [flat|nested] 5+ messages in thread