From d79b205d39f8a9e2c12297914fa3f2847a586ee1 Mon Sep 17 00:00:00 2001 From: raghusha-xlnx <raghusha@xilinx.com> Date: Fri, 29 Sep 2023 22:43:41 +0530 Subject: [PATCH] QDMA Linux reference driver for v2023.2.0 release. --- QDMA/linux-kernel/RELEASE | 13 +++- QDMA/linux-kernel/apps/dma-ctl/main.c | 2 +- QDMA/linux-kernel/apps/dma-ctl/version.h | 2 +- .../apps/dma-from-device/version.h | 2 +- QDMA/linux-kernel/apps/dma-latency/version.h | 2 +- QDMA/linux-kernel/apps/dma-perf/version.h | 2 +- .../linux-kernel/apps/dma-to-device/version.h | 2 +- QDMA/linux-kernel/apps/dma-utils/version.h | 2 +- QDMA/linux-kernel/apps/dma-xfer/version.h | 2 +- .../driver/libqdma/libqdma_export.c | 3 +- .../libqdma/qdma_access/qdma_access_version.h | 6 +- .../qdma_cpm4_access/qdma_cpm4_access.c | 64 +++++++++++++++++++ .../qdma_cpm4_access/qdma_cpm4_access.h | 4 ++ QDMA/linux-kernel/driver/libqdma/version.h | 2 +- QDMA/linux-kernel/driver/src/version.h | 4 +- 15 files changed, 96 insertions(+), 16 deletions(-) diff --git a/QDMA/linux-kernel/RELEASE b/QDMA/linux-kernel/RELEASE index 51278da..85b1b24 100755 --- a/QDMA/linux-kernel/RELEASE +++ b/QDMA/linux-kernel/RELEASE @@ -1,4 +1,4 @@ -RELEASE: 2023.1.3 +RELEASE: 2023.2.0 ================= This release is validated @@ -6,6 +6,7 @@ This release is validated - On VCU1525 for QDMA4.0 2020.2 example design - On VCU1525 for QDMA3.1 2019.2 example design - On XCVP1202 for CPM5 2022.1 example design + - On XCVC1902 for CPM4 2022.1 example design SUPPORTED FEATURES: =================== @@ -144,8 +145,18 @@ CPM5 ---------------- - dma-ctl application is updated to append q params during queue start. +2023.2.0 Updates +---------------- +- Added driver support for CPM4 design. + + KNOWN ISSUES: ============= +- CPM4 Only + - Due to HW PDI limitaion, + - VF is supported in poll mode only. + - VF functionality on VM is not verfied. + - Observed MMAP failure for applications when device is binded QDMA Linux driver on Fedora37. Fix will be availbale in upcoming release. - CPM5 Only diff --git a/QDMA/linux-kernel/apps/dma-ctl/main.c b/QDMA/linux-kernel/apps/dma-ctl/main.c index 95159ed..2a80961 100755 --- a/QDMA/linux-kernel/apps/dma-ctl/main.c +++ b/QDMA/linux-kernel/apps/dma-ctl/main.c @@ -131,7 +131,7 @@ static void dump_dev_global_csr(struct xcmd_info *xcmd) printf("%d ",xcmd->resp.csr.c2h_cnt_th[i]); printf("\nC2H Buf Sizes:"); for ( int i=0; i < QDMA_GLOBAL_CSR_ARRAY_SZ; i++) - printf("%d ",xcmd->resp.csr.c2h_cnt_th[i]); + printf("%d ",xcmd->resp.csr.c2h_buf_sz[i]); printf("\nWriteback Interval:%d\n",xcmd->resp.csr.wb_intvl); } diff --git a/QDMA/linux-kernel/apps/dma-ctl/version.h b/QDMA/linux-kernel/apps/dma-ctl/version.h index 447858d..e01b78a 100755 --- a/QDMA/linux-kernel/apps/dma-ctl/version.h +++ b/QDMA/linux-kernel/apps/dma-ctl/version.h @@ -13,7 +13,7 @@ #define __DMA_CTL_VERSION_H #define PROGNAME "dma-ctl" -#define VERSION "2023.1.3" +#define VERSION "2023.2.0" #define COPYRIGHT "Copyright (c) 2022-2023 Advanced Micro Devices Inc." #endif diff --git a/QDMA/linux-kernel/apps/dma-from-device/version.h b/QDMA/linux-kernel/apps/dma-from-device/version.h index 273a5d2..9eeb784 100755 --- a/QDMA/linux-kernel/apps/dma-from-device/version.h +++ b/QDMA/linux-kernel/apps/dma-from-device/version.h @@ -13,7 +13,7 @@ #define __DMA_FROM_DEVICE_VERSION_H #define PROGNAME "dma-from-device" -#define VERSION "2023.1.2" +#define VERSION "2023.2.0" #define COPYRIGHT "Copyright (c) 2022-2023 Advanced Micro Devices Inc." #endif diff --git a/QDMA/linux-kernel/apps/dma-latency/version.h b/QDMA/linux-kernel/apps/dma-latency/version.h index 2ec9693..650deb9 100755 --- a/QDMA/linux-kernel/apps/dma-latency/version.h +++ b/QDMA/linux-kernel/apps/dma-latency/version.h @@ -13,7 +13,7 @@ #define __DMA_LATENCY_VERSION_H #define PROGNAME "dma-latency" -#define VERSION "2023.1.2" +#define VERSION "2023.2.0" #define COPYRIGHT "Copyright (c) 2022-2023 Advanced Micro Devices Inc." #endif diff --git a/QDMA/linux-kernel/apps/dma-perf/version.h b/QDMA/linux-kernel/apps/dma-perf/version.h index dc3db51..53a766a 100755 --- a/QDMA/linux-kernel/apps/dma-perf/version.h +++ b/QDMA/linux-kernel/apps/dma-perf/version.h @@ -13,7 +13,7 @@ #define __DMA_PERF_VERSION_H #define PROGNAME "dma-perf" -#define VERSION "2023.1.2" +#define VERSION "2023.2.0" #define COPYRIGHT "Copyright (c) 2022-2023 Advanced Micro Devices Inc." #endif diff --git a/QDMA/linux-kernel/apps/dma-to-device/version.h b/QDMA/linux-kernel/apps/dma-to-device/version.h index 03e2a83..b14cefc 100755 --- a/QDMA/linux-kernel/apps/dma-to-device/version.h +++ b/QDMA/linux-kernel/apps/dma-to-device/version.h @@ -13,7 +13,7 @@ #define __DMA_TO_DEVICE_VERSION_H #define PROGNAME "dma-to-device" -#define VERSION "2023.1.2" +#define VERSION "2023.2.0" #define COPYRIGHT "Copyright (c) 2022-2023 Advanced Micro Devices Inc." #endif diff --git a/QDMA/linux-kernel/apps/dma-utils/version.h b/QDMA/linux-kernel/apps/dma-utils/version.h index 510eea8..7e540ef 100755 --- a/QDMA/linux-kernel/apps/dma-utils/version.h +++ b/QDMA/linux-kernel/apps/dma-utils/version.h @@ -13,7 +13,7 @@ #define __DMA_UTILS_VERSION_H #define LIBNAME "dma-utils" -#define QDMATUILS_VERSION "2023.1.2" +#define QDMATUILS_VERSION "2023.2.0" #define COPYRIGHT "Copyright (c) 2022-2023 Advanced Micro Devices Inc." #endif diff --git a/QDMA/linux-kernel/apps/dma-xfer/version.h b/QDMA/linux-kernel/apps/dma-xfer/version.h index 98a77e4..31e8654 100755 --- a/QDMA/linux-kernel/apps/dma-xfer/version.h +++ b/QDMA/linux-kernel/apps/dma-xfer/version.h @@ -12,7 +12,7 @@ #define __DMA_XFER_VERSION_H #define PROGNAME "dma-xfer" -#define VERSION "2023.1.2" +#define VERSION "2023.2.0" #define COPYRIGHT "Copyright (c) 2022-2023 Advanced Micro Devices Inc." #endif diff --git a/QDMA/linux-kernel/driver/libqdma/libqdma_export.c b/QDMA/linux-kernel/driver/libqdma/libqdma_export.c index 6280254..cf9ae2c 100755 --- a/QDMA/linux-kernel/driver/libqdma/libqdma_export.c +++ b/QDMA/linux-kernel/driver/libqdma/libqdma_export.c @@ -2672,7 +2672,8 @@ int qdma_init_st_ctxt(unsigned long dev_hndl, char *buf, int buflen) } if ((xdev->version_info.ip_type == QDMA_VERSAL_HARD_IP) && - (xdev->version_info.device_type == QDMA_DEVICE_VERSAL_CPM5)) { + ((xdev->version_info.device_type == QDMA_DEVICE_VERSAL_CPM4) || + (xdev->version_info.device_type == QDMA_DEVICE_VERSAL_CPM5))) { if (xdev->hw.qdma_init_st_ctxt == NULL) { pr_err("Err: Feature not supported\n"); snprintf(buf, buflen, "Err: Feature not supported\n"); diff --git a/QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_access_version.h b/QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_access_version.h index 9fb9181..5bc29ab 100755 --- a/QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_access_version.h +++ b/QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_access_version.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved. - * Copyright (c) 2022, Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved. * * This source code is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -20,8 +20,8 @@ #define QDMA_VERSION_MAJOR 2023 -#define QDMA_VERSION_MINOR 1 -#define QDMA_VERSION_PATCH 2 +#define QDMA_VERSION_MINOR 2 +#define QDMA_VERSION_PATCH 0 #define QDMA_VERSION_STR \ __stringify(QDMA_VERSION_MAJOR) "." \ diff --git a/QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_cpm4_access/qdma_cpm4_access.c b/QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_cpm4_access/qdma_cpm4_access.c index 757662f..33c45ff 100755 --- a/QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_cpm4_access/qdma_cpm4_access.c +++ b/QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_cpm4_access/qdma_cpm4_access.c @@ -4923,6 +4923,15 @@ int qdma_cpm4_init_ctxt_memory(void *dev_hndl) int sel = QDMA_CTXT_SEL_SW_C2H; int rv; + +#ifdef TANDEM_BOOT_SUPPORTED + for (; sel <= QDMA_CTXT_SEL_CR_H2C; sel++) { + rv = qdma_cpm4_indirect_reg_clear(dev_hndl, + (enum ind_ctxt_cmd_sel)sel, i); + if (rv < 0) + return rv; + } +#else for (; sel <= QDMA_CTXT_SEL_PFTCH; sel++) { /** if the st mode(h2c/c2h) not enabled * in the design, then skip the PFTCH @@ -4942,6 +4951,7 @@ int qdma_cpm4_init_ctxt_memory(void *dev_hndl) if (rv < 0) return rv; } +#endif } /* fmap */ @@ -4957,6 +4967,60 @@ int qdma_cpm4_init_ctxt_memory(void *dev_hndl) return 0; } +#ifdef TANDEM_BOOT_SUPPORTED +/*****************************************************************************/ +/** + * qdma_cpm4_init_st_ctxt() - Initialize the ST context + * + * @dev_hndl: device handle + * + * Return: returns the platform specific error code + *****************************************************************************/ +int qdma_cpm4_init_st_ctxt(void *dev_hndl) +{ + uint32_t data[QDMA_REG_IND_CTXT_REG_COUNT]; + uint16_t i = 0; + struct qdma_dev_attributes dev_info; + + if (!dev_hndl) { + qdma_log_error("%s: dev_handle is NULL, err:%d\n", + __func__, -QDMA_ERR_INV_PARAM); + return -QDMA_ERR_INV_PARAM; + } + + qdma_memset(data, 0, sizeof(uint32_t) * QDMA_REG_IND_CTXT_REG_COUNT); + qdma_cpm4_get_device_attributes(dev_hndl, &dev_info); + + for (; i < dev_info.num_qs; i++) { + int sel = QDMA_CTXT_SEL_CMPT; + int rv; + + for (; sel <= QDMA_CTXT_SEL_PFTCH; sel++) { + /** if the st mode(h2c/c2h) not enabled + * in the design, then skip the PFTCH + * and CMPT context setup + */ + if ((dev_info.st_en == 0) && + ((sel == QDMA_CTXT_SEL_PFTCH) || + (sel == QDMA_CTXT_SEL_CMPT))) { + qdma_log_debug("%s: ST context is skipped:", + __func__); + qdma_log_debug("sel = %d\n", sel); + continue; + } + + rv = qdma_cpm4_indirect_reg_clear(dev_hndl, + (enum ind_ctxt_cmd_sel)sel, i); + if (rv < 0) + return rv; + } + } + + return QDMA_SUCCESS; + +} +#endif + static int get_reg_entry(uint32_t reg_addr, int *reg_entry) { uint32_t i = 0; diff --git a/QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_cpm4_access/qdma_cpm4_access.h b/QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_cpm4_access/qdma_cpm4_access.h index b238c33..cecb0d7 100755 --- a/QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_cpm4_access/qdma_cpm4_access.h +++ b/QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_cpm4_access/qdma_cpm4_access.h @@ -163,6 +163,10 @@ struct qdma_cpm4_hw_err_info { int qdma_cpm4_init_ctxt_memory(void *dev_hndl); +#ifdef TANDEM_BOOT_SUPPORTED +int qdma_cpm4_init_st_ctxt(void *dev_hndl); +#endif + int qdma_cpm4_qid2vec_conf(void *dev_hndl, uint8_t c2h, uint16_t hw_qid, struct qdma_qid2vec *ctxt, enum qdma_hw_access_type access_type); diff --git a/QDMA/linux-kernel/driver/libqdma/version.h b/QDMA/linux-kernel/driver/libqdma/version.h index 2246946..5b6e332 100755 --- a/QDMA/linux-kernel/driver/libqdma/version.h +++ b/QDMA/linux-kernel/driver/libqdma/version.h @@ -24,7 +24,7 @@ #define LIBQDMA_MODULE_DESC "Xilinx QDMA Library" #define LIBQDMA_VERSION_MAJOR 2023 -#define LIBQDMA_VERSION_MINOR 1 +#define LIBQDMA_VERSION_MINOR 2 #define LIBQDMA_VERSION_PATCH 0 #define LIBQDMA_VERSION_STR \ diff --git a/QDMA/linux-kernel/driver/src/version.h b/QDMA/linux-kernel/driver/src/version.h index 2b97f66..5727428 100755 --- a/QDMA/linux-kernel/driver/src/version.h +++ b/QDMA/linux-kernel/driver/src/version.h @@ -29,10 +29,10 @@ #define DRV_MODULE_NAME "qdma-pf" #define DRV_MODULE_DESC "Xilinx QDMA PF Reference Driver" #endif /* #ifdef __QDMA_VF__ */ -#define DRV_MODULE_RELDATE "Jan 2023" +#define DRV_MODULE_RELDATE "Sept 2023" #define DRV_MOD_MAJOR 2023 -#define DRV_MOD_MINOR 1 +#define DRV_MOD_MINOR 2 #define DRV_MOD_PATCHLEVEL 0 #define DRV_MODULE_VERSION \ -- GitLab