Commit ac6183ae authored by Tomer Tayar's avatar Tomer Tayar Committed by Oded Gabbay

habanalabs: Update the device idle check

The patch updates the device idle check:
- Add reading the DMA core status register, because it is possible that
  a QMAN has finished its work but the DMA itself is still running.
- Remove the MME shadow status check, as the MME ARCH status register
  includes the status of all MME shadows.
Signed-off-by: default avatarTomer Tayar <ttayar@habana.ai>
Reviewed-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
parent 4a0ce776
...@@ -4893,17 +4893,22 @@ int goya_armcp_info_get(struct hl_device *hdev) ...@@ -4893,17 +4893,22 @@ int goya_armcp_info_get(struct hl_device *hdev)
static bool goya_is_device_idle(struct hl_device *hdev, char *buf, size_t size) static bool goya_is_device_idle(struct hl_device *hdev, char *buf, size_t size)
{ {
u64 offset, dma_qm_reg, tpc_qm_reg, tpc_cmdq_reg, tpc_cfg_reg; u64 offset, dma_qm_reg, tpc_qm_reg, tpc_cmdq_reg, tpc_cfg_reg,
dma_core_sts;
int i; int i;
offset = mmDMA_QM_1_GLBL_STS0 - mmDMA_QM_0_GLBL_STS0; offset = mmDMA_QM_1_GLBL_STS0 - mmDMA_QM_0_GLBL_STS0;
for (i = 0 ; i < DMA_MAX_NUM ; i++) { for (i = 0 ; i < DMA_MAX_NUM ; i++) {
dma_qm_reg = mmDMA_QM_0_GLBL_STS0 + i * offset; dma_qm_reg = mmDMA_QM_0_GLBL_STS0 + i * offset;
dma_core_sts = mmDMA_CH_0_STS0 + i * offset;
if ((RREG32(dma_qm_reg) & DMA_QM_IDLE_MASK) != if ((RREG32(dma_qm_reg) & DMA_QM_IDLE_MASK) !=
DMA_QM_IDLE_MASK) DMA_QM_IDLE_MASK)
return HL_ENG_BUSY(buf, size, "DMA%d_QM", i); return HL_ENG_BUSY(buf, size, "DMA%d_QM", i);
if (RREG32(dma_core_sts) & DMA_CH_0_STS0_DMA_BUSY_MASK)
return HL_ENG_BUSY(buf, size, "DMA%d_CORE", i);
} }
offset = mmTPC1_QM_GLBL_STS0 - mmTPC0_QM_GLBL_STS0; offset = mmTPC1_QM_GLBL_STS0 - mmTPC0_QM_GLBL_STS0;
...@@ -4938,9 +4943,6 @@ static bool goya_is_device_idle(struct hl_device *hdev, char *buf, size_t size) ...@@ -4938,9 +4943,6 @@ static bool goya_is_device_idle(struct hl_device *hdev, char *buf, size_t size)
MME_ARCH_IDLE_MASK) MME_ARCH_IDLE_MASK)
return HL_ENG_BUSY(buf, size, "MME_ARCH"); return HL_ENG_BUSY(buf, size, "MME_ARCH");
if (RREG32(mmMME_SHADOW_0_STATUS) & MME_SHADOW_IDLE_MASK)
return HL_ENG_BUSY(buf, size, "MME");
return true; return true;
} }
......
This diff is collapsed.
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
#include "psoc_global_conf_masks.h" #include "psoc_global_conf_masks.h"
#include "dma_macro_masks.h" #include "dma_macro_masks.h"
#include "dma_qm_0_masks.h" #include "dma_qm_0_masks.h"
#include "dma_ch_0_masks.h"
#include "tpc0_qm_masks.h" #include "tpc0_qm_masks.h"
#include "tpc0_cmdq_masks.h" #include "tpc0_cmdq_masks.h"
#include "mme_qm_masks.h" #include "mme_qm_masks.h"
......
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