@@ -837,14 +837,35 @@ intel_context_migrate_copy(struct intel_context *ce,
837
837
if (err )
838
838
goto out_rq ;
839
839
840
- /*
841
- * While we can't always restore/manage the CCS state,
842
- * we still need to ensure we don't leak the CCS state
843
- * from the previous user, so make sure we overwrite it
844
- * with something.
845
- */
846
- err = emit_copy_ccs (rq , dst_offset , INDIRECT_ACCESS ,
847
- dst_offset , DIRECT_ACCESS , len );
840
+ if (src_is_lmem ) {
841
+ /*
842
+ * If the src is already in lmem, then we must
843
+ * be doing an lmem -> lmem transfer, and so
844
+ * should be safe to directly copy the CCS
845
+ * state. In this case we have either
846
+ * initialised the CCS aux state when first
847
+ * clearing the pages (since it is already
848
+ * allocated in lmem), or the user has
849
+ * potentially populated it, in which case we
850
+ * need to copy the CCS state as-is.
851
+ */
852
+ err = emit_copy_ccs (rq ,
853
+ dst_offset , INDIRECT_ACCESS ,
854
+ src_offset , INDIRECT_ACCESS ,
855
+ len );
856
+ } else {
857
+ /*
858
+ * While we can't always restore/manage the CCS
859
+ * state, we still need to ensure we don't leak
860
+ * the CCS state from the previous user, so make
861
+ * sure we overwrite it with something.
862
+ */
863
+ err = emit_copy_ccs (rq ,
864
+ dst_offset , INDIRECT_ACCESS ,
865
+ dst_offset , DIRECT_ACCESS ,
866
+ len );
867
+ }
868
+
848
869
if (err )
849
870
goto out_rq ;
850
871
0 commit comments