All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
To: <dri-devel@lists.freedesktop.org>,
	<amd-gfx@lists.freedesktop.org>,
	<intel-gfx@lists.freedesktop.org>,
	<nouveau@lists.freedesktop.org>
Cc: alexander.deucher@amd.com,
	Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>,
	luben.tuikov@amd.com, christian.koenig@amd.com,
	matthew.auld@intel.com
Subject: [PATCH v2 2/6] drm/ttm: Implement intersect/compatible functions
Date: Mon, 25 Jul 2022 04:42:36 -0700	[thread overview]
Message-ID: <20220725114240.4844-2-Arunpravin.PaneerSelvam@amd.com> (raw)
In-Reply-To: <20220725114240.4844-1-Arunpravin.PaneerSelvam@amd.com>

Implemented a new intersect and compatible callback functions
to ttm range manager fetching start offset from drm mm range
allocator.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
---
 drivers/gpu/drm/ttm/ttm_range_manager.c | 33 +++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_range_manager.c b/drivers/gpu/drm/ttm/ttm_range_manager.c
index d91666721dc6..12b8d9b36fe6 100644
--- a/drivers/gpu/drm/ttm/ttm_range_manager.c
+++ b/drivers/gpu/drm/ttm/ttm_range_manager.c
@@ -113,6 +113,37 @@ static void ttm_range_man_free(struct ttm_resource_manager *man,
 	kfree(node);
 }
 
+static bool ttm_range_man_intersect(struct ttm_resource_manager *man,
+				    struct ttm_resource *res,
+				    const struct ttm_place *place,
+				    size_t size)
+{
+	struct drm_mm_node *node = &to_ttm_range_mgr_node(res)->mm_nodes[0];
+	u32 num_pages = PFN_UP(size);
+
+	/* Don't evict BOs outside of the requested placement range */
+	if (place->fpfn >= (node->start + num_pages) ||
+	    (place->lpfn && place->lpfn <= node->start))
+		return false;
+
+	return true;
+}
+
+static bool ttm_range_man_compatible(struct ttm_resource_manager *man,
+				     struct ttm_resource *res,
+				     const struct ttm_place *place,
+				     size_t size)
+{
+	struct drm_mm_node *node = &to_ttm_range_mgr_node(res)->mm_nodes[0];
+	u32 num_pages = PFN_UP(size);
+
+	if (node->start < place->fpfn ||
+	    (place->lpfn && (node->start + num_pages) > place->lpfn))
+		return false;
+
+	return true;
+}
+
 static void ttm_range_man_debug(struct ttm_resource_manager *man,
 				struct drm_printer *printer)
 {
@@ -126,6 +157,8 @@ static void ttm_range_man_debug(struct ttm_resource_manager *man,
 static const struct ttm_resource_manager_func ttm_range_manager_func = {
 	.alloc = ttm_range_man_alloc,
 	.free = ttm_range_man_free,
+	.intersect = ttm_range_man_intersect,
+	.compatible = ttm_range_man_compatible,
 	.debug = ttm_range_man_debug
 };
 
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
To: <dri-devel@lists.freedesktop.org>,
	<amd-gfx@lists.freedesktop.org>,
	<intel-gfx@lists.freedesktop.org>,
	<nouveau@lists.freedesktop.org>
Cc: alexander.deucher@amd.com,
	Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>,
	luben.tuikov@amd.com, christian.koenig@amd.com,
	matthew.auld@intel.com
Subject: [Intel-gfx] [PATCH v2 2/6] drm/ttm: Implement intersect/compatible functions
Date: Mon, 25 Jul 2022 04:42:36 -0700	[thread overview]
Message-ID: <20220725114240.4844-2-Arunpravin.PaneerSelvam@amd.com> (raw)
In-Reply-To: <20220725114240.4844-1-Arunpravin.PaneerSelvam@amd.com>

Implemented a new intersect and compatible callback functions
to ttm range manager fetching start offset from drm mm range
allocator.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
---
 drivers/gpu/drm/ttm/ttm_range_manager.c | 33 +++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_range_manager.c b/drivers/gpu/drm/ttm/ttm_range_manager.c
index d91666721dc6..12b8d9b36fe6 100644
--- a/drivers/gpu/drm/ttm/ttm_range_manager.c
+++ b/drivers/gpu/drm/ttm/ttm_range_manager.c
@@ -113,6 +113,37 @@ static void ttm_range_man_free(struct ttm_resource_manager *man,
 	kfree(node);
 }
 
+static bool ttm_range_man_intersect(struct ttm_resource_manager *man,
+				    struct ttm_resource *res,
+				    const struct ttm_place *place,
+				    size_t size)
+{
+	struct drm_mm_node *node = &to_ttm_range_mgr_node(res)->mm_nodes[0];
+	u32 num_pages = PFN_UP(size);
+
+	/* Don't evict BOs outside of the requested placement range */
+	if (place->fpfn >= (node->start + num_pages) ||
+	    (place->lpfn && place->lpfn <= node->start))
+		return false;
+
+	return true;
+}
+
+static bool ttm_range_man_compatible(struct ttm_resource_manager *man,
+				     struct ttm_resource *res,
+				     const struct ttm_place *place,
+				     size_t size)
+{
+	struct drm_mm_node *node = &to_ttm_range_mgr_node(res)->mm_nodes[0];
+	u32 num_pages = PFN_UP(size);
+
+	if (node->start < place->fpfn ||
+	    (place->lpfn && (node->start + num_pages) > place->lpfn))
+		return false;
+
+	return true;
+}
+
 static void ttm_range_man_debug(struct ttm_resource_manager *man,
 				struct drm_printer *printer)
 {
@@ -126,6 +157,8 @@ static void ttm_range_man_debug(struct ttm_resource_manager *man,
 static const struct ttm_resource_manager_func ttm_range_manager_func = {
 	.alloc = ttm_range_man_alloc,
 	.free = ttm_range_man_free,
+	.intersect = ttm_range_man_intersect,
+	.compatible = ttm_range_man_compatible,
 	.debug = ttm_range_man_debug
 };
 
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
To: <dri-devel@lists.freedesktop.org>,
	<amd-gfx@lists.freedesktop.org>,
	<intel-gfx@lists.freedesktop.org>,
	<nouveau@lists.freedesktop.org>
Cc: alexander.deucher@amd.com,
	Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>,
	luben.tuikov@amd.com, christian.koenig@amd.com,
	matthew.auld@intel.com
Subject: [Nouveau] [PATCH v2 2/6] drm/ttm: Implement intersect/compatible functions
Date: Mon, 25 Jul 2022 04:42:36 -0700	[thread overview]
Message-ID: <20220725114240.4844-2-Arunpravin.PaneerSelvam@amd.com> (raw)
In-Reply-To: <20220725114240.4844-1-Arunpravin.PaneerSelvam@amd.com>

Implemented a new intersect and compatible callback functions
to ttm range manager fetching start offset from drm mm range
allocator.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
---
 drivers/gpu/drm/ttm/ttm_range_manager.c | 33 +++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_range_manager.c b/drivers/gpu/drm/ttm/ttm_range_manager.c
index d91666721dc6..12b8d9b36fe6 100644
--- a/drivers/gpu/drm/ttm/ttm_range_manager.c
+++ b/drivers/gpu/drm/ttm/ttm_range_manager.c
@@ -113,6 +113,37 @@ static void ttm_range_man_free(struct ttm_resource_manager *man,
 	kfree(node);
 }
 
+static bool ttm_range_man_intersect(struct ttm_resource_manager *man,
+				    struct ttm_resource *res,
+				    const struct ttm_place *place,
+				    size_t size)
+{
+	struct drm_mm_node *node = &to_ttm_range_mgr_node(res)->mm_nodes[0];
+	u32 num_pages = PFN_UP(size);
+
+	/* Don't evict BOs outside of the requested placement range */
+	if (place->fpfn >= (node->start + num_pages) ||
+	    (place->lpfn && place->lpfn <= node->start))
+		return false;
+
+	return true;
+}
+
+static bool ttm_range_man_compatible(struct ttm_resource_manager *man,
+				     struct ttm_resource *res,
+				     const struct ttm_place *place,
+				     size_t size)
+{
+	struct drm_mm_node *node = &to_ttm_range_mgr_node(res)->mm_nodes[0];
+	u32 num_pages = PFN_UP(size);
+
+	if (node->start < place->fpfn ||
+	    (place->lpfn && (node->start + num_pages) > place->lpfn))
+		return false;
+
+	return true;
+}
+
 static void ttm_range_man_debug(struct ttm_resource_manager *man,
 				struct drm_printer *printer)
 {
@@ -126,6 +157,8 @@ static void ttm_range_man_debug(struct ttm_resource_manager *man,
 static const struct ttm_resource_manager_func ttm_range_manager_func = {
 	.alloc = ttm_range_man_alloc,
 	.free = ttm_range_man_free,
+	.intersect = ttm_range_man_intersect,
+	.compatible = ttm_range_man_compatible,
 	.debug = ttm_range_man_debug
 };
 
-- 
2.25.1


  reply	other threads:[~2022-07-25 11:43 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 11:42 [PATCH v2 1/6] drm/ttm: Add new callbacks to ttm res mgr Arunpravin Paneer Selvam
2022-07-25 11:42 ` [Nouveau] " Arunpravin Paneer Selvam
2022-07-25 11:42 ` [Intel-gfx] " Arunpravin Paneer Selvam
2022-07-25 11:42 ` Arunpravin Paneer Selvam [this message]
2022-07-25 11:42   ` [Nouveau] [PATCH v2 2/6] drm/ttm: Implement intersect/compatible functions Arunpravin Paneer Selvam
2022-07-25 11:42   ` [Intel-gfx] " Arunpravin Paneer Selvam
2022-08-08 11:30   ` [Nouveau] " Christian König
2022-08-08 11:30     ` Christian König
2022-08-08 11:30     ` [Intel-gfx] " Christian König
2022-08-09  8:26     ` [Nouveau] " Arunpravin Paneer Selvam
2022-08-09  8:26       ` [Intel-gfx] " Arunpravin Paneer Selvam
2022-08-09  8:26       ` Arunpravin Paneer Selvam
2022-07-25 11:42 ` [PATCH v2 3/6] drm/amdgpu: " Arunpravin Paneer Selvam
2022-07-25 11:42   ` [Nouveau] " Arunpravin Paneer Selvam
2022-07-25 11:42   ` [Intel-gfx] " Arunpravin Paneer Selvam
2022-07-25 11:42 ` [PATCH v2 4/6] drm/i915: " Arunpravin Paneer Selvam
2022-07-25 11:42   ` [Nouveau] " Arunpravin Paneer Selvam
2022-07-25 11:42   ` [Intel-gfx] " Arunpravin Paneer Selvam
2022-07-26 10:41   ` Matthew Auld
2022-07-26 10:41     ` [Nouveau] " Matthew Auld
2022-07-26 10:41     ` [Intel-gfx] " Matthew Auld
2022-07-28 14:36     ` Arunpravin Paneer Selvam
2022-07-28 14:36       ` [Nouveau] " Arunpravin Paneer Selvam
2022-07-28 14:36       ` [Intel-gfx] " Arunpravin Paneer Selvam
2022-07-25 11:42 ` [PATCH v2 5/6] drm/nouveau: " Arunpravin Paneer Selvam
2022-07-25 11:42   ` [Nouveau] " Arunpravin Paneer Selvam
2022-07-25 11:42   ` [Intel-gfx] " Arunpravin Paneer Selvam
2022-07-25 11:42 ` [PATCH v2 6/6] drm/ttm: Switch to using the new res callback Arunpravin Paneer Selvam
2022-07-25 11:42   ` [Nouveau] " Arunpravin Paneer Selvam
2022-07-25 11:42   ` [Intel-gfx] " Arunpravin Paneer Selvam
2022-07-25 13:44 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [v2,1/6] drm/ttm: Add new callbacks to ttm res mgr Patchwork
2022-07-25 14:05 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2022-08-08 11:28 ` [Intel-gfx] [PATCH v2 1/6] " Christian König
2022-08-08 11:28   ` [Nouveau] " Christian König
2022-08-08 11:28   ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220725114240.4844-2-Arunpravin.PaneerSelvam@amd.com \
    --to=arunpravin.paneerselvam@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=luben.tuikov@amd.com \
    --cc=matthew.auld@intel.com \
    --cc=nouveau@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.