Skip to contentSkip to conversation

drm/amdgpu: fix GFX10 missing CSIB set

PATCH In review Monk Liu 6 participants 24 messages Nov 26, 2019 – Nov 29, 2019 9 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Monk Liu

author
#0 lore raw

PATCH 1/5 drm/amdgpu: fix GFX10 missing CSIB set

still need to init csb even for SRIOV

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5 -3
index 4d6df35..879c0a1 100644
@@ -1926,14 +1926,16 @@ static int gfx_v10_0_rlc_resume(struct amdgpu_device *adev)
 {
 	int r;
 
-	if (amdgpu_sriov_vf(adev))
-		return 0;
-
 	if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
 		r = gfx_v10_0_wait_for_rlc_autoload_complete(adev);
 		if (r)
 			return r;
 
+		if (amdgpu_sriov_vf(adev)) {
+			gfx_v10_0_init_csb(adev);
+			return 0;
+		}
+
 		r = gfx_v10_0_init_pg(adev);
 		if (r)
 			return r;
Signature · 6 lines
2.7.4

_______________________________________________
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): 1574769024-30611-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/5 drm/amdgpu: skip rlc ucode loading for SRIOV gfx10

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 80 +++++++++++++++++-----------------
 1 file changed, 41 insertions(+), 39 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +41 -39
index 879c0a1..a56cba9 100644
@@ -691,59 +691,61 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
 	adev->gfx.ce_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
 	adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
-	err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
-	rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
-	version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
-	version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
-	if (version_major == 2 && version_minor == 1)
-		adev->gfx.rlc.is_rlc_v2_1 = true;
-
-	adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version);
-	adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version);
-	adev->gfx.rlc.save_and_restore_offset =
+	if (!amdgpu_sriov_vf(adev)) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
+		err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
+		if (err)
+			goto out;
+		err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
+		rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
+		version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
+		version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
+		if (version_major == 2 && version_minor == 1)
+			adev->gfx.rlc.is_rlc_v2_1 = true;
+
+		adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version);
+		adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version);
+		adev->gfx.rlc.save_and_restore_offset =
 			le32_to_cpu(rlc_hdr->save_and_restore_offset);
-	adev->gfx.rlc.clear_state_descriptor_offset =
+		adev->gfx.rlc.clear_state_descriptor_offset =
 			le32_to_cpu(rlc_hdr->clear_state_descriptor_offset);
-	adev->gfx.rlc.avail_scratch_ram_locations =
+		adev->gfx.rlc.avail_scratch_ram_locations =
 			le32_to_cpu(rlc_hdr->avail_scratch_ram_locations);
-	adev->gfx.rlc.reg_restore_list_size =
+		adev->gfx.rlc.reg_restore_list_size =
 			le32_to_cpu(rlc_hdr->reg_restore_list_size);
-	adev->gfx.rlc.reg_list_format_start =
+		adev->gfx.rlc.reg_list_format_start =
 			le32_to_cpu(rlc_hdr->reg_list_format_start);
-	adev->gfx.rlc.reg_list_format_separate_start =
+		adev->gfx.rlc.reg_list_format_separate_start =
 			le32_to_cpu(rlc_hdr->reg_list_format_separate_start);
-	adev->gfx.rlc.starting_offsets_start =
+		adev->gfx.rlc.starting_offsets_start =
 			le32_to_cpu(rlc_hdr->starting_offsets_start);
-	adev->gfx.rlc.reg_list_format_size_bytes =
+		adev->gfx.rlc.reg_list_format_size_bytes =
 			le32_to_cpu(rlc_hdr->reg_list_format_size_bytes);
-	adev->gfx.rlc.reg_list_size_bytes =
+		adev->gfx.rlc.reg_list_size_bytes =
 			le32_to_cpu(rlc_hdr->reg_list_size_bytes);
-	adev->gfx.rlc.register_list_format =
+		adev->gfx.rlc.register_list_format =
 			kmalloc(adev->gfx.rlc.reg_list_format_size_bytes +
-				adev->gfx.rlc.reg_list_size_bytes, GFP_KERNEL);
-	if (!adev->gfx.rlc.register_list_format) {
-		err = -ENOMEM;
-		goto out;
-	}
+					adev->gfx.rlc.reg_list_size_bytes, GFP_KERNEL);
+		if (!adev->gfx.rlc.register_list_format) {
+			err = -ENOMEM;
+			goto out;
+		}
 
-	tmp = (unsigned int *)((uintptr_t)rlc_hdr +
-			le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes));
-	for (i = 0 ; i < (rlc_hdr->reg_list_format_size_bytes >> 2); i++)
-		adev->gfx.rlc.register_list_format[i] =	le32_to_cpu(tmp[i]);
+		tmp = (unsigned int *)((uintptr_t)rlc_hdr +
+							   le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes));
+		for (i = 0 ; i < (rlc_hdr->reg_list_format_size_bytes >> 2); i++)
+			adev->gfx.rlc.register_list_format[i] =	le32_to_cpu(tmp[i]);
 
-	adev->gfx.rlc.register_restore = adev->gfx.rlc.register_list_format + i;
+		adev->gfx.rlc.register_restore = adev->gfx.rlc.register_list_format + i;
 
-	tmp = (unsigned int *)((uintptr_t)rlc_hdr +
-			le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes));
-	for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
-		adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
+		tmp = (unsigned int *)((uintptr_t)rlc_hdr +
+							   le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes));
+		for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
+			adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
 
-	if (adev->gfx.rlc.is_rlc_v2_1)
-		gfx_v10_0_init_rlc_ext_microcode(adev);
+		if (adev->gfx.rlc.is_rlc_v2_1)
+			gfx_v10_0_init_rlc_ext_microcode(adev);
+	}
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", chip_name, wks);
 	err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
Signature · 6 lines
2.7.4

_______________________________________________
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): 1574769024-30611-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

author
#4 lore raw

RE: [PATCH 2/5] drm/amdgpu: skip rlc ucode loading for SRIOV gfx10

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Monk Liu <[email protected]>
Sent: Tuesday, November 26, 2019 7:50 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 2/5] drm/amdgpu: skip rlc ucode loading for SRIOV gfx10

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 80 +++++++++++++++++-----------------
 1 file changed, 41 insertions(+), 39 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +41 -39
index 879c0a1..a56cba9 100644
@@ -691,59 +691,61 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
 	adev->gfx.ce_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
 	adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
-	err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
-	rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
-	version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
-	version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
-	if (version_major == 2 && version_minor == 1)
-		adev->gfx.rlc.is_rlc_v2_1 = true;
-
-	adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version);
-	adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version);
-	adev->gfx.rlc.save_and_restore_offset =
+	if (!amdgpu_sriov_vf(adev)) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
+		err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
+		if (err)
+			goto out;
+		err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
+		rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
+		version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
+		version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
+		if (version_major == 2 && version_minor == 1)
+			adev->gfx.rlc.is_rlc_v2_1 = true;
+
+		adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version);
+		adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version);
+		adev->gfx.rlc.save_and_restore_offset =
 			le32_to_cpu(rlc_hdr->save_and_restore_offset);
-	adev->gfx.rlc.clear_state_descriptor_offset =
+		adev->gfx.rlc.clear_state_descriptor_offset =
 			le32_to_cpu(rlc_hdr->clear_state_descriptor_offset);
-	adev->gfx.rlc.avail_scratch_ram_locations =
+		adev->gfx.rlc.avail_scratch_ram_locations =
 			le32_to_cpu(rlc_hdr->avail_scratch_ram_locations);
-	adev->gfx.rlc.reg_restore_list_size =
+		adev->gfx.rlc.reg_restore_list_size =
 			le32_to_cpu(rlc_hdr->reg_restore_list_size);
-	adev->gfx.rlc.reg_list_format_start =
+		adev->gfx.rlc.reg_list_format_start =
 			le32_to_cpu(rlc_hdr->reg_list_format_start);
-	adev->gfx.rlc.reg_list_format_separate_start =
+		adev->gfx.rlc.reg_list_format_separate_start =
 			le32_to_cpu(rlc_hdr->reg_list_format_separate_start);
-	adev->gfx.rlc.starting_offsets_start =
+		adev->gfx.rlc.starting_offsets_start =
 			le32_to_cpu(rlc_hdr->starting_offsets_start);
-	adev->gfx.rlc.reg_list_format_size_bytes =
+		adev->gfx.rlc.reg_list_format_size_bytes =
 			le32_to_cpu(rlc_hdr->reg_list_format_size_bytes);
-	adev->gfx.rlc.reg_list_size_bytes =
+		adev->gfx.rlc.reg_list_size_bytes =
 			le32_to_cpu(rlc_hdr->reg_list_size_bytes);
-	adev->gfx.rlc.register_list_format =
+		adev->gfx.rlc.register_list_format =
 			kmalloc(adev->gfx.rlc.reg_list_format_size_bytes +
-				adev->gfx.rlc.reg_list_size_bytes, GFP_KERNEL);
-	if (!adev->gfx.rlc.register_list_format) {
-		err = -ENOMEM;
-		goto out;
-	}
+					adev->gfx.rlc.reg_list_size_bytes, GFP_KERNEL);
+		if (!adev->gfx.rlc.register_list_format) {
+			err = -ENOMEM;
+			goto out;
+		}
 
-	tmp = (unsigned int *)((uintptr_t)rlc_hdr +
-			le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes));
-	for (i = 0 ; i < (rlc_hdr->reg_list_format_size_bytes >> 2); i++)
-		adev->gfx.rlc.register_list_format[i] =	le32_to_cpu(tmp[i]);
+		tmp = (unsigned int *)((uintptr_t)rlc_hdr +
+							   le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes));
+		for (i = 0 ; i < (rlc_hdr->reg_list_format_size_bytes >> 2); i++)
+			adev->gfx.rlc.register_list_format[i] =	le32_to_cpu(tmp[i]);
 
-	adev->gfx.rlc.register_restore = adev->gfx.rlc.register_list_format + i;
+		adev->gfx.rlc.register_restore = adev->gfx.rlc.register_list_format + i;
 
-	tmp = (unsigned int *)((uintptr_t)rlc_hdr +
-			le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes));
-	for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
-		adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
+		tmp = (unsigned int *)((uintptr_t)rlc_hdr +
+							   le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes));
+		for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
+			adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
 
-	if (adev->gfx.rlc.is_rlc_v2_1)
-		gfx_v10_0_init_rlc_ext_microcode(adev);
+		if (adev->gfx.rlc.is_rlc_v2_1)
+			gfx_v10_0_init_rlc_ext_microcode(adev);
+	}
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", chip_name, wks);
 	err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
Signature · 6 lines
2.7.4

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

RE: [PATCH 2/5] drm/amdgpu: skip rlc ucode loading for SRIOV gfx10

@Zhang, Hawking @Deucher, Alexander
Can you help to review it for me

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liu, Monk
Sent: Thursday, November 28, 2019 10:21 AM
To: [email protected]
Subject: RE: [PATCH 2/5] drm/amdgpu: skip rlc ucode loading for SRIOV gfx10

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Monk Liu <[email protected]>
Sent: Tuesday, November 26, 2019 7:50 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 2/5] drm/amdgpu: skip rlc ucode loading for SRIOV gfx10

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 80 +++++++++++++++++-----------------
 1 file changed, 41 insertions(+), 39 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +41 -39
index 879c0a1..a56cba9 100644
@@ -691,59 +691,61 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
 	adev->gfx.ce_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
 	adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
-	err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
-	rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
-	version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
-	version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
-	if (version_major == 2 && version_minor == 1)
-		adev->gfx.rlc.is_rlc_v2_1 = true;
-
-	adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version);
-	adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version);
-	adev->gfx.rlc.save_and_restore_offset =
+	if (!amdgpu_sriov_vf(adev)) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
+		err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
+		if (err)
+			goto out;
+		err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
+		rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
+		version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
+		version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
+		if (version_major == 2 && version_minor == 1)
+			adev->gfx.rlc.is_rlc_v2_1 = true;
+
+		adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version);
+		adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version);
+		adev->gfx.rlc.save_and_restore_offset =
 			le32_to_cpu(rlc_hdr->save_and_restore_offset);
-	adev->gfx.rlc.clear_state_descriptor_offset =
+		adev->gfx.rlc.clear_state_descriptor_offset =
 			le32_to_cpu(rlc_hdr->clear_state_descriptor_offset);
-	adev->gfx.rlc.avail_scratch_ram_locations =
+		adev->gfx.rlc.avail_scratch_ram_locations =
 			le32_to_cpu(rlc_hdr->avail_scratch_ram_locations);
-	adev->gfx.rlc.reg_restore_list_size =
+		adev->gfx.rlc.reg_restore_list_size =
 			le32_to_cpu(rlc_hdr->reg_restore_list_size);
-	adev->gfx.rlc.reg_list_format_start =
+		adev->gfx.rlc.reg_list_format_start =
 			le32_to_cpu(rlc_hdr->reg_list_format_start);
-	adev->gfx.rlc.reg_list_format_separate_start =
+		adev->gfx.rlc.reg_list_format_separate_start =
 			le32_to_cpu(rlc_hdr->reg_list_format_separate_start);
-	adev->gfx.rlc.starting_offsets_start =
+		adev->gfx.rlc.starting_offsets_start =
 			le32_to_cpu(rlc_hdr->starting_offsets_start);
-	adev->gfx.rlc.reg_list_format_size_bytes =
+		adev->gfx.rlc.reg_list_format_size_bytes =
 			le32_to_cpu(rlc_hdr->reg_list_format_size_bytes);
-	adev->gfx.rlc.reg_list_size_bytes =
+		adev->gfx.rlc.reg_list_size_bytes =
 			le32_to_cpu(rlc_hdr->reg_list_size_bytes);
-	adev->gfx.rlc.register_list_format =
+		adev->gfx.rlc.register_list_format =
 			kmalloc(adev->gfx.rlc.reg_list_format_size_bytes +
-				adev->gfx.rlc.reg_list_size_bytes, GFP_KERNEL);
-	if (!adev->gfx.rlc.register_list_format) {
-		err = -ENOMEM;
-		goto out;
-	}
+					adev->gfx.rlc.reg_list_size_bytes, GFP_KERNEL);
+		if (!adev->gfx.rlc.register_list_format) {
+			err = -ENOMEM;
+			goto out;
+		}
 
-	tmp = (unsigned int *)((uintptr_t)rlc_hdr +
-			le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes));
-	for (i = 0 ; i < (rlc_hdr->reg_list_format_size_bytes >> 2); i++)
-		adev->gfx.rlc.register_list_format[i] =	le32_to_cpu(tmp[i]);
+		tmp = (unsigned int *)((uintptr_t)rlc_hdr +
+							   le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes));
+		for (i = 0 ; i < (rlc_hdr->reg_list_format_size_bytes >> 2); i++)
+			adev->gfx.rlc.register_list_format[i] =	le32_to_cpu(tmp[i]);
 
-	adev->gfx.rlc.register_restore = adev->gfx.rlc.register_list_format + i;
+		adev->gfx.rlc.register_restore = adev->gfx.rlc.register_list_format + i;
 
-	tmp = (unsigned int *)((uintptr_t)rlc_hdr +
-			le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes));
-	for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
-		adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
+		tmp = (unsigned int *)((uintptr_t)rlc_hdr +
+							   le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes));
+		for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
+			adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
 
-	if (adev->gfx.rlc.is_rlc_v2_1)
-		gfx_v10_0_init_rlc_ext_microcode(adev);
+		if (adev->gfx.rlc.is_rlc_v2_1)
+			gfx_v10_0_init_rlc_ext_microcode(adev);
+	}
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", chip_name, wks);
 	err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
Signature · 10 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmonk.liu%40amd.com%7C093ac34778cb46b7063308d773a9abc0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637105044899753546&amp;sdata=U9afcHP70elMZY%2FVsVgGAvggS0wqTVax2wU8PeufWSM%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#6 lore raw

RE: [PATCH 2/5] drm/amdgpu: skip rlc ucode loading for SRIOV gfx10

[AMD Official Use Only - Internal Distribution Only]

Regards,
Hawking
-----Original Message-----
From: Liu, Monk <[email protected]>
Sent: 2019年11月29日 15:47
To: Liu, Monk <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 2/5] drm/amdgpu: skip rlc ucode loading for SRIOV gfx10

@Zhang, Hawking @Deucher, Alexander
Can you help to review it for me

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liu, Monk
Sent: Thursday, November 28, 2019 10:21 AM
To: [email protected]
Subject: RE: [PATCH 2/5] drm/amdgpu: skip rlc ucode loading for SRIOV gfx10

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Monk Liu <[email protected]>
Sent: Tuesday, November 26, 2019 7:50 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 2/5] drm/amdgpu: skip rlc ucode loading for SRIOV gfx10

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 80 +++++++++++++++++-----------------
 1 file changed, 41 insertions(+), 39 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +41 -39
index 879c0a1..a56cba9 100644
@@ -691,59 +691,61 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
 	adev->gfx.ce_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
 	adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
-	err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
-	rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
-	version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
-	version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
-	if (version_major == 2 && version_minor == 1)
-		adev->gfx.rlc.is_rlc_v2_1 = true;
-
-	adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version);
-	adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version);
-	adev->gfx.rlc.save_and_restore_offset =
+	if (!amdgpu_sriov_vf(adev)) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
+		err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
+		if (err)
+			goto out;
+		err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
+		rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
+		version_major = le16_to_cpu(rlc_hdr->header.header_version_major);
+		version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor);
+		if (version_major == 2 && version_minor == 1)
+			adev->gfx.rlc.is_rlc_v2_1 = true;
+
+		adev->gfx.rlc_fw_version = le32_to_cpu(rlc_hdr->header.ucode_version);
+		adev->gfx.rlc_feature_version = le32_to_cpu(rlc_hdr->ucode_feature_version);
+		adev->gfx.rlc.save_and_restore_offset =
 			le32_to_cpu(rlc_hdr->save_and_restore_offset);
-	adev->gfx.rlc.clear_state_descriptor_offset =
+		adev->gfx.rlc.clear_state_descriptor_offset =
 			le32_to_cpu(rlc_hdr->clear_state_descriptor_offset);
-	adev->gfx.rlc.avail_scratch_ram_locations =
+		adev->gfx.rlc.avail_scratch_ram_locations =
 			le32_to_cpu(rlc_hdr->avail_scratch_ram_locations);
-	adev->gfx.rlc.reg_restore_list_size =
+		adev->gfx.rlc.reg_restore_list_size =
 			le32_to_cpu(rlc_hdr->reg_restore_list_size);
-	adev->gfx.rlc.reg_list_format_start =
+		adev->gfx.rlc.reg_list_format_start =
 			le32_to_cpu(rlc_hdr->reg_list_format_start);
-	adev->gfx.rlc.reg_list_format_separate_start =
+		adev->gfx.rlc.reg_list_format_separate_start =
 			le32_to_cpu(rlc_hdr->reg_list_format_separate_start);
-	adev->gfx.rlc.starting_offsets_start =
+		adev->gfx.rlc.starting_offsets_start =
 			le32_to_cpu(rlc_hdr->starting_offsets_start);
-	adev->gfx.rlc.reg_list_format_size_bytes =
+		adev->gfx.rlc.reg_list_format_size_bytes =
 			le32_to_cpu(rlc_hdr->reg_list_format_size_bytes);
-	adev->gfx.rlc.reg_list_size_bytes =
+		adev->gfx.rlc.reg_list_size_bytes =
 			le32_to_cpu(rlc_hdr->reg_list_size_bytes);
-	adev->gfx.rlc.register_list_format =
+		adev->gfx.rlc.register_list_format =
 			kmalloc(adev->gfx.rlc.reg_list_format_size_bytes +
-				adev->gfx.rlc.reg_list_size_bytes, GFP_KERNEL);
-	if (!adev->gfx.rlc.register_list_format) {
-		err = -ENOMEM;
-		goto out;
-	}
+					adev->gfx.rlc.reg_list_size_bytes, GFP_KERNEL);
+		if (!adev->gfx.rlc.register_list_format) {
+			err = -ENOMEM;
+			goto out;
+		}
 
-	tmp = (unsigned int *)((uintptr_t)rlc_hdr +
-			le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes));
-	for (i = 0 ; i < (rlc_hdr->reg_list_format_size_bytes >> 2); i++)
-		adev->gfx.rlc.register_list_format[i] =	le32_to_cpu(tmp[i]);
+		tmp = (unsigned int *)((uintptr_t)rlc_hdr +
+							   le32_to_cpu(rlc_hdr->reg_list_format_array_offset_bytes));
+		for (i = 0 ; i < (rlc_hdr->reg_list_format_size_bytes >> 2); i++)
+			adev->gfx.rlc.register_list_format[i] =	le32_to_cpu(tmp[i]);
 
-	adev->gfx.rlc.register_restore = adev->gfx.rlc.register_list_format + i;
+		adev->gfx.rlc.register_restore = adev->gfx.rlc.register_list_format + i;
 
-	tmp = (unsigned int *)((uintptr_t)rlc_hdr +
-			le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes));
-	for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
-		adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
+		tmp = (unsigned int *)((uintptr_t)rlc_hdr +
+							   le32_to_cpu(rlc_hdr->reg_list_array_offset_bytes));
+		for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
+			adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
 
-	if (adev->gfx.rlc.is_rlc_v2_1)
-		gfx_v10_0_init_rlc_ext_microcode(adev);
+		if (adev->gfx.rlc.is_rlc_v2_1)
+			gfx_v10_0_init_rlc_ext_microcode(adev);
+	}
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", chip_name, wks);
 	err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
Signature · 10 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmonk.liu%40amd.com%7C093ac34778cb46b7063308d773a9abc0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637105044899753546&amp;sdata=U9afcHP70elMZY%2FVsVgGAvggS0wqTVax2wU8PeufWSM%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#7 lore raw

PATCH 3/5 drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

In reply to a message not in the archive

since we don't have RLCG ucode loading and no SRlist as well

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -2
index 96a6b00..b65fda9 100644
@@ -1490,8 +1490,7 @@ static int psp_np_fw_load(struct psp_context *psp)
 			return ret;
 
 		/* Start rlc autoload after psp recieved all the gfx firmware */
-		if (psp->autoload_supported && ucode->ucode_id ==
-			AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM) {
+		if (psp->autoload_supported && ucode->ucode_id == (amdgpu_sriov_vf(adev) ? AMDGPU_UCODE_ID_CP_MEC2 : AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM)) {
 			ret = psp_rlc_autoload(psp);
 			if (ret) {
 				DRM_ERROR("Failed to start rlc autoload\n");
Signature · 6 lines
2.7.4

_______________________________________________
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): 1574769024-30611-3-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

author
#9 lore raw

RE: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

ping
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Monk Liu <[email protected]>
Sent: Tuesday, November 26, 2019 7:50 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

since we don't have RLCG ucode loading and no SRlist as well

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -2
index 96a6b00..b65fda9 100644
@@ -1490,8 +1490,7 @@ static int psp_np_fw_load(struct psp_context *psp)
 			return ret;
 
 		/* Start rlc autoload after psp recieved all the gfx firmware */
-		if (psp->autoload_supported && ucode->ucode_id ==
-			AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM) {
+		if (psp->autoload_supported && ucode->ucode_id == (amdgpu_sriov_vf(adev) ? AMDGPU_UCODE_ID_CP_MEC2 : AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM)) {
 			ret = psp_rlc_autoload(psp);
 			if (ret) {
 				DRM_ERROR("Failed to start rlc autoload\n");
Signature · 6 lines
2.7.4

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

RE: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

@Zhang, Hawking@Deucher, Alexander

Can you help to review it for me ?

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liu, Monk
Sent: Thursday, November 28, 2019 10:22 AM
To: [email protected]
Subject: RE: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

ping
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Monk Liu <[email protected]>
Sent: Tuesday, November 26, 2019 7:50 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

since we don't have RLCG ucode loading and no SRlist as well

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -2
index 96a6b00..b65fda9 100644
@@ -1490,8 +1490,7 @@ static int psp_np_fw_load(struct psp_context *psp)
 			return ret;
 
 		/* Start rlc autoload after psp recieved all the gfx firmware */
-		if (psp->autoload_supported && ucode->ucode_id ==
-			AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM) {
+		if (psp->autoload_supported && ucode->ucode_id == (amdgpu_sriov_vf(adev) ? AMDGPU_UCODE_ID_CP_MEC2 : AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM)) {
 			ret = psp_rlc_autoload(psp);
 			if (ret) {
 				DRM_ERROR("Failed to start rlc autoload\n");
Signature · 10 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmonk.liu%40amd.com%7C0bc674ddf1c94ba831fa08d773a9b0ed%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637105044990255000&amp;sdata=kvsZdko%2FQAXIiZCP19wo%2BxEISLqEw7tMaFO0dvxU5Ew%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#11 lore raw

RE: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

[AMD Official Use Only - Internal Distribution Only]

It seems to me this is one line code that more than 80 characters. Please kindly split it to several ones. Other than that, the Patch is

Regards,
Hawking

-----Original Message-----
From: Liu, Monk <[email protected]>
Sent: 2019年11月29日 15:48
To: Liu, Monk <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

@Zhang, Hawking@Deucher, Alexander

Can you help to review it for me ?

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liu, Monk
Sent: Thursday, November 28, 2019 10:22 AM
To: [email protected]
Subject: RE: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

ping
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Monk Liu <[email protected]>
Sent: Tuesday, November 26, 2019 7:50 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

since we don't have RLCG ucode loading and no SRlist as well

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -2
index 96a6b00..b65fda9 100644
@@ -1490,8 +1490,7 @@ static int psp_np_fw_load(struct psp_context *psp)
 			return ret;
 
 		/* Start rlc autoload after psp recieved all the gfx firmware */
-		if (psp->autoload_supported && ucode->ucode_id ==
-			AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM) {
+		if (psp->autoload_supported && ucode->ucode_id == (amdgpu_sriov_vf(adev) ? AMDGPU_UCODE_ID_CP_MEC2 : AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM)) {
 			ret = psp_rlc_autoload(psp);
 			if (ret) {
 				DRM_ERROR("Failed to start rlc autoload\n");
Signature · 10 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmonk.liu%40amd.com%7C0bc674ddf1c94ba831fa08d773a9b0ed%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637105044990255000&amp;sdata=kvsZdko%2FQAXIiZCP19wo%2BxEISLqEw7tMaFO0dvxU5Ew%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by Hawking Zhang
#12 lore raw

RE: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

Okay, will do

Thanks

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Friday, November 29, 2019 4:05 PM
To: Liu, Monk <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

[AMD Official Use Only - Internal Distribution Only]

It seems to me this is one line code that more than 80 characters. Please kindly split it to several ones. Other than that, the Patch is

Regards,
Hawking

-----Original Message-----
From: Liu, Monk <[email protected]>
Sent: 2019年11月29日 15:48
To: Liu, Monk <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: RE: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

@Zhang, Hawking@Deucher, Alexander

Can you help to review it for me ?

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liu, Monk
Sent: Thursday, November 28, 2019 10:22 AM
To: [email protected]
Subject: RE: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

ping
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Monk Liu <[email protected]>
Sent: Tuesday, November 26, 2019 7:50 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 3/5] drm/amdgpu: do autoload right after MEC loaded for SRIOV VF

since we don't have RLCG ucode loading and no SRlist as well

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -2
index 96a6b00..b65fda9 100644
@@ -1490,8 +1490,7 @@ static int psp_np_fw_load(struct psp_context *psp)
 			return ret;
 
 		/* Start rlc autoload after psp recieved all the gfx firmware */
-		if (psp->autoload_supported && ucode->ucode_id ==
-			AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM) {
+		if (psp->autoload_supported && ucode->ucode_id == (amdgpu_sriov_vf(adev) ? AMDGPU_UCODE_ID_CP_MEC2 : AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM)) {
 			ret = psp_rlc_autoload(psp);
 			if (ret) {
 				DRM_ERROR("Failed to start rlc autoload\n");
Signature · 10 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmonk.liu%40amd.com%7C0bc674ddf1c94ba831fa08d773a9b0ed%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637105044990255000&amp;sdata=kvsZdko%2FQAXIiZCP19wo%2BxEISLqEw7tMaFO0dvxU5Ew%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#13 lore raw

PATCH 4/5 drm/amdgpu: use CPU to flush vmhub if sched stopped

In reply to a message not in the archive

otherwse the flush_gpu_tlb will hang if we unload the KMD becuase the schedulers already stopped

---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -1
index 321f8a9..4bb4d27 100644
@@ -326,7 +326,8 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
 
 	if (!adev->mman.buffer_funcs_enabled ||
 	    !adev->ib_pool_ready ||
-	    adev->in_gpu_reset) {
+	    adev->in_gpu_reset ||
+		ring->sched.ready == false) {
 		gmc_v10_0_flush_vm_hub(adev, vmid, AMDGPU_GFXHUB_0, 0);
 		mutex_unlock(&adev->mman.gtt_window_lock);
 		return;
Signature · 6 lines
2.7.4

_______________________________________________
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): 1574769024-30611-4-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

#15 lore raw

Re: [PATCH 4/5] drm/amdgpu: use CPU to flush vmhub if sched stopped

Am 26.11.19 um 12:50 schrieb Monk Liu:

Quoted 13 lines

otherwse the flush_gpu_tlb will hang if we unload the KMD becuase the schedulers already stopped

---
  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index 321f8a9..4bb4d27 100644

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, · line 330

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -1
@@ -326,7 +326,8 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
 
  	if (!adev->mman.buffer_funcs_enabled ||
  	    !adev->ib_pool_ready ||
-	    adev->in_gpu_reset) {
+	    adev->in_gpu_reset ||
+		ring->sched.ready == false) {

Good catch, but you are somehow messing up the indentation here.

With that fixed the patch is Reviewed-by: Christian König <[email protected]>

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, · line 333

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
  		gmc_v10_0_flush_vm_hub(adev, vmid, AMDGPU_GFXHUB_0, 0);
  		mutex_unlock(&adev->mman.gtt_window_lock);
  		return;

_______________________________________________
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): 74af5d01-6d42-113e-9e74-4e481bb6bf2d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

author
#17 lore raw

RE: [PATCH 4/5] drm/amdgpu: use CPU to flush vmhub if sched stopped

Christian

Quoted 1 line
Quoted 1 line

Good catch, but you are somehow messing up the indentation here.

I cannot align with the indentation, because my coding style check script (we use it to push code to gerritgit) requires me to use "tab" instead of "space" It means the current coding style is in fact wrong ....
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, November 26, 2019 8:20 PM
To: Liu, Monk <[email protected]>; [email protected]
Subject: Re: [PATCH 4/5] drm/amdgpu: use CPU to flush vmhub if sched stopped

Am 26.11.19 um 12:50 schrieb Monk Liu:

Quoted 14 lines

otherwse the flush_gpu_tlb will hang if we unload the KMD becuase the schedulers already stopped

---
  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index 321f8a9..4bb4d27 100644

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static void gmc_v10_0_flush_gpu_tlb(struct · line 331

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -1
@@ -326,7 +326,8 @@ static void gmc_v10_0_flush_gpu_tlb(struct 
 amdgpu_device *adev, uint32_t vmid,
 
  	if (!adev->mman.buffer_funcs_enabled ||
  	    !adev->ib_pool_ready ||
-	    adev->in_gpu_reset) {
+	    adev->in_gpu_reset ||
+		ring->sched.ready == false) {

Good catch, but you are somehow messing up the indentation here.

With that fixed the patch is Reviewed-by: Christian König <[email protected]>

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
  		gmc_v10_0_flush_vm_hub(adev, vmid, AMDGPU_GFXHUB_0, 0);
  		mutex_unlock(&adev->mman.gtt_window_lock);

return;

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

author
#18 lore raw

RE: [PATCH 4/5] drm/amdgpu: use CPU to flush vmhub if sched stopped

In reply to a message not in the archive

ping

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Monk Liu <[email protected]>
Sent: Tuesday, November 26, 2019 7:50 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 4/5] drm/amdgpu: use CPU to flush vmhub if sched stopped

otherwse the flush_gpu_tlb will hang if we unload the KMD becuase the schedulers already stopped

---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -1
index 321f8a9..4bb4d27 100644
@@ -326,7 +326,8 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
 
 	if (!adev->mman.buffer_funcs_enabled ||
 	    !adev->ib_pool_ready ||
-	    adev->in_gpu_reset) {
+	    adev->in_gpu_reset ||
+		ring->sched.ready == false) {
 		gmc_v10_0_flush_vm_hub(adev, vmid, AMDGPU_GFXHUB_0, 0);
 		mutex_unlock(&adev->mman.gtt_window_lock);
 		return;

--
2.7.4

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

author
#19 lore raw

PATCH 5/5 drm/amdgpu: fix calltrace during kmd unload

In reply to a message not in the archive

kernel would report a warning on double unpin on the csb BO because we unpin it during hw_fini but actually we don't need to pin/unpin it during hw_init/fini since it is created with kernel pinned

remove all those useless code for gfx9/10

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c |  1 -
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 38 --------------------------------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 ---------------------------------
 3 files changed, 78 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c +0 -1
index c8793e6..289fada 100644
@@ -145,7 +145,6 @@ int amdgpu_gfx_rlc_init_csb(struct amdgpu_device *adev)
 	dst_ptr = adev->gfx.rlc.cs_ptr;
 	adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
 	amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
-	amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
 	amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -38
index a56cba9..5ee7467 100644
@@ -996,39 +996,6 @@ static int gfx_v10_0_rlc_init(struct amdgpu_device *adev)
 	return 0;
 }
 
-static int gfx_v10_0_csb_vram_pin(struct amdgpu_device *adev)
-{
-	int r;
-
-	r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-	if (unlikely(r != 0))
-		return r;
-
-	r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-			AMDGPU_GEM_DOMAIN_VRAM);
-	if (!r)
-		adev->gfx.rlc.clear_state_gpu_addr =
-			amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-	amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-	return r;
-}
-
-static void gfx_v10_0_csb_vram_unpin(struct amdgpu_device *adev)
-{
-	int r;
-
-	if (!adev->gfx.rlc.clear_state_obj)
-		return;
-
-	r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-	if (likely(r == 0)) {
-		amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-		amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-	}
-}
-
 static void gfx_v10_0_mec_fini(struct amdgpu_device *adev)
 {
 	amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL);
@@ -3780,10 +3747,6 @@ static int gfx_v10_0_hw_init(void *handle)
 	int r;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-	r = gfx_v10_0_csb_vram_pin(adev);
-	if (r)
-		return r;
-
 	if (!amdgpu_emu_mode)
 		gfx_v10_0_init_golden_registers(adev);
 
@@ -3871,7 +3834,6 @@ static int gfx_v10_0_hw_fini(void *handle)
 	}
 	gfx_v10_0_cp_enable(adev, false);
 	gfx_v10_0_enable_gui_idle_interrupt(adev, false);
-	gfx_v10_0_csb_vram_unpin(adev);
 
 	return 0;
 }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -39
index 4cc2e50..524a7ba 100644
@@ -1683,39 +1683,6 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
 	return 0;
 }
 
-static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev)
-{
-	int r;
-
-	r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-	if (unlikely(r != 0))
-		return r;
-
-	r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-			AMDGPU_GEM_DOMAIN_VRAM);
-	if (!r)
-		adev->gfx.rlc.clear_state_gpu_addr =
-			amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-	amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-	return r;
-}
-
-static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev)
-{
-	int r;
-
-	if (!adev->gfx.rlc.clear_state_obj)
-		return;
-
-	r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-	if (likely(r == 0)) {
-		amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-		amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-	}
-}
-
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev)
 {
 	amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL);
@@ -3694,10 +3661,6 @@ static int gfx_v9_0_hw_init(void *handle)
 
 	gfx_v9_0_constants_init(adev);
 
-	r = gfx_v9_0_csb_vram_pin(adev);
-	if (r)
-		return r;
-
 	r = adev->gfx.rlc.funcs->resume(adev);
 	if (r)
 		return r;
@@ -3779,8 +3742,6 @@ static int gfx_v9_0_hw_fini(void *handle)
 	gfx_v9_0_cp_enable(adev, false);
 	adev->gfx.rlc.funcs->stop(adev);
 
-	gfx_v9_0_csb_vram_unpin(adev);
-
 	return 0;
 }
 
Signature · 6 lines
2.7.4

_______________________________________________
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): 1574769024-30611-5-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

#21 lore raw

Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

Hi Monk,

hw_fini() is called in suspend code path as well. I'm wondering how csb can be evicted if it's not unpined before suspend.

BR,
Xiaojie

Quoted 162 lines · Monk Liu

kernel would report a warning on double unpin on the csb BO because we unpin it during hw_fini but actually we don't need to pin/unpin it during hw_init/fini since it is created with kernel pinned

remove all those useless code for gfx9/10

---

drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c |  1 -
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 38 --------------------------------
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 ---------------------------------
3 files changed, 78 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c +0 -1
index c8793e6..289fada 100644
@@ -145,7 +145,6 @@ int amdgpu_gfx_rlc_init_csb(struct amdgpu_device *adev)
   dst_ptr = adev->gfx.rlc.cs_ptr;
   adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
   amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
-    amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
   amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
 
   return 0;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -38
index a56cba9..5ee7467 100644
@@ -996,39 +996,6 @@ static int gfx_v10_0_rlc_init(struct amdgpu_device *adev)
   return 0;
 }
 
-static int gfx_v10_0_csb_vram_pin(struct amdgpu_device *adev)
-{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v10_0_csb_vram_unpin(struct amdgpu_device *adev)
-{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v10_0_mec_fini(struct amdgpu_device *adev)
 {
   amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL);
@@ -3780,10 +3747,6 @@ static int gfx_v10_0_hw_init(void *handle)
   int r;
   struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-    r = gfx_v10_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
   if (!amdgpu_emu_mode)
       gfx_v10_0_init_golden_registers(adev);
 
@@ -3871,7 +3834,6 @@ static int gfx_v10_0_hw_fini(void *handle)
   }
   gfx_v10_0_cp_enable(adev, false);
   gfx_v10_0_enable_gui_idle_interrupt(adev, false);
-    gfx_v10_0_csb_vram_unpin(adev);
 
   return 0;
 }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -39
index 4cc2e50..524a7ba 100644
@@ -1683,39 +1683,6 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
   return 0;
 }
 
-static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev)
-{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev)
-{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev)
 {
   amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL);
@@ -3694,10 +3661,6 @@ static int gfx_v9_0_hw_init(void *handle)
 
   gfx_v9_0_constants_init(adev);
 
-    r = gfx_v9_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
   r = adev->gfx.rlc.funcs->resume(adev);
   if (r)
       return r;
@@ -3779,8 +3742,6 @@ static int gfx_v9_0_hw_fini(void *handle)
   gfx_v9_0_cp_enable(adev, false);
   adev->gfx.rlc.funcs->stop(adev);
 
-    gfx_v9_0_csb_vram_unpin(adev);
-
   return 0;
 }
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CXiaojie.Yuan%40amd.com%7C65e162e509ea4a90f79308d77266de65%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637103658464512751&amp;sdata=r5fpid5IsP8anzg%2FZIYHn0N8xceBvG7rtRG80%2B7868o%3D&amp;reserved=0

_______________________________________________
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): 7D1BEE15-D37F-4821-9DFF-CC1DD258A2CB-5C7GfCeVMHo@public.gmane.org

author
#23 lore raw

RE: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

Hi Xiaojie

For SRIOV we don't use suspend so I didn't think to that part, thanks for the remind !
But we still need to fix this call trace issue anyway (our jenkins testing system consider such call trace as an error )

How about we do " adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);" in the hw_init() ? this way You don't need to evict the CSIB during suspend and the CSIB always will be re-initialized after S3 resume ?

@Deucher, Alexander @Koenig, Christian what's your opinion ?
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Yuan, Xiaojie <[email protected]>
Sent: Tuesday, November 26, 2019 9:10 PM
To: Liu, Monk <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

Hi Monk,

hw_fini() is called in suspend code path as well. I'm wondering how csb can be evicted if it's not unpined before suspend.

BR,
Xiaojie

Quoted 154 lines · Monk Liu

kernel would report a warning on double unpin on the csb BO because we unpin it during hw_fini but actually we don't need to pin/unpin it during hw_init/fini since it is created with kernel pinned

remove all those useless code for gfx9/10

---

drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c |  1 - 
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 38 --------------------------------
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 ---------------------------------
3 files changed, 78 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c +0 -1
index c8793e6..289fada 100644
@@ -145,7 +145,6 @@ int amdgpu_gfx_rlc_init_csb(struct amdgpu_device *adev)
   dst_ptr = adev->gfx.rlc.cs_ptr;
   adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
   amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
-    amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
   amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
 
   return 0;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -37
index a56cba9..5ee7467 100644
@@ -996,39 +996,6 @@ static int gfx_v10_0_rlc_init(struct amdgpu_device *adev)
   return 0;
 }
 
-static int gfx_v10_0_csb_vram_pin(struct amdgpu_device *adev) -{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v10_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v10_0_mec_fini(struct amdgpu_device *adev) {
   amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@ 
-3780,10 +3747,6 @@ static int gfx_v10_0_hw_init(void *handle)
   int r;
   struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-    r = gfx_v10_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
   if (!amdgpu_emu_mode)
       gfx_v10_0_init_golden_registers(adev);
@@ -3871,7 +3834,6 @@ static int gfx_v10_0_hw_fini(void *handle)
   }
   gfx_v10_0_cp_enable(adev, false);
   gfx_v10_0_enable_gui_idle_interrupt(adev, false);
-    gfx_v10_0_csb_vram_unpin(adev);
 
   return 0;
 }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -39
index 4cc2e50..524a7ba 100644
@@ -1683,39 +1683,6 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
   return 0;
 }
 
-static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev) -{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev) {
   amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@ 
-3694,10 +3661,6 @@ static int gfx_v9_0_hw_init(void *handle)
 
   gfx_v9_0_constants_init(adev);
 
-    r = gfx_v9_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
   r = adev->gfx.rlc.funcs->resume(adev);
   if (r)
       return r;
@@ -3779,8 +3742,6 @@ static int gfx_v9_0_hw_fini(void *handle)
   gfx_v9_0_cp_enable(adev, false);
   adev->gfx.rlc.funcs->stop(adev);
 
-    gfx_v9_0_csb_vram_unpin(adev);
-
   return 0;
 }
 
--

2.7.4

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CXi aojie.Yuan%40amd.com%7C65e162e509ea4a90f79308d77266de65%7C3dd8961fe488 4e608e11a82d994e183d%7C0%7C0%7C637103658464512751&amp;sdata=r5fpid5IsP 8anzg%2FZIYHn0N8xceBvG7rtRG80%2B7868o%3D&amp;reserved=0

_______________________________________________
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): MN2PR12MB3933457BEF5A0AAAC37BE79184470-rweVpJHSKTq/[email protected]

Reviewed-by Hawking Zhang
#25 lore raw

Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

[AMD Official Use Only - Internal Distribution Only]

Hi Monk,

As long as the content of CSIB won't be changed by CP FW in runtime, I have no objection to 're-initialize after S3 resume'.
I am not quite sure about the actual behavior, let me do an experiment to confirm that and add Hawking / Jack who adds the original CSIB code for comment.

BTW, note that I recently has a patch to re-initialize CSIB in baco sequence, please consider to squash it when making your final fix:

commit c8494497feb0050a66128ca626f3883d6f08d783

Author: Xiaojie Yuan <[email protected]>
Date:   Wed Nov 20 14:02:22 2019 +0800

drm/amdgpu/gfx10: re-init clear state buffer after gpu reset

This patch fixes 2nd baco reset failure with gfxoff enabled on navi1x.

clear state buffer (resides in vram) is corrupted after 1st baco reset, upon gfxoff exit, CPF gets garbage header in CSIB and hangs.

BR,
Xiaojie

________________________________________
From: Liu, Monk <[email protected]>
Sent: Thursday, November 28, 2019 10:53 AM
To: Yuan, Xiaojie; Deucher, Alexander; Koenig, Christian
Cc: [email protected]
Subject: RE: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

Hi Xiaojie

For SRIOV we don't use suspend so I didn't think to that part, thanks for the remind !
But we still need to fix this call trace issue anyway (our jenkins testing system consider such call trace as an error )

How about we do " adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);" in the hw_init() ? this way You don't need to evict the CSIB during suspend and the CSIB always will be re-initialized after S3 resume ?

@Deucher, Alexander @Koenig, Christian what's your opinion ?
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Yuan, Xiaojie <[email protected]>
Sent: Tuesday, November 26, 2019 9:10 PM
To: Liu, Monk <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

Hi Monk,

hw_fini() is called in suspend code path as well. I'm wondering how csb can be evicted if it's not unpined before suspend.

BR,
Xiaojie

Quoted 154 lines · Monk Liu

kernel would report a warning on double unpin on the csb BO because we unpin it during hw_fini but actually we don't need to pin/unpin it during hw_init/fini since it is created with kernel pinned

remove all those useless code for gfx9/10

---

drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c |  1 -
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 38 --------------------------------
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 ---------------------------------
3 files changed, 78 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c +0 -1
index c8793e6..289fada 100644
@@ -145,7 +145,6 @@ int amdgpu_gfx_rlc_init_csb(struct amdgpu_device *adev)
   dst_ptr = adev->gfx.rlc.cs_ptr;
   adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
   amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
-    amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
   amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
 
   return 0;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -37
index a56cba9..5ee7467 100644
@@ -996,39 +996,6 @@ static int gfx_v10_0_rlc_init(struct amdgpu_device *adev)
   return 0;
 }
 
-static int gfx_v10_0_csb_vram_pin(struct amdgpu_device *adev) -{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v10_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v10_0_mec_fini(struct amdgpu_device *adev) {
   amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@
-3780,10 +3747,6 @@ static int gfx_v10_0_hw_init(void *handle)
   int r;
   struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-    r = gfx_v10_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
   if (!amdgpu_emu_mode)
       gfx_v10_0_init_golden_registers(adev);
@@ -3871,7 +3834,6 @@ static int gfx_v10_0_hw_fini(void *handle)
   }
   gfx_v10_0_cp_enable(adev, false);
   gfx_v10_0_enable_gui_idle_interrupt(adev, false);
-    gfx_v10_0_csb_vram_unpin(adev);
 
   return 0;
 }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -39
index 4cc2e50..524a7ba 100644
@@ -1683,39 +1683,6 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
   return 0;
 }
 
-static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev) -{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev) {
   amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@
-3694,10 +3661,6 @@ static int gfx_v9_0_hw_init(void *handle)
 
   gfx_v9_0_constants_init(adev);
 
-    r = gfx_v9_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
   r = adev->gfx.rlc.funcs->resume(adev);
   if (r)
       return r;
@@ -3779,8 +3742,6 @@ static int gfx_v9_0_hw_fini(void *handle)
   gfx_v9_0_cp_enable(adev, false);
   adev->gfx.rlc.funcs->stop(adev);
 
-    gfx_v9_0_csb_vram_unpin(adev);
-
   return 0;
 }
 
--

2.7.4

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CXi aojie.Yuan%40amd.com%7C65e162e509ea4a90f79308d77266de65%7C3dd8961fe488 4e608e11a82d994e183d%7C0%7C0%7C637103658464512751&amp;sdata=r5fpid5IsP 8anzg%2FZIYHn0N8xceBvG7rtRG80%2B7868o%3D&amp;reserved=0

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

#26 lore raw

Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

In reply to a message not in the archive

Hi Monk,

if the content of the CSIB is constant then it is certainly better to just re-initialize it.

This also prevents from corruption because of VRAM lost.

Christian.

Am 28.11.19 um 03:53 schrieb Liu, Monk:

Quoted 181 lines

Hi Xiaojie

For SRIOV we don't use suspend so I didn't think to that part, thanks for the remind !
But we still need to fix this call trace issue anyway (our jenkins testing system consider such call trace as an error )

How about we do " adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);" in the hw_init() ? this way You don't need to evict the CSIB during suspend and the CSIB always will be re-initialized after S3 resume ?

@Deucher, Alexander @Koenig, Christian what's your opinion ?
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Yuan, Xiaojie <[email protected]>
Sent: Tuesday, November 26, 2019 9:10 PM
To: Liu, Monk <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

Hi Monk,

hw_fini() is called in suspend code path as well. I'm wondering how csb can be evicted if it's not unpined before suspend.

BR,
Xiaojie

Quoted 154 lines · Monk Liu

kernel would report a warning on double unpin on the csb BO because we unpin it during hw_fini but actually we don't need to pin/unpin it during hw_init/fini since it is created with kernel pinned

remove all those useless code for gfx9/10

---

drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c |  1 -
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 38 --------------------------------
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 ---------------------------------
3 files changed, 78 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c +0 -1
index c8793e6..289fada 100644
@@ -145,7 +145,6 @@ int amdgpu_gfx_rlc_init_csb(struct amdgpu_device *adev)
    dst_ptr = adev->gfx.rlc.cs_ptr;
    adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
    amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
-    amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
 
    return 0;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -37
index a56cba9..5ee7467 100644
@@ -996,39 +996,6 @@ static int gfx_v10_0_rlc_init(struct amdgpu_device *adev)
    return 0;
 }
 
-static int gfx_v10_0_csb_vram_pin(struct amdgpu_device *adev) -{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v10_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v10_0_mec_fini(struct amdgpu_device *adev) {
    amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@
-3780,10 +3747,6 @@ static int gfx_v10_0_hw_init(void *handle)
    int r;
    struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-    r = gfx_v10_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
    if (!amdgpu_emu_mode)
        gfx_v10_0_init_golden_registers(adev);
@@ -3871,7 +3834,6 @@ static int gfx_v10_0_hw_fini(void *handle)
    }
    gfx_v10_0_cp_enable(adev, false);
    gfx_v10_0_enable_gui_idle_interrupt(adev, false);
-    gfx_v10_0_csb_vram_unpin(adev);
 
    return 0;
 }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -39
index 4cc2e50..524a7ba 100644
@@ -1683,39 +1683,6 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
    return 0;
 }
 
-static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev) -{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev) {
    amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@
-3694,10 +3661,6 @@ static int gfx_v9_0_hw_init(void *handle)
 
    gfx_v9_0_constants_init(adev);
 
-    r = gfx_v9_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
    r = adev->gfx.rlc.funcs->resume(adev);
    if (r)
        return r;
@@ -3779,8 +3742,6 @@ static int gfx_v9_0_hw_fini(void *handle)
    gfx_v9_0_cp_enable(adev, false);
    adev->gfx.rlc.funcs->stop(adev);
 
-    gfx_v9_0_csb_vram_unpin(adev);
-
    return 0;
 }
 
--

2.7.4

Quoted 12 lines
Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CXi aojie.Yuan%40amd.com%7C65e162e509ea4a90f79308d77266de65%7C3dd8961fe488 4e608e11a82d994e183d%7C0%7C0%7C637103658464512751&amp;sdata=r5fpid5IsP 8anzg%2FZIYHn0N8xceBvG7rtRG80%2B7868o%3D&amp;reserved=0

_______________________________________________
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): 6d31ba81-c01d-f334-7c14-fb6964674d97-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

author
#28 lore raw

RE: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

The content of CSIB is always static, I submitted a patch to use the re-init and get rid of pin/unpin CSIB in hw_ini/fini, (my purpose is to fix the double unpin warning during unload )
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, November 28, 2019 7:51 PM
To: Liu, Monk <[email protected]>; Yuan, Xiaojie <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

Hi Monk,

if the content of the CSIB is constant then it is certainly better to just re-initialize it.

This also prevents from corruption because of VRAM lost.

Christian.

Am 28.11.19 um 03:53 schrieb Liu, Monk:

Quoted 194 lines

Hi Xiaojie

For SRIOV we don't use suspend so I didn't think to that part, thanks for the remind ! But we still need to fix this call trace issue anyway (our jenkins testing system consider such call trace as an error )

How about we do " adev->gfx.rlc.funcs->get_csb_buffer(adev,
dst_ptr);" in the hw_init() ? this way You don't need to evict the CSIB during suspend and the CSIB always will be re-initialized after S3 resume ?

@Deucher, Alexander @Koenig, Christian what's your opinion ?
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Yuan, Xiaojie <[email protected]>
Sent: Tuesday, November 26, 2019 9:10 PM
To: Liu, Monk <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

Hi Monk,

hw_fini() is called in suspend code path as well. I'm wondering how csb can be evicted if it's not unpined before suspend.

BR,
Xiaojie

Quoted 154 lines · Monk Liu

kernel would report a warning on double unpin on the csb BO because we unpin it during hw_fini but actually we don't need to pin/unpin it during hw_init/fini since it is created with kernel pinned

remove all those useless code for gfx9/10

---

drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c |  1 - 
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 38 --------------------------------
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 ---------------------------------
3 files changed, 78 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c +0 -1
index c8793e6..289fada 100644
@@ -145,7 +145,6 @@ int amdgpu_gfx_rlc_init_csb(struct amdgpu_device *adev)
    dst_ptr = adev->gfx.rlc.cs_ptr;
    adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
    amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
-    amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
 
    return 0;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -37
index a56cba9..5ee7467 100644
@@ -996,39 +996,6 @@ static int gfx_v10_0_rlc_init(struct amdgpu_device *adev)
    return 0;
 }
 
-static int gfx_v10_0_csb_vram_pin(struct amdgpu_device *adev) -{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v10_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v10_0_mec_fini(struct amdgpu_device *adev) {
    amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@
-3780,10 +3747,6 @@ static int gfx_v10_0_hw_init(void *handle)
    int r;
    struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-    r = gfx_v10_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
    if (!amdgpu_emu_mode)
        gfx_v10_0_init_golden_registers(adev);
@@ -3871,7 +3834,6 @@ static int gfx_v10_0_hw_fini(void *handle)
    }
    gfx_v10_0_cp_enable(adev, false);
    gfx_v10_0_enable_gui_idle_interrupt(adev, false);
-    gfx_v10_0_csb_vram_unpin(adev);
 
    return 0;
 }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -39
index 4cc2e50..524a7ba 100644
@@ -1683,39 +1683,6 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
    return 0;
 }
 
-static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev) -{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev) {
    amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@
-3694,10 +3661,6 @@ static int gfx_v9_0_hw_init(void *handle)
 
    gfx_v9_0_constants_init(adev);
 
-    r = gfx_v9_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
    r = adev->gfx.rlc.funcs->resume(adev);
    if (r)
        return r;
@@ -3779,8 +3742,6 @@ static int gfx_v9_0_hw_fini(void *handle)
    gfx_v9_0_cp_enable(adev, false);
    adev->gfx.rlc.funcs->stop(adev);
 
-    gfx_v9_0_csb_vram_unpin(adev);
-
    return 0;
 }
 
--

2.7.4

Quoted 12 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CX i aojie.Yuan%40amd.com%7C65e162e509ea4a90f79308d77266de65%7C3dd8961fe48 8 4e608e11a82d994e183d%7C0%7C0%7C637103658464512751&amp;sdata=r5fpid5Is P
8anzg%2FZIYHn0N8xceBvG7rtRG80%2B7868o%3D&amp;reserved=0

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CMo nk.Liu%40amd.com%7Ccadef01b84ab45f90f1908d773f932cc%7C3dd8961fe4884e60 8e11a82d994e183d%7C0%7C0%7C637105386456299680&amp;sdata=hYsvNtzUb%2BTb iANKAx2x9dmYW1ikC66r%2B6Hbk3244PE%3D&amp;reserved=0

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

maintainer
#29 lore raw

Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

In this case feel free to add an Acked-by: Christian König <[email protected]> to your patch.

But I would recommend to get an rb from somebody which knows that stuff better than I do.

Regards,
Christian.

Am 29.11.19 um 02:58 schrieb Liu, Monk:

Quoted 14 lines

The content of CSIB is always static, I submitted a patch to use the re-init and get rid of pin/unpin CSIB in hw_ini/fini, (my purpose is to fix the double unpin warning during unload )
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, November 28, 2019 7:51 PM
To: Liu, Monk <[email protected]>; Yuan, Xiaojie <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

Hi Monk,

Quoted 209 lines

if the content of the CSIB is constant then it is certainly better to just re-initialize it.

This also prevents from corruption because of VRAM lost.

Christian.

Am 28.11.19 um 03:53 schrieb Liu, Monk:

Quoted 202 lines

Hi Xiaojie

For SRIOV we don't use suspend so I didn't think to that part, thanks for the remind ! But we still need to fix this call trace issue anyway (our jenkins testing system consider such call trace as an error )

How about we do " adev->gfx.rlc.funcs->get_csb_buffer(adev,
dst_ptr);" in the hw_init() ? this way You don't need to evict the CSIB during suspend and the CSIB always will be re-initialized after S3 resume ?

@Deucher, Alexander @Koenig, Christian what's your opinion ?
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Yuan, Xiaojie <[email protected]>
Sent: Tuesday, November 26, 2019 9:10 PM
To: Liu, Monk <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

Hi Monk,

hw_fini() is called in suspend code path as well. I'm wondering how csb can be evicted if it's not unpined before suspend.

BR,
Xiaojie

Quoted 154 lines · Monk Liu

kernel would report a warning on double unpin on the csb BO because we unpin it during hw_fini but actually we don't need to pin/unpin it during hw_init/fini since it is created with kernel pinned

remove all those useless code for gfx9/10

---

drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c |  1 -
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 38 --------------------------------
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 ---------------------------------
3 files changed, 78 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c +0 -1
index c8793e6..289fada 100644
@@ -145,7 +145,6 @@ int amdgpu_gfx_rlc_init_csb(struct amdgpu_device *adev)
     dst_ptr = adev->gfx.rlc.cs_ptr;
     adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
     amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
-    amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
     amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
 
     return 0;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -37
index a56cba9..5ee7467 100644
@@ -996,39 +996,6 @@ static int gfx_v10_0_rlc_init(struct amdgpu_device *adev)
     return 0;
 }
 
-static int gfx_v10_0_csb_vram_pin(struct amdgpu_device *adev) -{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v10_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v10_0_mec_fini(struct amdgpu_device *adev) {
     amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@
-3780,10 +3747,6 @@ static int gfx_v10_0_hw_init(void *handle)
     int r;
     struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-    r = gfx_v10_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
     if (!amdgpu_emu_mode)
         gfx_v10_0_init_golden_registers(adev);
@@ -3871,7 +3834,6 @@ static int gfx_v10_0_hw_fini(void *handle)
     }
     gfx_v10_0_cp_enable(adev, false);
     gfx_v10_0_enable_gui_idle_interrupt(adev, false);
-    gfx_v10_0_csb_vram_unpin(adev);
 
     return 0;
 }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -39
index 4cc2e50..524a7ba 100644
@@ -1683,39 +1683,6 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
     return 0;
 }
 
-static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev) -{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev) {
     amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@
-3694,10 +3661,6 @@ static int gfx_v9_0_hw_init(void *handle)
 
     gfx_v9_0_constants_init(adev);
 
-    r = gfx_v9_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
     r = adev->gfx.rlc.funcs->resume(adev);
     if (r)
         return r;
@@ -3779,8 +3742,6 @@ static int gfx_v9_0_hw_fini(void *handle)
     gfx_v9_0_cp_enable(adev, false);
     adev->gfx.rlc.funcs->stop(adev);
 
-    gfx_v9_0_csb_vram_unpin(adev);
-
     return 0;
 }
 
--

2.7.4

Quoted 12 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CX i aojie.Yuan%40amd.com%7C65e162e509ea4a90f79308d77266de65%7C3dd8961fe48 8 4e608e11a82d994e183d%7C0%7C0%7C637103658464512751&amp;sdata=r5fpid5Is P
8anzg%2FZIYHn0N8xceBvG7rtRG80%2B7868o%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CMo nk.Liu%40amd.com%7Ccadef01b84ab45f90f1908d773f932cc%7C3dd8961fe4884e60 8e11a82d994e183d%7C0%7C0%7C637105386456299680&amp;sdata=hYsvNtzUb%2BTb iANKAx2x9dmYW1ikC66r%2B6Hbk3244PE%3D&amp;reserved=0

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

#30 lore raw

RE: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

It is tested/verified by Xiaojie on nv14 against S3 issues.

Thanks

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Friday, November 29, 2019 3:46 PM
To: Liu, Monk <[email protected]>; Yuan, Xiaojie <[email protected]>; Deucher, Alexander <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

In this case feel free to add an Acked-by: Christian König <[email protected]> to your patch.

But I would recommend to get an rb from somebody which knows that stuff better than I do.

Regards,
Christian.

Am 29.11.19 um 02:58 schrieb Liu, Monk:

Quoted 19 lines

The content of CSIB is always static, I submitted a patch to use the re-init and get rid of pin/unpin CSIB in hw_ini/fini, (my purpose is to fix the double unpin warning during unload )
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, November 28, 2019 7:51 PM
To: Liu, Monk <[email protected]>; Yuan, Xiaojie <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

Hi Monk,

Quoted 219 lines

if the content of the CSIB is constant then it is certainly better to just re-initialize it.

This also prevents from corruption because of VRAM lost.

Christian.

Am 28.11.19 um 03:53 schrieb Liu, Monk:

Quoted 212 lines

Hi Xiaojie

For SRIOV we don't use suspend so I didn't think to that part, thanks for the remind ! But we still need to fix this call trace issue anyway (our jenkins testing system consider such call trace as an error )

How about we do " adev->gfx.rlc.funcs->get_csb_buffer(adev,
dst_ptr);" in the hw_init() ? this way You don't need to evict the CSIB during suspend and the CSIB always will be re-initialized after S3 resume ?

@Deucher, Alexander @Koenig, Christian what's your opinion ?
_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Yuan, Xiaojie <[email protected]>
Sent: Tuesday, November 26, 2019 9:10 PM
To: Liu, Monk <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

Hi Monk,

hw_fini() is called in suspend code path as well. I'm wondering how csb can be evicted if it's not unpined before suspend.

BR,
Xiaojie

Quoted 156 lines · Monk Liu

kernel would report a warning on double unpin on the csb BO because we unpin it during hw_fini but actually we don't need to pin/unpin it during hw_init/fini since it is created with kernel pinned

remove all those useless code for gfx9/10

---

drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c |  1 - 
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 38 --------------------------------
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 ---------------------------------
3 files changed, 78 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c +0 -1
index c8793e6..289fada 100644
@@ -145,7 +145,6 @@ int amdgpu_gfx_rlc_init_csb(struct amdgpu_device *adev)
     dst_ptr = adev->gfx.rlc.cs_ptr;
     adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
     amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
-    amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
     amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
 
     return 0;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -31
index a56cba9..5ee7467 100644
@@ -996,39 +996,6 @@ static int gfx_v10_0_rlc_init(struct amdgpu_device *adev)
     return 0;
 }
 
-static int gfx_v10_0_csb_vram_pin(struct amdgpu_device *adev) -{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v10_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v10_0_mec_fini(struct amdgpu_device *adev) {
     amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); 

@@
-3780,10 +3747,6 @@ static int gfx_v10_0_hw_init(void *handle)

     int r;
     struct amdgpu_device *adev = (struct amdgpu_device *)handle;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -5
-    r = gfx_v10_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
     if (!amdgpu_emu_mode)
         gfx_v10_0_init_golden_registers(adev);
@@ -3871,7 +3834,6 @@ static int gfx_v10_0_hw_fini(void *handle)
     }
     gfx_v10_0_cp_enable(adev, false);
     gfx_v10_0_enable_gui_idle_interrupt(adev, false);
-    gfx_v10_0_csb_vram_unpin(adev);
 
     return 0;
 }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -31
index 4cc2e50..524a7ba 100644
@@ -1683,39 +1683,6 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
     return 0;
 }
 
-static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev) -{
-    int r;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-    if (unlikely(r != 0))
-        return r;
-
-    r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-            AMDGPU_GEM_DOMAIN_VRAM);
-    if (!r)
-        adev->gfx.rlc.clear_state_gpu_addr =
-            amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-    amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-    return r;
-}
-
-static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-    int r;
-
-    if (!adev->gfx.rlc.clear_state_obj)
-        return;
-
-    r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-    if (likely(r == 0)) {
-        amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-        amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-    }
-}
-
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev) {
     amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); 

@@
-3694,10 +3661,6 @@ static int gfx_v9_0_hw_init(void *handle)

     gfx_v9_0_constants_init(adev);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -7
-    r = gfx_v9_0_csb_vram_pin(adev);
-    if (r)
-        return r;
-
     r = adev->gfx.rlc.funcs->resume(adev);
     if (r)
         return r;
@@ -3779,8 +3742,6 @@ static int gfx_v9_0_hw_fini(void *handle)
     gfx_v9_0_cp_enable(adev, false);
     adev->gfx.rlc.funcs->stop(adev);
 
-    gfx_v9_0_csb_vram_unpin(adev);
-
     return 0;
 }
 
--

2.7.4

Quoted 16 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fli
s
t s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7C X
i aojie.Yuan%40amd.com%7C65e162e509ea4a90f79308d77266de65%7C3dd8961fe4 8
8 4e608e11a82d994e183d%7C0%7C0%7C637103658464512751&amp;sdata=r5fpid5I s
P
8anzg%2FZIYHn0N8xceBvG7rtRG80%2B7868o%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CM o nk.Liu%40amd.com%7Ccadef01b84ab45f90f1908d773f932cc%7C3dd8961fe4884e6 0 8e11a82d994e183d%7C0%7C0%7C637105386456299680&amp;sdata=hYsvNtzUb%2BT b
iANKAx2x9dmYW1ikC66r%2B6Hbk3244PE%3D&amp;reserved=0

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

author
#31 lore raw

RE: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

In reply to a message not in the archive

ping

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Monk Liu <[email protected]>
Sent: Tuesday, November 26, 2019 7:50 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 5/5] drm/amdgpu: fix calltrace during kmd unload

kernel would report a warning on double unpin on the csb BO because we unpin it during hw_fini but actually we don't need to pin/unpin it during hw_init/fini since it is created with kernel pinned

remove all those useless code for gfx9/10

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c |  1 -  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 38 --------------------------------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 39 ---------------------------------
 3 files changed, 78 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.c +0 -1
index c8793e6..289fada 100644
@@ -145,7 +145,6 @@ int amdgpu_gfx_rlc_init_csb(struct amdgpu_device *adev)
 	dst_ptr = adev->gfx.rlc.cs_ptr;
 	adev->gfx.rlc.funcs->get_csb_buffer(adev, dst_ptr);
 	amdgpu_bo_kunmap(adev->gfx.rlc.clear_state_obj);
-	amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
 	amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -31
index a56cba9..5ee7467 100644
@@ -996,39 +996,6 @@ static int gfx_v10_0_rlc_init(struct amdgpu_device *adev)
 	return 0;
 }
 
-static int gfx_v10_0_csb_vram_pin(struct amdgpu_device *adev) -{
-	int r;
-
-	r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-	if (unlikely(r != 0))
-		return r;
-
-	r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-			AMDGPU_GEM_DOMAIN_VRAM);
-	if (!r)
-		adev->gfx.rlc.clear_state_gpu_addr =
-			amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-	amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-	return r;
-}
-
-static void gfx_v10_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-	int r;
-
-	if (!adev->gfx.rlc.clear_state_obj)
-		return;
-
-	r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-	if (likely(r == 0)) {
-		amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-		amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-	}
-}
-
 static void gfx_v10_0_mec_fini(struct amdgpu_device *adev)  {
 	amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@ -3780,10 +3747,6 @@ static int gfx_v10_0_hw_init(void *handle)
 	int r;

struct amdgpu_device *adev = (struct amdgpu_device *)handle;

- r = gfx_v10_0_csb_vram_pin(adev);
- if (r)
- return r;
-
if (!amdgpu_emu_mode)
gfx_v10_0_init_golden_registers(adev);

@@ -3871,7 +3834,6 @@ static int gfx_v10_0_hw_fini(void *handle)
}
gfx_v10_0_cp_enable(adev, false); gfx_v10_0_enable_gui_idle_interrupt(adev, false);
- gfx_v10_0_csb_vram_unpin(adev);

return 0;
}

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -31
index 4cc2e50..524a7ba 100644
@@ -1683,39 +1683,6 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
 	return 0;
 }
 
-static int gfx_v9_0_csb_vram_pin(struct amdgpu_device *adev) -{
-	int r;
-
-	r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, false);
-	if (unlikely(r != 0))
-		return r;
-
-	r = amdgpu_bo_pin(adev->gfx.rlc.clear_state_obj,
-			AMDGPU_GEM_DOMAIN_VRAM);
-	if (!r)
-		adev->gfx.rlc.clear_state_gpu_addr =
-			amdgpu_bo_gpu_offset(adev->gfx.rlc.clear_state_obj);
-
-	amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-
-	return r;
-}
-
-static void gfx_v9_0_csb_vram_unpin(struct amdgpu_device *adev) -{
-	int r;
-
-	if (!adev->gfx.rlc.clear_state_obj)
-		return;
-
-	r = amdgpu_bo_reserve(adev->gfx.rlc.clear_state_obj, true);
-	if (likely(r == 0)) {
-		amdgpu_bo_unpin(adev->gfx.rlc.clear_state_obj);
-		amdgpu_bo_unreserve(adev->gfx.rlc.clear_state_obj);
-	}
-}
-
 static void gfx_v9_0_mec_fini(struct amdgpu_device *adev)  {
 	amdgpu_bo_free_kernel(&adev->gfx.mec.hpd_eop_obj, NULL, NULL); @@ -3694,10 +3661,6 @@ static int gfx_v9_0_hw_init(void *handle)
 

gfx_v9_0_constants_init(adev);

- r = gfx_v9_0_csb_vram_pin(adev);
- if (r)
- return r;
-
r = adev->gfx.rlc.funcs->resume(adev);
if (r)
return r;
@@ -3779,8 +3742,6 @@ static int gfx_v9_0_hw_fini(void *handle)
gfx_v9_0_cp_enable(adev, false); adev->gfx.rlc.funcs->stop(adev);

- gfx_v9_0_csb_vram_unpin(adev);
-
return 0;
}

--
2.7.4

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

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

Ping

_____________________________________
Monk Liu|GPU Virtualization Team |AMD

-----Original Message-----
From: Monk Liu <[email protected]>
Sent: Tuesday, November 26, 2019 7:50 PM
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH 1/5] drm/amdgpu: fix GFX10 missing CSIB set

still need to init csb even for SRIOV

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +5 -4
index 4d6df35..879c0a1 100644
@@ -1926,14 +1926,16 @@ static int gfx_v10_0_rlc_resume(struct amdgpu_device *adev)  {
 	int r;
 
-	if (amdgpu_sriov_vf(adev))
-		return 0;
-
 	if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
 		r = gfx_v10_0_wait_for_rlc_autoload_complete(adev);
 		if (r)
 			return r;
 
+		if (amdgpu_sriov_vf(adev)) {
+			gfx_v10_0_init_csb(adev);
+			return 0;
+		}
+
 		r = gfx_v10_0_init_pg(adev);
 		if (r)
 			return r;
--

2.7.4

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