Skip to content

Commit

Permalink
Merge branch 'Xilinx:2024.1' into 2024.1
Browse files Browse the repository at this point in the history
  • Loading branch information
karthdmg-xilinx authored Dec 9, 2024
2 parents 13a16e4 + ca69494 commit 6f78c3e
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 39 deletions.
4 changes: 2 additions & 2 deletions build/build_edge_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions build/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Build-Depends: cmake,
libssl-dev,
libudev-dev,
libxml2-dev,
libxaiengine,
libyaml-dev,
lsb-release,
ocl-icd-dev,
Expand All @@ -29,7 +30,9 @@ Build-Depends: cmake,
pkg-config,
protobuf-compiler,
rapidjson-dev,
systemtap-sdt-dev,
uuid-dev,
xaiefal,
Standards-Version: 4.5.0

Package: xrt
Expand Down
4 changes: 2 additions & 2 deletions build/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions src/CMake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
53 changes: 25 additions & 28 deletions src/runtime_src/core/edge/drm/zocl/common/zocl_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -213,46 +213,43 @@ 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) {
struct drm_zocl_bo *cma_bo =
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;
}
DRM_WARN("Memory allocated from CMA region"
" 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);
Expand Down Expand Up @@ -403,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;
Expand Down
8 changes: 4 additions & 4 deletions src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/runtime_src/core/edge/drm/zocl/common/zocl_xclbin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#pragma once

#include <cstdint>
#include <string>
#include <vector>

Expand Down
1 change: 1 addition & 0 deletions src/runtime_src/core/edge/user/zynq_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef _XCL_ZYNQ_DEV_H_
#define _XCL_ZYNQ_DEV_H_

#include <cstdint>
#include <fstream>
#include <string>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::pair<double, double>value {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
Expand Down

0 comments on commit 6f78c3e

Please sign in to comment.