@@ -185,6 +185,14 @@ hwq_umq::
185185issue_single_exec_buf (const cmd_buffer *cmd_bo, bool last_of_chain)
186186{
187187 auto cmd = reinterpret_cast <ert_start_kernel_cmd *>(cmd_bo->vaddr ());
188+ auto handle = cmd_bo->id ().handle ;
189+
190+ // Restore header if this is a resubmission
191+ auto it = m_cmd_header_cache.find (handle);
192+ if (it != m_cmd_header_cache.end ()) {
193+ cmd->header = it->second ;
194+ }
195+
188196 auto dpu = get_ert_dpu_data (cmd);
189197
190198 // Sanity check
@@ -198,6 +206,10 @@ issue_single_exec_buf(const cmd_buffer *cmd_bo, bool last_of_chain)
198206 shim_err (EINVAL, " No dpu data, invalid exec buf" );
199207 }
200208
209+ if (it == m_cmd_header_cache.end ()) {
210+ m_cmd_header_cache[handle] = cmd->header ;
211+ }
212+
201213 auto slot_idx = get_next_avail_slot ();
202214
203215 if (get_ert_dpu_data_next (dpu))
@@ -316,6 +328,14 @@ issue_command(const cmd_buffer *cmd_bo)
316328 return issue_single_exec_buf (cmd_bo, true );
317329
318330 // Runlist command submission.
331+ auto handle = cmd_bo->id ().handle ;
332+
333+ // Restore chain BO header is this is a resubmission
334+ auto it = m_cmd_header_cache.find (handle);
335+ if (it != m_cmd_header_cache.end ()) {
336+ cmd->header = it->second ;
337+ }
338+
319339 auto payload = get_ert_cmd_chain_data (cmd);
320340 if (payload->command_count == 0 || payload->command_count > 100 )
321341 shim_err (EINVAL, " Runlist exec buf with bad num of subcmds: %zx" , payload->command_count );
@@ -329,6 +349,12 @@ issue_command(const cmd_buffer *cmd_bo)
329349 seq = issue_single_exec_buf (subcmd, i == payload->command_count - 1 );
330350 subcmds.push_back (subcmd);
331351 }
352+
353+ // Cache chain BO header on first submission
354+ if (it == m_cmd_header_cache.end ()) {
355+ m_cmd_header_cache[handle] = cmd->header ;
356+ }
357+
332358 return seq;
333359}
334360
0 commit comments