Skip to contentSkip to conversation

drm/ttm: cleanup ttm_agp_backend

PATCH In review Christian König 2 participants 3 messages Apr 26, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/ttm: cleanup ttm_agp_backend

Audit the includes and stop accessing the internal drm_mm_node.

The ttm_resource::start should be the same value as the drm_mm_node::start.

---
 drivers/gpu/drm/ttm/ttm_agp_backend.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/ttm/ttm_agp_backend.c +4 -4
index 0226ae69d3ab..6ddc16f0fe2b 100644
@@ -32,8 +32,9 @@
 
 #define pr_fmt(fmt) "[TTM] " fmt
 
-#include <drm/ttm/ttm_bo_driver.h>
-#include <drm/ttm/ttm_placement.h>
+#include <drm/ttm/ttm_device.h>
+#include <drm/ttm/ttm_tt.h>
+#include <drm/ttm/ttm_resource.h>
 #include <linux/agp_backend.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -50,7 +51,6 @@ int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem)
 {
 	struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);
 	struct page *dummy_read_page = ttm_glob.dummy_read_page;
-	struct drm_mm_node *node = bo_mem->mm_node;
 	struct agp_memory *mem;
 	int ret, cached = ttm->caching == ttm_cached;
 	unsigned i;
@@ -76,7 +76,7 @@ int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem)
 	mem->is_flushed = 1;
 	mem->type = (cached) ? AGP_USER_CACHED_MEMORY : AGP_USER_MEMORY;
 
-	ret = agp_bind_memory(mem, node->start);
+	ret = agp_bind_memory(mem, bo_mem->start);
 	if (ret)
 		pr_err("AGP Bind memory failed\n");
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Monday, April 26, 2021 1:58 PM
To: [email protected]
Cc: [email protected]
Subject: [PATCH] drm/ttm: cleanup ttm_agp_backend

Quoted 4 lines

Audit the includes and stop accessing the internal drm_mm_node.

The ttm_resource::start should be the same value as the drm_mm_node::start.

"should be"?

Are you sure? 😊

If it isn't, is there an issue?

If they are the same (set in ttm_range_man_alloc?), maybe:

The ttm_resource::start is the same value as the drm_mm_node::start.

With that change:

M

Quoted 43 lines

---
drivers/gpu/drm/ttm/ttm_agp_backend.c | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/ttm/ttm_agp_backend.c +3 -3
index 0226ae69d3ab..6ddc16f0fe2b 100644
@@ -32,8 +32,9 @@
 
 #define pr_fmt(fmt) "[TTM] " fmt
 
-#include <drm/ttm/ttm_bo_driver.h>
-#include <drm/ttm/ttm_placement.h>
+#include <drm/ttm/ttm_device.h>
+#include <drm/ttm/ttm_tt.h>
+#include <drm/ttm/ttm_resource.h>
 #include <linux/agp_backend.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -50,7 +51,6 @@ int ttm_agp_bind(struct ttm_tt *ttm, struct
 ttm_resource *bo_mem)
 {
 	struct ttm_agp_backend *agp_be = container_of(ttm, struct
 ttm_agp_backend, ttm);
 	struct page *dummy_read_page = ttm_glob.dummy_read_page;
-	struct drm_mm_node *node = bo_mem->mm_node;
 	struct agp_memory *mem;
	int ret, cached = ttm->caching == ttm_cached;
	unsigned i;
drivers/gpu/drm/ttm/ttm_agp_backend.c +1 -1
@@ -76,7 +76,7 @@ int ttm_agp_bind(struct ttm_tt *ttm, struct
 ttm_resource *bo_mem)
 	mem->is_flushed = 1;
 	mem->type = (cached) ? AGP_USER_CACHED_MEMORY :
 AGP_USER_MEMORY;
 
-	ret = agp_bind_memory(mem, node->start);
+	ret = agp_bind_memory(mem, bo_mem->start);
 	if (ret)
		pr_err("AGP Bind memory failed\n");
Quoted 7 lines

--
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Am 26.04.21 um 21:36 schrieb Ruhl, Michael J:

Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Christian König
Sent: Monday, April 26, 2021 1:58 PM
To: [email protected]
Cc: [email protected]
Subject: [PATCH] drm/ttm: cleanup ttm_agp_backend

Quoted 7 lines
Quoted 4 lines

Audit the includes and stop accessing the internal drm_mm_node.

The ttm_resource::start should be the same value as the drm_mm_node::start.

"should be"?

Are you sure? 😊

Nope, that's why Ben is on CC. He explicitly changed that for nouveau about 10 years ago :)

But I'm pretty sure that this is completely outdated and not necessary any more.

Quoted 5 lines

If it isn't, is there an issue?

If they are the same (set in ttm_range_man_alloc?), maybe:

The ttm_resource::start is the same value as the drm_mm_node::start.

Yes, as far as I can see that is true for all current code paths. Going to update the commit message.

Quoted 4 lines

With that change:

Thanks,
Christian.

Quoted 46 lines

M

Quoted 43 lines

---
drivers/gpu/drm/ttm/ttm_agp_backend.c | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/ttm/ttm_agp_backend.c +3 -3
index 0226ae69d3ab..6ddc16f0fe2b 100644
@@ -32,8 +32,9 @@
 
 #define pr_fmt(fmt) "[TTM] " fmt
 
-#include <drm/ttm/ttm_bo_driver.h>
-#include <drm/ttm/ttm_placement.h>
+#include <drm/ttm/ttm_device.h>
+#include <drm/ttm/ttm_tt.h>
+#include <drm/ttm/ttm_resource.h>
 #include <linux/agp_backend.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -50,7 +51,6 @@ int ttm_agp_bind(struct ttm_tt *ttm, struct
 ttm_resource *bo_mem)
 {
 	struct ttm_agp_backend *agp_be = container_of(ttm, struct
 ttm_agp_backend, ttm);
 	struct page *dummy_read_page = ttm_glob.dummy_read_page;
-	struct drm_mm_node *node = bo_mem->mm_node;
 	struct agp_memory *mem;
	int ret, cached = ttm->caching == ttm_cached;
	unsigned i;
drivers/gpu/drm/ttm/ttm_agp_backend.c +1 -1
@@ -76,7 +76,7 @@ int ttm_agp_bind(struct ttm_tt *ttm, struct
 ttm_resource *bo_mem)
 	mem->is_flushed = 1;
 	mem->type = (cached) ? AGP_USER_CACHED_MEMORY :
 AGP_USER_MEMORY;
 
-	ret = agp_bind_memory(mem, node->start);
+	ret = agp_bind_memory(mem, bo_mem->start);
 	if (ret)
		pr_err("AGP Bind memory failed\n");
Quoted 7 lines
Quoted 7 lines

--
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel