From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3ADEC54E60 for ; Fri, 8 Mar 2024 05:08:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7286E112EBD; Fri, 8 Mar 2024 05:08:08 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="e+uuXgdK"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E94B10F7AB for ; Fri, 8 Mar 2024 05:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709874474; x=1741410474; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OHk+usE0GFk/3nYYjuA9XwlVvOQZbRvQEfHayDogqac=; b=e+uuXgdKOixeP8UzLEGDv2obFavyTF4U5H95hFh/u812f198rUDXM02U JyxRG0cZr2y4NeNDF+Rg4wKWwuvpVhdad85txfB9OqbxgX7gBO5iUA+b8 UGD9Qyz0AkQgUIpOfBXzb76IQPvUXwohWH567EJVq2X1RDw7K1d+WtSLi gAJL3u8awFH628IZmaOVR12lhA4FakkyDXLTHfHzQOZWYw7fqpso5zJur TFoluIqdE9OcR3UaZtwHeFAMhLkE9AC2hqfyE9QWaqVfqJrSqY7XEQCzU eiq7DEUA5stjOCe92ZjLNKmhd308MmLNmztbQMT7++p3zFrfYNt9tOFzu w==; X-IronPort-AV: E=McAfee;i="6600,9927,11006"; a="4761976" X-IronPort-AV: E=Sophos;i="6.07,108,1708416000"; d="scan'208";a="4761976" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2024 21:07:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,108,1708416000"; d="scan'208";a="10403032" Received: from lstrano-desk.jf.intel.com ([10.54.39.91]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2024 21:07:52 -0800 From: Matthew Brost To: Cc: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Matthew Brost Subject: [PATCH v4 21/30] drm/xe: Update xe_vm_rebind to return int Date: Thu, 7 Mar 2024 21:07:57 -0800 Message-Id: <20240308050806.577176-22-matthew.brost@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240308050806.577176-1-matthew.brost@intel.com> References: <20240308050806.577176-1-matthew.brost@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" From: Thomas Hellström Now that rebinds are installed in the kernel dma-resv slot the fence returned from xe_vm_rebind is unused aside from error checking. Update to xe_vm_rebind to return int. Signed-off-by: Matthew Brost Signed-off-by: Thomas Hellström --- drivers/gpu/drm/xe/xe_exec.c | 8 ++------ drivers/gpu/drm/xe/xe_vm.c | 17 +++++++---------- drivers/gpu/drm/xe/xe_vm.h | 2 +- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c index 4feff67620c4..7d676e3610fa 100644 --- a/drivers/gpu/drm/xe/xe_exec.c +++ b/drivers/gpu/drm/xe/xe_exec.c @@ -152,7 +152,6 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file) struct drm_exec *exec = &vm_exec.exec; u32 i, num_syncs = 0, num_ufence = 0; struct xe_sched_job *job; - struct dma_fence *rebind_fence; struct xe_vm *vm; bool write_locked, skip_retry = false; ktime_t end = 0; @@ -289,12 +288,9 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file) * Rebind any invalidated userptr or evicted BOs in the VM, non-compute * VM mode only. */ - rebind_fence = xe_vm_rebind(vm, false); - if (IS_ERR(rebind_fence)) { - err = PTR_ERR(rebind_fence); + err = xe_vm_rebind(vm, false); + if (err) goto err_put_job; - } - dma_fence_put(rebind_fence); /* Wait for rebinds */ if (!xe_vm_in_lr_mode(vm)) { diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c index 47658465b735..47a0d3a6cda5 100644 --- a/drivers/gpu/drm/xe/xe_vm.c +++ b/drivers/gpu/drm/xe/xe_vm.c @@ -526,7 +526,6 @@ static void preempt_rebind_work_func(struct work_struct *w) { struct xe_vm *vm = container_of(w, struct xe_vm, preempt.rebind_work); struct drm_exec exec; - struct dma_fence *rebind_fence; unsigned int fence_count = 0; LIST_HEAD(preempt_fences); ktime_t end = 0; @@ -572,12 +571,9 @@ static void preempt_rebind_work_func(struct work_struct *w) if (err) goto out_unlock; - rebind_fence = xe_vm_rebind(vm, true); - if (IS_ERR(rebind_fence)) { - err = PTR_ERR(rebind_fence); + err = xe_vm_rebind(vm, true); + if (err) goto out_unlock; - } - dma_fence_put(rebind_fence); /* Wait on rebinds */ wait = dma_resv_wait_timeout(xe_vm_resv(vm), @@ -796,14 +792,14 @@ void xe_vm_populate_dummy_rebind(struct xe_vm *vm, struct xe_vma *vma, vm->dummy_ops.op.map.is_null = xe_vma_is_null(vma); } -struct dma_fence *xe_vm_rebind(struct xe_vm *vm, bool rebind_worker) +int xe_vm_rebind(struct xe_vm *vm, bool rebind_worker) { struct dma_fence *fence = NULL; struct xe_vma *vma, *next; lockdep_assert_held(&vm->lock); if (xe_vm_in_lr_mode(vm) && !rebind_worker) - return NULL; + return 0; xe_vm_assert_held(vm); list_for_each_entry_safe(vma, next, &vm->rebind_list, @@ -820,10 +816,11 @@ struct dma_fence *xe_vm_rebind(struct xe_vm *vm, bool rebind_worker) xe_vm_populate_dummy_rebind(vm, vma, vma->tile_present); fence = xe_vm_ops_execute(vm, &vm->dummy_ops.vops); if (IS_ERR(fence)) - return fence; + return PTR_ERR(fence); } - return fence; + dma_fence_put(fence); + return 0; } static void xe_vma_free(struct xe_vma *vma) diff --git a/drivers/gpu/drm/xe/xe_vm.h b/drivers/gpu/drm/xe/xe_vm.h index 8201ecb8f05a..c849ad0d44b5 100644 --- a/drivers/gpu/drm/xe/xe_vm.h +++ b/drivers/gpu/drm/xe/xe_vm.h @@ -207,7 +207,7 @@ int __xe_vm_userptr_needs_repin(struct xe_vm *vm); int xe_vm_userptr_check_repin(struct xe_vm *vm); -struct dma_fence *xe_vm_rebind(struct xe_vm *vm, bool rebind_worker); +int xe_vm_rebind(struct xe_vm *vm, bool rebind_worker); int xe_vm_invalidate_vma(struct xe_vma *vma); -- 2.34.1