Skip to contentSkip to conversation

drm/amdgpu: properly byteswap gpu_info firmware

PATCH In review Alex Deucher 3 participants 3 messages May 11, 2017 – May 12, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: properly byteswap gpu_info firmware

It's stored in LE format.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +11 -11
index d95d4c9..8a5bb42 100644
@@ -1459,19 +1459,19 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
 			(const struct gpu_info_firmware_v1_0 *)(fw->data +
 								le32_to_cpu(hdr->header.ucode_array_offset_bytes));
 
-		adev->gfx.config.max_shader_engines = gpu_info_fw->gc_num_se;
-		adev->gfx.config.max_cu_per_sh = gpu_info_fw->gc_num_cu_per_sh;
-		adev->gfx.config.max_sh_per_se = gpu_info_fw->gc_num_sh_per_se;
-		adev->gfx.config.max_backends_per_se = gpu_info_fw->gc_num_rb_per_se;
+		adev->gfx.config.max_shader_engines = le32_to_cpu(gpu_info_fw->gc_num_se);
+		adev->gfx.config.max_cu_per_sh = le32_to_cpu(gpu_info_fw->gc_num_cu_per_sh);
+		adev->gfx.config.max_sh_per_se = le32_to_cpu(gpu_info_fw->gc_num_sh_per_se);
+		adev->gfx.config.max_backends_per_se = le32_to_cpu(gpu_info_fw->gc_num_rb_per_se);
 		adev->gfx.config.max_texture_channel_caches =
-			gpu_info_fw->gc_num_tccs;
-		adev->gfx.config.max_gprs = gpu_info_fw->gc_num_gprs;
-		adev->gfx.config.max_gs_threads = gpu_info_fw->gc_num_max_gs_thds;
-		adev->gfx.config.gs_vgt_table_depth = gpu_info_fw->gc_gs_table_depth;
-		adev->gfx.config.gs_prim_buffer_depth = gpu_info_fw->gc_gsprim_buff_depth;
+			le32_to_cpu(gpu_info_fw->gc_num_tccs);
+		adev->gfx.config.max_gprs = le32_to_cpu(gpu_info_fw->gc_num_gprs);
+		adev->gfx.config.max_gs_threads = le32_to_cpu(gpu_info_fw->gc_num_max_gs_thds);
+		adev->gfx.config.gs_vgt_table_depth = le32_to_cpu(gpu_info_fw->gc_gs_table_depth);
+		adev->gfx.config.gs_prim_buffer_depth = le32_to_cpu(gpu_info_fw->gc_gsprim_buff_depth);
 		adev->gfx.config.double_offchip_lds_buf =
-			gpu_info_fw->gc_double_offchip_lds_buffer;
-		adev->gfx.cu_info.wave_front_size = gpu_info_fw->gc_wave_size;
+			le32_to_cpu(gpu_info_fw->gc_double_offchip_lds_buffer);
+		adev->gfx.cu_info.wave_front_size = le32_to_cpu(gpu_info_fw->gc_wave_size);
 		break;
 	}
 	default:
Signature · 6 lines
2.5.5

_______________________________________________
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): 1494544256-31858-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 33 lines · Alex Deucher

It's stored in LE format.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -9
index d95d4c9..8a5bb42 100644
@@ -1459,19 +1459,19 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
 			(const struct gpu_info_firmware_v1_0 *)(fw->data +
 								le32_to_cpu(hdr->header.ucode_array_offset_bytes));
 
-		adev->gfx.config.max_shader_engines = gpu_info_fw->gc_num_se;
-		adev->gfx.config.max_cu_per_sh = gpu_info_fw->gc_num_cu_per_sh;
-		adev->gfx.config.max_sh_per_se = gpu_info_fw->gc_num_sh_per_se;
-		adev->gfx.config.max_backends_per_se = gpu_info_fw->gc_num_rb_per_se;
+		adev->gfx.config.max_shader_engines = le32_to_cpu(gpu_info_fw->gc_num_se);
+		adev->gfx.config.max_cu_per_sh = le32_to_cpu(gpu_info_fw->gc_num_cu_per_sh);
+		adev->gfx.config.max_sh_per_se = le32_to_cpu(gpu_info_fw->gc_num_sh_per_se);
+		adev->gfx.config.max_backends_per_se = le32_to_cpu(gpu_info_fw->gc_num_rb_per_se);
 		adev->gfx.config.max_texture_channel_caches =
-			gpu_info_fw->gc_num_tccs;
-		adev->gfx.config.max_gprs = gpu_info_fw->gc_num_gprs;
-		adev->gfx.config.max_gs_threads = gpu_info_fw->gc_num_max_gs_thds;
-		adev->gfx.config.gs_vgt_table_depth = gpu_info_fw->gc_gs_table_depth;
-		adev->gfx.config.gs_prim_buffer_depth = gpu_info_fw->gc_gsprim_buff_depth;
+			le32_to_cpu(gpu_info_fw->gc_num_tccs);
+		adev->gfx.config.max_gprs = le32_to_cpu(gpu_info_fw->gc_num_gprs);
+		adev->gfx.config.max_gs_threads = le32_to_cpu(gpu_info_fw->gc_num_max_gs_thds);

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

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -2
+		adev->gfx.config.gs_vgt_table_depth = le32_to_cpu(gpu_info_fw->gc_gs_table_depth);
+		adev->gfx.config.gs_prim_buffer_depth = le32_to_cpu(gpu_info_fw->gc_gsprim_buff_depth);
 		adev->gfx.config.double_offchip_lds_buf =
-			gpu_info_fw->gc_double_offchip_lds_buffer;
-		adev->gfx.cu_info.wave_front_size = gpu_info_fw->gc_wave_size;
+			le32_to_cpu(gpu_info_fw->gc_double_offchip_lds_buffer);
+		adev->gfx.cu_info.wave_front_size = le32_to_cpu(gpu_info_fw->gc_wave_size);
 		break;
 	}
 	default:
Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#3 lore raw
In reply to a message not in the archive

Am 12.05.2017 um 01:10 schrieb Alex Deucher:

Quoted 3 lines

It's stored in LE format.

Quoted 29 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 22 +++++++++++-----------
  1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -9
index d95d4c9..8a5bb42 100644
@@ -1459,19 +1459,19 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
  			(const struct gpu_info_firmware_v1_0 *)(fw->data +
  								le32_to_cpu(hdr->header.ucode_array_offset_bytes));
 
-		adev->gfx.config.max_shader_engines = gpu_info_fw->gc_num_se;
-		adev->gfx.config.max_cu_per_sh = gpu_info_fw->gc_num_cu_per_sh;
-		adev->gfx.config.max_sh_per_se = gpu_info_fw->gc_num_sh_per_se;
-		adev->gfx.config.max_backends_per_se = gpu_info_fw->gc_num_rb_per_se;
+		adev->gfx.config.max_shader_engines = le32_to_cpu(gpu_info_fw->gc_num_se);
+		adev->gfx.config.max_cu_per_sh = le32_to_cpu(gpu_info_fw->gc_num_cu_per_sh);
+		adev->gfx.config.max_sh_per_se = le32_to_cpu(gpu_info_fw->gc_num_sh_per_se);
+		adev->gfx.config.max_backends_per_se = le32_to_cpu(gpu_info_fw->gc_num_rb_per_se);
  		adev->gfx.config.max_texture_channel_caches =
-			gpu_info_fw->gc_num_tccs;
-		adev->gfx.config.max_gprs = gpu_info_fw->gc_num_gprs;
-		adev->gfx.config.max_gs_threads = gpu_info_fw->gc_num_max_gs_thds;
-		adev->gfx.config.gs_vgt_table_depth = gpu_info_fw->gc_gs_table_depth;
-		adev->gfx.config.gs_prim_buffer_depth = gpu_info_fw->gc_gsprim_buff_depth;
+			le32_to_cpu(gpu_info_fw->gc_num_tccs);
+		adev->gfx.config.max_gprs = le32_to_cpu(gpu_info_fw->gc_num_gprs);
+		adev->gfx.config.max_gs_threads = le32_to_cpu(gpu_info_fw->gc_num_max_gs_thds);

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

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -2
+		adev->gfx.config.gs_vgt_table_depth = le32_to_cpu(gpu_info_fw->gc_gs_table_depth);
+		adev->gfx.config.gs_prim_buffer_depth = le32_to_cpu(gpu_info_fw->gc_gsprim_buff_depth);
  		adev->gfx.config.double_offchip_lds_buf =
-			gpu_info_fw->gc_double_offchip_lds_buffer;
-		adev->gfx.cu_info.wave_front_size = gpu_info_fw->gc_wave_size;
+			le32_to_cpu(gpu_info_fw->gc_double_offchip_lds_buffer);
+		adev->gfx.cu_info.wave_front_size = le32_to_cpu(gpu_info_fw->gc_wave_size);
  		break;
  	}
  	default:

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