From 22cef192ec6d9ca696cfd1a83915e38c91002972 Mon Sep 17 00:00:00 2001 From: DMG Karthik <146181807+karthdmg-xilinx@users.noreply.github.com> Date: Fri, 23 Aug 2024 14:31:31 +0530 Subject: [PATCH 1/7] Fix errors in PR 8361 (#8363) Co-authored-by: rave --- src/runtime_src/core/pcie/driver/aws/kernel/mgmt/mgmt-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime_src/core/pcie/driver/aws/kernel/mgmt/mgmt-core.c b/src/runtime_src/core/pcie/driver/aws/kernel/mgmt/mgmt-core.c index a7ecc47644b..6aa9a8b9d86 100644 --- a/src/runtime_src/core/pcie/driver/aws/kernel/mgmt/mgmt-core.c +++ b/src/runtime_src/core/pcie/driver/aws/kernel/mgmt/mgmt-core.c @@ -853,10 +853,10 @@ static int __init awsmgmt_init(void) printk(KERN_INFO DRV_NAME " init()\n"); #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) - xrt_class = class_create(THIS_MODULE, DRV_NAME); + awsmgmt_class = class_create(THIS_MODULE, DRV_NAME); #else awsmgmt_class = class_create(DRV_NAME); -#endif +#endif if (IS_ERR(awsmgmt_class)) return PTR_ERR(awsmgmt_class); res = alloc_chrdev_region(&awsmgmt_devnode, AWSMGMT_MINOR_BASE, From f6205f4fdbf2b66bbee1fb168c758fefa0389273 Mon Sep 17 00:00:00 2001 From: Manoj Takasi <133196374+ManojTakasi@users.noreply.github.com> Date: Tue, 24 Sep 2024 21:35:55 +0530 Subject: [PATCH 2/7] Cherry-pick commits from master to support build edge deb flow in 2024.1 (#8440) * In GCC 13.1 usage of uint64 and similar will result in an error without (#8224) #include Signed-off-by: Manoj Takasi Co-authored-by: Manoj Takasi (cherry picked from commit 8964124b8809060236f377fa449420d2d361f812) * Added checks to version api's to throw exception when information is not available Signed-off-by: Manoj Takasi (cherry picked from commit 762335698d258e75746135e34fc895570c05c488) --------- Co-authored-by: Manoj Takasi --- build/debian/control | 1 + src/CMake/version.cmake | 10 ++++++++++ .../core/edge/drm/zocl/common/zocl_xclbin.c | 4 ++-- .../core/edge/user/aie/common_layer/adf_api_config.h | 1 + src/runtime_src/core/edge/user/zynq_dev.h | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/build/debian/control b/build/debian/control index 72441dbdb76..9b584478a49 100644 --- a/build/debian/control +++ b/build/debian/control @@ -29,6 +29,7 @@ Build-Depends: cmake, pkg-config, protobuf-compiler, rapidjson-dev, + systemtap-sdt-dev, uuid-dev, Standards-Version: 4.5.0 diff --git a/src/CMake/version.cmake b/src/CMake/version.cmake index e818b2a9c60..77dd2893a7d 100644 --- a/src/CMake/version.cmake +++ b/src/CMake/version.cmake @@ -36,6 +36,11 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE ) +#Set XRT_HEAD_COMMITS to default value if above command is not executed +if (NOT XRT_HEAD_COMMITS) +set (XRT_HEAD_COMMITS -1) +endif() + # Get number of commits between HEAD and master execute_process( COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD ^origin/master @@ -44,6 +49,11 @@ execute_process( OUTPUT_STRIP_TRAILING_WHITESPACE ) +#Set XRT_BRANCH_COMMITS to default value if above command is not executed +if (NOT XRT_BRANCH_COMMITS) +set (XRT_BRANCH_COMMITS -1) +endif() + # Get the latest abbreviated commit hash date of the working branch execute_process( COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%cD diff --git a/src/runtime_src/core/edge/drm/zocl/common/zocl_xclbin.c b/src/runtime_src/core/edge/drm/zocl/common/zocl_xclbin.c index dbe63674c6a..6b661ba7df3 100644 --- a/src/runtime_src/core/edge/drm/zocl/common/zocl_xclbin.c +++ b/src/runtime_src/core/edge/drm/zocl/common/zocl_xclbin.c @@ -305,7 +305,7 @@ zocl_update_apertures(struct drm_zocl_dev *zdev, struct drm_zocl_slot *slot) int i = 0; char kname[64] = {0}; char *kname_p = NULL; - struct kernel_info *krnl_info = NULL; + struct kernel_info *krnl_info = NULL; /* Update aperture should only happen when loading xclbin */ if (slot->ip) @@ -339,7 +339,7 @@ zocl_update_apertures(struct drm_zocl_dev *zdev, struct drm_zocl_slot *slot) apt = &zdev->cu_subdev.apertures[apt_idx]; apt->addr = ip->m_base_address; - + strncpy(kname, ip->m_name, sizeof(kname)); kname[sizeof(kname)-1] = '\0'; kname_p = &kname[0]; diff --git a/src/runtime_src/core/edge/user/aie/common_layer/adf_api_config.h b/src/runtime_src/core/edge/user/aie/common_layer/adf_api_config.h index e4a9d2e77d0..603699791c4 100755 --- a/src/runtime_src/core/edge/user/aie/common_layer/adf_api_config.h +++ b/src/runtime_src/core/edge/user/aie/common_layer/adf_api_config.h @@ -16,6 +16,7 @@ #pragma once +#include #include #include diff --git a/src/runtime_src/core/edge/user/zynq_dev.h b/src/runtime_src/core/edge/user/zynq_dev.h index 90d57b11c7e..9e9d3e5523d 100644 --- a/src/runtime_src/core/edge/user/zynq_dev.h +++ b/src/runtime_src/core/edge/user/zynq_dev.h @@ -17,6 +17,7 @@ #ifndef _XCL_ZYNQ_DEV_H_ #define _XCL_ZYNQ_DEV_H_ +#include #include #include #include From 8f3beee4fee48dd2dd5f41324ee681158a36c142 Mon Sep 17 00:00:00 2001 From: Manoj Takasi <133196374+ManojTakasi@users.noreply.github.com> Date: Wed, 25 Sep 2024 15:30:13 +0530 Subject: [PATCH 3/7] Modified the if loops to check for mm_node if buffers are created on DMA (#8449) (#8452) Signed-off-by: Manoj Takasi Co-authored-by: Manoj Takasi (cherry picked from commit 72a2ed6a5fe7ac6a609f21753c34233465bcc6a7) --- .../core/edge/drm/zocl/common/zocl_bo.c | 51 +++++++++---------- .../core/edge/drm/zocl/common/zocl_drv.c | 6 +-- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/runtime_src/core/edge/drm/zocl/common/zocl_bo.c b/src/runtime_src/core/edge/drm/zocl/common/zocl_bo.c index 90d45f2430b..62e2452c335 100644 --- a/src/runtime_src/core/edge/drm/zocl/common/zocl_bo.c +++ b/src/runtime_src/core/edge/drm/zocl/common/zocl_bo.c @@ -57,7 +57,7 @@ void zocl_describe(const struct drm_zocl_bo *obj) static inline void zocl_bo_describe(const struct drm_zocl_bo *bo, uint64_t *size, uint64_t *paddr) { - if (bo->flags & (ZOCL_BO_FLAGS_CMA | ZOCL_BO_FLAGS_USERPTR)) { + if (!bo->mm_node) { *size = (uint64_t)bo->cma_base.base.size; #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) *paddr = (uint64_t)bo->cma_base.dma_addr; @@ -213,27 +213,6 @@ zocl_create_range_mem(struct drm_device *dev, size_t size, struct zocl_mem *mem) struct zocl_mem *head_mem = mem; int err = -ENOMEM; - bo = kzalloc(sizeof(struct drm_zocl_bo), GFP_KERNEL); - if (IS_ERR(bo)) - return ERR_PTR(-ENOMEM); - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) - bo->gem_base.funcs = &zocl_gem_object_funcs; -#endif - err = drm_gem_object_init(dev, &bo->gem_base, size); - if (err) { - kfree(bo); - return ERR_PTR(err); - } - - bo->mm_node = kzalloc(sizeof(struct drm_mm_node), - GFP_KERNEL); - if (IS_ERR(bo->mm_node)) { - drm_gem_object_release(&bo->gem_base); - kfree(bo); - return ERR_PTR(-ENOMEM); - } - mutex_lock(&zdev->mm_lock); do { if (mem->zm_type == ZOCL_MEM_TYPE_CMA) { @@ -241,10 +220,6 @@ zocl_create_range_mem(struct drm_device *dev, size_t size, struct zocl_mem *mem) zocl_create_cma_mem(dev, size); if (!IS_ERR(cma_bo)) { /* Get the memory from CMA memory region */ - mutex_unlock(&zdev->mm_lock); - kfree(bo->mm_node); - drm_gem_object_release(&bo->gem_base); - kfree(bo); cma_bo->flags |= ZOCL_BO_FLAGS_CMA; return cma_bo; } @@ -252,7 +227,29 @@ zocl_create_range_mem(struct drm_device *dev, size_t size, struct zocl_mem *mem) " whereas requested for reserved memory region\n"); } else { - err = drm_mm_insert_node_in_range(zdev->zm_drm_mm, + bo = kzalloc(sizeof(struct drm_zocl_bo), GFP_KERNEL); + if (IS_ERR(bo)) + return ERR_PTR(-ENOMEM); + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) + bo->gem_base.funcs = &zocl_gem_object_funcs; + #endif + + err = drm_gem_object_init(dev, &bo->gem_base, size); + if (err) { + kfree(bo); + return ERR_PTR(err); + } + + bo->mm_node = kzalloc(sizeof(struct drm_mm_node),GFP_KERNEL); + + if (IS_ERR(bo->mm_node)) { + drm_gem_object_release(&bo->gem_base); + kfree(bo); + return ERR_PTR(-ENOMEM); + } + + err = drm_mm_insert_node_in_range(zdev->zm_drm_mm, bo->mm_node, size, PAGE_SIZE, 0, mem->zm_base_addr, mem->zm_base_addr + mem->zm_size, 0); diff --git a/src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c b/src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c index 1aefb7b0b7c..ca8e337c923 100644 --- a/src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c +++ b/src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c @@ -708,7 +708,7 @@ zocl_gem_mmap(struct file *filp, struct vm_area_struct *vma) */ vma->vm_page_prot = prot; - if (bo->flags & ZOCL_BO_FLAGS_CMA) { + if (!bo->mm_node) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) dma_obj = to_drm_gem_dma_obj(gem_obj); paddr = dma_obj->dma_addr; @@ -719,8 +719,8 @@ zocl_gem_mmap(struct file *filp, struct vm_area_struct *vma) } else paddr = bo->mm_node->start; - if ((!(bo->flags & ZOCL_BO_FLAGS_CMA)) || - (bo->flags & ZOCL_BO_FLAGS_CMA && + if (bo->mm_node || + (!bo->mm_node && bo->flags & ZOCL_BO_FLAGS_CACHEABLE)) { /* Map PL-DDR and cacheable CMA */ rc = remap_pfn_range(vma, vma->vm_start, From 6d704fd68d7325ee1d45c6107c7b53bb320ce879 Mon Sep 17 00:00:00 2001 From: Manoj Takasi <133196374+ManojTakasi@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:13:30 +0530 Subject: [PATCH 4/7] Modified zocl_free_bo and zocl_gem_prime_get_sg_table functions to check for mm_node. (#8500) (#8504) Signed-off-by: Manoj Takasi Co-authored-by: Manoj Takasi (cherry picked from commit acf8e76c7091af59d56c0b660ac4f9f6628773a1) Co-authored-by: Manoj Takasi --- src/runtime_src/core/edge/drm/zocl/common/zocl_bo.c | 2 +- src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime_src/core/edge/drm/zocl/common/zocl_bo.c b/src/runtime_src/core/edge/drm/zocl/common/zocl_bo.c index 62e2452c335..10561dd3522 100644 --- a/src/runtime_src/core/edge/drm/zocl/common/zocl_bo.c +++ b/src/runtime_src/core/edge/drm/zocl/common/zocl_bo.c @@ -400,7 +400,7 @@ zocl_create_bo(struct drm_device *dev, uint64_t unaligned_size, u32 user_flags) struct sg_table *zocl_gem_prime_get_sg_table(struct drm_gem_object *obj) { struct drm_zocl_bo *zocl_obj = to_zocl_bo(obj); - if (zocl_obj && (zocl_obj->flags & ZOCL_BO_FLAGS_CMA)) { + if (zocl_obj && !(zocl_obj->mm_node)) { return drm_gem_dma_get_sg_table(&zocl_obj->cma_base); } struct drm_device *drm = obj->dev; diff --git a/src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c b/src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c index ca8e337c923..3f51e7243c4 100644 --- a/src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c +++ b/src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c @@ -586,7 +586,7 @@ void zocl_free_bo(struct drm_gem_object *obj) zocl_free_userptr_bo(obj); else if (zocl_obj->flags & ZOCL_BO_FLAGS_HOST_BO) zocl_free_host_bo(obj); - else if (zocl_obj->flags & ZOCL_BO_FLAGS_CMA) { + else if (!zocl_obj->mm_node) { /* Update memory usage statistics */ zocl_update_mem_stat(zdev, obj->size, -1, zocl_obj->mem_index); From 212dcaeb186d53830a612e087c01c22bc48c89e8 Mon Sep 17 00:00:00 2001 From: Manoj Takasi <133196374+ManojTakasi@users.noreply.github.com> Date: Mon, 14 Oct 2024 20:55:15 +0530 Subject: [PATCH 5/7] Updated package version to generate packages with latest version (#8524) Signed-off-by: Manoj Takasi Co-authored-by: Manoj Takasi --- build/build_edge_deb.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/build_edge_deb.sh b/build/build_edge_deb.sh index 995abd12158..ff8f2e1b2c2 100755 --- a/build/build_edge_deb.sh +++ b/build/build_edge_deb.sh @@ -35,8 +35,8 @@ PROGRAM=`basename $0` # XRT Version variables XRT_MAJOR_VERSION=2 -XRT_MINOR_VERSION=15 -RELEASE_VERSION=202310 +XRT_MINOR_VERSION=17 +RELEASE_VERSION=202410 # Default distribution DIST=jammy From 09bc24eb77a2794e36e20a3a025d202785b2b88a Mon Sep 17 00:00:00 2001 From: DMG Karthik <146181807+karthdmg-xilinx@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:50:20 +0530 Subject: [PATCH 6/7] porting AWS F2 work around changes to 2024.1 (#8607) * Fix errors in PR 8361 * porting AWS F2 work around changes to 2024.1 Signed-off-by: karthik dmg --------- Signed-off-by: karthik dmg Co-authored-by: rave --- .../driver/linux/xocl/userpf/xocl_ioctl.c | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_ioctl.c b/src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_ioctl.c index 99953890f32..fe2c918b62e 100644 --- a/src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_ioctl.c +++ b/src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_ioctl.c @@ -19,6 +19,7 @@ #include #include #include +#include #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) #include #endif @@ -538,6 +539,32 @@ xocl_resolver(struct xocl_dev *xdev, struct axlf *axlf, xuid_t *xclbin_id, return ret; } +/* This is a Workaround function for AWS F2 to reset the clock registers. + * This function also incurs a delay of 10seconds to work around AWS ocl timeout issue. + * These changes will be removed once the issue is addressed in AWS F2 instance. + */ +void aws_reset_clock_registers(xdev_handle_t xdev) +{ + struct xocl_dev_core *core = XDEV(xdev); + resource_size_t bar0_clk1, bar0_clk2; + void __iomem *vbar0_clk1, *vbar0_clk2; + + userpf_info(xdev, "AWS F2 WA, waiting to reset clock registers after Load "); + msleep(10000); + + bar0_clk1 = pci_resource_start(core->pdev, 0) + 0x4058014; + bar0_clk2 = pci_resource_start(core->pdev, 0) + 0x4058010; + vbar0_clk1 = ioremap_nocache(bar0_clk1, 32); + vbar0_clk2 = ioremap_nocache(bar0_clk2, 32); + + iowrite32(0, vbar0_clk1); + iowrite32(0, vbar0_clk2); + + iounmap(vbar0_clk1); + iounmap(vbar0_clk2); + return; +} + int xocl_read_axlf_helper(struct xocl_drm *drm_p, struct drm_xocl_axlf *axlf_ptr, uint32_t qos, uint32_t *slot) @@ -555,6 +582,7 @@ xocl_read_axlf_helper(struct xocl_drm *drm_p, struct drm_xocl_axlf *axlf_ptr, void *ulp_blob; void *kernels; int rc = 0; + struct xocl_dev_core *core = XDEV(drm_p->xdev); if (!xocl_is_unified(xdev)) { userpf_err(xdev, "XOCL: not unified Shell\n"); @@ -766,8 +794,14 @@ xocl_read_axlf_helper(struct xocl_drm *drm_p, struct drm_xocl_axlf *axlf_ptr, userpf_err(xdev, "Failed to download xclbin, err: %ld\n", err); } - else + else { userpf_info(xdev, "Loaded xclbin %pUb", &bin_obj.m_header.uuid); + /* Work around added for AWS F2 Instance to perform delay and reset clock registers */ + if(core->pdev->device == 0xf010) + { + aws_reset_clock_registers(xdev); + } + } out_done: /* Update the slot */ From ca694947192b3c4f5928a9756d98462ef33cf444 Mon Sep 17 00:00:00 2001 From: Manoj Takasi <133196374+ManojTakasi@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:51:26 +0530 Subject: [PATCH 7/7] building packages by enabling AIE (#8605) Signed-off-by: Manoj Takasi (cherry picked from commit 927dd40089c8b0988efa419b3302f291e3e86b86) Co-authored-by: Manoj Takasi --- build/debian/control | 2 ++ build/debian/rules | 4 ++-- src/runtime_src/xdp/profile/database/statistics_database.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build/debian/control b/build/debian/control index 9b584478a49..a6a0fb6d505 100644 --- a/build/debian/control +++ b/build/debian/control @@ -21,6 +21,7 @@ Build-Depends: cmake, libssl-dev, libudev-dev, libxml2-dev, + libxaiengine, libyaml-dev, lsb-release, ocl-icd-dev, @@ -31,6 +32,7 @@ Build-Depends: cmake, rapidjson-dev, systemtap-sdt-dev, uuid-dev, + xaiefal, Standards-Version: 4.5.0 Package: xrt diff --git a/build/debian/rules b/build/debian/rules index 664e2d40492..24d595072cd 100755 --- a/build/debian/rules +++ b/build/debian/rules @@ -6,9 +6,9 @@ override_dh_auto_configure: set -ex; \ if [ "$$(dpkg-architecture -q DEB_TARGET_ARCH)" = arm64 ]; then \ - XRT_NATIVE_BUILD=no DKMS_FLOW=yes dh_auto_configure; \ + XRT_NATIVE_BUILD=no DKMS_FLOW=yes XRT_AIE_BUILD=true CXXFLAGS="-DXRT_ENABLE_AIE -DFAL_LINUX=on" dh_auto_configure; \ else \ - dh_auto_configure; \ + dh_auto_configure; \ fi override_dh_auto_test: diff --git a/src/runtime_src/xdp/profile/database/statistics_database.cpp b/src/runtime_src/xdp/profile/database/statistics_database.cpp index 022c5e44c4d..9baf4d0f5cd 100644 --- a/src/runtime_src/xdp/profile/database/statistics_database.cpp +++ b/src/runtime_src/xdp/profile/database/statistics_database.cpp @@ -220,7 +220,7 @@ namespace xdp { auto threadId = std::this_thread::get_id(); auto key = std::make_pair(name, threadId); - auto value = std::make_pair(timestamp, (double)0.0); + std::pairvalue {timestamp, 0.0}; // Since a single thread can call a function multiple times, we store // the starts in a vector. If the thread makes a recursive call, we'll