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 121C9CDB482 for ; Fri, 13 Oct 2023 15:21:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CBB7610E197; Fri, 13 Oct 2023 15:21:49 +0000 (UTC) Received: from mblankhorst.nl (lankhorst.se [IPv6:2a02:2308:0:7ec:e79c:4e97:b6c4:f0ae]) by gabe.freedesktop.org (Postfix) with ESMTPS id 67C9710E191 for ; Fri, 13 Oct 2023 15:21:48 +0000 (UTC) From: maarten.lankhorst@linux.intel.com To: intel-xe@lists.freedesktop.org Date: Fri, 13 Oct 2023 17:21:40 +0200 Message-Id: <20231013152142.52869-3-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231013152142.52869-1-maarten.lankhorst@linux.intel.com> References: <20231013152142.52869-1-maarten.lankhorst@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Intel-xe] [PATCH 2/4] drm/xe: Annotate each dumpable vma as such 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: , Cc: Maarten Lankhorst Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" From: Maarten Lankhorst Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/xe/xe_vm.c | 21 ++++++++++++++++----- drivers/gpu/drm/xe/xe_vm_types.h | 3 +++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c index 6eab1a478ed5..da006249147e 100644 --- a/drivers/gpu/drm/xe/xe_vm.c +++ b/drivers/gpu/drm/xe/xe_vm.c @@ -859,6 +859,7 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm, u64 start, u64 end, bool read_only, bool is_null, + bool dumpable, u8 tile_mask) { struct xe_vma *vma; @@ -890,6 +891,8 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm, vma->gpuva.flags |= XE_VMA_READ_ONLY; if (is_null) vma->gpuva.flags |= DRM_GPUVA_SPARSE; + if (dumpable) + vma->gpuva.flags |= XE_VMA_DUMPABLE; if (tile_mask) { vma->tile_mask = tile_mask; @@ -2426,6 +2429,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo, op->map.read_only = operation & XE_VM_BIND_FLAG_READONLY; op->map.is_null = operation & XE_VM_BIND_FLAG_NULL; + op->map.dumpable = operation & XE_VM_BIND_FLAG_DUMPABLE; } break; case XE_VM_BIND_OP_UNMAP: @@ -2490,7 +2494,8 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo, } static struct xe_vma *new_vma(struct xe_vm *vm, struct drm_gpuva_op_map *op, - u8 tile_mask, bool read_only, bool is_null) + u8 tile_mask, bool read_only, bool is_null, + bool dumpable) { struct xe_bo *bo = op->gem.obj ? gem_to_xe_bo(op->gem.obj) : NULL; struct xe_vma *vma; @@ -2506,7 +2511,7 @@ static struct xe_vma *new_vma(struct xe_vm *vm, struct drm_gpuva_op_map *op, vma = xe_vma_create(vm, bo, op->gem.offset, op->va.addr, op->va.addr + op->va.range - 1, read_only, is_null, - tile_mask); + dumpable, tile_mask); if (bo) xe_bo_unlock(bo); @@ -2663,7 +2668,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q, vma = new_vma(vm, &op->base.map, op->tile_mask, op->map.read_only, - op->map.is_null); + op->map.is_null, op->map.dumpable); if (IS_ERR(vma)) { err = PTR_ERR(vma); goto free_fence; @@ -2688,10 +2693,13 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q, bool is_null = op->base.remap.unmap->va->flags & DRM_GPUVA_SPARSE; + bool dumpable = + op->base.remap.unmap->va->flags & + XE_VMA_DUMPABLE; vma = new_vma(vm, op->base.remap.prev, op->tile_mask, read_only, - is_null); + is_null, dumpable); if (IS_ERR(vma)) { err = PTR_ERR(vma); goto free_fence; @@ -2724,10 +2732,13 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q, bool is_null = op->base.remap.unmap->va->flags & DRM_GPUVA_SPARSE; + bool dumpable = + op->base.remap.unmap->va->flags & + XE_VMA_DUMPABLE; vma = new_vma(vm, op->base.remap.next, op->tile_mask, read_only, - is_null); + is_null, dumpable); if (IS_ERR(vma)) { err = PTR_ERR(vma); goto free_fence; diff --git a/drivers/gpu/drm/xe/xe_vm_types.h b/drivers/gpu/drm/xe/xe_vm_types.h index da5e6cb6f094..825f8127741e 100644 --- a/drivers/gpu/drm/xe/xe_vm_types.h +++ b/drivers/gpu/drm/xe/xe_vm_types.h @@ -33,6 +33,7 @@ struct xe_vm; #define XE_VMA_PTE_4K (DRM_GPUVA_USERBITS << 5) #define XE_VMA_PTE_2M (DRM_GPUVA_USERBITS << 6) #define XE_VMA_PTE_1G (DRM_GPUVA_USERBITS << 7) +#define XE_VMA_DUMPABLE (DRM_GPUVA_USERBITS << 8) /** struct xe_userptr - User pointer */ struct xe_userptr { @@ -352,6 +353,8 @@ struct xe_vma_op_map { bool read_only; /** @is_null: is NULL binding */ bool is_null; + /** @dumpable: whether BO is dumped on GPU hang */ + bool dumpable; }; /** struct xe_vma_op_remap - VMA remap operation */ -- 2.40.1