Skip to contentSkip to conversation

drm/amdgpu: add fwlog support on vcn_v4_0_3

PATCH New Alex Deucher 1 participant 8 messages Mar 30, 2023

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/8 drm/amdgpu: add fwlog support on vcn_v4_0_3

From: James Zhu <[email protected]>

Add fwlog support on vcn_v4_0_3.

Acked-by Leo Liu <[email protected]>

---
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +3 -0
index 8db50a50b868..40de2852c5ca 100644
@@ -118,6 +118,9 @@ static int vcn_v4_0_3_sw_init(void *handle)
 		fw_shared = adev->vcn.inst[i].fw_shared.cpu_addr;
 		fw_shared->present_flag_0 = 0;
 		fw_shared->sq.is_enabled = cpu_to_le32(true);
+
+		if (amdgpu_vcnfw_log)
+			amdgpu_vcn_fwlog_init(&adev->vcn.inst[i]);
 	}
 
 	if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)
Signature · 1 line
2.39.2
author maintainer
#1 lore raw

PATCH 2/8 drm/amdgpu: add unified queue support on vcn_v4_0_3

From: James Zhu <[email protected]>

Add unified queue support on vcn_v4_0_3.

Acked-by Leo Liu <[email protected]>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c |   9 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 173 +++++++++++++-----------
 2 files changed, 102 insertions(+), 80 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +6 -3
index 72eb12aa2e8d..2e28b19e741e 100644
@@ -1004,11 +1004,14 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 
 int amdgpu_vcn_unified_ring_test_ib(struct amdgpu_ring *ring, long timeout)
 {
+	struct amdgpu_device *adev = ring->adev;
 	long r;
 
-	r = amdgpu_vcn_enc_ring_test_ib(ring, timeout);
-	if (r)
-		goto error;
+	if (adev->ip_versions[UVD_HWIP][0] != IP_VERSION(4, 0, 3)) {
+		r = amdgpu_vcn_enc_ring_test_ib(ring, timeout);
+		if (r)
+			goto error;
+	}
 
 	r =  amdgpu_vcn_dec_sw_ring_test_ib(ring, timeout);
 
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +96 -77

372 lines not on this page · raw message

Signature · 1 line
2.39.2
author maintainer
#2 lore raw

PATCH 3/8 drm/amdgpu: enable indirect_sram mode on vcn_v4_0_3

In reply to Alex Deucher

From: James Zhu <[email protected]>

Enable indirect_sram mode on vcn_v4_0_3.

Acked-by Leo Liu <[email protected]>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -12
index 2e28b19e741e..daa69ae766d3 100644
@@ -113,18 +113,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
 	for (i = 0; i < adev->vcn.num_vcn_inst; i++)
 		atomic_set(&adev->vcn.inst[i].dpg_enc_submission_cnt, 0);
 
-	switch (adev->ip_versions[UVD_HWIP][0]) {
-	case IP_VERSION(4, 0, 3):
-		if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
-		    (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
-			adev->vcn.indirect_sram = false;
-		break;
-	default:
-		if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
-		    (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
-			adev->vcn.indirect_sram = true;
-		break;
-	}
+	if ((adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) &&
+	    (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG))
+		adev->vcn.indirect_sram = true;
 
 	/*
 	 * Some Steam Deck's BIOS versions are incompatible with the
Signature · 1 line
2.39.2
author maintainer
#3 lore raw

PATCH 4/8 drm/amdgpu: enable vcn/jpeg on vcn_v4_0_3

In reply to Alex Deucher

From: James Zhu <[email protected]>

Enable vcn/jpeg on vcn_v4_0_3.

Acked-by Leo Liu <[email protected]>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +7 -1
index 5dc89cfa86ad..200cbb0d3052 100644
@@ -76,6 +76,8 @@
 #include "jpeg_v3_0.h"
 #include "vcn_v4_0.h"
 #include "jpeg_v4_0.h"
+#include "vcn_v4_0_3.h"
+#include "jpeg_v4_0_3.h"
 #include "amdgpu_vkms.h"
 #include "mes_v10_1.h"
 #include "mes_v11_0.h"
@@ -1999,7 +2001,11 @@ static int amdgpu_discovery_set_mm_ip_blocks(struct amdgpu_device *adev)
 		case IP_VERSION(4, 0, 4):
 			amdgpu_device_ip_block_add(adev, &vcn_v4_0_ip_block);
 			amdgpu_device_ip_block_add(adev, &jpeg_v4_0_ip_block);
-			return 0;
+			break;
+		case IP_VERSION(4, 0, 3):
+			amdgpu_device_ip_block_add(adev, &vcn_v4_0_3_ip_block);
+			amdgpu_device_ip_block_add(adev, &jpeg_v4_0_3_ip_block);
+			break;
 		default:
 			dev_err(adev->dev,
 				"Failed to add vcn/jpeg ip block(UVD_HWIP:0x%x)\n",
Signature · 1 line
2.39.2
author maintainer
#4 lore raw

PATCH 5/8 drm/amdgpu: Remove SMU powergate message call for SDMA

In reply to Alex Deucher

From: Asad kamal <[email protected]>

SDMA v4.4.2 doesn't need explicit power gating control through PMFW

---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +0 -4
index 184eb7902722..7c91cbd91ac8 100644
@@ -1398,10 +1398,6 @@ static int sdma_v4_4_2_hw_init(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	uint32_t inst_mask;
 
-	/* TODO: Check if this is needed */
-	if (adev->flags & AMD_IS_APU)
-		amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_SDMA, false);
-
 	inst_mask = GENMASK(adev->sdma.num_instances - 1, 0);
 	if (!amdgpu_sriov_vf(adev))
 		sdma_v4_4_2_inst_init_golden_registers(adev, inst_mask);
Signature · 1 line
2.39.2
author maintainer
#5 lore raw

PATCH 6/8 drm/amdgpu: Correct dGPU MTYPE settings for gfx943

In reply to Alex Deucher

From: Graham Sider <[email protected]>

Revert temporary dGPU VRAM MTYPE setting and align with expected coherency protocol.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 15 +++++----------
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c  |  8 ++------
 2 files changed, 7 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +5 -10
index 5c9a0f3d5581..7564c6b237eb 100644
@@ -1220,17 +1220,12 @@ static void gmc_v9_0_get_coherence_flags(struct amdgpu_device *adev,
 			mtype = MTYPE_RW;
 		} else {
 			/* dGPU */
-			/*
-			if ((mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM) &&
-			    bo_adev == adev)
-				mapping_flags |= AMDGPU_VM_MTYPE_RW;
+			if (is_vram && bo_adev == adev)
+				mtype = MTYPE_RW;
+			else if (is_vram)
+				mtype = MTYPE_NC;
 			else
-			*/
-			/* Temporarily comment out above lines and use MTYPE_NC
-			 * on both VRAM and system memory access until
-			 * MTYPE_RW can properly work on VRAM access
-			 */
-			mtype = MTYPE_NC;
+				mtype = MTYPE_UC;
 		}
 
 		break;
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +2 -6
index efd2bffbb892..89c0f3b333d3 100644
@@ -1195,13 +1195,9 @@ svm_range_get_pte_flags(struct kfd_node *node,
 		if (uncached) {
 			mapping_flags |= AMDGPU_VM_MTYPE_UC;
 		} else if (domain == SVM_RANGE_VRAM_DOMAIN) {
-			/* local HBM region close to partition with a workaround
-			 * for Endpoint systems.
-			 */
+			/* local HBM region close to partition */
 			if (bo_node == node)
-				mapping_flags |=
-					(node->adev->flags & AMD_IS_APU) ?
-					AMDGPU_VM_MTYPE_RW : AMDGPU_VM_MTYPE_NC;
+				mapping_flags |= AMDGPU_VM_MTYPE_RW;
 			/* local HBM region far from partition or remote XGMI GPU */
 			else if (svm_nodes_in_same_hive(bo_node, node))
 				mapping_flags |= AMDGPU_VM_MTYPE_NC;
Signature · 1 line
2.39.2
author maintainer
#6 lore raw

PATCH 7/8 drm/amdgpu: Populate VCN/JPEG harvest information

In reply to Alex Deucher

From: Lijo Lazar <[email protected]>

Certain instances of VCN/JPEG IPs may not be usable. Fetch the information from harvest table.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +4 -4
index 200cbb0d3052..779697d8b939 100644
@@ -563,10 +563,10 @@ static void amdgpu_discovery_read_from_harvest_table(struct amdgpu_device *adev,
 		switch (le16_to_cpu(harvest_info->list[i].hw_id)) {
 		case VCN_HWID:
 			(*vcn_harvest_count)++;
-			if (harvest_info->list[i].number_instance == 0)
-				adev->vcn.harvest_config |= AMDGPU_VCN_HARVEST_VCN0;
-			else
-				adev->vcn.harvest_config |= AMDGPU_VCN_HARVEST_VCN1;
+			adev->vcn.harvest_config |=
+				(1 << harvest_info->list[i].number_instance);
+			adev->jpeg.harvest_config |=
+				(1 << harvest_info->list[i].number_instance);
 			break;
 		case DMU_HWID:
 			adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;
Signature · 1 line
2.39.2
author maintainer
#7 lore raw

PATCH 8/8 drm/amdgpu: vcn_v4_0_3 load vcn fw once for all AIDs

In reply to Alex Deucher

From: James Zhu <[email protected]>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 3 +++
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -0
index daa69ae766d3..57dabfe1a1be 100644
@@ -1046,6 +1046,9 @@ void amdgpu_vcn_setup_ucode(struct amdgpu_device *adev)
 			adev->firmware.ucode[idx].fw = adev->vcn.fw;
 			adev->firmware.fw_size +=
 				ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE);
+
+			if (adev->ip_versions[UVD_HWIP][0] == IP_VERSION(4, 0, 3))
+				break;
 		}
 		dev_info(adev->dev, "Will use PSP to load VCN firmware\n");
 	}
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +1 -1
index 18320eebdb4c..746df23b2eaa 100644
@@ -730,7 +730,7 @@ static int vcn_v4_0_3_start_dpg_mode(struct amdgpu_device *adev, int inst_idx, b
 		UVD_MASTINT_EN__VCPU_EN_MASK, 0, indirect);
 
 	if (indirect)
-		psp_update_vcn_sram(adev, inst_idx, adev->vcn.inst[inst_idx].dpg_sram_gpu_addr,
+		psp_update_vcn_sram(adev, 0, adev->vcn.inst[inst_idx].dpg_sram_gpu_addr,
 			(uint32_t)((uintptr_t)adev->vcn.inst[inst_idx].dpg_sram_curr_addr -
 				(uintptr_t)adev->vcn.inst[inst_idx].dpg_sram_cpu_addr));
 
Signature · 1 line
2.39.2