Skip to content

Commit

Permalink
Fixed xocl driver issues (#7527)
Browse files Browse the repository at this point in the history
Signed-off-by: Saifuddin <saifuddi@xilinx.com>
  • Loading branch information
saifuddin-xilinx authored May 3, 2023
1 parent e5ba80c commit 5cc7361
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
22 changes: 13 additions & 9 deletions src/runtime_src/core/pcie/driver/linux/xocl/userpf/xocl_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,16 +559,20 @@ __xocl_create_bo_ioctl(struct drm_device *dev, struct drm_file *filp,
uint32_t slot_id = 0;
int ret;

/* Currently userspace will provide the corresponding hw context id.
* Driver has to map that hw context to the corresponding slot id.
*/
hw_ctx_id = xocl_bo_slot_idx(args->flags);
ret = xocl_get_slot_id_by_hw_ctx_id(xdev, filp, hw_ctx_id);
if (ret < 0)
return ERR_PTR(ret);
if (bo_type != XOCL_BO_EXECBUF) {
/* Currently userspace will provide the corresponding hw context id.
* Driver has to map that hw context to the corresponding slot id.
* This is not valid for Host memory.
*/
hw_ctx_id = xocl_bo_slot_idx(args->flags);
ret = xocl_get_slot_id_by_hw_ctx_id(xdev, filp, hw_ctx_id);
if (ret < 0)
return ERR_PTR(ret);

slot_id = ret;
args->flags = xocl_bo_set_slot_idx(args->flags, slot_id);
}

slot_id = ret;
args->flags = xocl_bo_set_slot_idx(args->flags, slot_id);
xobj = xocl_create_bo(dev, args->size, args->flags, bo_type);
if (IS_ERR(xobj)) {
DRM_ERROR("object creation failed idx %d, size 0x%llx\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ static int xocl_mm_insert_node_range_all(struct xocl_drm *drm_p, uint32_t *mem_i

phy_bank_exists = true;
start_addr = mem_data->m_base_address;
end_addr = start_addr + mem_data->m_size;
end_addr = start_addr + mem_data->m_size * 1024;

#if defined(XOCL_DRM_FREE_MALLOC)
ret = drm_mm_insert_node_in_range(xocl_mm->mm, dnode, size, PAGE_SIZE, 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,6 @@ xocl_read_axlf_helper(struct xocl_drm *drm_p, struct drm_xocl_axlf *axlf_ptr,
}

done:
/* Update the slot */
*slot = slot_id;
if (size < 0)
err = size;
if (err) {
Expand All @@ -766,6 +764,8 @@ xocl_read_axlf_helper(struct xocl_drm *drm_p, struct drm_xocl_axlf *axlf_ptr,
userpf_info(xdev, "Loaded xclbin %pUb", &bin_obj.m_header.uuid);

out_done:
/* Update the slot */
*slot = slot_id;
vfree(axlf);
return err;
}
Expand Down

0 comments on commit 5cc7361

Please sign in to comment.