* [habanaai:habanalabs-next 17/17] drivers/misc/habanalabs/gaudi/gaudi.c:6077 gaudi_is_device_idle() warn: should '!is_eng_idle << (0 + dma_id)' be a 64 bit
@ 2020-08-24 10:49 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-08-24 10:49 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 9688 bytes --]
tree: https://github.com/HabanaAI/linux.git habanalabs-next
head: eb5cb5d380ac735874da3b555f4c8ab6ea814c90
commit: eb5cb5d380ac735874da3b555f4c8ab6ea814c90 [17/17] habanalabs: extend busy engines mask to 64 bits
config: x86_64-randconfig-m001-20200820 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/misc/habanalabs/gaudi/gaudi.c:6077 gaudi_is_device_idle() warn: should '!is_eng_idle << (0 + dma_id)' be a 64 bit type?
# https://github.com/HabanaAI/linux/commit/eb5cb5d380ac735874da3b555f4c8ab6ea814c90
git remote add habanaai https://github.com/HabanaAI/linux.git
git fetch --no-tags habanaai habanalabs-next
git checkout eb5cb5d380ac735874da3b555f4c8ab6ea814c90
vim +6077 drivers/misc/habanalabs/gaudi/gaudi.c
eb5cb5d380ac735 farah kassabri 2020-08-12 6044 static bool gaudi_is_device_idle(struct hl_device *hdev, u64 *mask,
^^^^^^^^^
This is now 64 bit.
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6045 struct seq_file *s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6046 {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6047 struct gaudi_device *gaudi = hdev->asic_specific;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6048 const char *fmt = "%-5d%-9s%#-14x%#-12x%#x\n";
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6049 const char *mme_slave_fmt = "%-5d%-9s%-14s%-12s%#x\n";
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6050 u32 qm_glbl_sts0, qm_cgm_sts, dma_core_sts0, tpc_cfg_sts, mme_arch_sts;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6051 bool is_idle = true, is_eng_idle, is_slave;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6052 u64 offset;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6053 int i, dma_id;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6054
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6055 mutex_lock(&gaudi->clk_gate_mutex);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6056
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6057 hdev->asic_funcs->disable_clock_gating(hdev);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6058
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6059 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6060 seq_puts(s,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6061 "\nDMA is_idle QM_GLBL_STS0 QM_CGM_STS DMA_CORE_STS0\n"
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6062 "--- ------- ------------ ---------- -------------\n");
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6063
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6064 for (i = 0 ; i < DMA_NUMBER_OF_CHNLS ; i++) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6065 dma_id = gaudi_dma_assignment[i];
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6066 offset = dma_id * DMA_QMAN_OFFSET;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6067
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6068 qm_glbl_sts0 = RREG32(mmDMA0_QM_GLBL_STS0 + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6069 qm_cgm_sts = RREG32(mmDMA0_QM_CGM_STS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6070 dma_core_sts0 = RREG32(mmDMA0_CORE_STS0 + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6071 is_eng_idle = IS_QM_IDLE(qm_glbl_sts0, qm_cgm_sts) &&
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6072 IS_DMA_IDLE(dma_core_sts0);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6073 is_idle &= is_eng_idle;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6074
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6075 if (mask)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6076 *mask |= !is_eng_idle <<
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 @6077 (GAUDI_ENGINE_ID_DMA_0 + dma_id);
So this needs to be:
*mask |= (u64)s_eng_idle << (GAUDI_ENGINE_ID_DMA_0 + dma_id);
to prevent shift wrapping. Smatch doesn't know the value of dma_id.
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6078 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6079 seq_printf(s, fmt, dma_id,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6080 is_eng_idle ? "Y" : "N", qm_glbl_sts0,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6081 qm_cgm_sts, dma_core_sts0);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6082 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6083
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6084 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6085 seq_puts(s,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6086 "\nTPC is_idle QM_GLBL_STS0 QM_CGM_STS CFG_STATUS\n"
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6087 "--- ------- ------------ ---------- ----------\n");
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6088
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6089 for (i = 0 ; i < TPC_NUMBER_OF_ENGINES ; i++) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6090 offset = i * TPC_QMAN_OFFSET;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6091 qm_glbl_sts0 = RREG32(mmTPC0_QM_GLBL_STS0 + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6092 qm_cgm_sts = RREG32(mmTPC0_QM_CGM_STS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6093 tpc_cfg_sts = RREG32(mmTPC0_CFG_STATUS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6094 is_eng_idle = IS_QM_IDLE(qm_glbl_sts0, qm_cgm_sts) &&
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6095 IS_TPC_IDLE(tpc_cfg_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6096 is_idle &= is_eng_idle;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6097
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6098 if (mask)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6099 *mask |= !is_eng_idle << (GAUDI_ENGINE_ID_TPC_0 + i);
Presumably Smatch knows that TPC_NUMBER_OF_ENGINES + GAUDI_ENGINE_ID_TPC_0
is less than 31.
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6100 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6101 seq_printf(s, fmt, i,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6102 is_eng_idle ? "Y" : "N",
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6103 qm_glbl_sts0, qm_cgm_sts, tpc_cfg_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6104 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6105
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6106 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6107 seq_puts(s,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6108 "\nMME is_idle QM_GLBL_STS0 QM_CGM_STS ARCH_STATUS\n"
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6109 "--- ------- ------------ ---------- -----------\n");
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6110
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6111 for (i = 0 ; i < MME_NUMBER_OF_ENGINES ; i++) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6112 offset = i * MME_QMAN_OFFSET;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6113 mme_arch_sts = RREG32(mmMME0_CTRL_ARCH_STATUS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6114 is_eng_idle = IS_MME_IDLE(mme_arch_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6115
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6116 /* MME 1 & 3 are slaves, no need to check their QMANs */
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6117 is_slave = i % 2;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6118 if (!is_slave) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6119 qm_glbl_sts0 = RREG32(mmMME0_QM_GLBL_STS0 + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6120 qm_cgm_sts = RREG32(mmMME0_QM_CGM_STS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6121 is_eng_idle &= IS_QM_IDLE(qm_glbl_sts0, qm_cgm_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6122 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6123
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6124 is_idle &= is_eng_idle;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6125
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6126 if (mask)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6127 *mask |= !is_eng_idle << (GAUDI_ENGINE_ID_MME_0 + i);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6128 if (s) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6129 if (!is_slave)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6130 seq_printf(s, fmt, i,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6131 is_eng_idle ? "Y" : "N",
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6132 qm_glbl_sts0, qm_cgm_sts, mme_arch_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6133 else
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6134 seq_printf(s, mme_slave_fmt, i,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6135 is_eng_idle ? "Y" : "N", "-",
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6136 "-", mme_arch_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6137 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6138 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6139
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6140 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6141 seq_puts(s, "\n");
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6142
e38bfd30e08802d Oded Gabbay 2020-07-03 6143 hdev->asic_funcs->set_clock_gating(hdev);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6144
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6145 mutex_unlock(&gaudi->clk_gate_mutex);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6146
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6147 return is_idle;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6148 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36161 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* [habanaai:habanalabs-next 17/17] drivers/misc/habanalabs/gaudi/gaudi.c:6077 gaudi_is_device_idle() warn: should '!is_eng_idle << (0 + dma_id)' be a 64 bit
@ 2020-08-24 10:49 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-08-24 10:49 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 9688 bytes --]
tree: https://github.com/HabanaAI/linux.git habanalabs-next
head: eb5cb5d380ac735874da3b555f4c8ab6ea814c90
commit: eb5cb5d380ac735874da3b555f4c8ab6ea814c90 [17/17] habanalabs: extend busy engines mask to 64 bits
config: x86_64-randconfig-m001-20200820 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/misc/habanalabs/gaudi/gaudi.c:6077 gaudi_is_device_idle() warn: should '!is_eng_idle << (0 + dma_id)' be a 64 bit type?
# https://github.com/HabanaAI/linux/commit/eb5cb5d380ac735874da3b555f4c8ab6ea814c90
git remote add habanaai https://github.com/HabanaAI/linux.git
git fetch --no-tags habanaai habanalabs-next
git checkout eb5cb5d380ac735874da3b555f4c8ab6ea814c90
vim +6077 drivers/misc/habanalabs/gaudi/gaudi.c
eb5cb5d380ac735 farah kassabri 2020-08-12 6044 static bool gaudi_is_device_idle(struct hl_device *hdev, u64 *mask,
^^^^^^^^^
This is now 64 bit.
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6045 struct seq_file *s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6046 {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6047 struct gaudi_device *gaudi = hdev->asic_specific;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6048 const char *fmt = "%-5d%-9s%#-14x%#-12x%#x\n";
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6049 const char *mme_slave_fmt = "%-5d%-9s%-14s%-12s%#x\n";
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6050 u32 qm_glbl_sts0, qm_cgm_sts, dma_core_sts0, tpc_cfg_sts, mme_arch_sts;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6051 bool is_idle = true, is_eng_idle, is_slave;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6052 u64 offset;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6053 int i, dma_id;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6054
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6055 mutex_lock(&gaudi->clk_gate_mutex);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6056
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6057 hdev->asic_funcs->disable_clock_gating(hdev);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6058
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6059 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6060 seq_puts(s,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6061 "\nDMA is_idle QM_GLBL_STS0 QM_CGM_STS DMA_CORE_STS0\n"
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6062 "--- ------- ------------ ---------- -------------\n");
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6063
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6064 for (i = 0 ; i < DMA_NUMBER_OF_CHNLS ; i++) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6065 dma_id = gaudi_dma_assignment[i];
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6066 offset = dma_id * DMA_QMAN_OFFSET;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6067
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6068 qm_glbl_sts0 = RREG32(mmDMA0_QM_GLBL_STS0 + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6069 qm_cgm_sts = RREG32(mmDMA0_QM_CGM_STS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6070 dma_core_sts0 = RREG32(mmDMA0_CORE_STS0 + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6071 is_eng_idle = IS_QM_IDLE(qm_glbl_sts0, qm_cgm_sts) &&
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6072 IS_DMA_IDLE(dma_core_sts0);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6073 is_idle &= is_eng_idle;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6074
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6075 if (mask)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6076 *mask |= !is_eng_idle <<
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 @6077 (GAUDI_ENGINE_ID_DMA_0 + dma_id);
So this needs to be:
*mask |= (u64)s_eng_idle << (GAUDI_ENGINE_ID_DMA_0 + dma_id);
to prevent shift wrapping. Smatch doesn't know the value of dma_id.
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6078 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6079 seq_printf(s, fmt, dma_id,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6080 is_eng_idle ? "Y" : "N", qm_glbl_sts0,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6081 qm_cgm_sts, dma_core_sts0);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6082 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6083
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6084 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6085 seq_puts(s,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6086 "\nTPC is_idle QM_GLBL_STS0 QM_CGM_STS CFG_STATUS\n"
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6087 "--- ------- ------------ ---------- ----------\n");
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6088
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6089 for (i = 0 ; i < TPC_NUMBER_OF_ENGINES ; i++) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6090 offset = i * TPC_QMAN_OFFSET;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6091 qm_glbl_sts0 = RREG32(mmTPC0_QM_GLBL_STS0 + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6092 qm_cgm_sts = RREG32(mmTPC0_QM_CGM_STS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6093 tpc_cfg_sts = RREG32(mmTPC0_CFG_STATUS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6094 is_eng_idle = IS_QM_IDLE(qm_glbl_sts0, qm_cgm_sts) &&
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6095 IS_TPC_IDLE(tpc_cfg_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6096 is_idle &= is_eng_idle;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6097
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6098 if (mask)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6099 *mask |= !is_eng_idle << (GAUDI_ENGINE_ID_TPC_0 + i);
Presumably Smatch knows that TPC_NUMBER_OF_ENGINES + GAUDI_ENGINE_ID_TPC_0
is less than 31.
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6100 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6101 seq_printf(s, fmt, i,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6102 is_eng_idle ? "Y" : "N",
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6103 qm_glbl_sts0, qm_cgm_sts, tpc_cfg_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6104 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6105
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6106 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6107 seq_puts(s,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6108 "\nMME is_idle QM_GLBL_STS0 QM_CGM_STS ARCH_STATUS\n"
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6109 "--- ------- ------------ ---------- -----------\n");
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6110
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6111 for (i = 0 ; i < MME_NUMBER_OF_ENGINES ; i++) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6112 offset = i * MME_QMAN_OFFSET;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6113 mme_arch_sts = RREG32(mmMME0_CTRL_ARCH_STATUS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6114 is_eng_idle = IS_MME_IDLE(mme_arch_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6115
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6116 /* MME 1 & 3 are slaves, no need to check their QMANs */
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6117 is_slave = i % 2;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6118 if (!is_slave) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6119 qm_glbl_sts0 = RREG32(mmMME0_QM_GLBL_STS0 + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6120 qm_cgm_sts = RREG32(mmMME0_QM_CGM_STS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6121 is_eng_idle &= IS_QM_IDLE(qm_glbl_sts0, qm_cgm_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6122 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6123
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6124 is_idle &= is_eng_idle;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6125
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6126 if (mask)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6127 *mask |= !is_eng_idle << (GAUDI_ENGINE_ID_MME_0 + i);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6128 if (s) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6129 if (!is_slave)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6130 seq_printf(s, fmt, i,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6131 is_eng_idle ? "Y" : "N",
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6132 qm_glbl_sts0, qm_cgm_sts, mme_arch_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6133 else
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6134 seq_printf(s, mme_slave_fmt, i,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6135 is_eng_idle ? "Y" : "N", "-",
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6136 "-", mme_arch_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6137 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6138 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6139
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6140 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6141 seq_puts(s, "\n");
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6142
e38bfd30e08802d Oded Gabbay 2020-07-03 6143 hdev->asic_funcs->set_clock_gating(hdev);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6144
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6145 mutex_unlock(&gaudi->clk_gate_mutex);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6146
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6147 return is_idle;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6148 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36161 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [habanaai:habanalabs-next 17/17] drivers/misc/habanalabs/gaudi/gaudi.c:6077 gaudi_is_device_idle() warn: should '!is_eng_idle << (0 + dma_id)' be a 64 bit
@ 2020-08-20 22:16 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-08-20 22:16 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 9814 bytes --]
CC: kbuild-all(a)lists.01.org
TO: farah kassabri <fkassabri@habana.ai>
CC: Oded Gabbay <oded.gabbay@gmail.com>
tree: https://github.com/HabanaAI/linux.git habanalabs-next
head: eb5cb5d380ac735874da3b555f4c8ab6ea814c90
commit: eb5cb5d380ac735874da3b555f4c8ab6ea814c90 [17/17] habanalabs: extend busy engines mask to 64 bits
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: x86_64-randconfig-m001-20200820 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/misc/habanalabs/gaudi/gaudi.c:6077 gaudi_is_device_idle() warn: should '!is_eng_idle << (0 + dma_id)' be a 64 bit type?
# https://github.com/HabanaAI/linux/commit/eb5cb5d380ac735874da3b555f4c8ab6ea814c90
git remote add habanaai https://github.com/HabanaAI/linux.git
git fetch --no-tags habanaai habanalabs-next
git checkout eb5cb5d380ac735874da3b555f4c8ab6ea814c90
vim +6077 drivers/misc/habanalabs/gaudi/gaudi.c
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6043
eb5cb5d380ac735 farah kassabri 2020-08-12 6044 static bool gaudi_is_device_idle(struct hl_device *hdev, u64 *mask,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6045 struct seq_file *s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6046 {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6047 struct gaudi_device *gaudi = hdev->asic_specific;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6048 const char *fmt = "%-5d%-9s%#-14x%#-12x%#x\n";
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6049 const char *mme_slave_fmt = "%-5d%-9s%-14s%-12s%#x\n";
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6050 u32 qm_glbl_sts0, qm_cgm_sts, dma_core_sts0, tpc_cfg_sts, mme_arch_sts;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6051 bool is_idle = true, is_eng_idle, is_slave;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6052 u64 offset;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6053 int i, dma_id;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6054
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6055 mutex_lock(&gaudi->clk_gate_mutex);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6056
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6057 hdev->asic_funcs->disable_clock_gating(hdev);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6058
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6059 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6060 seq_puts(s,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6061 "\nDMA is_idle QM_GLBL_STS0 QM_CGM_STS DMA_CORE_STS0\n"
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6062 "--- ------- ------------ ---------- -------------\n");
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6063
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6064 for (i = 0 ; i < DMA_NUMBER_OF_CHNLS ; i++) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6065 dma_id = gaudi_dma_assignment[i];
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6066 offset = dma_id * DMA_QMAN_OFFSET;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6067
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6068 qm_glbl_sts0 = RREG32(mmDMA0_QM_GLBL_STS0 + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6069 qm_cgm_sts = RREG32(mmDMA0_QM_CGM_STS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6070 dma_core_sts0 = RREG32(mmDMA0_CORE_STS0 + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6071 is_eng_idle = IS_QM_IDLE(qm_glbl_sts0, qm_cgm_sts) &&
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6072 IS_DMA_IDLE(dma_core_sts0);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6073 is_idle &= is_eng_idle;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6074
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6075 if (mask)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6076 *mask |= !is_eng_idle <<
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 @6077 (GAUDI_ENGINE_ID_DMA_0 + dma_id);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6078 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6079 seq_printf(s, fmt, dma_id,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6080 is_eng_idle ? "Y" : "N", qm_glbl_sts0,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6081 qm_cgm_sts, dma_core_sts0);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6082 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6083
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6084 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6085 seq_puts(s,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6086 "\nTPC is_idle QM_GLBL_STS0 QM_CGM_STS CFG_STATUS\n"
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6087 "--- ------- ------------ ---------- ----------\n");
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6088
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6089 for (i = 0 ; i < TPC_NUMBER_OF_ENGINES ; i++) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6090 offset = i * TPC_QMAN_OFFSET;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6091 qm_glbl_sts0 = RREG32(mmTPC0_QM_GLBL_STS0 + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6092 qm_cgm_sts = RREG32(mmTPC0_QM_CGM_STS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6093 tpc_cfg_sts = RREG32(mmTPC0_CFG_STATUS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6094 is_eng_idle = IS_QM_IDLE(qm_glbl_sts0, qm_cgm_sts) &&
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6095 IS_TPC_IDLE(tpc_cfg_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6096 is_idle &= is_eng_idle;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6097
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6098 if (mask)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6099 *mask |= !is_eng_idle << (GAUDI_ENGINE_ID_TPC_0 + i);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6100 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6101 seq_printf(s, fmt, i,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6102 is_eng_idle ? "Y" : "N",
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6103 qm_glbl_sts0, qm_cgm_sts, tpc_cfg_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6104 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6105
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6106 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6107 seq_puts(s,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6108 "\nMME is_idle QM_GLBL_STS0 QM_CGM_STS ARCH_STATUS\n"
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6109 "--- ------- ------------ ---------- -----------\n");
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6110
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6111 for (i = 0 ; i < MME_NUMBER_OF_ENGINES ; i++) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6112 offset = i * MME_QMAN_OFFSET;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6113 mme_arch_sts = RREG32(mmMME0_CTRL_ARCH_STATUS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6114 is_eng_idle = IS_MME_IDLE(mme_arch_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6115
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6116 /* MME 1 & 3 are slaves, no need to check their QMANs */
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6117 is_slave = i % 2;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6118 if (!is_slave) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6119 qm_glbl_sts0 = RREG32(mmMME0_QM_GLBL_STS0 + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6120 qm_cgm_sts = RREG32(mmMME0_QM_CGM_STS + offset);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6121 is_eng_idle &= IS_QM_IDLE(qm_glbl_sts0, qm_cgm_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6122 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6123
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6124 is_idle &= is_eng_idle;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6125
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6126 if (mask)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6127 *mask |= !is_eng_idle << (GAUDI_ENGINE_ID_MME_0 + i);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6128 if (s) {
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6129 if (!is_slave)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6130 seq_printf(s, fmt, i,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6131 is_eng_idle ? "Y" : "N",
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6132 qm_glbl_sts0, qm_cgm_sts, mme_arch_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6133 else
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6134 seq_printf(s, mme_slave_fmt, i,
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6135 is_eng_idle ? "Y" : "N", "-",
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6136 "-", mme_arch_sts);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6137 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6138 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6139
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6140 if (s)
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6141 seq_puts(s, "\n");
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6142
e38bfd30e08802d Oded Gabbay 2020-07-03 6143 hdev->asic_funcs->set_clock_gating(hdev);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6144
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6145 mutex_unlock(&gaudi->clk_gate_mutex);
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6146
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6147 return is_idle;
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6148 }
ac0ae6a96aa58ee Oded Gabbay 2020-05-11 6149
:::::: The code at line 6077 was first introduced by commit
:::::: ac0ae6a96aa58eeba4aed97b12ef1dea8c5bf399 habanalabs: add gaudi asic-dependent code
:::::: TO: Oded Gabbay <oded.gabbay@gmail.com>
:::::: CC: Oded Gabbay <oded.gabbay@gmail.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36161 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-24 10:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-24 10:49 [habanaai:habanalabs-next 17/17] drivers/misc/habanalabs/gaudi/gaudi.c:6077 gaudi_is_device_idle() warn: should '!is_eng_idle << (0 + dma_id)' be a 64 bit Dan Carpenter
2020-08-24 10:49 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2020-08-20 22:16 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.