From 18ce9f487dd98a8a96dd0ead80034cf1de48ced1 Mon Sep 17 00:00:00 2001 From: yuzexi Date: Thu, 7 Nov 2024 11:03:51 +0800 Subject: [PATCH] guest_kernel: modify platform driver according to comments modify platform driver according to comments Signed-off-by: yuzexi --- kae_driver/plat_hpre_main.c | 5 ++- kae_driver/plat_hpre_main.h | 16 --------- kae_driver/plat_qm.c | 3 +- kae_driver/plat_qm.h | 72 +++++++++++++++++++++++++++++++++++-- kae_driver/plat_sec.h | 16 --------- kae_driver/plat_sec_main.c | 7 +++- 6 files changed, 80 insertions(+), 39 deletions(-) delete mode 100644 kae_driver/plat_hpre_main.h delete mode 100644 kae_driver/plat_sec.h diff --git a/kae_driver/plat_hpre_main.c b/kae_driver/plat_hpre_main.c index 76868a0..9e49a51 100644 --- a/kae_driver/plat_hpre_main.c +++ b/kae_driver/plat_hpre_main.c @@ -9,7 +9,10 @@ #include #include "plat_qm.h" -#include "plat_hpre_main.h" + +struct plat_hpre { + struct hisi_plat_qm qm; +}; #define HPRE_SQE_SIZE 64 diff --git a/kae_driver/plat_hpre_main.h b/kae_driver/plat_hpre_main.h deleted file mode 100644 index f9490da..0000000 --- a/kae_driver/plat_hpre_main.h +++ /dev/null @@ -1,16 +0,0 @@ - -/* - * SPDX-License-Identifier: GPL-2.0 - * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. - */ - -#ifndef __HISI_HPRE_MAIN_H -#define __HISI_HPRE_MAIN_H - -#include "plat_qm.h" - -struct plat_hpre { - struct hisi_plat_qm qm; -}; - -#endif \ No newline at end of file diff --git a/kae_driver/plat_qm.c b/kae_driver/plat_qm.c index 394a23b..11236c9 100644 --- a/kae_driver/plat_qm.c +++ b/kae_driver/plat_qm.c @@ -9,7 +9,6 @@ #include #include #include -#include "qm_common.h" #include "plat_qm.h" /* mailbox */ @@ -1318,4 +1317,4 @@ MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Leisen "); MODULE_AUTHOR("Guangwei Zhou "); MODULE_AUTHOR("Wangyuan "); -MODULE_DESCRIPTION("HiSilicon Accelerator queue manager Platform driver"); \ No newline at end of file +MODULE_DESCRIPTION("HiSilicon Accelerator queue manager Platform driver"); diff --git a/kae_driver/plat_qm.h b/kae_driver/plat_qm.h index b584b75..edf38d1 100644 --- a/kae_driver/plat_qm.h +++ b/kae_driver/plat_qm.h @@ -1,6 +1,5 @@ - +// SPDX-License-Identifier: GPL-2.0 /* - * SPDX-License-Identifier: GPL-2.0 * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. */ @@ -12,6 +11,73 @@ #define QM_Q_DEPTH 1024 +struct qm_cqe { + __le32 rsvd0; + __le16 cmd_id; + __le16 rsvd1; + __le16 sq_head; + __le16 sq_num; + __le16 rsvd2; + __le16 w7; +}; + +struct qm_eqe { + __le32 dw0; +}; + +struct qm_aeqe { + __le32 dw0; +}; + +struct qm_sqc { + __le16 head; + __le16 tail; + __le32 base_l; + __le32 base_h; + __le32 dw3; + __le16 w8; + __le16 rsvd0; + __le16 pasid; + __le16 w11; + __le16 cq_num; + __le16 w13; + __le32 rsvd1; +}; + +struct qm_cqc { + __le16 head; + __le16 tail; + __le32 base_l; + __le32 base_h; + __le32 dw3; + __le16 w8; + __le16 rsvd0; + __le16 pasid; + __le16 w11; + __le32 dw6; + __le32 rsvd1; +}; + +struct qm_eqc { + __le16 head; + __le16 tail; + __le32 base_l; + __le32 base_h; + __le32 dw3; + __le32 rsvd[2]; + __le32 dw6; +}; + +struct qm_aeqc { + __le16 head; + __le16 tail; + __le32 base_l; + __le32 base_h; + __le32 dw3; + __le32 rsvd[2]; + __le32 dw6; +}; + struct hisi_plat_qp { u32 qp_id; u16 sq_depth; @@ -79,4 +145,4 @@ int platform_start_qm(struct hisi_plat_qm *qm); int platform_stop_qm(struct hisi_plat_qm *qm, enum qm_stop_reason r); void platform_uninit_qm(struct hisi_plat_qm *qm); int platform_register_uacce(struct hisi_plat_qm *qm); -#endif /* !PLAT_QM_H */ \ No newline at end of file +#endif /* !PLAT_QM_H */ diff --git a/kae_driver/plat_sec.h b/kae_driver/plat_sec.h deleted file mode 100644 index 9993255..0000000 --- a/kae_driver/plat_sec.h +++ /dev/null @@ -1,16 +0,0 @@ - -/* - * SPDX-License-Identifier: GPL-2.0 - * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. - */ - -#ifndef __PLAT_SEC_H -#define __PLAT_SEC_H - -#include "plat_qm.h" - -struct sec_dev { - struct hisi_plat_qm qm; -}; - -#endif diff --git a/kae_driver/plat_sec_main.c b/kae_driver/plat_sec_main.c index 6bdd9a8..efc1c71 100644 --- a/kae_driver/plat_sec_main.c +++ b/kae_driver/plat_sec_main.c @@ -9,6 +9,11 @@ #define SEC_SQE_SIZE 128 +struct plat_sec { + struct hisi_plat_qm qm; +}; + + static int sec_qm_init(struct hisi_plat_qm *qm, struct platform_device *pdev) { qm->pdev = pdev; @@ -27,7 +32,7 @@ static int sec_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct hisi_plat_qm *qm; - struct sec_dev *sec; + struct plat_sec *sec; int ret; dev_info(dev, "SEC init ...\n"); -- Gitee