drivers: implement HiSilicon Queue Management (QM) module - #6368
Conversation
96fddf6 to
1183f4e
Compare
etienne-lms
left a comment
There was a problem hiding this comment.
2 main comments to be addressed. Otherwise the implementation LGTM.
@xiaoxuZeng, maybe some comments apply to hisi_qm part1 P-R.
a707419 to
cd21284
Compare
|
LGTM
|
etienne-lms
left a comment
There was a problem hiding this comment.
Few remaining nitpicking comments and question around allocated memory: should it be zeored before it's used?
etienne-lms
left a comment
There was a problem hiding this comment.
Hi @xiaoxuZeng, I think you made too many changes in this last series. It seems all uint32_t have changed into unsigned int despite most of them are expected to be 32bit values used with io_read32()/write32(). I've started to puts some comments but there are too many occurrences. Could you come back to the series previous version and change s/uint32_t/unsigned int/ only for the few function local variables used as index in for or like loops?
877a2ae to
8761fa9
Compare
etienne-lms
left a comment
There was a problem hiding this comment.
Looks consistent to me.
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
|
Hi @jforissier Please review this patch when you are convenience. We look forward to your guidance. Thanks. |
jforissier
left a comment
There was a problem hiding this comment.
Hi @xiaoxuZeng, please see my comments below. Overall this looks good to me.
Please replace the commit subject " The Hisilicon QM is a Queue Management module." with "drivers: implement HiSilicon Queue Management (QM) module".
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
| } | ||
| } | ||
|
|
||
| if (qm->qp_num == 0 || qm->sqe_size == 0) { |
There was a problem hiding this comment.
Prefer if (!qm->qp_num || !qm->sqe_size) {
| } | ||
|
|
||
| if (qm->qp_num == 0 || qm->sqe_size == 0) { | ||
| EMSG("Invalid qm parameters"); |
There was a problem hiding this comment.
Prefer uppercase QM: Invalid QM parameters
| for (i = QM_SQC_VFT; i <= QM_CQC_VFT; i++) { | ||
| ret = qm_set_vft_common(qm, i, function, base, num); | ||
| if (ret) { | ||
| EMSG("QM set type%d fail", i); |
| *base = (sqc_vft >> QM_SQC_VFT_START_SQN_SHIFT) & QM_SQC_VFT_BASE_MASK; | ||
| *num = ((sqc_vft >> QM_SQC_VFT_SQ_NUM_SHIFT) & QM_SQC_VFT_NUM_MASK) + 1; |
There was a problem hiding this comment.
@jenswi-linaro should we define SHIFTR_U64() for such right-shift operations? Or are they safe to do like this?
| free(qp->cqe); | ||
| } | ||
|
|
||
| static enum hisi_drv_status qp_memory_init(struct hisi_qm *qm, uint32_t id) |
There was a problem hiding this comment.
I suggest s/qp_memory_init/qp_alloc/ and s/qp_memory_uninit/qp_free/ because the names are simpler and better reflect the fact that you are indeed allocating/freeing from the heap, not just initializing/clearing some data.
| free(qm->cqc); | ||
| } | ||
|
|
||
| static enum hisi_drv_status qm_memory_init(struct hisi_qm *qm) |
There was a problem hiding this comment.
Same suggestion here: qm_alloc() and qm_free().
| { | ||
| uint32_t val = 0; | ||
|
|
||
| /* return 0 mailbox ready, HISI_QM_DRVCRYPT_ETMOUT hardware timeout */ |
There was a problem hiding this comment.
Better to start comments with an uppercase letter: /* Return 0... */
|
Please also rebase on master to fix the IBART CI error. Thanks! |
Thank you for your guidance, and we will complete the remaining issues in the near future. |
98d1747 to
79e5acd
Compare
| { .reg_name = "QM_DFX_WB_SQE_FROM_ACC_CNT", .reg_offset = 0x104058 }, | ||
| { .reg_name = "QM_DFX_ACC_FINISH_CNT ", .reg_offset = 0x104060 }, | ||
| { .reg_name = "QM_DFX_CQE_ERR_CNT ", .reg_offset = 0x1040b4 }, | ||
| { .reg_name = NULL, 0 } |
There was a problem hiding this comment.
s/{ .reg_name = NULL, 0 }/{ }/
| /** | ||
| * @Description: Init QM for Kunpeng drv | ||
| * @param qm: Handle of Queue Management module | ||
| * @return success: 0,fail: HISI_QM_DRVCRYPT_EBUSY/HISI_QM_DRVCRYPT_EINVAL |
There was a problem hiding this comment.
s/0/HISI_QM_DRVCRYPT_NO_ERR/ ?
Dittto at 248 and 256
The Hisilicon QM is a Queue Management module. In order to unify the interface between accelerator and software, a unified queue management module QM is used to interact with software. Each accelerator module integrates a QM. Software issues tasks to the SQ (Submmision Queue),and the QM obtains the address of the SQE (Submmision Queue Element). The BD (Buffer Description, same as SQE) information is sent to the accelerator. After the task processing is complete, the accelerator applies for a write-back address from the QM to write back the SQ. Signed-off-by: Xiaoxu Zeng <zengxiaoxu@huawei.com> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
|
@xiaoxuZeng thanks, I am merging this now (the CI error is unrelated and will go away when the code is rebased to include #6484). |
The Hisilicon QM is a Queue Management module.
In order to unify the interface between accelerator and software, a unified queue management module QM is used to interact with software. Each accelerator module integrates a QM. Software issues tasks to the SQ (Submmision Queue),and the QM obtains the address of the SQE (Submmision Queue Element). The BD (Buffer Description, same as SQE) information is sent to the accelerator. After the task processing is complete, the accelerator applies for a write-back address from the QM to write back the SQ.