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
0 commit comments