AMD-GFX Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 00/15] amdgpu: remove load and unload callbacks (v3)
@ 2020-02-07 19:50 Alex Deucher
  2020-02-07 19:50 ` [PATCH 01/15] drm/amdgpu: rename amdgpu_debugfs_preempt_cleanup Alex Deucher
                   ` (15 more replies)
  0 siblings, 16 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher

These are deprecated and the drm will soon start warning when drivers still
use them.  It was a long and twisty road, but seems to work.

v2: Add additional patch (13/15) which should fix the crash reported by
Thomas Zimmermann.
v3: Fix dp aux registration harder, add missing kconfig guard

Alex Deucher (15):
  drm/amdgpu: rename amdgpu_debugfs_preempt_cleanup
  drm/amdgpu/ttm: move debugfs init into core amdgpu debugfs
  drm/amdgpu/pm: move debugfs init into core amdgpu debugfs
  drm/amdgpu/sa: move debugfs init into core amdgpu debugfs
  drm/amdgpu/fence: move debugfs init into core amdgpu debugfs
  drm/amdgpu/gem: move debugfs init into core amdgpu debugfs
  drm/amdgpu/regs: move debugfs init into core amdgpu debugfs
  drm/amdgpu/firmware: move debugfs init into core amdgpu debugfs
  drm/amdgpu: don't call drm_connector_register for non-MST ports
  drm/amdgpu/display: move debugfs init into core amdgpu debugfs (v2)
  drm/amd/display: move dpcd debugfs members setup
  drm/amdgpu/display: add a late register connector callback
  drm/amdgpu/display: split dp connector registration (v2)
  drm/amdgpu/ring: move debugfs init into core amdgpu debugfs
  drm/amdgpu: drop legacy drm load and unload callbacks

 .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 17 ++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   | 69 ++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    | 17 -----
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       | 13 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c     |  3 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c        |  7 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h    |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  9 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h        |  2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c      | 15 +---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h      |  4 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c       | 14 +---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h       |  3 +
 drivers/gpu/drm/amd/amdgpu/atombios_dp.c      | 10 +--
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |  1 -
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 26 +++----
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c |  3 +
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 13 ++--
 19 files changed, 140 insertions(+), 89 deletions(-)

-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 01/15] drm/amdgpu: rename amdgpu_debugfs_preempt_cleanup
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
@ 2020-02-07 19:50 ` Alex Deucher
  2020-02-07 19:50 ` [PATCH 02/15] drm/amdgpu/ttm: move debugfs init into core amdgpu debugfs Alex Deucher
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Christian König

to amdgpu_debugfs_fini.  It will be used for other things in
the future.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index f24ed9a1a3e5..58b5e1b4f814 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1229,7 +1229,7 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 					ARRAY_SIZE(amdgpu_debugfs_list));
 }
 
-void amdgpu_debugfs_preempt_cleanup(struct amdgpu_device *adev)
+void amdgpu_debugfs_fini(struct amdgpu_device *adev)
 {
 	debugfs_remove(adev->debugfs_preempt);
 }
@@ -1239,7 +1239,7 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 {
 	return 0;
 }
-void amdgpu_debugfs_preempt_cleanup(struct amdgpu_device *adev) { }
+void amdgpu_debugfs_fini(struct amdgpu_device *adev) { }
 int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
 {
 	return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h
index f289d28ad6b2..b382527e359a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h
@@ -34,7 +34,7 @@ struct amdgpu_debugfs {
 int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
 void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev);
 int amdgpu_debugfs_init(struct amdgpu_device *adev);
-void amdgpu_debugfs_preempt_cleanup(struct amdgpu_device *adev);
+void amdgpu_debugfs_fini(struct amdgpu_device *adev);
 int amdgpu_debugfs_add_files(struct amdgpu_device *adev,
 			     const struct drm_info_list *files,
 			     unsigned nfiles);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 7cbb6d358ee1..4cf1c2d261ca 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3260,7 +3260,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
 		amdgpu_ucode_sysfs_fini(adev);
 	if (IS_ENABLED(CONFIG_PERF_EVENTS))
 		amdgpu_pmu_fini(adev);
-	amdgpu_debugfs_preempt_cleanup(adev);
+	amdgpu_debugfs_fini(adev);
 	if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10)
 		amdgpu_discovery_fini(adev);
 }
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 02/15] drm/amdgpu/ttm: move debugfs init into core amdgpu debugfs
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
  2020-02-07 19:50 ` [PATCH 01/15] drm/amdgpu: rename amdgpu_debugfs_preempt_cleanup Alex Deucher
@ 2020-02-07 19:50 ` Alex Deucher
  2020-02-07 19:50 ` [PATCH 03/15] drm/amdgpu/pm: " Alex Deucher
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Christian König

In order to remove the load and unload drm callbacks,
we need to reorder the init sequence to move all the drm
debugfs file handling.  Do this for ttm.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 10 ++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 14 ++------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h     |  3 +++
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 58b5e1b4f814..f49604c0d0b8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1216,6 +1216,8 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
 
 int amdgpu_debugfs_init(struct amdgpu_device *adev)
 {
+	int r;
+
 	adev->debugfs_preempt =
 		debugfs_create_file("amdgpu_preempt_ib", 0600,
 				    adev->ddev->primary->debugfs_root, adev,
@@ -1225,12 +1227,20 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 		return -EIO;
 	}
 
+	/* Register debugfs entries for amdgpu_ttm */
+	r = amdgpu_ttm_debugfs_init(adev);
+	if (r) {
+		DRM_ERROR("Failed to init debugfs\n");
+		return r;
+	}
+
 	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
 					ARRAY_SIZE(amdgpu_debugfs_list));
 }
 
 void amdgpu_debugfs_fini(struct amdgpu_device *adev)
 {
+	amdgpu_ttm_debugfs_fini(adev);
 	debugfs_remove(adev->debugfs_preempt);
 }
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 76f86d64dd35..15f5451d312d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -68,9 +68,6 @@ static int amdgpu_map_buffer(struct ttm_buffer_object *bo,
 			     struct amdgpu_ring *ring,
 			     uint64_t *addr);
 
-static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev);
-static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev);
-
 static int amdgpu_invalidate_caches(struct ttm_bo_device *bdev, uint32_t flags)
 {
 	return 0;
@@ -1921,12 +1918,6 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 		return r;
 	}
 
-	/* Register debugfs entries for amdgpu_ttm */
-	r = amdgpu_ttm_debugfs_init(adev);
-	if (r) {
-		DRM_ERROR("Failed to init debugfs\n");
-		return r;
-	}
 	return 0;
 }
 
@@ -1948,7 +1939,6 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)
 	if (!adev->mman.initialized)
 		return;
 
-	amdgpu_ttm_debugfs_fini(adev);
 	amdgpu_ttm_training_reserve_vram_fini(adev);
 	/* return the IP Discovery TMR memory back to VRAM */
 	amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL);
@@ -2548,7 +2538,7 @@ static const struct {
 
 #endif
 
-static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
+int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
 {
 #if defined(CONFIG_DEBUG_FS)
 	unsigned count;
@@ -2584,7 +2574,7 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
 #endif
 }
 
-static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev)
+void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev)
 {
 #if defined(CONFIG_DEBUG_FS)
 	unsigned i;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index f1ebd424510c..2c4ad5b589d0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -133,4 +133,7 @@ uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_mem_reg *mem);
 uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
 				 struct ttm_mem_reg *mem);
 
+int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev);
+void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev);
+
 #endif
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 03/15] drm/amdgpu/pm: move debugfs init into core amdgpu debugfs
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
  2020-02-07 19:50 ` [PATCH 01/15] drm/amdgpu: rename amdgpu_debugfs_preempt_cleanup Alex Deucher
  2020-02-07 19:50 ` [PATCH 02/15] drm/amdgpu/ttm: move debugfs init into core amdgpu debugfs Alex Deucher
@ 2020-02-07 19:50 ` " Alex Deucher
  2020-02-07 19:50 ` [PATCH 04/15] drm/amdgpu/sa: " Alex Deucher
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Christian König

In order to remove the load and unload drm callbacks,
we need to reorder the init sequence to move all the drm
debugfs file handling.  Do this for pm.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 7 +++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c      | 9 +--------
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h      | 2 ++
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index f49604c0d0b8..c1d66cc6e6d8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -31,6 +31,7 @@
 #include <drm/drm_debugfs.h>
 
 #include "amdgpu.h"
+#include "amdgpu_pm.h"
 
 /**
  * amdgpu_debugfs_add_files - Add simple debugfs entries
@@ -1234,6 +1235,12 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 		return r;
 	}
 
+	r = amdgpu_debugfs_pm_init(adev);
+	if (r) {
+		DRM_ERROR("Failed to register debugfs file for dpm!\n");
+		return r;
+	}
+
 	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
 					ARRAY_SIZE(amdgpu_debugfs_list));
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index b03b1eb7ba04..bc3cf04a1a94 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -41,8 +41,6 @@
 #include "hwmgr.h"
 #define WIDTH_4K 3840
 
-static int amdgpu_debugfs_pm_init(struct amdgpu_device *adev);
-
 static const struct cg_flag_name clocks[] = {
 	{AMD_CG_SUPPORT_GFX_MGCG, "Graphics Medium Grain Clock Gating"},
 	{AMD_CG_SUPPORT_GFX_MGLS, "Graphics Medium Grain memory Light Sleep"},
@@ -3398,11 +3396,6 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
 		DRM_ERROR("failed to create device file unique_id\n");
 		return ret;
 	}
-	ret = amdgpu_debugfs_pm_init(adev);
-	if (ret) {
-		DRM_ERROR("Failed to register debugfs file for dpm!\n");
-		return ret;
-	}
 
 	if ((adev->asic_type >= CHIP_VEGA10) &&
 	    !(adev->flags & AMD_IS_APU)) {
@@ -3669,7 +3662,7 @@ static const struct drm_info_list amdgpu_pm_info_list[] = {
 };
 #endif
 
-static int amdgpu_debugfs_pm_init(struct amdgpu_device *adev)
+int amdgpu_debugfs_pm_init(struct amdgpu_device *adev)
 {
 #if defined(CONFIG_DEBUG_FS)
 	return amdgpu_debugfs_add_files(adev, amdgpu_pm_info_list, ARRAY_SIZE(amdgpu_pm_info_list));
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h
index 3da1da277805..5db0ef86e84c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h
@@ -43,4 +43,6 @@ void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable);
 void amdgpu_dpm_enable_vce(struct amdgpu_device *adev, bool enable);
 void amdgpu_dpm_enable_jpeg(struct amdgpu_device *adev, bool enable);
 
+int amdgpu_debugfs_pm_init(struct amdgpu_device *adev);
+
 #endif
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 04/15] drm/amdgpu/sa: move debugfs init into core amdgpu debugfs
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (2 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 03/15] drm/amdgpu/pm: " Alex Deucher
@ 2020-02-07 19:50 ` " Alex Deucher
  2020-02-07 19:50 ` [PATCH 05/15] drm/amdgpu/fence: " Alex Deucher
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Christian König

In order to remove the load and unload drm callbacks,
we need to reorder the init sequence to move all the drm
debugfs file handling.  Do this for SA (sub allocator).

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c      | 7 ++-----
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h  | 1 +
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index c1d66cc6e6d8..84c5e9f23c76 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1241,6 +1241,10 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 		return r;
 	}
 
+	if (amdgpu_debugfs_sa_init(adev)) {
+		dev_err(adev->dev, "failed to register debugfs file for SA\n");
+	}
+
 	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
 					ARRAY_SIZE(amdgpu_debugfs_list));
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 6e0f97afb030..abf286f2bc5e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -48,7 +48,6 @@
  * produce command buffers which are send to the kernel and
  * put in IBs for execution by the requested ring.
  */
-static int amdgpu_debugfs_sa_init(struct amdgpu_device *adev);
 
 /**
  * amdgpu_ib_get - request an IB (Indirect Buffer)
@@ -295,9 +294,7 @@ int amdgpu_ib_pool_init(struct amdgpu_device *adev)
 	}
 
 	adev->ib_pool_ready = true;
-	if (amdgpu_debugfs_sa_init(adev)) {
-		dev_err(adev->dev, "failed to register debugfs file for SA\n");
-	}
+
 	return 0;
 }
 
@@ -421,7 +418,7 @@ static const struct drm_info_list amdgpu_debugfs_sa_list[] = {
 
 #endif
 
-static int amdgpu_debugfs_sa_init(struct amdgpu_device *adev)
+int amdgpu_debugfs_sa_init(struct amdgpu_device *adev)
 {
 #if defined(CONFIG_DEBUG_FS)
 	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_sa_list, 1);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
index 26a654cbd530..7d41f7b9a340 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
@@ -330,6 +330,7 @@ void amdgpu_sa_bo_free(struct amdgpu_device *adev,
 void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager,
 					 struct seq_file *m);
 #endif
+int amdgpu_debugfs_sa_init(struct amdgpu_device *adev);
 
 bool amdgpu_bo_support_uswc(u64 bo_flags);
 
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 05/15] drm/amdgpu/fence: move debugfs init into core amdgpu debugfs
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (3 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 04/15] drm/amdgpu/sa: " Alex Deucher
@ 2020-02-07 19:50 ` " Alex Deucher
  2020-02-07 19:50 ` [PATCH 06/15] drm/amdgpu/gem: " Alex Deucher
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Christian König

In order to remove the load and unload drm callbacks,
we need to reorder the init sequence to move all the drm
debugfs file handling.  Do this for fence handling.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c   | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 84c5e9f23c76..bcd10daa6e39 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1245,6 +1245,9 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 		dev_err(adev->dev, "failed to register debugfs file for SA\n");
 	}
 
+	if (amdgpu_debugfs_fence_init(adev))
+		dev_err(adev->dev, "fence debugfs file creation failed\n");
+
 	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
 					ARRAY_SIZE(amdgpu_debugfs_list));
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index 3c01252b1e0e..7531527067df 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -503,9 +503,6 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
  */
 int amdgpu_fence_driver_init(struct amdgpu_device *adev)
 {
-	if (amdgpu_debugfs_fence_init(adev))
-		dev_err(adev->dev, "fence debugfs file creation failed\n");
-
 	return 0;
 }
 
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 06/15] drm/amdgpu/gem: move debugfs init into core amdgpu debugfs
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (4 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 05/15] drm/amdgpu/fence: " Alex Deucher
@ 2020-02-07 19:50 ` " Alex Deucher
  2020-02-07 19:50 ` [PATCH 07/15] drm/amdgpu/regs: " Alex Deucher
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Christian König

In order to remove the load and unload drm callbacks,
we need to reorder the init sequence to move all the drm
debugfs file handling.  Do this for gem.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c  | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index bcd10daa6e39..cb7db7edfc3f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1248,6 +1248,10 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 	if (amdgpu_debugfs_fence_init(adev))
 		dev_err(adev->dev, "fence debugfs file creation failed\n");
 
+	r = amdgpu_debugfs_gem_init(adev);
+	if (r)
+		DRM_ERROR("registering gem debugfs failed (%d).\n", r);
+
 	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
 					ARRAY_SIZE(amdgpu_debugfs_list));
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 4cf1c2d261ca..c787aebc240b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3123,10 +3123,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	} else
 		adev->ucode_sysfs_en = true;
 
-	r = amdgpu_debugfs_gem_init(adev);
-	if (r)
-		DRM_ERROR("registering gem debugfs failed (%d).\n", r);
-
 	r = amdgpu_debugfs_regs_init(adev);
 	if (r)
 		DRM_ERROR("registering register debugfs failed (%d).\n", r);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 07/15] drm/amdgpu/regs: move debugfs init into core amdgpu debugfs
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (5 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 06/15] drm/amdgpu/gem: " Alex Deucher
@ 2020-02-07 19:50 ` " Alex Deucher
  2020-02-07 19:50 ` [PATCH 08/15] drm/amdgpu/firmware: " Alex Deucher
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Christian König

In order to remove the load and unload drm callbacks,
we need to reorder the init sequence to move all the drm
debugfs file handling.  Do this for register access files.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c  | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index cb7db7edfc3f..7721f1416cdb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1252,6 +1252,10 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 	if (r)
 		DRM_ERROR("registering gem debugfs failed (%d).\n", r);
 
+	r = amdgpu_debugfs_regs_init(adev);
+	if (r)
+		DRM_ERROR("registering register debugfs failed (%d).\n", r);
+
 	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
 					ARRAY_SIZE(amdgpu_debugfs_list));
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index c787aebc240b..3ec95c11e748 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3123,10 +3123,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	} else
 		adev->ucode_sysfs_en = true;
 
-	r = amdgpu_debugfs_regs_init(adev);
-	if (r)
-		DRM_ERROR("registering register debugfs failed (%d).\n", r);
-
 	r = amdgpu_debugfs_firmware_init(adev);
 	if (r)
 		DRM_ERROR("registering firmware debugfs failed (%d).\n", r);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 08/15] drm/amdgpu/firmware: move debugfs init into core amdgpu debugfs
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (6 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 07/15] drm/amdgpu/regs: " Alex Deucher
@ 2020-02-07 19:50 ` " Alex Deucher
  2020-02-07 19:50 ` [PATCH 09/15] drm/amdgpu: don't call drm_connector_register for non-MST ports Alex Deucher
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Christian König

In order to remove the load and unload drm callbacks,
we need to reorder the init sequence to move all the drm
debugfs file handling.  Do this for firmware.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c  | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 7721f1416cdb..5bf43f20ec30 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1256,6 +1256,10 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 	if (r)
 		DRM_ERROR("registering register debugfs failed (%d).\n", r);
 
+	r = amdgpu_debugfs_firmware_init(adev);
+	if (r)
+		DRM_ERROR("registering firmware debugfs failed (%d).\n", r);
+
 	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
 					ARRAY_SIZE(amdgpu_debugfs_list));
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 3ec95c11e748..5adf936cf733 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3123,10 +3123,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	} else
 		adev->ucode_sysfs_en = true;
 
-	r = amdgpu_debugfs_firmware_init(adev);
-	if (r)
-		DRM_ERROR("registering firmware debugfs failed (%d).\n", r);
-
 	r = amdgpu_debugfs_init(adev);
 	if (r)
 		DRM_ERROR("Creating debugfs files failed (%d).\n", r);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 09/15] drm/amdgpu: don't call drm_connector_register for non-MST ports
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (7 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 08/15] drm/amdgpu/firmware: " Alex Deucher
@ 2020-02-07 19:50 ` Alex Deucher
  2020-02-07 19:50 ` [PATCH 10/15] drm/amdgpu/display: move debugfs init into core amdgpu debugfs (v2) Alex Deucher
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Christian König

The core does this for us now.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 1 -
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c          | 1 -
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 -
 3 files changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index a62cbc8199de..ec1501e3a63a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -1931,7 +1931,6 @@ amdgpu_connector_add(struct amdgpu_device *adev,
 		connector->polled = DRM_CONNECTOR_POLL_HPD;
 
 	connector->display_info.subpixel_order = subpixel_order;
-	drm_connector_register(connector);
 
 	if (has_aux)
 		amdgpu_atombios_dp_aux_init(amdgpu_connector);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index e4f94863332c..3c9f2d2490a5 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -609,7 +609,6 @@ static int dce_virtual_connector_encoder_init(struct amdgpu_device *adev,
 	connector->display_info.subpixel_order = SubPixelHorizontalRGB;
 	connector->interlace_allowed = false;
 	connector->doublescan_allowed = false;
-	drm_connector_register(connector);
 
 	/* link them */
 	drm_connector_attach_encoder(connector, encoder);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index bd798b6bdf0f..50137df9cdad 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -5839,7 +5839,6 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
 	drm_connector_attach_encoder(
 		&aconnector->base, &aencoder->base);
 
-	drm_connector_register(&aconnector->base);
 #if defined(CONFIG_DEBUG_FS)
 	connector_debugfs_init(aconnector);
 	aconnector->debugfs_dpcd_address = 0;
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 10/15] drm/amdgpu/display: move debugfs init into core amdgpu debugfs (v2)
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (8 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 09/15] drm/amdgpu: don't call drm_connector_register for non-MST ports Alex Deucher
@ 2020-02-07 19:50 ` Alex Deucher
  2020-02-07 19:50 ` [PATCH 11/15] drm/amd/display: move dpcd debugfs members setup Alex Deucher
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Harry Wentland, Christian König

In order to remove the load and unload drm callbacks,
we need to reorder the init sequence to move all the drm
debugfs file handling.  Do this for display.

v2: add config guard for DC

Reviewed-by: Harry Wentland <harry.wentland@amd.com> (v1)
Acked-by: Christian König <christian.koenig@amd.com> (v1)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c       | 8 ++++++++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 -----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 5bf43f20ec30..df3919ef886b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -32,6 +32,7 @@
 
 #include "amdgpu.h"
 #include "amdgpu_pm.h"
+#include "amdgpu_dm_debugfs.h"
 
 /**
  * amdgpu_debugfs_add_files - Add simple debugfs entries
@@ -1260,6 +1261,13 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 	if (r)
 		DRM_ERROR("registering firmware debugfs failed (%d).\n", r);
 
+#if defined(CONFIG_DRM_AMD_DC)
+	if (amdgpu_device_has_dc_support(adev)) {
+		if (dtn_debugfs_init(adev))
+			DRM_ERROR("amdgpu: failed initialize dtn debugfs support.\n");
+	}
+#endif
+
 	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
 					ARRAY_SIZE(amdgpu_debugfs_list));
 }
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 50137df9cdad..81c8d8c61d62 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -991,11 +991,6 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 		goto error;
 	}
 
-#if defined(CONFIG_DEBUG_FS)
-	if (dtn_debugfs_init(adev))
-		DRM_ERROR("amdgpu: failed initialize dtn debugfs support.\n");
-#endif
-
 	DRM_DEBUG_DRIVER("KMS initialized.\n");
 
 	return 0;
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 11/15] drm/amd/display: move dpcd debugfs members setup
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (9 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 10/15] drm/amdgpu/display: move debugfs init into core amdgpu debugfs (v2) Alex Deucher
@ 2020-02-07 19:50 ` Alex Deucher
  2020-02-07 19:50 ` [PATCH 12/15] drm/amdgpu/display: add a late register connector callback Alex Deucher
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Harry Wentland, Christian König

Into the function that creates the debugfs files rather
than setting them explicitly in the callers.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c           | 2 --
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c   | 3 +++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 --
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 81c8d8c61d62..af8155708569 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -5836,8 +5836,6 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
 
 #if defined(CONFIG_DEBUG_FS)
 	connector_debugfs_init(aconnector);
-	aconnector->debugfs_dpcd_address = 0;
-	aconnector->debugfs_dpcd_size = 0;
 #endif
 
 	if (connector_type == DRM_MODE_CONNECTOR_DisplayPort
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index ead5c05eec92..6bc0bdc8835c 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -1066,6 +1066,9 @@ void connector_debugfs_init(struct amdgpu_dm_connector *connector)
 	debugfs_create_file_unsafe("force_yuv420_output", 0644, dir, connector,
 				   &force_yuv420_output_fops);
 
+	connector->debugfs_dpcd_address = 0;
+	connector->debugfs_dpcd_size = 0;
+
 }
 
 /*
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 5672f7765919..3959c942c88b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -158,8 +158,6 @@ amdgpu_dm_mst_connector_late_register(struct drm_connector *connector)
 
 #if defined(CONFIG_DEBUG_FS)
 	connector_debugfs_init(amdgpu_dm_connector);
-	amdgpu_dm_connector->debugfs_dpcd_address = 0;
-	amdgpu_dm_connector->debugfs_dpcd_size = 0;
 #endif
 
 	return drm_dp_mst_connector_late_register(connector, port);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 12/15] drm/amdgpu/display: add a late register connector callback
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (10 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 11/15] drm/amd/display: move dpcd debugfs members setup Alex Deucher
@ 2020-02-07 19:50 ` Alex Deucher
  2020-02-07 19:50 ` [PATCH 13/15] drm/amdgpu/display: split dp connector registration (v2) Alex Deucher
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Harry Wentland, Christian König

To handle debugfs setup on non DP MST connectors.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index af8155708569..b6190079ed3f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4486,6 +4486,19 @@ amdgpu_dm_connector_atomic_duplicate_state(struct drm_connector *connector)
 	return &new_state->base;
 }
 
+static int
+amdgpu_dm_connector_late_register(struct drm_connector *connector)
+{
+	struct amdgpu_dm_connector *amdgpu_dm_connector =
+		to_amdgpu_dm_connector(connector);
+
+#if defined(CONFIG_DEBUG_FS)
+	connector_debugfs_init(amdgpu_dm_connector);
+#endif
+
+	return 0;
+}
+
 static const struct drm_connector_funcs amdgpu_dm_connector_funcs = {
 	.reset = amdgpu_dm_connector_funcs_reset,
 	.detect = amdgpu_dm_connector_detect,
@@ -4495,6 +4508,7 @@ static const struct drm_connector_funcs amdgpu_dm_connector_funcs = {
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 	.atomic_set_property = amdgpu_dm_connector_atomic_set_property,
 	.atomic_get_property = amdgpu_dm_connector_atomic_get_property,
+	.late_register = amdgpu_dm_connector_late_register,
 	.early_unregister = amdgpu_dm_connector_unregister
 };
 
@@ -5834,10 +5848,6 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
 	drm_connector_attach_encoder(
 		&aconnector->base, &aencoder->base);
 
-#if defined(CONFIG_DEBUG_FS)
-	connector_debugfs_init(aconnector);
-#endif
-
 	if (connector_type == DRM_MODE_CONNECTOR_DisplayPort
 		|| connector_type == DRM_MODE_CONNECTOR_eDP)
 		amdgpu_dm_initialize_dp_connector(dm, aconnector);
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 13/15] drm/amdgpu/display: split dp connector registration (v2)
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (11 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 12/15] drm/amdgpu/display: add a late register connector callback Alex Deucher
@ 2020-02-07 19:50 ` Alex Deucher
  2020-02-07 19:50 ` [PATCH 14/15] drm/amdgpu/ring: move debugfs init into core amdgpu debugfs Alex Deucher
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher

Split into init and register functions to avoid a segfault
in some configs when the load/unload callbacks are removed.

v2:
- add back accidently dropped has_aux setting
- set dev in late_register

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c   | 16 ++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/atombios_dp.c         | 10 ++--------
 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c  | 11 ++++++++---
 3 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index ec1501e3a63a..f355d9a752d2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -1461,6 +1461,20 @@ static enum drm_mode_status amdgpu_connector_dp_mode_valid(struct drm_connector
 	return MODE_OK;
 }
 
+static int
+amdgpu_connector_late_register(struct drm_connector *connector)
+{
+	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
+	int r = 0;
+
+	if (amdgpu_connector->ddc_bus->has_aux) {
+		amdgpu_connector->ddc_bus->aux.dev = amdgpu_connector->base.kdev;
+		r = drm_dp_aux_register(&amdgpu_connector->ddc_bus->aux);
+	}
+
+	return r;
+}
+
 static const struct drm_connector_helper_funcs amdgpu_connector_dp_helper_funcs = {
 	.get_modes = amdgpu_connector_dp_get_modes,
 	.mode_valid = amdgpu_connector_dp_mode_valid,
@@ -1475,6 +1489,7 @@ static const struct drm_connector_funcs amdgpu_connector_dp_funcs = {
 	.early_unregister = amdgpu_connector_unregister,
 	.destroy = amdgpu_connector_destroy,
 	.force = amdgpu_connector_dvi_force,
+	.late_register = amdgpu_connector_late_register,
 };
 
 static const struct drm_connector_funcs amdgpu_connector_edp_funcs = {
@@ -1485,6 +1500,7 @@ static const struct drm_connector_funcs amdgpu_connector_edp_funcs = {
 	.early_unregister = amdgpu_connector_unregister,
 	.destroy = amdgpu_connector_destroy,
 	.force = amdgpu_connector_dvi_force,
+	.late_register = amdgpu_connector_late_register,
 };
 
 void
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
index ea702a64f807..9b74cfdba7b8 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
@@ -186,16 +186,10 @@ amdgpu_atombios_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *m
 
 void amdgpu_atombios_dp_aux_init(struct amdgpu_connector *amdgpu_connector)
 {
-	int ret;
-
 	amdgpu_connector->ddc_bus->rec.hpd = amdgpu_connector->hpd.hpd;
-	amdgpu_connector->ddc_bus->aux.dev = amdgpu_connector->base.kdev;
 	amdgpu_connector->ddc_bus->aux.transfer = amdgpu_atombios_dp_aux_transfer;
-	ret = drm_dp_aux_register(&amdgpu_connector->ddc_bus->aux);
-	if (!ret)
-		amdgpu_connector->ddc_bus->has_aux = true;
-
-	WARN(ret, "drm_dp_aux_register_i2c_bus() failed with error %d\n", ret);
+	drm_dp_aux_init(&amdgpu_connector->ddc_bus->aux);
+	amdgpu_connector->ddc_bus->has_aux = true;
 }
 
 /***** general DP utility functions *****/
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 3959c942c88b..a4e6f9d39e12 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -155,6 +155,13 @@ amdgpu_dm_mst_connector_late_register(struct drm_connector *connector)
 	struct amdgpu_dm_connector *amdgpu_dm_connector =
 		to_amdgpu_dm_connector(connector);
 	struct drm_dp_mst_port *port = amdgpu_dm_connector->port;
+	int r;
+
+	r = drm_dp_aux_register(&amdgpu_dm_connector->dm_dp_aux.aux);
+	if (r)
+		return r;
+	drm_dp_cec_register_connector(&amdgpu_dm_connector->dm_dp_aux.aux,
+				      connector);
 
 #if defined(CONFIG_DEBUG_FS)
 	connector_debugfs_init(amdgpu_dm_connector);
@@ -484,9 +491,7 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
 	aconnector->dm_dp_aux.aux.transfer = dm_dp_aux_transfer;
 	aconnector->dm_dp_aux.ddc_service = aconnector->dc_link->ddc;
 
-	drm_dp_aux_register(&aconnector->dm_dp_aux.aux);
-	drm_dp_cec_register_connector(&aconnector->dm_dp_aux.aux,
-				      &aconnector->base);
+	drm_dp_aux_init(&aconnector->dm_dp_aux.aux);
 
 	if (aconnector->base.connector_type == DRM_MODE_CONNECTOR_eDP)
 		return;
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 14/15] drm/amdgpu/ring: move debugfs init into core amdgpu debugfs
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (12 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 13/15] drm/amdgpu/display: split dp connector registration (v2) Alex Deucher
@ 2020-02-07 19:50 ` Alex Deucher
  2020-02-13  9:54   ` Daniel Vetter
  2020-02-07 19:50 ` [PATCH 15/15] drm/amdgpu: drop legacy drm load and unload callbacks Alex Deucher
  2020-02-10 10:39 ` [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Thomas Zimmermann
  15 siblings, 1 reply; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Christian König

In order to remove the load and unload drm callbacks,
we need to reorder the init sequence to move all the drm
debugfs file handling.  Do this for rings.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 23 ++++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c    | 15 +++-----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h    |  4 ++++
 3 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index df3919ef886b..7379910790c9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1218,7 +1218,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
 
 int amdgpu_debugfs_init(struct amdgpu_device *adev)
 {
-	int r;
+	int r, i;
 
 	adev->debugfs_preempt =
 		debugfs_create_file("amdgpu_preempt_ib", 0600,
@@ -1268,12 +1268,33 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 	}
 #endif
 
+	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
+		struct amdgpu_ring *ring = adev->rings[i];
+
+		if (!ring)
+			continue;
+
+		if (amdgpu_debugfs_ring_init(adev, ring)) {
+			DRM_ERROR("Failed to register debugfs file for rings !\n");
+		}
+	}
+
 	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
 					ARRAY_SIZE(amdgpu_debugfs_list));
 }
 
 void amdgpu_debugfs_fini(struct amdgpu_device *adev)
 {
+	int i;
+
+	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
+		struct amdgpu_ring *ring = adev->rings[i];
+
+		if (!ring)
+			continue;
+
+		amdgpu_debugfs_ring_fini(ring);
+	}
 	amdgpu_ttm_debugfs_fini(adev);
 	debugfs_remove(adev->debugfs_preempt);
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
index e5c83e164d82..539be138260e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
@@ -48,9 +48,6 @@
  * wptr.  The GPU then starts fetching commands and executes
  * them until the pointers are equal again.
  */
-static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
-				    struct amdgpu_ring *ring);
-static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
 
 /**
  * amdgpu_ring_alloc - allocate space on the ring buffer
@@ -334,10 +331,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
 	for (i = 0; i < DRM_SCHED_PRIORITY_MAX; ++i)
 		atomic_set(&ring->num_jobs[i], 0);
 
-	if (amdgpu_debugfs_ring_init(adev, ring)) {
-		DRM_ERROR("Failed to register debugfs file for rings !\n");
-	}
-
 	return 0;
 }
 
@@ -367,8 +360,6 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
 			      &ring->gpu_addr,
 			      (void **)&ring->ring);
 
-	amdgpu_debugfs_ring_fini(ring);
-
 	dma_fence_put(ring->vmid_wait);
 	ring->vmid_wait = NULL;
 	ring->me = 0;
@@ -485,8 +476,8 @@ static const struct file_operations amdgpu_debugfs_ring_fops = {
 
 #endif
 
-static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
-				    struct amdgpu_ring *ring)
+int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
+			     struct amdgpu_ring *ring)
 {
 #if defined(CONFIG_DEBUG_FS)
 	struct drm_minor *minor = adev->ddev->primary;
@@ -507,7 +498,7 @@ static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
 	return 0;
 }
 
-static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
+void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
 {
 #if defined(CONFIG_DEBUG_FS)
 	debugfs_remove(ring->ent);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
index 5134d0dd6dc2..0d098dafd23c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
@@ -329,4 +329,8 @@ static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring,
 
 int amdgpu_ring_test_helper(struct amdgpu_ring *ring);
 
+int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
+			     struct amdgpu_ring *ring);
+void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
+
 #endif
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 15/15] drm/amdgpu: drop legacy drm load and unload callbacks
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (13 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 14/15] drm/amdgpu/ring: move debugfs init into core amdgpu debugfs Alex Deucher
@ 2020-02-07 19:50 ` Alex Deucher
  2020-02-10 10:39 ` [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Thomas Zimmermann
  15 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-07 19:50 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Christian König

We've moved the debugfs handling into a centralized place
so we can remove the legacy load an unload callbacks.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  5 -----
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 13 +++++++++++--
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 5adf936cf733..31e07d45eb1a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3123,10 +3123,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	} else
 		adev->ucode_sysfs_en = true;
 
-	r = amdgpu_debugfs_init(adev);
-	if (r)
-		DRM_ERROR("Creating debugfs files failed (%d).\n", r);
-
 	if ((amdgpu_testing & 1)) {
 		if (adev->accel_working)
 			amdgpu_test_moves(adev);
@@ -3248,7 +3244,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
 		amdgpu_ucode_sysfs_fini(adev);
 	if (IS_ENABLED(CONFIG_PERF_EVENTS))
 		amdgpu_pmu_fini(adev);
-	amdgpu_debugfs_fini(adev);
 	if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10)
 		amdgpu_discovery_fini(adev);
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index f0a82486a9b7..ff73af165e61 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1031,6 +1031,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *ent)
 {
 	struct drm_device *dev;
+	struct amdgpu_device *adev;
 	unsigned long flags = ent->driver_data;
 	int ret, retry = 0;
 	bool supports_atomic = false;
@@ -1100,6 +1101,8 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 
 	pci_set_drvdata(pdev, dev);
 
+	amdgpu_driver_load_kms(dev, ent->driver_data);
+
 retry_init:
 	ret = drm_dev_register(dev, ent->driver_data);
 	if (ret == -EAGAIN && ++retry <= 3) {
@@ -1110,6 +1113,11 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 	} else if (ret)
 		goto err_pci;
 
+	adev = dev->dev_private;
+	ret = amdgpu_debugfs_init(adev);
+	if (ret)
+		DRM_ERROR("Creating debugfs files failed (%d).\n", ret);
+
 	return 0;
 
 err_pci:
@@ -1123,6 +1131,7 @@ static void
 amdgpu_pci_remove(struct pci_dev *pdev)
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
+	struct amdgpu_device *adev = dev->dev_private;
 
 #ifdef MODULE
 	if (THIS_MODULE->state != MODULE_STATE_GOING)
@@ -1130,6 +1139,8 @@ amdgpu_pci_remove(struct pci_dev *pdev)
 		DRM_ERROR("Hotplug removal is not supported\n");
 	drm_dev_unplug(dev);
 	drm_dev_put(dev);
+	amdgpu_debugfs_fini(adev);
+	amdgpu_driver_unload_kms(dev);
 	pci_disable_device(pdev);
 	pci_set_drvdata(pdev, NULL);
 }
@@ -1436,11 +1447,9 @@ static struct drm_driver kms_driver = {
 	    DRIVER_GEM |
 	    DRIVER_RENDER | DRIVER_MODESET | DRIVER_SYNCOBJ |
 	    DRIVER_SYNCOBJ_TIMELINE,
-	.load = amdgpu_driver_load_kms,
 	.open = amdgpu_driver_open_kms,
 	.postclose = amdgpu_driver_postclose_kms,
 	.lastclose = amdgpu_driver_lastclose_kms,
-	.unload = amdgpu_driver_unload_kms,
 	.get_vblank_counter = amdgpu_get_vblank_counter_kms,
 	.enable_vblank = amdgpu_enable_vblank_kms,
 	.disable_vblank = amdgpu_disable_vblank_kms,
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 00/15] amdgpu: remove load and unload callbacks (v3)
  2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
                   ` (14 preceding siblings ...)
  2020-02-07 19:50 ` [PATCH 15/15] drm/amdgpu: drop legacy drm load and unload callbacks Alex Deucher
@ 2020-02-10 10:39 ` Thomas Zimmermann
  15 siblings, 0 replies; 23+ messages in thread
From: Thomas Zimmermann @ 2020-02-10 10:39 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx, dri-devel; +Cc: Alex Deucher

[-- Attachment #1.1.1: Type: text/plain, Size: 2819 bytes --]

Hi

Am 07.02.20 um 20:50 schrieb Alex Deucher:
> These are deprecated and the drm will soon start warning when drivers still
> use them.  It was a long and twisty road, but seems to work.
> 
> v2: Add additional patch (13/15) which should fix the crash reported by
> Thomas Zimmermann.
> v3: Fix dp aux registration harder, add missing kconfig guard

No more stacktraces.

Tested-by: Thomas Zimmermann <tzimmermann@suse.de>

> 
> Alex Deucher (15):
>   drm/amdgpu: rename amdgpu_debugfs_preempt_cleanup
>   drm/amdgpu/ttm: move debugfs init into core amdgpu debugfs
>   drm/amdgpu/pm: move debugfs init into core amdgpu debugfs
>   drm/amdgpu/sa: move debugfs init into core amdgpu debugfs
>   drm/amdgpu/fence: move debugfs init into core amdgpu debugfs
>   drm/amdgpu/gem: move debugfs init into core amdgpu debugfs
>   drm/amdgpu/regs: move debugfs init into core amdgpu debugfs
>   drm/amdgpu/firmware: move debugfs init into core amdgpu debugfs
>   drm/amdgpu: don't call drm_connector_register for non-MST ports
>   drm/amdgpu/display: move debugfs init into core amdgpu debugfs (v2)
>   drm/amd/display: move dpcd debugfs members setup
>   drm/amdgpu/display: add a late register connector callback
>   drm/amdgpu/display: split dp connector registration (v2)
>   drm/amdgpu/ring: move debugfs init into core amdgpu debugfs
>   drm/amdgpu: drop legacy drm load and unload callbacks
> 
>  .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 17 ++++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c   | 69 ++++++++++++++++++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h   |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    | 17 -----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       | 13 +++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c     |  3 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c        |  7 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h    |  1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  9 +--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h        |  2 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c      | 15 +---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h      |  4 ++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c       | 14 +---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h       |  3 +
>  drivers/gpu/drm/amd/amdgpu/atombios_dp.c      | 10 +--
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c      |  1 -
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 26 +++----
>  .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c |  3 +
>  .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 13 ++--
>  19 files changed, 140 insertions(+), 89 deletions(-)
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 14/15] drm/amdgpu/ring: move debugfs init into core amdgpu debugfs
  2020-02-07 19:50 ` [PATCH 14/15] drm/amdgpu/ring: move debugfs init into core amdgpu debugfs Alex Deucher
@ 2020-02-13  9:54   ` Daniel Vetter
  2020-02-13 10:17     ` Christian König
  0 siblings, 1 reply; 23+ messages in thread
From: Daniel Vetter @ 2020-02-13  9:54 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Alex Deucher, dri-devel, amd-gfx, Christian König

On Fri, Feb 07, 2020 at 02:50:57PM -0500, Alex Deucher wrote:
> In order to remove the load and unload drm callbacks,
> we need to reorder the init sequence to move all the drm
> debugfs file handling.  Do this for rings.
> 
> Acked-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 23 ++++++++++++++++++++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c    | 15 +++-----------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h    |  4 ++++
>  3 files changed, 29 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> index df3919ef886b..7379910790c9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> @@ -1218,7 +1218,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
>  
>  int amdgpu_debugfs_init(struct amdgpu_device *adev)
>  {
> -	int r;
> +	int r, i;
>  
>  	adev->debugfs_preempt =
>  		debugfs_create_file("amdgpu_preempt_ib", 0600,
> @@ -1268,12 +1268,33 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
>  	}
>  #endif
>  
> +	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
> +		struct amdgpu_ring *ring = adev->rings[i];
> +
> +		if (!ring)
> +			continue;
> +
> +		if (amdgpu_debugfs_ring_init(adev, ring)) {
> +			DRM_ERROR("Failed to register debugfs file for rings !\n");
> +		}
> +	}
> +
>  	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
>  					ARRAY_SIZE(amdgpu_debugfs_list));
>  }
>  
>  void amdgpu_debugfs_fini(struct amdgpu_device *adev)

btw debugfs_fini shouldn't be needed anymore, Greg KH removed this all.
drm core removes all debugfs files recusrively for you, there should be 0
need for debugfs cleanup.

Also at least my tree doesn't even have this, where does this apply to?
-Daniel

>  {
> +	int i;
> +
> +	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
> +		struct amdgpu_ring *ring = adev->rings[i];
> +
> +		if (!ring)
> +			continue;
> +
> +		amdgpu_debugfs_ring_fini(ring);
> +	}
>  	amdgpu_ttm_debugfs_fini(adev);
>  	debugfs_remove(adev->debugfs_preempt);
>  }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index e5c83e164d82..539be138260e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -48,9 +48,6 @@
>   * wptr.  The GPU then starts fetching commands and executes
>   * them until the pointers are equal again.
>   */
> -static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> -				    struct amdgpu_ring *ring);
> -static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
>  
>  /**
>   * amdgpu_ring_alloc - allocate space on the ring buffer
> @@ -334,10 +331,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
>  	for (i = 0; i < DRM_SCHED_PRIORITY_MAX; ++i)
>  		atomic_set(&ring->num_jobs[i], 0);
>  
> -	if (amdgpu_debugfs_ring_init(adev, ring)) {
> -		DRM_ERROR("Failed to register debugfs file for rings !\n");
> -	}
> -
>  	return 0;
>  }
>  
> @@ -367,8 +360,6 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
>  			      &ring->gpu_addr,
>  			      (void **)&ring->ring);
>  
> -	amdgpu_debugfs_ring_fini(ring);
> -
>  	dma_fence_put(ring->vmid_wait);
>  	ring->vmid_wait = NULL;
>  	ring->me = 0;
> @@ -485,8 +476,8 @@ static const struct file_operations amdgpu_debugfs_ring_fops = {
>  
>  #endif
>  
> -static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> -				    struct amdgpu_ring *ring)
> +int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> +			     struct amdgpu_ring *ring)
>  {
>  #if defined(CONFIG_DEBUG_FS)
>  	struct drm_minor *minor = adev->ddev->primary;
> @@ -507,7 +498,7 @@ static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>  	return 0;
>  }
>  
> -static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
> +void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
>  {
>  #if defined(CONFIG_DEBUG_FS)
>  	debugfs_remove(ring->ent);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> index 5134d0dd6dc2..0d098dafd23c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> @@ -329,4 +329,8 @@ static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring,
>  
>  int amdgpu_ring_test_helper(struct amdgpu_ring *ring);
>  
> +int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> +			     struct amdgpu_ring *ring);
> +void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
> +
>  #endif
> -- 
> 2.24.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 14/15] drm/amdgpu/ring: move debugfs init into core amdgpu debugfs
  2020-02-13  9:54   ` Daniel Vetter
@ 2020-02-13 10:17     ` Christian König
  2020-02-13 14:32       ` Alex Deucher
  0 siblings, 1 reply; 23+ messages in thread
From: Christian König @ 2020-02-13 10:17 UTC (permalink / raw)
  To: Daniel Vetter, Alex Deucher; +Cc: Alex Deucher, dri-devel, amd-gfx

Am 13.02.20 um 10:54 schrieb Daniel Vetter:
> On Fri, Feb 07, 2020 at 02:50:57PM -0500, Alex Deucher wrote:
>> In order to remove the load and unload drm callbacks,
>> we need to reorder the init sequence to move all the drm
>> debugfs file handling.  Do this for rings.
>>
>> Acked-by: Christian König <christian.koenig@amd.com>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 23 ++++++++++++++++++++-
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c    | 15 +++-----------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h    |  4 ++++
>>   3 files changed, 29 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>> index df3919ef886b..7379910790c9 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>> @@ -1218,7 +1218,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
>>   
>>   int amdgpu_debugfs_init(struct amdgpu_device *adev)
>>   {
>> -	int r;
>> +	int r, i;
>>   
>>   	adev->debugfs_preempt =
>>   		debugfs_create_file("amdgpu_preempt_ib", 0600,
>> @@ -1268,12 +1268,33 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
>>   	}
>>   #endif
>>   
>> +	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
>> +		struct amdgpu_ring *ring = adev->rings[i];
>> +
>> +		if (!ring)
>> +			continue;
>> +
>> +		if (amdgpu_debugfs_ring_init(adev, ring)) {
>> +			DRM_ERROR("Failed to register debugfs file for rings !\n");
>> +		}
>> +	}
>> +
>>   	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
>>   					ARRAY_SIZE(amdgpu_debugfs_list));
>>   }
>>   
>>   void amdgpu_debugfs_fini(struct amdgpu_device *adev)
> btw debugfs_fini shouldn't be needed anymore, Greg KH removed this all.
> drm core removes all debugfs files recusrively for you, there should be 0
> need for debugfs cleanup.

Oh, yes please. Removing that was on my TODO list for an eternity as well.

>
> Also at least my tree doesn't even have this, where does this apply to?

I would guess amd-staging-drm-next, but it might be that Alex is waiting 
for the next rebase to land.

Christian.

> -Daniel
>
>>   {
>> +	int i;
>> +
>> +	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
>> +		struct amdgpu_ring *ring = adev->rings[i];
>> +
>> +		if (!ring)
>> +			continue;
>> +
>> +		amdgpu_debugfs_ring_fini(ring);
>> +	}
>>   	amdgpu_ttm_debugfs_fini(adev);
>>   	debugfs_remove(adev->debugfs_preempt);
>>   }
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> index e5c83e164d82..539be138260e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>> @@ -48,9 +48,6 @@
>>    * wptr.  The GPU then starts fetching commands and executes
>>    * them until the pointers are equal again.
>>    */
>> -static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>> -				    struct amdgpu_ring *ring);
>> -static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
>>   
>>   /**
>>    * amdgpu_ring_alloc - allocate space on the ring buffer
>> @@ -334,10 +331,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
>>   	for (i = 0; i < DRM_SCHED_PRIORITY_MAX; ++i)
>>   		atomic_set(&ring->num_jobs[i], 0);
>>   
>> -	if (amdgpu_debugfs_ring_init(adev, ring)) {
>> -		DRM_ERROR("Failed to register debugfs file for rings !\n");
>> -	}
>> -
>>   	return 0;
>>   }
>>   
>> @@ -367,8 +360,6 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
>>   			      &ring->gpu_addr,
>>   			      (void **)&ring->ring);
>>   
>> -	amdgpu_debugfs_ring_fini(ring);
>> -
>>   	dma_fence_put(ring->vmid_wait);
>>   	ring->vmid_wait = NULL;
>>   	ring->me = 0;
>> @@ -485,8 +476,8 @@ static const struct file_operations amdgpu_debugfs_ring_fops = {
>>   
>>   #endif
>>   
>> -static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>> -				    struct amdgpu_ring *ring)
>> +int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>> +			     struct amdgpu_ring *ring)
>>   {
>>   #if defined(CONFIG_DEBUG_FS)
>>   	struct drm_minor *minor = adev->ddev->primary;
>> @@ -507,7 +498,7 @@ static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>>   	return 0;
>>   }
>>   
>> -static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
>> +void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
>>   {
>>   #if defined(CONFIG_DEBUG_FS)
>>   	debugfs_remove(ring->ent);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>> index 5134d0dd6dc2..0d098dafd23c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>> @@ -329,4 +329,8 @@ static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring,
>>   
>>   int amdgpu_ring_test_helper(struct amdgpu_ring *ring);
>>   
>> +int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>> +			     struct amdgpu_ring *ring);
>> +void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
>> +
>>   #endif
>> -- 
>> 2.24.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7C0fa2f611ed814861bf6908d7b06abf6a%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637171844839285121&amp;sdata=ey6I%2B8fjxpNeFT%2ByFEl3rNubbG4S%2F5hdSkRdX8%2BPJLk%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 14/15] drm/amdgpu/ring: move debugfs init into core amdgpu debugfs
  2020-02-13 10:17     ` Christian König
@ 2020-02-13 14:32       ` Alex Deucher
  2020-02-13 17:28         ` Christian König
  0 siblings, 1 reply; 23+ messages in thread
From: Alex Deucher @ 2020-02-13 14:32 UTC (permalink / raw)
  To: Christian König
  Cc: Alex Deucher, Maling list - DRI developers, amd-gfx list, Daniel Vetter

On Thu, Feb 13, 2020 at 5:17 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 13.02.20 um 10:54 schrieb Daniel Vetter:
> > On Fri, Feb 07, 2020 at 02:50:57PM -0500, Alex Deucher wrote:
> >> In order to remove the load and unload drm callbacks,
> >> we need to reorder the init sequence to move all the drm
> >> debugfs file handling.  Do this for rings.
> >>
> >> Acked-by: Christian König <christian.koenig@amd.com>
> >> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> >> ---
> >>   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 23 ++++++++++++++++++++-
> >>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c    | 15 +++-----------
> >>   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h    |  4 ++++
> >>   3 files changed, 29 insertions(+), 13 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> >> index df3919ef886b..7379910790c9 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> >> @@ -1218,7 +1218,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
> >>
> >>   int amdgpu_debugfs_init(struct amdgpu_device *adev)
> >>   {
> >> -    int r;
> >> +    int r, i;
> >>
> >>      adev->debugfs_preempt =
> >>              debugfs_create_file("amdgpu_preempt_ib", 0600,
> >> @@ -1268,12 +1268,33 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
> >>      }
> >>   #endif
> >>
> >> +    for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
> >> +            struct amdgpu_ring *ring = adev->rings[i];
> >> +
> >> +            if (!ring)
> >> +                    continue;
> >> +
> >> +            if (amdgpu_debugfs_ring_init(adev, ring)) {
> >> +                    DRM_ERROR("Failed to register debugfs file for rings !\n");
> >> +            }
> >> +    }
> >> +
> >>      return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
> >>                                      ARRAY_SIZE(amdgpu_debugfs_list));
> >>   }
> >>
> >>   void amdgpu_debugfs_fini(struct amdgpu_device *adev)
> > btw debugfs_fini shouldn't be needed anymore, Greg KH removed this all.
> > drm core removes all debugfs files recusrively for you, there should be 0
> > need for debugfs cleanup.
>
> Oh, yes please. Removing that was on my TODO list for an eternity as well.
>
> >
> > Also at least my tree doesn't even have this, where does this apply to?
>
> I would guess amd-staging-drm-next, but it might be that Alex is waiting
> for the next rebase to land.
>

Patches are against my drm-next branch which is based on fdo drm-next.
There are a number of files which the driver creates directly rather
than through drm.

Alex

> Christian.
>
> > -Daniel
> >
> >>   {
> >> +    int i;
> >> +
> >> +    for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
> >> +            struct amdgpu_ring *ring = adev->rings[i];
> >> +
> >> +            if (!ring)
> >> +                    continue;
> >> +
> >> +            amdgpu_debugfs_ring_fini(ring);
> >> +    }
> >>      amdgpu_ttm_debugfs_fini(adev);
> >>      debugfs_remove(adev->debugfs_preempt);
> >>   }
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> >> index e5c83e164d82..539be138260e 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> >> @@ -48,9 +48,6 @@
> >>    * wptr.  The GPU then starts fetching commands and executes
> >>    * them until the pointers are equal again.
> >>    */
> >> -static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> >> -                                struct amdgpu_ring *ring);
> >> -static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
> >>
> >>   /**
> >>    * amdgpu_ring_alloc - allocate space on the ring buffer
> >> @@ -334,10 +331,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
> >>      for (i = 0; i < DRM_SCHED_PRIORITY_MAX; ++i)
> >>              atomic_set(&ring->num_jobs[i], 0);
> >>
> >> -    if (amdgpu_debugfs_ring_init(adev, ring)) {
> >> -            DRM_ERROR("Failed to register debugfs file for rings !\n");
> >> -    }
> >> -
> >>      return 0;
> >>   }
> >>
> >> @@ -367,8 +360,6 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
> >>                            &ring->gpu_addr,
> >>                            (void **)&ring->ring);
> >>
> >> -    amdgpu_debugfs_ring_fini(ring);
> >> -
> >>      dma_fence_put(ring->vmid_wait);
> >>      ring->vmid_wait = NULL;
> >>      ring->me = 0;
> >> @@ -485,8 +476,8 @@ static const struct file_operations amdgpu_debugfs_ring_fops = {
> >>
> >>   #endif
> >>
> >> -static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> >> -                                struct amdgpu_ring *ring)
> >> +int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> >> +                         struct amdgpu_ring *ring)
> >>   {
> >>   #if defined(CONFIG_DEBUG_FS)
> >>      struct drm_minor *minor = adev->ddev->primary;
> >> @@ -507,7 +498,7 @@ static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> >>      return 0;
> >>   }
> >>
> >> -static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
> >> +void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
> >>   {
> >>   #if defined(CONFIG_DEBUG_FS)
> >>      debugfs_remove(ring->ent);
> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> >> index 5134d0dd6dc2..0d098dafd23c 100644
> >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> >> @@ -329,4 +329,8 @@ static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring,
> >>
> >>   int amdgpu_ring_test_helper(struct amdgpu_ring *ring);
> >>
> >> +int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> >> +                         struct amdgpu_ring *ring);
> >> +void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
> >> +
> >>   #endif
> >> --
> >> 2.24.1
> >>
> >> _______________________________________________
> >> dri-devel mailing list
> >> dri-devel@lists.freedesktop.org
> >> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7C0fa2f611ed814861bf6908d7b06abf6a%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637171844839285121&amp;sdata=ey6I%2B8fjxpNeFT%2ByFEl3rNubbG4S%2F5hdSkRdX8%2BPJLk%3D&amp;reserved=0
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 14/15] drm/amdgpu/ring: move debugfs init into core amdgpu debugfs
  2020-02-13 14:32       ` Alex Deucher
@ 2020-02-13 17:28         ` Christian König
  2020-02-13 17:32           ` Alex Deucher
  0 siblings, 1 reply; 23+ messages in thread
From: Christian König @ 2020-02-13 17:28 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Alex Deucher, Maling list - DRI developers, amd-gfx list, Daniel Vetter

Am 13.02.20 um 15:32 schrieb Alex Deucher:
> On Thu, Feb 13, 2020 at 5:17 AM Christian König
> <christian.koenig@amd.com> wrote:
>> Am 13.02.20 um 10:54 schrieb Daniel Vetter:
>>> On Fri, Feb 07, 2020 at 02:50:57PM -0500, Alex Deucher wrote:
>>>> In order to remove the load and unload drm callbacks,
>>>> we need to reorder the init sequence to move all the drm
>>>> debugfs file handling.  Do this for rings.
>>>>
>>>> Acked-by: Christian König <christian.koenig@amd.com>
>>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>>> ---
>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 23 ++++++++++++++++++++-
>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c    | 15 +++-----------
>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h    |  4 ++++
>>>>    3 files changed, 29 insertions(+), 13 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>>>> index df3919ef886b..7379910790c9 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>>>> @@ -1218,7 +1218,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
>>>>
>>>>    int amdgpu_debugfs_init(struct amdgpu_device *adev)
>>>>    {
>>>> -    int r;
>>>> +    int r, i;
>>>>
>>>>       adev->debugfs_preempt =
>>>>               debugfs_create_file("amdgpu_preempt_ib", 0600,
>>>> @@ -1268,12 +1268,33 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
>>>>       }
>>>>    #endif
>>>>
>>>> +    for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
>>>> +            struct amdgpu_ring *ring = adev->rings[i];
>>>> +
>>>> +            if (!ring)
>>>> +                    continue;
>>>> +
>>>> +            if (amdgpu_debugfs_ring_init(adev, ring)) {
>>>> +                    DRM_ERROR("Failed to register debugfs file for rings !\n");
>>>> +            }
>>>> +    }
>>>> +
>>>>       return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
>>>>                                       ARRAY_SIZE(amdgpu_debugfs_list));
>>>>    }
>>>>
>>>>    void amdgpu_debugfs_fini(struct amdgpu_device *adev)
>>> btw debugfs_fini shouldn't be needed anymore, Greg KH removed this all.
>>> drm core removes all debugfs files recusrively for you, there should be 0
>>> need for debugfs cleanup.
>> Oh, yes please. Removing that was on my TODO list for an eternity as well.
>>
>>> Also at least my tree doesn't even have this, where does this apply to?
>> I would guess amd-staging-drm-next, but it might be that Alex is waiting
>> for the next rebase to land.
>>
> Patches are against my drm-next branch which is based on fdo drm-next.
> There are a number of files which the driver creates directly rather
> than through drm.

The last time I locked it I was about to completely nuke creating 
anything through DRM and just create it directly.

As Daniel wrote we also don't have to remove anything explicitly, that 
is done implicitly when the whole directory is removed.

Christian.

>
> Alex
>
>> Christian.
>>
>>> -Daniel
>>>
>>>>    {
>>>> +    int i;
>>>> +
>>>> +    for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
>>>> +            struct amdgpu_ring *ring = adev->rings[i];
>>>> +
>>>> +            if (!ring)
>>>> +                    continue;
>>>> +
>>>> +            amdgpu_debugfs_ring_fini(ring);
>>>> +    }
>>>>       amdgpu_ttm_debugfs_fini(adev);
>>>>       debugfs_remove(adev->debugfs_preempt);
>>>>    }
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>>>> index e5c83e164d82..539be138260e 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>>>> @@ -48,9 +48,6 @@
>>>>     * wptr.  The GPU then starts fetching commands and executes
>>>>     * them until the pointers are equal again.
>>>>     */
>>>> -static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>>>> -                                struct amdgpu_ring *ring);
>>>> -static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
>>>>
>>>>    /**
>>>>     * amdgpu_ring_alloc - allocate space on the ring buffer
>>>> @@ -334,10 +331,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
>>>>       for (i = 0; i < DRM_SCHED_PRIORITY_MAX; ++i)
>>>>               atomic_set(&ring->num_jobs[i], 0);
>>>>
>>>> -    if (amdgpu_debugfs_ring_init(adev, ring)) {
>>>> -            DRM_ERROR("Failed to register debugfs file for rings !\n");
>>>> -    }
>>>> -
>>>>       return 0;
>>>>    }
>>>>
>>>> @@ -367,8 +360,6 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
>>>>                             &ring->gpu_addr,
>>>>                             (void **)&ring->ring);
>>>>
>>>> -    amdgpu_debugfs_ring_fini(ring);
>>>> -
>>>>       dma_fence_put(ring->vmid_wait);
>>>>       ring->vmid_wait = NULL;
>>>>       ring->me = 0;
>>>> @@ -485,8 +476,8 @@ static const struct file_operations amdgpu_debugfs_ring_fops = {
>>>>
>>>>    #endif
>>>>
>>>> -static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>>>> -                                struct amdgpu_ring *ring)
>>>> +int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>>>> +                         struct amdgpu_ring *ring)
>>>>    {
>>>>    #if defined(CONFIG_DEBUG_FS)
>>>>       struct drm_minor *minor = adev->ddev->primary;
>>>> @@ -507,7 +498,7 @@ static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>>>>       return 0;
>>>>    }
>>>>
>>>> -static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
>>>> +void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
>>>>    {
>>>>    #if defined(CONFIG_DEBUG_FS)
>>>>       debugfs_remove(ring->ent);
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>>>> index 5134d0dd6dc2..0d098dafd23c 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>>>> @@ -329,4 +329,8 @@ static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring,
>>>>
>>>>    int amdgpu_ring_test_helper(struct amdgpu_ring *ring);
>>>>
>>>> +int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>>>> +                         struct amdgpu_ring *ring);
>>>> +void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
>>>> +
>>>>    #endif
>>>> --
>>>> 2.24.1
>>>>
>>>> _______________________________________________
>>>> dri-devel mailing list
>>>> dri-devel@lists.freedesktop.org
>>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7C0647e5ecad344fb4d19208d7b09198d6%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637172011693912378&amp;sdata=dBwdfJW2nPzwPZJYklNexgu0NWT3vGSOgbO79SLQ%2B74%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 14/15] drm/amdgpu/ring: move debugfs init into core amdgpu debugfs
  2020-02-13 17:28         ` Christian König
@ 2020-02-13 17:32           ` Alex Deucher
  0 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-13 17:32 UTC (permalink / raw)
  To: Christian König
  Cc: Alex Deucher, Maling list - DRI developers, amd-gfx list, Daniel Vetter

On Thu, Feb 13, 2020 at 12:28 PM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 13.02.20 um 15:32 schrieb Alex Deucher:
> > On Thu, Feb 13, 2020 at 5:17 AM Christian König
> > <christian.koenig@amd.com> wrote:
> >> Am 13.02.20 um 10:54 schrieb Daniel Vetter:
> >>> On Fri, Feb 07, 2020 at 02:50:57PM -0500, Alex Deucher wrote:
> >>>> In order to remove the load and unload drm callbacks,
> >>>> we need to reorder the init sequence to move all the drm
> >>>> debugfs file handling.  Do this for rings.
> >>>>
> >>>> Acked-by: Christian König <christian.koenig@amd.com>
> >>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> >>>> ---
> >>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 23 ++++++++++++++++++++-
> >>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c    | 15 +++-----------
> >>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h    |  4 ++++
> >>>>    3 files changed, 29 insertions(+), 13 deletions(-)
> >>>>
> >>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> >>>> index df3919ef886b..7379910790c9 100644
> >>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> >>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> >>>> @@ -1218,7 +1218,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
> >>>>
> >>>>    int amdgpu_debugfs_init(struct amdgpu_device *adev)
> >>>>    {
> >>>> -    int r;
> >>>> +    int r, i;
> >>>>
> >>>>       adev->debugfs_preempt =
> >>>>               debugfs_create_file("amdgpu_preempt_ib", 0600,
> >>>> @@ -1268,12 +1268,33 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
> >>>>       }
> >>>>    #endif
> >>>>
> >>>> +    for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
> >>>> +            struct amdgpu_ring *ring = adev->rings[i];
> >>>> +
> >>>> +            if (!ring)
> >>>> +                    continue;
> >>>> +
> >>>> +            if (amdgpu_debugfs_ring_init(adev, ring)) {
> >>>> +                    DRM_ERROR("Failed to register debugfs file for rings !\n");
> >>>> +            }
> >>>> +    }
> >>>> +
> >>>>       return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
> >>>>                                       ARRAY_SIZE(amdgpu_debugfs_list));
> >>>>    }
> >>>>
> >>>>    void amdgpu_debugfs_fini(struct amdgpu_device *adev)
> >>> btw debugfs_fini shouldn't be needed anymore, Greg KH removed this all.
> >>> drm core removes all debugfs files recusrively for you, there should be 0
> >>> need for debugfs cleanup.
> >> Oh, yes please. Removing that was on my TODO list for an eternity as well.
> >>
> >>> Also at least my tree doesn't even have this, where does this apply to?
> >> I would guess amd-staging-drm-next, but it might be that Alex is waiting
> >> for the next rebase to land.
> >>
> > Patches are against my drm-next branch which is based on fdo drm-next.
> > There are a number of files which the driver creates directly rather
> > than through drm.
>
> The last time I locked it I was about to completely nuke creating
> anything through DRM and just create it directly.
>
> As Daniel wrote we also don't have to remove anything explicitly, that
> is done implicitly when the whole directory is removed.

I dunno.  Most of this stuff has been there for years.  Maybe someone
wants to take a look if it can be further cleaned up.  It builds fine
against current kernels.

Alex


>
> Christian.
>
> >
> > Alex
> >
> >> Christian.
> >>
> >>> -Daniel
> >>>
> >>>>    {
> >>>> +    int i;
> >>>> +
> >>>> +    for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
> >>>> +            struct amdgpu_ring *ring = adev->rings[i];
> >>>> +
> >>>> +            if (!ring)
> >>>> +                    continue;
> >>>> +
> >>>> +            amdgpu_debugfs_ring_fini(ring);
> >>>> +    }
> >>>>       amdgpu_ttm_debugfs_fini(adev);
> >>>>       debugfs_remove(adev->debugfs_preempt);
> >>>>    }
> >>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> >>>> index e5c83e164d82..539be138260e 100644
> >>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> >>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> >>>> @@ -48,9 +48,6 @@
> >>>>     * wptr.  The GPU then starts fetching commands and executes
> >>>>     * them until the pointers are equal again.
> >>>>     */
> >>>> -static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> >>>> -                                struct amdgpu_ring *ring);
> >>>> -static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
> >>>>
> >>>>    /**
> >>>>     * amdgpu_ring_alloc - allocate space on the ring buffer
> >>>> @@ -334,10 +331,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
> >>>>       for (i = 0; i < DRM_SCHED_PRIORITY_MAX; ++i)
> >>>>               atomic_set(&ring->num_jobs[i], 0);
> >>>>
> >>>> -    if (amdgpu_debugfs_ring_init(adev, ring)) {
> >>>> -            DRM_ERROR("Failed to register debugfs file for rings !\n");
> >>>> -    }
> >>>> -
> >>>>       return 0;
> >>>>    }
> >>>>
> >>>> @@ -367,8 +360,6 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
> >>>>                             &ring->gpu_addr,
> >>>>                             (void **)&ring->ring);
> >>>>
> >>>> -    amdgpu_debugfs_ring_fini(ring);
> >>>> -
> >>>>       dma_fence_put(ring->vmid_wait);
> >>>>       ring->vmid_wait = NULL;
> >>>>       ring->me = 0;
> >>>> @@ -485,8 +476,8 @@ static const struct file_operations amdgpu_debugfs_ring_fops = {
> >>>>
> >>>>    #endif
> >>>>
> >>>> -static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> >>>> -                                struct amdgpu_ring *ring)
> >>>> +int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> >>>> +                         struct amdgpu_ring *ring)
> >>>>    {
> >>>>    #if defined(CONFIG_DEBUG_FS)
> >>>>       struct drm_minor *minor = adev->ddev->primary;
> >>>> @@ -507,7 +498,7 @@ static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> >>>>       return 0;
> >>>>    }
> >>>>
> >>>> -static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
> >>>> +void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
> >>>>    {
> >>>>    #if defined(CONFIG_DEBUG_FS)
> >>>>       debugfs_remove(ring->ent);
> >>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> >>>> index 5134d0dd6dc2..0d098dafd23c 100644
> >>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> >>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> >>>> @@ -329,4 +329,8 @@ static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring,
> >>>>
> >>>>    int amdgpu_ring_test_helper(struct amdgpu_ring *ring);
> >>>>
> >>>> +int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
> >>>> +                         struct amdgpu_ring *ring);
> >>>> +void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
> >>>> +
> >>>>    #endif
> >>>> --
> >>>> 2.24.1
> >>>>
> >>>> _______________________________________________
> >>>> dri-devel mailing list
> >>>> dri-devel@lists.freedesktop.org
> >>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7C0647e5ecad344fb4d19208d7b09198d6%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637172011693912378&amp;sdata=dBwdfJW2nPzwPZJYklNexgu0NWT3vGSOgbO79SLQ%2B74%3D&amp;reserved=0
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 14/15] drm/amdgpu/ring: move debugfs init into core amdgpu debugfs
  2020-02-05 15:39 [PATCH 00/15] amdgpu: remove load and unload callbacks (v2) Alex Deucher
@ 2020-02-05 15:39 ` Alex Deucher
  0 siblings, 0 replies; 23+ messages in thread
From: Alex Deucher @ 2020-02-05 15:39 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Christian König

In order to remove the load and unload drm callbacks,
we need to reorder the init sequence to move all the drm
debugfs file handling.  Do this for rings.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 23 ++++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c    | 15 +++-----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h    |  4 ++++
 3 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 82d30bae2ba0..a7e6b5de2c62 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1218,7 +1218,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt, NULL,
 
 int amdgpu_debugfs_init(struct amdgpu_device *adev)
 {
-	int r;
+	int r, i;
 
 	adev->debugfs_preempt =
 		debugfs_create_file("amdgpu_preempt_ib", 0600,
@@ -1266,12 +1266,33 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 			DRM_ERROR("amdgpu: failed initialize dtn debugfs support.\n");
 	}
 
+	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
+		struct amdgpu_ring *ring = adev->rings[i];
+
+		if (!ring)
+			continue;
+
+		if (amdgpu_debugfs_ring_init(adev, ring)) {
+			DRM_ERROR("Failed to register debugfs file for rings !\n");
+		}
+	}
+
 	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
 					ARRAY_SIZE(amdgpu_debugfs_list));
 }
 
 void amdgpu_debugfs_fini(struct amdgpu_device *adev)
 {
+	int i;
+
+	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
+		struct amdgpu_ring *ring = adev->rings[i];
+
+		if (!ring)
+			continue;
+
+		amdgpu_debugfs_ring_fini(ring);
+	}
 	amdgpu_ttm_debugfs_fini(adev);
 	debugfs_remove(adev->debugfs_preempt);
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
index e5c83e164d82..539be138260e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
@@ -48,9 +48,6 @@
  * wptr.  The GPU then starts fetching commands and executes
  * them until the pointers are equal again.
  */
-static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
-				    struct amdgpu_ring *ring);
-static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
 
 /**
  * amdgpu_ring_alloc - allocate space on the ring buffer
@@ -334,10 +331,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
 	for (i = 0; i < DRM_SCHED_PRIORITY_MAX; ++i)
 		atomic_set(&ring->num_jobs[i], 0);
 
-	if (amdgpu_debugfs_ring_init(adev, ring)) {
-		DRM_ERROR("Failed to register debugfs file for rings !\n");
-	}
-
 	return 0;
 }
 
@@ -367,8 +360,6 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring)
 			      &ring->gpu_addr,
 			      (void **)&ring->ring);
 
-	amdgpu_debugfs_ring_fini(ring);
-
 	dma_fence_put(ring->vmid_wait);
 	ring->vmid_wait = NULL;
 	ring->me = 0;
@@ -485,8 +476,8 @@ static const struct file_operations amdgpu_debugfs_ring_fops = {
 
 #endif
 
-static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
-				    struct amdgpu_ring *ring)
+int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
+			     struct amdgpu_ring *ring)
 {
 #if defined(CONFIG_DEBUG_FS)
 	struct drm_minor *minor = adev->ddev->primary;
@@ -507,7 +498,7 @@ static int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
 	return 0;
 }
 
-static void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
+void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring)
 {
 #if defined(CONFIG_DEBUG_FS)
 	debugfs_remove(ring->ent);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
index 5134d0dd6dc2..0d098dafd23c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
@@ -329,4 +329,8 @@ static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring,
 
 int amdgpu_ring_test_helper(struct amdgpu_ring *ring);
 
+int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
+			     struct amdgpu_ring *ring);
+void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
+
 #endif
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, back to index

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07 19:50 [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Alex Deucher
2020-02-07 19:50 ` [PATCH 01/15] drm/amdgpu: rename amdgpu_debugfs_preempt_cleanup Alex Deucher
2020-02-07 19:50 ` [PATCH 02/15] drm/amdgpu/ttm: move debugfs init into core amdgpu debugfs Alex Deucher
2020-02-07 19:50 ` [PATCH 03/15] drm/amdgpu/pm: " Alex Deucher
2020-02-07 19:50 ` [PATCH 04/15] drm/amdgpu/sa: " Alex Deucher
2020-02-07 19:50 ` [PATCH 05/15] drm/amdgpu/fence: " Alex Deucher
2020-02-07 19:50 ` [PATCH 06/15] drm/amdgpu/gem: " Alex Deucher
2020-02-07 19:50 ` [PATCH 07/15] drm/amdgpu/regs: " Alex Deucher
2020-02-07 19:50 ` [PATCH 08/15] drm/amdgpu/firmware: " Alex Deucher
2020-02-07 19:50 ` [PATCH 09/15] drm/amdgpu: don't call drm_connector_register for non-MST ports Alex Deucher
2020-02-07 19:50 ` [PATCH 10/15] drm/amdgpu/display: move debugfs init into core amdgpu debugfs (v2) Alex Deucher
2020-02-07 19:50 ` [PATCH 11/15] drm/amd/display: move dpcd debugfs members setup Alex Deucher
2020-02-07 19:50 ` [PATCH 12/15] drm/amdgpu/display: add a late register connector callback Alex Deucher
2020-02-07 19:50 ` [PATCH 13/15] drm/amdgpu/display: split dp connector registration (v2) Alex Deucher
2020-02-07 19:50 ` [PATCH 14/15] drm/amdgpu/ring: move debugfs init into core amdgpu debugfs Alex Deucher
2020-02-13  9:54   ` Daniel Vetter
2020-02-13 10:17     ` Christian König
2020-02-13 14:32       ` Alex Deucher
2020-02-13 17:28         ` Christian König
2020-02-13 17:32           ` Alex Deucher
2020-02-07 19:50 ` [PATCH 15/15] drm/amdgpu: drop legacy drm load and unload callbacks Alex Deucher
2020-02-10 10:39 ` [PATCH 00/15] amdgpu: remove load and unload callbacks (v3) Thomas Zimmermann
  -- strict thread matches above, loose matches on Subject: below --
2020-02-05 15:39 [PATCH 00/15] amdgpu: remove load and unload callbacks (v2) Alex Deucher
2020-02-05 15:39 ` [PATCH 14/15] drm/amdgpu/ring: move debugfs init into core amdgpu debugfs Alex Deucher

AMD-GFX Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/amd-gfx/0 amd-gfx/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 amd-gfx amd-gfx/ https://lore.kernel.org/amd-gfx \
		amd-gfx@lists.freedesktop.org
	public-inbox-index amd-gfx

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.amd-gfx


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git