From patchwork Sun Oct 8 23:32:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Danilo Krummrich X-Patchwork-Id: 13412824 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 F2E19E95A67 for ; Sun, 8 Oct 2023 23:32:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F150D10E0EE; Sun, 8 Oct 2023 23:32:32 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 66D1510E0EE for ; Sun, 8 Oct 2023 23:32:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696807948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RJphU8IGhvgwUi2yl/XNO6bryXEecRsbCtSU17bPD/8=; b=eba4vdJ3EPrVw04jrv/kWqFlAgh9QC4n5if+Hkngf6xvpjGsPhxMWuCSy/yYgoHNSh8c+k dergRzVRB/igCyCbKJppHwbAq8TPOMSi7E1rPPqUAHR6q//ljrmCsihibnoxQTxZENCUb4 kPdPxf6gRjOd39gXapMtOzJg8jfVClg= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-142-TAqznvi2PAqG2gU3x65goA-1; Sun, 08 Oct 2023 19:32:27 -0400 X-MC-Unique: TAqznvi2PAqG2gU3x65goA-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-94f7a2b21fdso297399266b.2 for ; Sun, 08 Oct 2023 16:32:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696807946; x=1697412746; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RJphU8IGhvgwUi2yl/XNO6bryXEecRsbCtSU17bPD/8=; b=uZ/l1dHq7mX1OZBP994yZ3Ic9xQaVtUswafJEFIEMXCJsJwtGM11IuwO0qVJcIesh9 cRVq/L9XXfEVzkWoGfJ/zd4o9QUtLjd36AGyW8ZSmxnUGmJigOaOccqxzU99eHEJybVz qT4l41C0XmJ/CXcbyq+lLlC1EWntW+4kn1pMRq6JXcCofp7ozAfbKGktWaXo6gl69wK2 IIDkPE9l3g7K89NhgeX/sjVkVzvlrVITCvgbXsYeMJ7u/SMb+tZLWGFrQkdxIouc7iPC FNvbARZ5pj4q5RlVNM2PcR9tHZBWTBQhkrNmavcr8Uffc/gMxy2Veg7Qi52r3sRzpQmt GIBw== X-Gm-Message-State: AOJu0YwZeNVPYLCVHAsUJfWmftfBVGCpHHjZX5DsCuQFTKq9ngDXhRyf 1BvCHqzkfAUDsOH2d0NDls9QfH4J8hVcXfYSGPq4W7RbnR97pgFrxyuqG1ySTZN9di0tvxya/P5 HzSfAnCspDYtbPHMhfS73OD0BEfUL X-Received: by 2002:a17:906:310b:b0:9b5:f25d:9261 with SMTP id 11-20020a170906310b00b009b5f25d9261mr12282155ejx.22.1696807946137; Sun, 08 Oct 2023 16:32:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0NbsDQri663/zEaJyzXrug24KBVwnj7eg91dNf4JIQkc6Xi3YvatVdULmvC7QMID0VPYl1w== X-Received: by 2002:a17:906:310b:b0:9b5:f25d:9261 with SMTP id 11-20020a170906310b00b009b5f25d9261mr12282141ejx.22.1696807945891; Sun, 08 Oct 2023 16:32:25 -0700 (PDT) Received: from cassiopeiae.. ([2a02:810d:4b3f:de9c:642:1aff:fe31:a19f]) by smtp.gmail.com with ESMTPSA id l12-20020a170906230c00b009920e9a3a73sm6008080eja.115.2023.10.08.16.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Oct 2023 16:32:25 -0700 (PDT) From: Danilo Krummrich To: airlied@gmail.com, daniel@ffwll.ch, matthew.brost@intel.com, thomas.hellstrom@linux.intel.com, sarah.walker@imgtec.com, donald.robson@imgtec.com, boris.brezillon@collabora.com, christian.koenig@amd.com, faith@gfxstrand.net Subject: [PATCH drm-misc-next v6 2/6] drm/gpuvm: add drm_gpuvm_flags to drm_gpuvm Date: Mon, 9 Oct 2023 01:32:02 +0200 Message-ID: <20231008233212.13815-3-dakr@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231008233212.13815-1-dakr@redhat.com> References: <20231008233212.13815-1-dakr@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nouveau@lists.freedesktop.org, Danilo Krummrich , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Introduce flags for struct drm_gpuvm, this required by subsequent commits. Signed-off-by: Danilo Krummrich Reviewed-by: Thomas Hellström --- drivers/gpu/drm/drm_gpuvm.c | 4 +++- drivers/gpu/drm/nouveau/nouveau_uvmm.c | 2 +- include/drm/drm_gpuvm.h | 17 ++++++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_gpuvm.c b/drivers/gpu/drm/drm_gpuvm.c index ebda9d594165..6368dfdbe9dd 100644 --- a/drivers/gpu/drm/drm_gpuvm.c +++ b/drivers/gpu/drm/drm_gpuvm.c @@ -703,6 +703,7 @@ EXPORT_SYMBOL_GPL(drm_gpuvm_root_object_alloc); * @gpuvm: pointer to the &drm_gpuvm to initialize * @r_obj: the root &drm_gem_object providing the GPUVM's common &dma_resv * @name: the name of the GPU VA space + * @flags: the &drm_gpuvm_flags for this GPUVM * @start_offset: the start offset of the GPU VA space * @range: the size of the GPU VA space * @reserve_offset: the start of the kernel reserved GPU VA area @@ -716,7 +717,7 @@ EXPORT_SYMBOL_GPL(drm_gpuvm_root_object_alloc); */ void drm_gpuvm_init(struct drm_gpuvm *gpuvm, struct drm_gem_object *r_obj, - const char *name, + const char *name, enum drm_gpuvm_flags flags, u64 start_offset, u64 range, u64 reserve_offset, u64 reserve_range, const struct drm_gpuvm_ops *ops) @@ -729,6 +730,7 @@ drm_gpuvm_init(struct drm_gpuvm *gpuvm, struct drm_gem_object *r_obj, gpuvm->mm_range = range; gpuvm->name = name ? name : "unknown"; + gpuvm->flags = flags; gpuvm->ops = ops; gpuvm->r_obj = r_obj; diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c index 4dea847ef989..93ad2ba7ec8b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c @@ -1843,7 +1843,7 @@ nouveau_uvmm_init(struct nouveau_uvmm *uvmm, struct nouveau_cli *cli, uvmm->kernel_managed_addr = kernel_managed_addr; uvmm->kernel_managed_size = kernel_managed_size; - drm_gpuvm_init(&uvmm->base, r_obj, cli->name, + drm_gpuvm_init(&uvmm->base, r_obj, cli->name, 0, NOUVEAU_VA_SPACE_START, NOUVEAU_VA_SPACE_END, kernel_managed_addr, kernel_managed_size, diff --git a/include/drm/drm_gpuvm.h b/include/drm/drm_gpuvm.h index 0aec14d8b259..13539f32c2e2 100644 --- a/include/drm/drm_gpuvm.h +++ b/include/drm/drm_gpuvm.h @@ -183,6 +183,16 @@ static inline bool drm_gpuva_invalidated(struct drm_gpuva *va) return va->flags & DRM_GPUVA_INVALIDATED; } +/** + * enum drm_gpuvm_flags - flags for struct drm_gpuvm + */ +enum drm_gpuvm_flags { + /** + * @DRM_GPUVM_USERBITS: user defined bits + */ + DRM_GPUVM_USERBITS = (1 << 0), +}; + /** * struct drm_gpuvm - DRM GPU VA Manager * @@ -201,6 +211,11 @@ struct drm_gpuvm { */ const char *name; + /** + * @flags: the &drm_gpuvm_flags of this GPUVM + */ + enum drm_gpuvm_flags flags; + /** * @mm_start: start of the VA space */ @@ -246,7 +261,7 @@ struct drm_gpuvm { }; void drm_gpuvm_init(struct drm_gpuvm *gpuvm, struct drm_gem_object *r_obj, - const char *name, + const char *name, enum drm_gpuvm_flags flags, u64 start_offset, u64 range, u64 reserve_offset, u64 reserve_range, const struct drm_gpuvm_ops *ops);