drm/amdgpu/vcn4: fix endian conversion
Subsystems (2)
Alex Deucher
maintainerPATCH 1/2 drm/amdgpu/vcn4: fix endian conversion
sq.is_enabled is a byte so there is no need to endian swap it.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +1 -1
@@ -124,7 +124,7 @@ 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 =cpu_to_le32 (AMDGPU_FW_SHARED_FLAG_0_UNIFIED_QUEUE ); - fw_shared->sq.is_enabled =cpu_to_le32 (true); + fw_shared->sq.is_enabled = true;if (amdgpu_vcnfw_log)amdgpu_vcn_fwlog_init (&adev->vcn.inst[i]);
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 2/2 drm/amdgpu/gmc9: fix 64 bit division in partition code
Rework logic or use do_div() to avoid problems on 32 bit.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 11 ++++++----- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4 -1
@@ -818,11 +818,14 @@ static void amdgpu_ttm_gart_bind_gfx9_mqd(struct amdgpu_device *adev,struct amdgpu_ttm_tt *gtt = (void *)ttm;uint64_t total_pages = ttm->num_pages;int num_xcc =max (1U , adev->gfx.num_xcc_per_xcp); -uint64_t page_idx, pages_per_xcc = total_pages / num_xcc; +uint64_t page_idx, pages_per_xcc;int i;uint64_t ctrl_flags = (flags & ~AMDGPU_PTE_MTYPE_VG10_MASK ) |AMDGPU_PTE_MTYPE_VG10 (AMDGPU_MTYPE_NC ); + pages_per_xcc = total_pages; +do_div (pages_per_xcc, num_xcc); +for (i =0 , page_idx =0 ; i < num_xcc; i++, page_idx += pages_per_xcc) {/* MQD page: use default flags */ amdgpu_gart_bind(adev,
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +6 -5
@@ -1919,9 +1919,10 @@ gmc_v9_0_init_acpi_mem_ranges(struct amdgpu_device *adev, adev->gmc.num_mem_partitions = num_ranges;/* If there is only partition, don't use entire size */ -if (adev->gmc.num_mem_partitions ==1 ) - mem_ranges[0 ].size = - (mem_ranges[0 ].size * (mem_groups -1 ) / mem_groups); +if (adev->gmc.num_mem_partitions ==1 ) { + mem_ranges[0 ].size = mem_ranges[0 ].size * (mem_groups -1 ); +do_div (mem_ranges[0 ].size, mem_groups); + } } static void
@@ -1953,8 +1954,8 @@ gmc_v9_0_init_sw_mem_ranges(struct amdgpu_device *adev,break ; } - size = (adev->gmc.real_vram_size >>AMDGPU_GPU_PAGE_SHIFT ) / - adev->gmc.num_mem_partitions; + size = adev->gmc.real_vram_size >>AMDGPU_GPU_PAGE_SHIFT ; + size /= adev->gmc.num_mem_partitions;for (i =0 ; i < adev->gmc.num_mem_partitions; ++i) { mem_ranges[i].range.fpfn = start_addr;
Signature · 1 line
2.40.1
Regards,
Guchun
Quoted 32 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, May 17, 2023 5:18 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu/vcn4: fix endian conversionsq.is_enabled is a byte so there is no need to endian swap it.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +1
-1@@ -124,7 +124,7 @@ 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 =cpu_to_le32 (AMDGPU_FW_SHARED_FLAG_0_UNIFIED_QUEUE ); - fw_shared->sq.is_enabled =cpu_to_le32 (true); + fw_shared->sq.is_enabled = true;if (amdgpu_vcnfw_log)
amdgpu_vcn_fwlog_init(&adev->vcn.inst[i]);
--
2.40.1