SYNC_BO does not constrain its size, so a request for zero bytes reaches amdxdna_flush_bo(). On the vmap path that calls drm_clflush_virt_range() with a length of zero, which flushes the byte in front of the region rather than anything the caller asked to maintain; on the import path it flushes the whole scatterlist, since that arm ignores the range.
Nothing needs flushing for an empty range, so answer before choosing a path. Signed-off-by: Taimuraz Kaitmazov <[email protected]> --- drivers/accel/amdxdna/amdxdna_gem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c index b66ec9e4828..813b212a53f 100644 --- a/drivers/accel/amdxdna/amdxdna_gem.c +++ b/drivers/accel/amdxdna/amdxdna_gem.c @@ -1232,6 +1232,9 @@ static int amdxdna_flush_bo(struct amdxdna_gem_obj *abo, u64 offset, u64 size) return -EINVAL; size = min(abo->mem.size, end) - offset; + if (!size) + return 0; + if (is_import_bo(abo)) drm_clflush_sg(abo->base.sgt); else if (amdxdna_gem_vmap(abo)) -- 2.55.0
