From patchwork Thu Sep 28 19:16:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danilo Krummrich X-Patchwork-Id: 13403464 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 52FC8E7F153 for ; Thu, 28 Sep 2023 19:16:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 440DB10E098; Thu, 28 Sep 2023 19:16:45 +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 49EA710E09E for ; Thu, 28 Sep 2023 19:16:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695928598; 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=LHymGGMkbEFf6Ut7cDHVVB33+PYsHgBjcJtFFyKDftZsaSe+2xUjiqNj1Nlln7yRxEZOz2 uCpGcmbLndRhAs66UNQJkzlprIWRYr6hzrAR5H0++7kCReLNgvevQty3I5ia9XXNJ/kk4z ofy/Id4CqtzrClmYiQA7zNTcHWp/Ws8= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-422-1SLVv-MsPJO1DHtPVOgCCQ-1; Thu, 28 Sep 2023 15:16:37 -0400 X-MC-Unique: 1SLVv-MsPJO1DHtPVOgCCQ-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5334e22b2dbso10455606a12.0 for ; Thu, 28 Sep 2023 12:16:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695928596; x=1696533396; 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=NQDx4vXusH0AdCK4eYPdgCNwcidDEX8zwmQoZYWTbRtz5ckBaaLGStVx1I5hWsJpNL UnegYqWs0786U5FCEqC6wB/qQxqAoLK/aMDL6ChM8+WbTZoEXxJnYujGofNLuOvUfRu8 Gbk3/01NcQ75za9Yct6inWMxf9z2DZ7jceaTWvanxqGmp0EWNmTrpSvbuNH9CVmLiVSm Y0KGH1FaHlHIF26LYhuGoEPQTWNHMDBTrRJI9L4ri3k2HOJvaBUkrXibWZNFdyltGziP sQPJsljvAJjrKfavs/RBHSIKR8MMYsY5JRifDc0WfYy7KR+TD4av0tSxuJCv3h2xxIOQ ub1g== X-Gm-Message-State: AOJu0YxyPJrIwjGbkYx0cQ7xNJLDhuYgWk9/ykotXIL+NuEbavB+hRZ7 3JHiCiyv5BfQvCTNvXfhPDfKMZ+WdMLaBn8r1DFJNhDf//qJ8KZOC1ixjrpY060gwU3Mx00FgAY ybSh4yYPbT/BwWE0rfI+GTI2AhQbb X-Received: by 2002:aa7:c6cd:0:b0:533:310b:a8aa with SMTP id b13-20020aa7c6cd000000b00533310ba8aamr2057030eds.13.1695928595967; Thu, 28 Sep 2023 12:16:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH08h6TIbMzADHS7ErW8zMwj+N6/RN5qpwmxEtXg6DkwgG4bbcTXnWHxwX4EBkuuqc6BeaVfQ== X-Received: by 2002:aa7:c6cd:0:b0:533:310b:a8aa with SMTP id b13-20020aa7c6cd000000b00533310ba8aamr2057014eds.13.1695928595618; Thu, 28 Sep 2023 12:16:35 -0700 (PDT) Received: from cassiopeiae.. ([2a02:810d:4b3f:de9c:642:1aff:fe31:a19f]) by smtp.gmail.com with ESMTPSA id v10-20020aa7cd4a000000b0052ff9bae873sm10068453edw.5.2023.09.28.12.16.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 12:16:35 -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 v5 2/6] drm/gpuvm: add drm_gpuvm_flags to drm_gpuvm Date: Thu, 28 Sep 2023 21:16:16 +0200 Message-ID: <20230928191624.13703-3-dakr@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230928191624.13703-1-dakr@redhat.com> References: <20230928191624.13703-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 --- 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);