Skip to content

Commit e84692c

Browse files
bisingha-xilinxBikash Singha
andauthored
Phase2 cleanup (Xilinx#9701)
* removed dead code -- unused enums, fields, statics and orphan prototypes Signed-off-by: Bikash Singha <bisingha@xcobisingha50x.amd.com> * removing redundant XCLBIN_HW_EMU checks Signed-off-by: Bikash Singha <bisingha@xcobisingha50x.amd.com> * Unify AIE PDI load path via zocl_load_sect, remove redundant shim flag logic Signed-off-by: Bikash Singha <bisingha@xcobisingha50x.amd.com> --------- Signed-off-by: Bikash Singha <bisingha@xcobisingha50x.amd.com> Co-authored-by: Bikash Singha <bisingha@xcobisingha50x.amd.com>
1 parent c14ddcf commit e84692c

8 files changed

Lines changed: 25 additions & 97 deletions

File tree

src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ static int zocl_pr_slot_init(struct drm_zocl_dev *zdev,
224224

225225
zocl_slot->partial_overlay_id = -1;
226226
zocl_slot->slot_idx = i;
227-
zocl_slot->slot_type = ZOCL_SLOT_TYPE_PHY;
228227
zocl_slot->hwctx_ref_cnt = 0;
229228

230229
zdev->pr_slot[i] = zocl_slot;
@@ -245,7 +244,6 @@ static int zocl_pr_slot_init(struct drm_zocl_dev *zdev,
245244
mutex_init(&zocl_slot->aie_lock);
246245

247246
zocl_slot->slot_idx = i;
248-
zocl_slot->slot_type = ZOCL_SLOT_TYPE_VIRT;
249247

250248
zdev->pr_slot[i] = zocl_slot;
251249
}

src/runtime_src/core/edge/drm/zocl/common/zocl_xclbin.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -155,39 +155,6 @@ zocl_load_bitstream(struct drm_zocl_dev *zdev, char *buffer, int length,
155155
return zocl_fpga_mgr_load(zdev, buffer, length, 0);
156156
}
157157

158-
/*
159-
* Load PDI for overlay xclbins that have the AM_LOAD_PDI action mask set.
160-
*/
161-
int
162-
zocl_load_aie_only_pdi(struct drm_zocl_dev *zdev, struct drm_zocl_slot* slot, struct axlf *axlf,
163-
char __user *xclbin, struct kds_client *client)
164-
{
165-
uint64_t size = 0;
166-
char *pdi_buf = NULL;
167-
int ret = 0;
168-
169-
if (client && client->aie_ctx == ZOCL_CTX_SHARED) {
170-
DRM_ERROR("%s Shared context can not load xclbin", __func__);
171-
return -EPERM;
172-
}
173-
174-
size = zocl_read_sect(PDI, &pdi_buf, axlf, xclbin);
175-
if (size == 0)
176-
return 0;
177-
178-
ret = zocl_fpga_mgr_load(zdev, pdi_buf, size, FPGA_MGR_PARTIAL_RECONFIG);
179-
vfree(pdi_buf);
180-
181-
/* Mark AIE out of reset state after load PDI */
182-
if (slot->aie) {
183-
mutex_lock(&slot->aie_lock);
184-
slot->aie->aie_reset = false;
185-
mutex_unlock(&slot->aie_lock);
186-
}
187-
188-
return ret;
189-
}
190-
191158
int
192159
zocl_offsetof_sect(enum axlf_section_kind kind, void *sect,
193160
struct axlf *axlf_full, char __user *xclbin_ptr)

src/runtime_src/core/edge/drm/zocl/edge/zocl_edge_xclbin.c

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,6 @@
2121
#include "xrt_xclbin.h"
2222
#include "xclbin.h"
2323

24-
static inline u32 xclbin_protocol(u32 prop)
25-
{
26-
u32 intr_id = prop & IP_CONTROL_MASK;
27-
28-
return intr_id >> IP_CONTROL_SHIFT;
29-
}
30-
31-
static inline u32 xclbin_intr_enable(u32 prop)
32-
{
33-
u32 intr_enable = prop & IP_INT_ENABLE_MASK;
34-
35-
return intr_enable;
36-
}
37-
38-
static inline u32 xclbin_intr_id(u32 prop)
39-
{
40-
u32 intr_id = prop & IP_INTERRUPT_ID_MASK;
41-
42-
return intr_id >> IP_INTERRUPT_ID_SHIFT;
43-
}
44-
4524

4625
/*
4726
* Cache the xclbin blob so that it can be shared by processes.
@@ -106,7 +85,7 @@ zocl_xclbin_read_axlf(struct drm_zocl_dev *zdev, struct drm_zocl_axlf *axlf_obj,
10685
void *aie_res = 0;
10786
int ret = 0;
10887
struct drm_zocl_slot *slot = NULL;
109-
uint32_t qos = 0;
88+
uint32_t flags = 0;
11089
uint8_t hw_gen = axlf_obj->hw_gen;
11190

11291
/* Download the XCLBIN from user space to kernel space and validate */
@@ -162,13 +141,12 @@ zocl_xclbin_read_axlf(struct drm_zocl_dev *zdev, struct drm_zocl_axlf *axlf_obj,
162141
return -EFAULT;
163142
}
164143

165-
/* TODO : qos need to define */
166-
qos |= axlf_obj->za_flags;
144+
flags = axlf_obj->za_flags;
167145
slot = zdev->pr_slot[slot_id];
168146

169147
mutex_lock(&slot->slot_xclbin_lock);
170148
if (zocl_xclbin_same_uuid(slot, &axlf_head.m_header.uuid)) {
171-
if (qos & DRM_ZOCL_FORCE_PROGRAM) {
149+
if (flags & DRM_ZOCL_FORCE_PROGRAM) {
172150
// We come here if user sets force_xclbin_program
173151
// option "true" in xrt.ini under [Runtime] section
174152
DRM_WARN("%s Force xclbin download", __func__);
@@ -192,7 +170,7 @@ zocl_xclbin_read_axlf(struct drm_zocl_dev *zdev, struct drm_zocl_axlf *axlf_obj,
192170

193171
zocl_read_sect(AIE_RESOURCES, &aie_res, axlf, xclbin);
194172

195-
/* 1. We locked &zdev->slot_xclbin_lock so that no new contexts
173+
/* 1. We locked slot->slot_xclbin_lock so that no new contexts
196174
* can be opened and/or closed
197175
* 2. A opened context would lock bitstream and hold it.
198176
* 3. If all contexts are closed, new kds would make sure all
@@ -229,16 +207,28 @@ zocl_xclbin_read_axlf(struct drm_zocl_dev *zdev, struct drm_zocl_axlf *axlf_obj,
229207
#endif
230208
if (zocl_xclbin_needs_pdi_load(axlf)) {
231209

232-
ret = zocl_load_aie_only_pdi(zdev, slot, axlf, xclbin, client);
210+
if (client && client->aie_ctx == ZOCL_CTX_SHARED) {
211+
DRM_ERROR("%s Shared context can not load xclbin",
212+
__func__);
213+
ret = -EPERM;
214+
goto out0;
215+
}
216+
217+
ret = zocl_load_sect(zdev, axlf, xclbin, PDI, slot);
233218
if (ret)
234219
goto out0;
235220

221+
/* Mark AIE out of reset state after load PDI */
222+
if (slot->aie) {
223+
mutex_lock(&slot->aie_lock);
224+
slot->aie->aie_reset = false;
225+
mutex_unlock(&slot->aie_lock);
226+
}
227+
236228
zocl_cache_xclbin(zdev, slot, axlf, xclbin);
237229

238230
} else if ((axlf_obj->za_flags & DRM_ZOCL_PLATFORM_FLAT) &&
239-
axlf_head.m_header.m_mode == XCLBIN_FLAT &&
240-
axlf_head.m_header.m_mode != XCLBIN_HW_EMU &&
241-
axlf_head.m_header.m_mode != XCLBIN_HW_EMU_PR) {
231+
axlf_head.m_header.m_mode == XCLBIN_FLAT) {
242232
/*
243233
* Load full bitstream, enabled in xrt runtime config
244234
* and xclbin has full bitstream and its not hw emulation

src/runtime_src/core/edge/drm/zocl/include/zocl_util.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,6 @@ enum zocl_mem_type {
7373
ZOCL_MEM_TYPE_STREAMING = 2,
7474
};
7575

76-
/* Possible slots Types for ZOCL */
77-
enum zocl_slot_type {
78-
ZOCL_SLOT_TYPE_PHY = 0,
79-
ZOCL_SLOT_TYPE_VIRT = 1
80-
};
81-
82-
/*
83-
* Deprecated: PL_ONLY and AIE_ONLY types are no longer set in the unified
84-
* hw_context flow. Retained for backward compatibility with legacy
85-
* xrt::device paths. Will be removed in a future release.
86-
*/
87-
enum zocl_xclbin_type {
88-
ZOCL_XCLBIN_TYPE_FULL = 0,
89-
ZOCL_XCLBIN_TYPE_PL_ONLY = 1,
90-
ZOCL_XCLBIN_TYPE_AIE_ONLY = 2,
91-
ZOCL_XCLBIN_TYPE_PS = 3
92-
};
93-
9476
/*
9577
* Memory structure in zocl driver. There will be an array of this
9678
* structure where each element is representing each section in
@@ -124,8 +106,6 @@ struct aie_metadata {
124106

125107
struct drm_zocl_slot {
126108
u32 slot_idx;
127-
u32 slot_type;
128-
u32 xclbin_type;
129109
struct mem_topology *topology;
130110
struct ip_layout *ip;
131111
struct debug_ip_layout *debug_ip;

src/runtime_src/core/edge/drm/zocl/include/zocl_xclbin.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ int zocl_xclbin_read_axlf(struct drm_zocl_dev *zdev,
6464
int zocl_xclbin_load_pdi(struct drm_zocl_dev *zdev, void *data,
6565
struct drm_zocl_slot *slot);
6666
int zocl_xclbin_load_pskernel(struct drm_zocl_dev *zdev, void *data, uint32_t slot_id);
67-
bool zocl_xclbin_accel_adapter(int kds_mask);
6867
int zocl_xclbin_set_dtbo_path(struct drm_zocl_dev *zdev,
6968
struct drm_zocl_slot *slot, char *dtbo_path, uint32_t len);
7069
int zocl_reset(struct drm_zocl_dev *zdev, const char *buf, size_t count);
@@ -87,8 +86,5 @@ bool zocl_bitstream_is_locked(struct drm_zocl_dev *zdev,
8786
struct drm_zocl_slot *slot);
8887
int zocl_load_partial(struct drm_zocl_dev *zdev, const char *buffer, int length,
8988
struct drm_zocl_slot *slot);
90-
int
91-
zocl_load_aie_only_pdi(struct drm_zocl_dev *zdev, struct drm_zocl_slot* slot, struct axlf *axlf,
92-
char __user *xclbin, struct kds_client *client);
9389

9490
#endif /* _ZOCL_XCLBIN_H_ */

src/runtime_src/core/edge/drm/zocl/zert/zocl_ps_xclbin.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ zocl_xclbin_load_pskernel(struct drm_zocl_dev *zdev, void *data, uint32_t slot_i
325325
return ret;
326326
}
327327

328-
slot->xclbin_type = ZOCL_XCLBIN_TYPE_FULL;
329328
/* Get full axlf header */
330329
size_of_header = sizeof(struct axlf_section_header);
331330
num_of_sections = axlf_head->m_header.m_numSections-1;

src/runtime_src/core/edge/include/zynq_ioctl.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ struct drm_zocl_pwrite_bo {
297297
* @handle: GEM object handle
298298
* @pad: Padding
299299
* @offset: Offset into the object to read from
300-
* @size: Length of data to wrreadite
300+
* @size: Length of data to read
301301
* @data_ptr: Pointer to write the data into (pointers not 32/64 compatible)
302302
*/
303303
struct drm_zocl_pread_bo {
@@ -423,7 +423,7 @@ struct drm_zocl_hw_ctx_execbuf {
423423
};
424424

425425
/*
426-
* enum drm_zocl_platform_flags - can be used for axlf bitstream
426+
* enum drm_zocl_axlf_flags - platform and load flags for axlf bitstream
427427
*/
428428
enum drm_zocl_axlf_flags {
429429
DRM_ZOCL_PLATFORM_BASE = 0,
@@ -558,10 +558,8 @@ struct drm_zocl_close_cu_ctx {
558558
* used with DRM_IOCTL_ZOCL_OPEN_GRAPH_CTX
559559
*
560560
* @hw_context: Open a graph context under this hw context handle
561-
* @graph_name: Name of the graph on the device image for which the open context is being made
562561
* @flags: Shared or Exclusive context (ZOCL_CTX_SHARED/ZOCL_CTX_EXCLUSIVE)
563562
* @graph_id: graph id
564-
* @graph_context: Reture the acquired graph index. This will be required for closing
565563
*/
566564
struct drm_zocl_open_graph_ctx {
567565
uint32_t hw_context;

src/runtime_src/core/edge/user/shim.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ xclLoadAxlf(const axlf *buffer)
685685
std::string dtbo_path("");
686686

687687
#ifndef __HWEM__
688-
auto is_pr_platform = (buffer->m_header.m_mode == XCLBIN_PR || buffer->m_header.m_actionMask & AM_LOAD_PDI);
688+
auto is_pr_platform = buffer->m_header.m_mode == XCLBIN_PR;
689689
auto is_flat_enabled = xrt_core::config::get_enable_flat(); //default value is false
690690
auto force_program = xrt_core::config::get_force_program_xclbin(); //default value is false
691691
auto overlay_header = xclbin::get_axlf_section(buffer, axlf_section_kind::OVERLAY);
@@ -1180,9 +1180,9 @@ int shim::prepare_hw_axlf(const axlf *buffer, struct drm_zocl_axlf *axlf_obj)
11801180
std::string dtbo_path("");
11811181

11821182
#ifndef __HWEM__
1183-
auto is_pr_platform = (buffer->m_header.m_mode == XCLBIN_PR || buffer->m_header.m_actionMask & AM_LOAD_PDI);
1183+
auto is_pr_platform = buffer->m_header.m_mode == XCLBIN_PR;
11841184
auto is_flat_enabled = xrt_core::config::get_enable_flat(); //default value is false
1185-
auto force_program = xrt_core::config::get_force_program_xclbin() || buffer->m_header.m_actionMask & AM_LOAD_PDI;
1185+
auto force_program = xrt_core::config::get_force_program_xclbin();
11861186
auto overlay_header = xclbin::get_axlf_section(buffer, axlf_section_kind::OVERLAY);
11871187

11881188
if (is_pr_platform)

0 commit comments

Comments
 (0)