Skip to contentSkip to conversation

drm/amdgpu: Remove FW_LOAD_DIRECT type support on VI

PATCH Superseded Rex Zhu 2 participants 14 messages Sep 29, 2018 – Oct 3, 2018 8 messages not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/6 drm/amdgpu: Remove FW_LOAD_DIRECT type support on VI

AMDGPU_FW_LOAD_DIRECT is used for bring up. Now it don't work any more. so remove the support.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c |   3 -
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c     | 249 ++++++------------------------
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c    |  57 +------
 3 files changed, 56 insertions(+), 253 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +0 -3
index 1fa8bc3..fb2bdf3 100644
@@ -297,9 +297,6 @@ enum amdgpu_firmware_load_type
 	case CHIP_POLARIS11:
 	case CHIP_POLARIS12:
 	case CHIP_VEGAM:
-		if (!load_type)
-			return AMDGPU_FW_LOAD_DIRECT;
-		else
 			return AMDGPU_FW_LOAD_SMU;
 	case CHIP_VEGA10:
 	case CHIP_RAVEN:
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +49 -200

290 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +7 -50

75 lines not on this page · raw message

Signature · 6 lines
1.9.1

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

A message that is not in the archive (sent off-list or not yet received): 1538237713-3293-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/6 drm/amdgpu: Move gfx flag in_suspend to adev

Move in_suspend flag to adev from gfx, so
can be used in other ip blocks, also keep
consistent with gpu_in_reset flag.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h    |  3 +--
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c      | 13 +++----------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c      | 16 ++++------------
 5 files changed, 14 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
index 6583a68..7c44871 100644
@@ -1046,6 +1046,9 @@ struct amdgpu_device {
 	bool has_hw_reset;
 	u8				reset_magic[AMDGPU_RESET_MAGIC_NUM];
 
+	/* s3/s4 mask */
+	bool                            in_suspend;
+
 	/* record last mm index being written through WREG32*/
 	unsigned long last_mm_index;
 	bool                            in_gpu_reset;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
index a1d8d97..95095a8 100644
@@ -2649,6 +2649,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
 	if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
 		return 0;
 
+	adev->in_suspend = true;
 	drm_kms_helper_poll_disable(dev);
 
 	if (fbcon)
@@ -2834,6 +2835,8 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 #ifdef CONFIG_PM
 	dev->dev->power.disable_depth--;
 #endif
+	adev->in_suspend = false;
+
 	return 0;
 }
 
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +1 -2
index f172e92..b61b5c1 100644
@@ -297,8 +297,7 @@ struct amdgpu_gfx {
 	/* reset mask */
 	uint32_t                        grbm_soft_reset;
 	uint32_t                        srbm_soft_reset;
-	/* s3/s4 mask */
-	bool                            in_suspend;
+
 	/* NGG */
 	struct amdgpu_ngg		ngg;
 
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -10
index c63ede1..6b1954e 100644
@@ -4732,7 +4732,7 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
 	struct vi_mqd *mqd = ring->mqd_ptr;
 	int mqd_idx = ring - &adev->gfx.compute_ring[0];
 
-	if (!adev->in_gpu_reset && !adev->gfx.in_suspend) {
+	if (!adev->in_gpu_reset && !adev->in_suspend) {
 		memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation));
 		((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF;
 		((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF;
@@ -4991,19 +4991,12 @@ static int gfx_v8_0_hw_fini(void *handle)
 
 static int gfx_v8_0_suspend(void *handle)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	adev->gfx.in_suspend = true;
-	return gfx_v8_0_hw_fini(adev);
+	return gfx_v8_0_hw_fini(handle);
 }
 
 static int gfx_v8_0_resume(void *handle)
 {
-	int r;
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
-	r = gfx_v8_0_hw_init(adev);
-	adev->gfx.in_suspend = false;
-	return r;
+	return gfx_v8_0_hw_init(handle);
 }
 
 static bool gfx_v8_0_check_soft_reset(void *handle)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4 -12
index 7a6a814..4b020cc 100644
@@ -3198,7 +3198,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring)
 	struct v9_mqd *mqd = ring->mqd_ptr;
 	int mqd_idx = ring - &adev->gfx.compute_ring[0];
 
-	if (!adev->in_gpu_reset && !adev->gfx.in_suspend) {
+	if (!adev->in_gpu_reset && !adev->in_suspend) {
 		memset((void *)mqd, 0, sizeof(struct v9_mqd_allocation));
 		((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF;
 		((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF;
@@ -3417,7 +3417,7 @@ static int gfx_v9_0_hw_fini(void *handle)
 	/* Use deinitialize sequence from CAIL when unbinding device from driver,
 	 * otherwise KIQ is hanging when binding back
 	 */
-	if (!adev->in_gpu_reset && !adev->gfx.in_suspend) {
+	if (!adev->in_gpu_reset && !adev->in_suspend) {
 		mutex_lock(&adev->srbm_mutex);
 		soc15_grbm_select(adev, adev->gfx.kiq.ring.me,
 				adev->gfx.kiq.ring.pipe,
@@ -3437,20 +3437,12 @@ static int gfx_v9_0_hw_fini(void *handle)
 
 static int gfx_v9_0_suspend(void *handle)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
-	adev->gfx.in_suspend = true;
-	return gfx_v9_0_hw_fini(adev);
+	return gfx_v9_0_hw_fini(handle);
 }
 
 static int gfx_v9_0_resume(void *handle)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	int r;
-
-	r = gfx_v9_0_hw_init(adev);
-	adev->gfx.in_suspend = false;
-	return r;
+	return gfx_v9_0_hw_init(handle);
 }
 
 static bool gfx_v9_0_is_idle(void *handle)
Signature · 6 lines
1.9.1

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

A message that is not in the archive (sent off-list or not yet received): 1538237713-3293-2-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by Evan Quan
#4 lore raw

RE: [PATCH 2/6] drm/amdgpu: Move gfx flag in_suspend to adev

Quoted 162 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Rex Zhu
Sent: 2018年9月30日 0:15
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH 2/6] drm/amdgpu: Move gfx flag in_suspend to adev

Move in_suspend flag to adev from gfx, so can be used in other ip blocks, also keep consistent with gpu_in_reset flag.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h    |  3 +--
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c      | 13 +++----------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c      | 16 ++++------------
 5 files changed, 14 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
index 6583a68..7c44871 100644
@@ -1046,6 +1046,9 @@ struct amdgpu_device {
 	bool has_hw_reset;
 	u8
 	reset_magic[AMDGPU_RESET_MAGIC_NUM];
 
+	/* s3/s4 mask */
+	bool                            in_suspend;
+
 	/* record last mm index being written through WREG32*/
 	unsigned long last_mm_index;
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
 	bool                            in_gpu_reset;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index a1d8d97..95095a8 100644
@@ -2649,6 +2649,7 @@ int amdgpu_device_suspend(struct drm_device
 *dev, bool suspend, bool fbcon)
 	if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
 		return 0;
 
+	adev->in_suspend = true;
 	drm_kms_helper_poll_disable(dev);
 
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
 	if (fbcon)
@@ -2834,6 +2835,8 @@ int amdgpu_device_resume(struct drm_device
 *dev, bool resume, bool fbcon)  #ifdef CONFIG_PM
 	dev->dev->power.disable_depth--;
 #endif
+	adev->in_suspend = false;
+
 	return 0;
 }
 
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +1 -2
index f172e92..b61b5c1 100644
@@ -297,8 +297,7 @@ struct amdgpu_gfx {
 	/* reset mask */
 	uint32_t                        grbm_soft_reset;
 	uint32_t                        srbm_soft_reset;
-	/* s3/s4 mask */
-	bool                            in_suspend;
+
 	/* NGG */
 	struct amdgpu_ngg		ngg;
 
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -1
index c63ede1..6b1954e 100644
@@ -4732,7 +4732,7 @@ static int gfx_v8_0_kcq_init_queue(struct
 amdgpu_ring *ring)
 	struct vi_mqd *mqd = ring->mqd_ptr;
 	int mqd_idx = ring - &adev->gfx.compute_ring[0];
 
-	if (!adev->in_gpu_reset && !adev->gfx.in_suspend) {
+	if (!adev->in_gpu_reset && !adev->in_suspend) {
 		memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation));
 		((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask =

0xFFFFFFFF;
((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask =
0xFFFFFFFF; @@ -4991,19 +4991,12 @@ static int gfx_v8_0_hw_fini(void *handle)

static int gfx_v8_0_suspend(void *handle) {

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -9
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	adev->gfx.in_suspend = true;
-	return gfx_v8_0_hw_fini(adev);
+	return gfx_v8_0_hw_fini(handle);
 }
 
 static int gfx_v8_0_resume(void *handle)  {
-	int r;
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
-	r = gfx_v8_0_hw_init(adev);
-	adev->gfx.in_suspend = false;
-	return r;
+	return gfx_v8_0_hw_init(handle);
 }
 
 static bool gfx_v8_0_check_soft_reset(void *handle) diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 7a6a814..4b020cc 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
@@ -3198,7 +3198,7 @@ static int gfx_v9_0_kcq_init_queue(struct
 amdgpu_ring *ring)
 	struct v9_mqd *mqd = ring->mqd_ptr;
 	int mqd_idx = ring - &adev->gfx.compute_ring[0];
 
-	if (!adev->in_gpu_reset && !adev->gfx.in_suspend) {
+	if (!adev->in_gpu_reset && !adev->in_suspend) {
 		memset((void *)mqd, 0, sizeof(struct v9_mqd_allocation));
 		((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask =

0xFFFFFFFF;
((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask =
0xFFFFFFFF; @@ -3417,7 +3417,7 @@ static int gfx_v9_0_hw_fini(void *handle)
/* Use deinitialize sequence from CAIL when unbinding device from
driver,

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -12
 	 * otherwise KIQ is hanging when binding back
 	 */
-	if (!adev->in_gpu_reset && !adev->gfx.in_suspend) {
+	if (!adev->in_gpu_reset && !adev->in_suspend) {
 		mutex_lock(&adev->srbm_mutex);
 		soc15_grbm_select(adev, adev->gfx.kiq.ring.me,
 				adev->gfx.kiq.ring.pipe,
@@ -3437,20 +3437,12 @@ static int gfx_v9_0_hw_fini(void *handle)
 
 static int gfx_v9_0_suspend(void *handle)  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
-	adev->gfx.in_suspend = true;
-	return gfx_v9_0_hw_fini(adev);
+	return gfx_v9_0_hw_fini(handle);
 }
 
 static int gfx_v9_0_resume(void *handle)  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-	int r;
-
-	r = gfx_v9_0_hw_init(adev);
-	adev->gfx.in_suspend = false;
-	return r;
+	return gfx_v9_0_hw_init(handle);
 }
 
 static bool gfx_v9_0_is_idle(void *handle)
--

1.9.1

Quoted 4 lines

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

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

author
#5 lore raw

PATCH 3/6 drm/amdgpu: Fix cg/pg unexpected disabled when hw init failed

In reply to a message not in the archive

Check the ip blocks late_initialized state before enable/disable cg/pg, so if hw init failed, cg/pg function will not be executed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -4
index 95095a8..94c92f5 100644
@@ -1656,7 +1656,7 @@ static int amdgpu_device_set_cg_state(struct amdgpu_device *adev,
 
 	for (j = 0; j < adev->num_ip_blocks; j++) {
 		i = state == AMD_CG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;
-		if (!adev->ip_blocks[i].status.valid)
+		if (!adev->ip_blocks[i].status.late_initialized)
 			continue;
 		/* skip CG for VCE/UVD, it's handled specially */
 		if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD &&
@@ -1686,7 +1686,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
 
 	for (j = 0; j < adev->num_ip_blocks; j++) {
 		i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;
-		if (!adev->ip_blocks[i].status.valid)
+		if (!adev->ip_blocks[i].status.late_initialized)
 			continue;
 		/* skip CG for VCE/UVD, it's handled specially */
 		if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD &&
@@ -1723,7 +1723,7 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)
 	int i = 0, r;
 
 	for (i = 0; i < adev->num_ip_blocks; i++) {
-		if (!adev->ip_blocks[i].status.valid)
+		if (!adev->ip_blocks[i].status.hw)
 			continue;
 		if (adev->ip_blocks[i].version->funcs->late_init) {
 			r = adev->ip_blocks[i].version->funcs->late_init((void *)adev);
@@ -1732,8 +1732,8 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)
 					  adev->ip_blocks[i].version->funcs->name, r);
 				return r;
 			}
-			adev->ip_blocks[i].status.late_initialized = true;
 		}
+		adev->ip_blocks[i].status.late_initialized = true;
 	}
 
 	amdgpu_device_set_cg_state(adev, AMD_CG_STATE_GATE);
Signature · 6 lines
1.9.1

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

A message that is not in the archive (sent off-list or not yet received): 1538237713-3293-3-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#7 lore raw

RE: [PATCH 3/6] drm/amdgpu: Fix cg/pg unexpected disabled when hw init failed

Comment inline

Quoted 47 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Rex Zhu
Sent: 2018年9月30日 0:15
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH 3/6] drm/amdgpu: Fix cg/pg unexpected disabled when hw init failed

Check the ip blocks late_initialized state before enable/disable cg/pg, so if hw init failed, cg/pg function will not be executed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index 95095a8..94c92f5 100644
@@ -1656,7 +1656,7 @@ static int amdgpu_device_set_cg_state(struct
 amdgpu_device *adev,
 
 	for (j = 0; j < adev->num_ip_blocks; j++) {
 		i = state == AMD_CG_STATE_GATE ? j : adev-
 >num_ip_blocks - j - 1;
-		if (!adev->ip_blocks[i].status.valid)
+		if (!adev->ip_blocks[i].status.late_initialized)
 			continue;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
 		/* skip CG for VCE/UVD, it's handled specially */
 		if (adev->ip_blocks[i].version->type !=

AMD_IP_BLOCK_TYPE_UVD && @@ -1686,7 +1686,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
 	for (j = 0; j < adev->num_ip_blocks; j++) {
 		i = state == AMD_PG_STATE_GATE ? j : adev-
Quoted 1 line

num_ip_blocks - j - 1;

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
-		if (!adev->ip_blocks[i].status.valid)
+		if (!adev->ip_blocks[i].status.late_initialized)
 			continue;
 		/* skip CG for VCE/UVD, it's handled specially */
 		if (adev->ip_blocks[i].version->type !=

AMD_IP_BLOCK_TYPE_UVD && @@ -1723,7 +1723,7 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_ip_late_init(struct amdgpu_device *adev) · line 1726

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
 	int i = 0, r;
 
 	for (i = 0; i < adev->num_ip_blocks; i++) {
-		if (!adev->ip_blocks[i].status.valid)
+		if (!adev->ip_blocks[i].status.hw)

[Quan, Evan] typo?

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
 			continue;
 		if (adev->ip_blocks[i].version->funcs->late_init) {
 			r = adev->ip_blocks[i].version->funcs->late_init((void

*)adev); @@ -1732,8 +1732,8 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)
adev->ip_blocks[i].version->funcs-

Quoted 1 line

name, r);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -2
 				return r;
 			}
-			adev->ip_blocks[i].status.late_initialized = true;
 		}
+		adev->ip_blocks[i].status.late_initialized = true;
 	}
 
 	amdgpu_device_set_cg_state(adev, AMD_CG_STATE_GATE);
--

1.9.1

Quoted 4 lines

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

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

A message that is not in the archive (sent off-list or not yet received): SN6PR12MB2656030961A518FF1E9EA8F1E4EE0-kxOKjb6HO/FeL/[email protected]

author
#9 lore raw

RE: [PATCH 3/6] drm/amdgpu: Fix cg/pg unexpected disabled when hw init failed

Quoted 58 lines

-----Original Message-----
From: Quan, Evan
Sent: Sunday, September 30, 2018 11:03 AM
To: Zhu, Rex <[email protected]>; [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: RE: [PATCH 3/6] drm/amdgpu: Fix cg/pg unexpected disabled when hw init failed

Comment inline

Quoted 31 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Rex Zhu
Sent: 2018年9月30日 0:15
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH 3/6] drm/amdgpu: Fix cg/pg unexpected disabled when hw init failed

Check the ip blocks late_initialized state before enable/disable cg/pg, so if hw init failed, cg/pg function will not be executed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index 95095a8..94c92f5 100644
@@ -1656,7 +1656,7 @@ static int amdgpu_device_set_cg_state(struct
 amdgpu_device *adev,
 
 	for (j = 0; j < adev->num_ip_blocks; j++) {
 		i = state == AMD_CG_STATE_GATE ? j : adev-
 >num_ip_blocks - j - 1;
-		if (!adev->ip_blocks[i].status.valid)
+		if (!adev->ip_blocks[i].status.late_initialized)
 			continue;

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
 		/* skip CG for VCE/UVD, it's handled specially */
 		if (adev->ip_blocks[i].version->type !=

AMD_IP_BLOCK_TYPE_UVD && @@

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_set_cg_state(struct amdgpu_device *adev,

Quoted 11 lines

-1686,7 +1686,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
 	for (j = 0; j < adev->num_ip_blocks; j++) {
 		i = state == AMD_PG_STATE_GATE ? j : adev-
Quoted 1 line

num_ip_blocks - j - 1;

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
-		if (!adev->ip_blocks[i].status.valid)
+		if (!adev->ip_blocks[i].status.late_initialized)
 			continue;
 		/* skip CG for VCE/UVD, it's handled specially */
 		if (adev->ip_blocks[i].version->type !=

AMD_IP_BLOCK_TYPE_UVD && @@

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_ip_late_init(struct amdgpu_device *adev) · line 1726

Quoted 7 lines

-1723,7 +1723,7 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
 	int i = 0, r;
 
 	for (i = 0; i < adev->num_ip_blocks; i++) {
-		if (!adev->ip_blocks[i].status.valid)
+		if (!adev->ip_blocks[i].status.hw)

[Quan, Evan] typo?

No, In late_init, we check the hw_init status.

Rex

Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
 			continue;
 		if (adev->ip_blocks[i].version->funcs->late_init) {
 			r = adev->ip_blocks[i].version->funcs->late_init((void

*)adev); @@ -1732,8 +1732,8 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)
adev->ip_blocks[i].version->funcs-

Quoted 1 line

name, r);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
 				return r;
 			}
-			adev->ip_blocks[i].status.late_initialized = true;
 		}
+		adev->ip_blocks[i].status.late_initialized = true;
 	}
Quoted 8 lines
Quoted 8 lines

amdgpu_device_set_cg_state(adev, AMD_CG_STATE_GATE);
--
1.9.1

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

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

author
#10 lore raw

PATCH 4/6 drm/amdgpu: Don't allocate memory for ucode when suspend

In reply to a message not in the archive

driver don't release the ucode memory when suspend. so don't need to allocate bo when resume back.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +1 -1
index fb2bdf3..e7dafa1 100644
@@ -432,7 +432,7 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev)
 		return 0;
 	}
 
-	if (!adev->in_gpu_reset) {
+	if (!adev->in_gpu_reset && !adev->in_suspend) {
 		err = amdgpu_bo_create_kernel(adev, adev->firmware.fw_size, PAGE_SIZE,
 					amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
 					&adev->firmware.fw_buf,
Signature · 6 lines
1.9.1

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

A message that is not in the archive (sent off-list or not yet received): 1538237713-3293-4-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#12 lore raw

RE: [PATCH 4/6] drm/amdgpu: Don't allocate memory for ucode when suspend

The patch is fine. But i can not see where amdgpu_ucode_init_bo is called on resume.

Regards,
Evan

Quoted 37 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Rex Zhu
Sent: 2018年9月30日 0:15
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH 4/6] drm/amdgpu: Don't allocate memory for ucode when suspend

driver don't release the ucode memory when suspend. so don't need to allocate bo when resume back.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +1 -1
index fb2bdf3..e7dafa1 100644
@@ -432,7 +432,7 @@ int amdgpu_ucode_init_bo(struct amdgpu_device
 *adev)
 		return 0;
 	}
 
-	if (!adev->in_gpu_reset) {
+	if (!adev->in_gpu_reset && !adev->in_suspend) {
 		err = amdgpu_bo_create_kernel(adev, adev-
 >firmware.fw_size, PAGE_SIZE,

amdgpu_sriov_vf(adev) ?
AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
&adev->firmware.fw_buf,
--
1.9.1

Quoted 4 lines

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

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

author
#13 lore raw

PATCH 5/6 drm/amd/pp: Fix memory leak on Si/CI/AI dgpu asics

In reply to a message not in the archive

On SI/CI/AI, driver still need to release smu's fw, it was not related to other hw ip's fw load_type.

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +4 -4
index 5008d2e..d3eaf5d 100644
@@ -109,11 +109,11 @@ static int pp_sw_fini(void *handle)
 
 	hwmgr_sw_fini(hwmgr);
 
-	if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU) {
-		release_firmware(adev->pm.fw);
-		adev->pm.fw = NULL;
+	if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU)
 		amdgpu_ucode_fini_bo(adev);
-	}
+
+	release_firmware(adev->pm.fw);
+	adev->pm.fw = NULL;
 
 	return 0;
 }
Signature · 6 lines
1.9.1

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

A message that is not in the archive (sent off-list or not yet received): 1538237713-3293-5-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by Evan Quan
#15 lore raw

RE: [PATCH 5/6] drm/amd/pp: Fix memory leak on Si/CI/AI dgpu asics

Quoted 40 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Rex Zhu
Sent: 2018年9月30日 0:15
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH 5/6] drm/amd/pp: Fix memory leak on Si/CI/AI dgpu asics

On SI/CI/AI, driver still need to release smu's fw, it was not related to other hw ip's fw load_type.

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +4 -5
index 5008d2e..d3eaf5d 100644
@@ -109,11 +109,11 @@ static int pp_sw_fini(void *handle)
 
 	hwmgr_sw_fini(hwmgr);
 
-	if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU) {
-		release_firmware(adev->pm.fw);
-		adev->pm.fw = NULL;
+	if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU)
 		amdgpu_ucode_fini_bo(adev);
-	}
+
+	release_firmware(adev->pm.fw);
+	adev->pm.fw = NULL;
 
 	return 0;
 }
--

1.9.1

Quoted 4 lines

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

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

author
#16 lore raw

PATCH 6/6 drm/amdgpu: Drop dead define in amdgpu.h

In reply to a message not in the archive

the struct was not in use any more.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 28 ----------------------------
 1 file changed, 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -28
index 7c44871..c21d9b9 100644
@@ -616,31 +616,6 @@ struct amdgpu_wb {
  */
 void amdgpu_test_moves(struct amdgpu_device *adev);
 
-
-/*
- * amdgpu smumgr functions
- */
-struct amdgpu_smumgr_funcs {
-	int (*check_fw_load_finish)(struct amdgpu_device *adev, uint32_t fwtype);
-	int (*request_smu_load_fw)(struct amdgpu_device *adev);
-	int (*request_smu_specific_fw)(struct amdgpu_device *adev, uint32_t fwtype);
-};
-
-/*
- * amdgpu smumgr
- */
-struct amdgpu_smumgr {
-	struct amdgpu_bo *toc_buf;
-	struct amdgpu_bo *smu_buf;
-	/* asic priv smu data */
-	void *priv;
-	spinlock_t smu_lock;
-	/* smumgr functions */
-	const struct amdgpu_smumgr_funcs *smumgr_funcs;
-	/* ucode loading complete flag */
-	uint32_t fw_flags;
-};
-
 /*
  * ASIC specific register table accessible by UMD
  */
@@ -979,9 +954,6 @@ struct amdgpu_device {
 	u32				cg_flags;
 	u32				pg_flags;
 
-	/* amdgpu smumgr */
-	struct amdgpu_smumgr smu;
-
 	/* gfx */
 	struct amdgpu_gfx		gfx;
 
Signature · 6 lines
1.9.1

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

A message that is not in the archive (sent off-list or not yet received): 1538237713-3293-6-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by Evan Quan
#18 lore raw

RE: [PATCH 6/6] drm/amdgpu: Drop dead define in amdgpu.h

Quoted 67 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Rex Zhu
Sent: 2018年9月30日 0:15
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH 6/6] drm/amdgpu: Drop dead define in amdgpu.h

the struct was not in use any more.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 28 ----------------------------
 1 file changed, 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -25
index 7c44871..c21d9b9 100644
@@ -616,31 +616,6 @@ struct amdgpu_wb {
  */
 void amdgpu_test_moves(struct amdgpu_device *adev);
 
-
-/*
- * amdgpu smumgr functions
- */
-struct amdgpu_smumgr_funcs {
-	int (*check_fw_load_finish)(struct amdgpu_device *adev, uint32_t
 fwtype);
-	int (*request_smu_load_fw)(struct amdgpu_device *adev);
-	int (*request_smu_specific_fw)(struct amdgpu_device *adev,
 uint32_t fwtype);
-};
-
-/*
- * amdgpu smumgr
- */
-struct amdgpu_smumgr {
-	struct amdgpu_bo *toc_buf;
-	struct amdgpu_bo *smu_buf;
-	/* asic priv smu data */
-	void *priv;
-	spinlock_t smu_lock;
-	/* smumgr functions */
-	const struct amdgpu_smumgr_funcs *smumgr_funcs;
-	/* ucode loading complete flag */
-	uint32_t fw_flags;
-};
-
 /*

* ASIC specific register table accessible by UMD */

drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -4
@@ -979,9 +954,6 @@ struct amdgpu_device {
 	u32				cg_flags;
 	u32				pg_flags;
 
-	/* amdgpu smumgr */
-	struct amdgpu_smumgr smu;
-
 	/* gfx */
 	struct amdgpu_gfx		gfx;
 
--

1.9.1

Quoted 4 lines

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

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

#19 lore raw
In reply to a message not in the archive

Instead of change the fw load type to AMDGPU_FW_LOAD_SMU silently, it's better to warn/error out if user specify FW_LOAD_DIRECT load type.

Regards,
Evan

Quoted 476 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Rex Zhu
Sent: 2018年9月30日 0:15
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH 1/6] drm/amdgpu: Remove FW_LOAD_DIRECT type support on VI

AMDGPU_FW_LOAD_DIRECT is used for bring up. Now it don't work any more. so remove the support.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c |   3 -
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c     | 249 ++++++---------------------
---
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c    |  57 +------
 3 files changed, 56 insertions(+), 253 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +0 -3
index 1fa8bc3..fb2bdf3 100644
@@ -297,9 +297,6 @@ enum amdgpu_firmware_load_type
 	case CHIP_POLARIS11:
 	case CHIP_POLARIS12:
 	case CHIP_VEGAM:
-		if (!load_type)
-			return AMDGPU_FW_LOAD_DIRECT;
-		else
 			return AMDGPU_FW_LOAD_SMU;
 	case CHIP_VEGA10:
 	case CHIP_RAVEN:
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +41 -25
index 2aeef2b..c63ede1 100644
@@ -1173,64 +1173,61 @@ static int gfx_v8_0_init_microcode(struct
 amdgpu_device *adev)
 		}
 	}
 
-	if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU) {
-		info = &adev-
 >firmware.ucode[AMDGPU_UCODE_ID_CP_PFP];
-		info->ucode_id = AMDGPU_UCODE_ID_CP_PFP;
-		info->fw = adev->gfx.pfp_fw;
-		header = (const struct common_firmware_header *)info-
 >fw->data;
-		adev->firmware.fw_size +=
-			ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
-
-		info = &adev-
 >firmware.ucode[AMDGPU_UCODE_ID_CP_ME];
-		info->ucode_id = AMDGPU_UCODE_ID_CP_ME;
-		info->fw = adev->gfx.me_fw;
-		header = (const struct common_firmware_header *)info-
 >fw->data;
-		adev->firmware.fw_size +=
-			ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
-
-		info = &adev-
 >firmware.ucode[AMDGPU_UCODE_ID_CP_CE];
-		info->ucode_id = AMDGPU_UCODE_ID_CP_CE;
-		info->fw = adev->gfx.ce_fw;
-		header = (const struct common_firmware_header *)info-
 >fw->data;
-		adev->firmware.fw_size +=
-			ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
+	info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_PFP];
+	info->ucode_id = AMDGPU_UCODE_ID_CP_PFP;
+	info->fw = adev->gfx.pfp_fw;
+	header = (const struct common_firmware_header *)info->fw->data;
+	adev->firmware.fw_size +=
+		ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
+
+	info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_ME];
+	info->ucode_id = AMDGPU_UCODE_ID_CP_ME;
+	info->fw = adev->gfx.me_fw;
+	header = (const struct common_firmware_header *)info->fw->data;
+	adev->firmware.fw_size +=
+		ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
+
+	info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_CE];
+	info->ucode_id = AMDGPU_UCODE_ID_CP_CE;
+	info->fw = adev->gfx.ce_fw;
+	header = (const struct common_firmware_header *)info->fw->data;
+	adev->firmware.fw_size +=
+		ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
+
+	info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_G];
+	info->ucode_id = AMDGPU_UCODE_ID_RLC_G;
+	info->fw = adev->gfx.rlc_fw;
+	header = (const struct common_firmware_header *)info->fw->data;
+	adev->firmware.fw_size +=
+		ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
+
+	info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC1];
+	info->ucode_id = AMDGPU_UCODE_ID_CP_MEC1;
+	info->fw = adev->gfx.mec_fw;
+	header = (const struct common_firmware_header *)info->fw->data;
+	adev->firmware.fw_size +=
+		ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
+
+	/* we need account JT in */
+	cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev-
 >gfx.mec_fw->data;
+	adev->firmware.fw_size +=
+		ALIGN(le32_to_cpu(cp_hdr->jt_size) << 2, PAGE_SIZE);
 
-		info = &adev-
 >firmware.ucode[AMDGPU_UCODE_ID_RLC_G];
-		info->ucode_id = AMDGPU_UCODE_ID_RLC_G;
-		info->fw = adev->gfx.rlc_fw;
-		header = (const struct common_firmware_header *)info-
 >fw->data;
+	if (amdgpu_sriov_vf(adev)) {
+		info = &adev-
Quoted 1 line

firmware.ucode[AMDGPU_UCODE_ID_STORAGE];

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -1
+		info->ucode_id = AMDGPU_UCODE_ID_STORAGE;
+		info->fw = adev->gfx.mec_fw;
 		adev->firmware.fw_size +=
-			ALIGN(le32_to_cpu(header->ucode_size_bytes),

PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -1
+			ALIGN(le32_to_cpu(64 * PAGE_SIZE), PAGE_SIZE);
+	}
 
-		info = &adev-
Quoted 1 line

firmware.ucode[AMDGPU_UCODE_ID_CP_MEC1];

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
-		info->ucode_id = AMDGPU_UCODE_ID_CP_MEC1;
-		info->fw = adev->gfx.mec_fw;
+	if (adev->gfx.mec2_fw) {
+		info = &adev-
Quoted 1 line

firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2];

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+		info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
+		info->fw = adev->gfx.mec2_fw;
 		header = (const struct common_firmware_header *)info-
Quoted 1 line

fw->data;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
 		adev->firmware.fw_size +=
 			ALIGN(le32_to_cpu(header->ucode_size_bytes),

PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -3
-
-		/* we need account JT in */
-		cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev-
Quoted 1 line

gfx.mec_fw->data;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
-		adev->firmware.fw_size +=
-			ALIGN(le32_to_cpu(cp_hdr->jt_size) << 2,

PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -3
-
-		if (amdgpu_sriov_vf(adev)) {
-			info = &adev-
Quoted 1 line

firmware.ucode[AMDGPU_UCODE_ID_STORAGE];

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -4
-			info->ucode_id = AMDGPU_UCODE_ID_STORAGE;
-			info->fw = adev->gfx.mec_fw;
-			adev->firmware.fw_size +=
-				ALIGN(le32_to_cpu(64 * PAGE_SIZE),

PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -4
-		}
-
-		if (adev->gfx.mec2_fw) {
-			info = &adev-
Quoted 1 line

firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2];

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -3
-			info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
-			info->fw = adev->gfx.mec2_fw;
-			header = (const struct common_firmware_header

*)info->fw->data;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
-			adev->firmware.fw_size +=
-				ALIGN(le32_to_cpu(header-
Quoted 1 line

ucode_size_bytes), PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -86
-		}
-
 	}
 
 out:
@@ -4181,45 +4178,11 @@ static void gfx_v8_0_rlc_start(struct
 amdgpu_device *adev)
 	udelay(50);
 }
 
-static int gfx_v8_0_rlc_load_microcode(struct amdgpu_device *adev) -{
-	const struct rlc_firmware_header_v2_0 *hdr;
-	const __le32 *fw_data;
-	unsigned i, fw_size;
-
-	if (!adev->gfx.rlc_fw)
-		return -EINVAL;
-
-	hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw-
 >data;
-	amdgpu_ucode_print_rlc_hdr(&hdr->header);
-
-	fw_data = (const __le32 *)(adev->gfx.rlc_fw->data +
-			   le32_to_cpu(hdr-
 >header.ucode_array_offset_bytes));
-	fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4;
-
-	WREG32(mmRLC_GPM_UCODE_ADDR, 0);
-	for (i = 0; i < fw_size; i++)
-		WREG32(mmRLC_GPM_UCODE_DATA,
 le32_to_cpup(fw_data++));
-	WREG32(mmRLC_GPM_UCODE_ADDR, adev->gfx.rlc_fw_version);
-
-	return 0;
-}
-
 static int gfx_v8_0_rlc_resume(struct amdgpu_device *adev)  {
-	int r;
-
 	gfx_v8_0_rlc_stop(adev);
 	gfx_v8_0_rlc_reset(adev);
 	gfx_v8_0_init_pg(adev);
-
-	if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
-		/* legacy rlc firmware loading */
-		r = gfx_v8_0_rlc_load_microcode(adev);
-		if (r)
-			return r;
-	}
-
 	gfx_v8_0_rlc_start(adev);
 
 	return 0;
@@ -4245,63 +4208,6 @@ static void gfx_v8_0_cp_gfx_enable(struct
 amdgpu_device *adev, bool enable)
 	udelay(50);
 }
 
-static int gfx_v8_0_cp_gfx_load_microcode(struct amdgpu_device *adev) -{
-	const struct gfx_firmware_header_v1_0 *pfp_hdr;
-	const struct gfx_firmware_header_v1_0 *ce_hdr;
-	const struct gfx_firmware_header_v1_0 *me_hdr;
-	const __le32 *fw_data;
-	unsigned i, fw_size;
-
-	if (!adev->gfx.me_fw || !adev->gfx.pfp_fw || !adev->gfx.ce_fw)
-		return -EINVAL;
-
-	pfp_hdr = (const struct gfx_firmware_header_v1_0 *)
-		adev->gfx.pfp_fw->data;
-	ce_hdr = (const struct gfx_firmware_header_v1_0 *)
-		adev->gfx.ce_fw->data;
-	me_hdr = (const struct gfx_firmware_header_v1_0 *)
-		adev->gfx.me_fw->data;
-
-	amdgpu_ucode_print_gfx_hdr(&pfp_hdr->header);
-	amdgpu_ucode_print_gfx_hdr(&ce_hdr->header);
-	amdgpu_ucode_print_gfx_hdr(&me_hdr->header);
-
-	gfx_v8_0_cp_gfx_enable(adev, false);
-
-	/* PFP */
-	fw_data = (const __le32 *)
-		(adev->gfx.pfp_fw->data +
-		 le32_to_cpu(pfp_hdr->header.ucode_array_offset_bytes));
-	fw_size = le32_to_cpu(pfp_hdr->header.ucode_size_bytes) / 4;
-	WREG32(mmCP_PFP_UCODE_ADDR, 0);
-	for (i = 0; i < fw_size; i++)
-		WREG32(mmCP_PFP_UCODE_DATA,
 le32_to_cpup(fw_data++));
-	WREG32(mmCP_PFP_UCODE_ADDR, adev->gfx.pfp_fw_version);
-
-	/* CE */
-	fw_data = (const __le32 *)
-		(adev->gfx.ce_fw->data +
-		 le32_to_cpu(ce_hdr->header.ucode_array_offset_bytes));
-	fw_size = le32_to_cpu(ce_hdr->header.ucode_size_bytes) / 4;
-	WREG32(mmCP_CE_UCODE_ADDR, 0);
-	for (i = 0; i < fw_size; i++)
-		WREG32(mmCP_CE_UCODE_DATA,
 le32_to_cpup(fw_data++));
-	WREG32(mmCP_CE_UCODE_ADDR, adev->gfx.ce_fw_version);
-
-	/* ME */
-	fw_data = (const __le32 *)
-		(adev->gfx.me_fw->data +
-		 le32_to_cpu(me_hdr->header.ucode_array_offset_bytes));
-	fw_size = le32_to_cpu(me_hdr->header.ucode_size_bytes) / 4;
-	WREG32(mmCP_ME_RAM_WADDR, 0);
-	for (i = 0; i < fw_size; i++)
-		WREG32(mmCP_ME_RAM_DATA,

le32_to_cpup(fw_data++));

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -27
-	WREG32(mmCP_ME_RAM_WADDR, adev->gfx.me_fw_version);
-
-	return 0;
-}
-
 static u32 gfx_v8_0_get_csb_size(struct amdgpu_device *adev)  {
 	u32 count = 0;
@@ -4501,52 +4407,6 @@ static void gfx_v8_0_cp_compute_enable(struct
 amdgpu_device *adev, bool enable)
 	udelay(50);
 }
 
-static int gfx_v8_0_cp_compute_load_microcode(struct amdgpu_device
 *adev) -{
-	const struct gfx_firmware_header_v1_0 *mec_hdr;
-	const __le32 *fw_data;
-	unsigned i, fw_size;
-
-	if (!adev->gfx.mec_fw)
-		return -EINVAL;
-
-	gfx_v8_0_cp_compute_enable(adev, false);
-
-	mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev-
 >gfx.mec_fw->data;
-	amdgpu_ucode_print_gfx_hdr(&mec_hdr->header);
-
-	fw_data = (const __le32 *)
-		(adev->gfx.mec_fw->data +
-		 le32_to_cpu(mec_hdr->header.ucode_array_offset_bytes));
-	fw_size = le32_to_cpu(mec_hdr->header.ucode_size_bytes) / 4;
-
-	/* MEC1 */
-	WREG32(mmCP_MEC_ME1_UCODE_ADDR, 0);
-	for (i = 0; i < fw_size; i++)
-		WREG32(mmCP_MEC_ME1_UCODE_DATA,

le32_to_cpup(fw_data+i));

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-	WREG32(mmCP_MEC_ME1_UCODE_ADDR, adev-
Quoted 1 line

gfx.mec_fw_version);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
-
-	/* Loading MEC2 firmware is only necessary if MEC2 should run

different microcode than MEC1. */

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -4
-	if (adev->gfx.mec2_fw) {
-		const struct gfx_firmware_header_v1_0 *mec2_hdr;
-
-		mec2_hdr = (const struct gfx_firmware_header_v1_0

*)adev->gfx.mec2_fw->data;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -5
-		amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header);
-
-		fw_data = (const __le32 *)
-			(adev->gfx.mec2_fw->data +
-			 le32_to_cpu(mec2_hdr-
Quoted 1 line

header.ucode_array_offset_bytes));

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-		fw_size = le32_to_cpu(mec2_hdr-
Quoted 1 line

header.ucode_size_bytes) / 4;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -4
-
-		WREG32(mmCP_MEC_ME2_UCODE_ADDR, 0);
-		for (i = 0; i < fw_size; i++)
-			WREG32(mmCP_MEC_ME2_UCODE_DATA,

le32_to_cpup(fw_data+i));

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-		WREG32(mmCP_MEC_ME2_UCODE_ADDR, adev-
Quoted 1 line

gfx.mec2_fw_version);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -16
-	}
-
-	return 0;
-}
-
 /* KIQ functions */
 static void gfx_v8_0_kiq_setting(struct amdgpu_ring *ring)  { @@ -4980,17
+4840,6 @@ static int gfx_v8_0_cp_resume(struct amdgpu_device *adev)
 	if (!(adev->flags & AMD_IS_APU))
 		gfx_v8_0_enable_gui_idle_interrupt(adev, false);
 
-	if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
-			/* legacy firmware loading */
-		r = gfx_v8_0_cp_gfx_load_microcode(adev);
-		if (r)
-			return r;
-
-		r = gfx_v8_0_cp_compute_load_microcode(adev);
-		if (r)
-			return r;
-	}
-
 	r = gfx_v8_0_kiq_resume(adev);
 	if (r)
 		return r;
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -7
index 6d5c8ac..6fb3eda 100644
@@ -318,14 +318,13 @@ static int sdma_v3_0_init_microcode(struct
 amdgpu_device *adev)
 		if (adev->sdma.instance[i].feature_version >= 20)
 			adev->sdma.instance[i].burst_nop = true;
 
-		if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU)
 {
-			info = &adev-
 >firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i];
-			info->ucode_id = AMDGPU_UCODE_ID_SDMA0 + i;
-			info->fw = adev->sdma.instance[i].fw;
-			header = (const struct common_firmware_header
 *)info->fw->data;
-			adev->firmware.fw_size +=
-				ALIGN(le32_to_cpu(header-
Quoted 1 line

ucode_size_bytes), PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
-		}
+		info = &adev-
Quoted 1 line

firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i];

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +3 -0
+		info->ucode_id = AMDGPU_UCODE_ID_SDMA0 + i;
+		info->fw = adev->sdma.instance[i].fw;
+		header = (const struct common_firmware_header *)info-
Quoted 1 line

fw->data;

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
+		adev->firmware.fw_size +=
+			ALIGN(le32_to_cpu(header->ucode_size_bytes),

PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -29
+
 	}
 out:
 	if (err) {
@@ -778,42 +777,6 @@ static int sdma_v3_0_rlc_resume(struct
 amdgpu_device *adev)  }
 
 /**
- * sdma_v3_0_load_microcode - load the sDMA ME ucode
- *
- * @adev: amdgpu_device pointer
- *
- * Loads the sDMA0/1 ucode.
- * Returns 0 for success, -EINVAL if the ucode is not available.
- */
-static int sdma_v3_0_load_microcode(struct amdgpu_device *adev) -{
-	const struct sdma_firmware_header_v1_0 *hdr;
-	const __le32 *fw_data;
-	u32 fw_size;
-	int i, j;
-
-	/* halt the MEs */
-	sdma_v3_0_enable(adev, false);
-
-	for (i = 0; i < adev->sdma.num_instances; i++) {
-		if (!adev->sdma.instance[i].fw)
-			return -EINVAL;
-		hdr = (const struct sdma_firmware_header_v1_0 *)adev-
 >sdma.instance[i].fw->data;
-		amdgpu_ucode_print_sdma_hdr(&hdr->header);
-		fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4;
-		fw_data = (const __le32 *)
-			(adev->sdma.instance[i].fw->data +
-				le32_to_cpu(hdr-
 >header.ucode_array_offset_bytes));
-		WREG32(mmSDMA0_UCODE_ADDR + sdma_offsets[i], 0);
-		for (j = 0; j < fw_size; j++)
-			WREG32(mmSDMA0_UCODE_DATA +
 sdma_offsets[i], le32_to_cpup(fw_data++));
-		WREG32(mmSDMA0_UCODE_ADDR + sdma_offsets[i], adev-
Quoted 1 line

sdma.instance[i].fw_version);

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -13
-	}
-
-	return 0;
-}
-
-/**
  * sdma_v3_0_start - setup and start the async dma engines
  *
  * @adev: amdgpu_device pointer
@@ -825,12 +788,6 @@ static int sdma_v3_0_start(struct amdgpu_device
 *adev)  {
 	int r;
 
-	if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
-		r = sdma_v3_0_load_microcode(adev);
-		if (r)
-			return r;
-	}
-
 	/* disable sdma engine before programing it */
 	sdma_v3_0_ctx_switch_enable(adev, false);
 	sdma_v3_0_enable(adev, false);
--

1.9.1

Quoted 4 lines

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

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

A message that is not in the archive (sent off-list or not yet received): SN6PR12MB265640F4BB8C59C498E9631CE4EE0-kxOKjb6HO/FeL/[email protected]

author
#21 lore raw

I will add some warnings in dmesg.
Thanks

Best Regards
Rex

Quoted 492 lines

-----Original Message-----
From: Quan, Evan
Sent: Sunday, September 30, 2018 10:30 AM
To: Zhu, Rex <[email protected]>; [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: RE: [PATCH 1/6] drm/amdgpu: Remove FW_LOAD_DIRECT type support on VI

Instead of change the fw load type to AMDGPU_FW_LOAD_SMU silently, it's better to warn/error out if user specify FW_LOAD_DIRECT load type.

Regards,
Evan

Quoted 7 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Rex Zhu
Sent: 2018年9月30日 0:15
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH 1/6] drm/amdgpu: Remove FW_LOAD_DIRECT type

support on

Quoted 227 lines

VI

AMDGPU_FW_LOAD_DIRECT is used for bring up. Now it don't work any more. so remove the support.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c |   3 -
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c     | 249 ++++++---------------------
---
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c    |  57 +------
 3 files changed, 56 insertions(+), 253 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +0 -3
index 1fa8bc3..fb2bdf3 100644
@@ -297,9 +297,6 @@ enum amdgpu_firmware_load_type
 	case CHIP_POLARIS11:
 	case CHIP_POLARIS12:
 	case CHIP_VEGAM:
-		if (!load_type)
-			return AMDGPU_FW_LOAD_DIRECT;
-		else
 			return AMDGPU_FW_LOAD_SMU;
 	case CHIP_VEGA10:
 	case CHIP_RAVEN:
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +41 -25
index 2aeef2b..c63ede1 100644
@@ -1173,64 +1173,61 @@ static int gfx_v8_0_init_microcode(struct
 amdgpu_device *adev)
 		}
 	}
 
-	if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU) {
-		info = &adev-
 >firmware.ucode[AMDGPU_UCODE_ID_CP_PFP];
-		info->ucode_id = AMDGPU_UCODE_ID_CP_PFP;
-		info->fw = adev->gfx.pfp_fw;
-		header = (const struct common_firmware_header *)info-
 >fw->data;
-		adev->firmware.fw_size +=
-			ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
-
-		info = &adev-
 >firmware.ucode[AMDGPU_UCODE_ID_CP_ME];
-		info->ucode_id = AMDGPU_UCODE_ID_CP_ME;
-		info->fw = adev->gfx.me_fw;
-		header = (const struct common_firmware_header *)info-
 >fw->data;
-		adev->firmware.fw_size +=
-			ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
-
-		info = &adev-
 >firmware.ucode[AMDGPU_UCODE_ID_CP_CE];
-		info->ucode_id = AMDGPU_UCODE_ID_CP_CE;
-		info->fw = adev->gfx.ce_fw;
-		header = (const struct common_firmware_header *)info-
 >fw->data;
-		adev->firmware.fw_size +=
-			ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
+	info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_PFP];
+	info->ucode_id = AMDGPU_UCODE_ID_CP_PFP;
+	info->fw = adev->gfx.pfp_fw;
+	header = (const struct common_firmware_header *)info->fw->data;
+	adev->firmware.fw_size +=
+		ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
+
+	info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_ME];
+	info->ucode_id = AMDGPU_UCODE_ID_CP_ME;
+	info->fw = adev->gfx.me_fw;
+	header = (const struct common_firmware_header *)info->fw->data;
+	adev->firmware.fw_size +=
+		ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
+
+	info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_CE];
+	info->ucode_id = AMDGPU_UCODE_ID_CP_CE;
+	info->fw = adev->gfx.ce_fw;
+	header = (const struct common_firmware_header *)info->fw->data;
+	adev->firmware.fw_size +=
+		ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
+
+	info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_G];
+	info->ucode_id = AMDGPU_UCODE_ID_RLC_G;
+	info->fw = adev->gfx.rlc_fw;
+	header = (const struct common_firmware_header *)info->fw->data;
+	adev->firmware.fw_size +=
+		ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
+
+	info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC1];
+	info->ucode_id = AMDGPU_UCODE_ID_CP_MEC1;
+	info->fw = adev->gfx.mec_fw;
+	header = (const struct common_firmware_header *)info->fw->data;
+	adev->firmware.fw_size +=
+		ALIGN(le32_to_cpu(header->ucode_size_bytes),
 PAGE_SIZE);
+
+	/* we need account JT in */
+	cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev-
 >gfx.mec_fw->data;
+	adev->firmware.fw_size +=
+		ALIGN(le32_to_cpu(cp_hdr->jt_size) << 2, PAGE_SIZE);
 
-		info = &adev-
 >firmware.ucode[AMDGPU_UCODE_ID_RLC_G];
-		info->ucode_id = AMDGPU_UCODE_ID_RLC_G;
-		info->fw = adev->gfx.rlc_fw;
-		header = (const struct common_firmware_header *)info-
 >fw->data;
+	if (amdgpu_sriov_vf(adev)) {
+		info = &adev-
Quoted 1 line

firmware.ucode[AMDGPU_UCODE_ID_STORAGE];

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -1
+		info->ucode_id = AMDGPU_UCODE_ID_STORAGE;
+		info->fw = adev->gfx.mec_fw;
 		adev->firmware.fw_size +=
-			ALIGN(le32_to_cpu(header->ucode_size_bytes),

PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -1
+			ALIGN(le32_to_cpu(64 * PAGE_SIZE), PAGE_SIZE);
+	}
 
-		info = &adev-
Quoted 1 line

firmware.ucode[AMDGPU_UCODE_ID_CP_MEC1];

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
-		info->ucode_id = AMDGPU_UCODE_ID_CP_MEC1;
-		info->fw = adev->gfx.mec_fw;
+	if (adev->gfx.mec2_fw) {
+		info = &adev-
Quoted 1 line

firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2];

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+		info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
+		info->fw = adev->gfx.mec2_fw;
 		header = (const struct common_firmware_header *)info-
Quoted 1 line

fw->data;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
 		adev->firmware.fw_size +=
 			ALIGN(le32_to_cpu(header->ucode_size_bytes),

PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -3
-
-		/* we need account JT in */
-		cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev-
Quoted 1 line

gfx.mec_fw->data;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
-		adev->firmware.fw_size +=
-			ALIGN(le32_to_cpu(cp_hdr->jt_size) << 2,

PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -3
-
-		if (amdgpu_sriov_vf(adev)) {
-			info = &adev-
Quoted 1 line

firmware.ucode[AMDGPU_UCODE_ID_STORAGE];

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -4
-			info->ucode_id = AMDGPU_UCODE_ID_STORAGE;
-			info->fw = adev->gfx.mec_fw;
-			adev->firmware.fw_size +=
-				ALIGN(le32_to_cpu(64 * PAGE_SIZE),

PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -4
-		}
-
-		if (adev->gfx.mec2_fw) {
-			info = &adev-
Quoted 1 line

firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2];

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -3
-			info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
-			info->fw = adev->gfx.mec2_fw;
-			header = (const struct common_firmware_header

*)info->fw->data;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
-			adev->firmware.fw_size +=
-				ALIGN(le32_to_cpu(header-
Quoted 1 line

ucode_size_bytes), PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -35
-		}
-
 	}
 
 out:
@@ -4181,45 +4178,11 @@ static void gfx_v8_0_rlc_start(struct
 amdgpu_device *adev)
 	udelay(50);
 }
 
-static int gfx_v8_0_rlc_load_microcode(struct amdgpu_device *adev) -{
-	const struct rlc_firmware_header_v2_0 *hdr;
-	const __le32 *fw_data;
-	unsigned i, fw_size;
-
-	if (!adev->gfx.rlc_fw)
-		return -EINVAL;
-
-	hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw-
 >data;
-	amdgpu_ucode_print_rlc_hdr(&hdr->header);
-
-	fw_data = (const __le32 *)(adev->gfx.rlc_fw->data +
-			   le32_to_cpu(hdr-
 >header.ucode_array_offset_bytes));
-	fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4;
-
-	WREG32(mmRLC_GPM_UCODE_ADDR, 0);
-	for (i = 0; i < fw_size; i++)
-		WREG32(mmRLC_GPM_UCODE_DATA,
 le32_to_cpup(fw_data++));
-	WREG32(mmRLC_GPM_UCODE_ADDR, adev->gfx.rlc_fw_version);
-
-	return 0;
-}
-
 static int gfx_v8_0_rlc_resume(struct amdgpu_device *adev)  {
-	int r;
-
 	gfx_v8_0_rlc_stop(adev);
 	gfx_v8_0_rlc_reset(adev);
 	gfx_v8_0_init_pg(adev);
-
-	if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
-		/* legacy rlc firmware loading */
-		r = gfx_v8_0_rlc_load_microcode(adev);
-		if (r)
-			return r;
-	}
-
 	gfx_v8_0_rlc_start(adev);
 
 	return 0;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_cp_gfx_enable(struct · line 4249

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
@@ -4245,63 +4208,6 @@ static void gfx_v8_0_cp_gfx_enable(struct
 amdgpu_device *adev, bool enable)
 	udelay(50);
 }
 
-static int gfx_v8_0_cp_gfx_load_microcode(struct amdgpu_device *adev) -

{

Quoted 238 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -50
-	const struct gfx_firmware_header_v1_0 *pfp_hdr;
-	const struct gfx_firmware_header_v1_0 *ce_hdr;
-	const struct gfx_firmware_header_v1_0 *me_hdr;
-	const __le32 *fw_data;
-	unsigned i, fw_size;
-
-	if (!adev->gfx.me_fw || !adev->gfx.pfp_fw || !adev->gfx.ce_fw)
-		return -EINVAL;
-
-	pfp_hdr = (const struct gfx_firmware_header_v1_0 *)
-		adev->gfx.pfp_fw->data;
-	ce_hdr = (const struct gfx_firmware_header_v1_0 *)
-		adev->gfx.ce_fw->data;
-	me_hdr = (const struct gfx_firmware_header_v1_0 *)
-		adev->gfx.me_fw->data;
-
-	amdgpu_ucode_print_gfx_hdr(&pfp_hdr->header);
-	amdgpu_ucode_print_gfx_hdr(&ce_hdr->header);
-	amdgpu_ucode_print_gfx_hdr(&me_hdr->header);
-
-	gfx_v8_0_cp_gfx_enable(adev, false);
-
-	/* PFP */
-	fw_data = (const __le32 *)
-		(adev->gfx.pfp_fw->data +
-		 le32_to_cpu(pfp_hdr->header.ucode_array_offset_bytes));
-	fw_size = le32_to_cpu(pfp_hdr->header.ucode_size_bytes) / 4;
-	WREG32(mmCP_PFP_UCODE_ADDR, 0);
-	for (i = 0; i < fw_size; i++)
-		WREG32(mmCP_PFP_UCODE_DATA,
 le32_to_cpup(fw_data++));
-	WREG32(mmCP_PFP_UCODE_ADDR, adev->gfx.pfp_fw_version);
-
-	/* CE */
-	fw_data = (const __le32 *)
-		(adev->gfx.ce_fw->data +
-		 le32_to_cpu(ce_hdr->header.ucode_array_offset_bytes));
-	fw_size = le32_to_cpu(ce_hdr->header.ucode_size_bytes) / 4;
-	WREG32(mmCP_CE_UCODE_ADDR, 0);
-	for (i = 0; i < fw_size; i++)
-		WREG32(mmCP_CE_UCODE_DATA,
 le32_to_cpup(fw_data++));
-	WREG32(mmCP_CE_UCODE_ADDR, adev->gfx.ce_fw_version);
-
-	/* ME */
-	fw_data = (const __le32 *)
-		(adev->gfx.me_fw->data +
-		 le32_to_cpu(me_hdr->header.ucode_array_offset_bytes));
-	fw_size = le32_to_cpu(me_hdr->header.ucode_size_bytes) / 4;
-	WREG32(mmCP_ME_RAM_WADDR, 0);
-	for (i = 0; i < fw_size; i++)
-		WREG32(mmCP_ME_RAM_DATA,

le32_to_cpup(fw_data++));

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -27
-	WREG32(mmCP_ME_RAM_WADDR, adev->gfx.me_fw_version);
-
-	return 0;
-}
-
 static u32 gfx_v8_0_get_csb_size(struct amdgpu_device *adev)  {
 	u32 count = 0;
@@ -4501,52 +4407,6 @@ static void gfx_v8_0_cp_compute_enable(struct
 amdgpu_device *adev, bool enable)
 	udelay(50);
 }
 
-static int gfx_v8_0_cp_compute_load_microcode(struct amdgpu_device
 *adev) -{
-	const struct gfx_firmware_header_v1_0 *mec_hdr;
-	const __le32 *fw_data;
-	unsigned i, fw_size;
-
-	if (!adev->gfx.mec_fw)
-		return -EINVAL;
-
-	gfx_v8_0_cp_compute_enable(adev, false);
-
-	mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev-
 >gfx.mec_fw->data;
-	amdgpu_ucode_print_gfx_hdr(&mec_hdr->header);
-
-	fw_data = (const __le32 *)
-		(adev->gfx.mec_fw->data +
-		 le32_to_cpu(mec_hdr->header.ucode_array_offset_bytes));
-	fw_size = le32_to_cpu(mec_hdr->header.ucode_size_bytes) / 4;
-
-	/* MEC1 */
-	WREG32(mmCP_MEC_ME1_UCODE_ADDR, 0);
-	for (i = 0; i < fw_size; i++)
-		WREG32(mmCP_MEC_ME1_UCODE_DATA,

le32_to_cpup(fw_data+i));

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-	WREG32(mmCP_MEC_ME1_UCODE_ADDR, adev-
Quoted 1 line

gfx.mec_fw_version);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
-
-	/* Loading MEC2 firmware is only necessary if MEC2 should run

different microcode than MEC1. */

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -4
-	if (adev->gfx.mec2_fw) {
-		const struct gfx_firmware_header_v1_0 *mec2_hdr;
-
-		mec2_hdr = (const struct gfx_firmware_header_v1_0

*)adev->gfx.mec2_fw->data;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -5
-		amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header);
-
-		fw_data = (const __le32 *)
-			(adev->gfx.mec2_fw->data +
-			 le32_to_cpu(mec2_hdr-
Quoted 1 line

header.ucode_array_offset_bytes));

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-		fw_size = le32_to_cpu(mec2_hdr-
Quoted 1 line

header.ucode_size_bytes) / 4;

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -4
-
-		WREG32(mmCP_MEC_ME2_UCODE_ADDR, 0);
-		for (i = 0; i < fw_size; i++)
-			WREG32(mmCP_MEC_ME2_UCODE_DATA,

le32_to_cpup(fw_data+i));

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-		WREG32(mmCP_MEC_ME2_UCODE_ADDR, adev-
Quoted 1 line

gfx.mec2_fw_version);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -17
-	}
-
-	return 0;
-}
-
 /* KIQ functions */
 static void gfx_v8_0_kiq_setting(struct amdgpu_ring *ring)  { @@
-4980,17
+4840,6 @@ static int gfx_v8_0_cp_resume(struct amdgpu_device *adev)
 	if (!(adev->flags & AMD_IS_APU))
 		gfx_v8_0_enable_gui_idle_interrupt(adev, false);
 
-	if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
-			/* legacy firmware loading */
-		r = gfx_v8_0_cp_gfx_load_microcode(adev);
-		if (r)
-			return r;
-
-		r = gfx_v8_0_cp_compute_load_microcode(adev);
-		if (r)
-			return r;
-	}
-
 	r = gfx_v8_0_kiq_resume(adev);
 	if (r)
 		return r;
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -7
index 6d5c8ac..6fb3eda 100644
@@ -318,14 +318,13 @@ static int sdma_v3_0_init_microcode(struct
 amdgpu_device *adev)
 		if (adev->sdma.instance[i].feature_version >= 20)
 			adev->sdma.instance[i].burst_nop = true;
 
-		if (adev->firmware.load_type == AMDGPU_FW_LOAD_SMU)
 {
-			info = &adev-
 >firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i];
-			info->ucode_id = AMDGPU_UCODE_ID_SDMA0 + i;
-			info->fw = adev->sdma.instance[i].fw;
-			header = (const struct common_firmware_header
 *)info->fw->data;
-			adev->firmware.fw_size +=
-				ALIGN(le32_to_cpu(header-
Quoted 1 line

ucode_size_bytes), PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
-		}
+		info = &adev-
Quoted 1 line

firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i];

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +3 -0
+		info->ucode_id = AMDGPU_UCODE_ID_SDMA0 + i;
+		info->fw = adev->sdma.instance[i].fw;
+		header = (const struct common_firmware_header *)info-
Quoted 1 line

fw->data;

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
+		adev->firmware.fw_size +=
+			ALIGN(le32_to_cpu(header->ucode_size_bytes),

PAGE_SIZE);

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -29
+
 	}
 out:
 	if (err) {
@@ -778,42 +777,6 @@ static int sdma_v3_0_rlc_resume(struct
 amdgpu_device *adev)  }
 
 /**
- * sdma_v3_0_load_microcode - load the sDMA ME ucode
- *
- * @adev: amdgpu_device pointer
- *
- * Loads the sDMA0/1 ucode.
- * Returns 0 for success, -EINVAL if the ucode is not available.
- */
-static int sdma_v3_0_load_microcode(struct amdgpu_device *adev) -{
-	const struct sdma_firmware_header_v1_0 *hdr;
-	const __le32 *fw_data;
-	u32 fw_size;
-	int i, j;
-
-	/* halt the MEs */
-	sdma_v3_0_enable(adev, false);
-
-	for (i = 0; i < adev->sdma.num_instances; i++) {
-		if (!adev->sdma.instance[i].fw)
-			return -EINVAL;
-		hdr = (const struct sdma_firmware_header_v1_0 *)adev-
 >sdma.instance[i].fw->data;
-		amdgpu_ucode_print_sdma_hdr(&hdr->header);
-		fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4;
-		fw_data = (const __le32 *)
-			(adev->sdma.instance[i].fw->data +
-				le32_to_cpu(hdr-
 >header.ucode_array_offset_bytes));
-		WREG32(mmSDMA0_UCODE_ADDR + sdma_offsets[i], 0);
-		for (j = 0; j < fw_size; j++)
-			WREG32(mmSDMA0_UCODE_DATA +
 sdma_offsets[i], le32_to_cpup(fw_data++));
-		WREG32(mmSDMA0_UCODE_ADDR + sdma_offsets[i], adev-
Quoted 1 line

sdma.instance[i].fw_version);

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -13
-	}
-
-	return 0;
-}
-
-/**
  * sdma_v3_0_start - setup and start the async dma engines
  *
  * @adev: amdgpu_device pointer
@@ -825,12 +788,6 @@ static int sdma_v3_0_start(struct amdgpu_device
 *adev)  {
 	int r;
 
-	if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
-		r = sdma_v3_0_load_microcode(adev);
-		if (r)
-			return r;
-	}
-
 	/* disable sdma engine before programing it */
 	sdma_v3_0_ctx_switch_enable(adev, false);
 	sdma_v3_0_enable(adev, false);
--

1.9.1

Quoted 4 lines
Quoted 4 lines

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

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