aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorEmily Deng <Emily.Deng@amd.com>2018-08-17 06:26:41 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-08-27 12:11:08 -0400
commit39b62541aac396d18108c160ddb956a22483046d (patch)
tree31cfd4dceda260be8ff6233d30b2b607653854fe /drivers/gpu
parentdd73043534515c1b8bf31f78f0e9945f5d95e0e6 (diff)
drm/amdgpu: Remove the sriov checking and add firmware checking
Unify bare metal and sriov, and add firmware checking for reg write and reg wait unify command. Signed-off-by: Emily Deng <Emily.Deng@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Reviewed-and-Tested-by: Rex Zhu <Rex.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c59
2 files changed, 60 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
index 53e9e2a0821e..f172e92c463c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
@@ -274,6 +274,8 @@ struct amdgpu_gfx {
274 uint32_t rlc_srls_feature_version; 274 uint32_t rlc_srls_feature_version;
275 uint32_t mec_feature_version; 275 uint32_t mec_feature_version;
276 uint32_t mec2_feature_version; 276 uint32_t mec2_feature_version;
277 bool mec_fw_write_wait;
278 bool me_fw_write_wait;
277 struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS]; 279 struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS];
278 unsigned num_gfx_rings; 280 unsigned num_gfx_rings;
279 struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS]; 281 struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS];
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 4e1e1a0dd681..0cba430712d1 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -482,6 +482,59 @@ static void gfx_v9_0_init_rlc_ext_microcode(struct amdgpu_device *adev)
482 le32_to_cpu(rlc_hdr->reg_list_format_direct_reg_list_length); 482 le32_to_cpu(rlc_hdr->reg_list_format_direct_reg_list_length);
483} 483}
484 484
485static void gfx_v9_0_check_fw_write_wait(struct amdgpu_device *adev)
486{
487 adev->gfx.me_fw_write_wait = false;
488 adev->gfx.mec_fw_write_wait = false;
489
490 switch (adev->asic_type) {
491 case CHIP_VEGA10:
492 if ((adev->gfx.me_fw_version >= 0x0000009c) &&
493 (adev->gfx.me_feature_version >= 42) &&
494 (adev->gfx.pfp_fw_version >= 0x000000b1) &&
495 (adev->gfx.pfp_feature_version >= 42))
496 adev->gfx.me_fw_write_wait = true;
497
498 if ((adev->gfx.mec_fw_version >= 0x00000193) &&
499 (adev->gfx.mec_feature_version >= 42))
500 adev->gfx.mec_fw_write_wait = true;
501 break;
502 case CHIP_VEGA12:
503 if ((adev->gfx.me_fw_version >= 0x0000009c) &&
504 (adev->gfx.me_feature_version >= 44) &&
505 (adev->gfx.pfp_fw_version >= 0x000000b2) &&
506 (adev->gfx.pfp_feature_version >= 44))
507 adev->gfx.me_fw_write_wait = true;
508
509 if ((adev->gfx.mec_fw_version >= 0x00000196) &&
510 (adev->gfx.mec_feature_version >= 44))
511 adev->gfx.mec_fw_write_wait = true;
512 break;
513 case CHIP_VEGA20:
514 if ((adev->gfx.me_fw_version >= 0x0000009c) &&
515 (adev->gfx.me_feature_version >= 44) &&
516 (adev->gfx.pfp_fw_version >= 0x000000b2) &&
517 (adev->gfx.pfp_feature_version >= 44))
518 adev->gfx.me_fw_write_wait = true;
519
520 if ((adev->gfx.mec_fw_version >= 0x00000197) &&
521 (adev->gfx.mec_feature_version >= 44))
522 adev->gfx.mec_fw_write_wait = true;
523 break;
524 case CHIP_RAVEN:
525 if ((adev->gfx.me_fw_version >= 0x0000009c) &&
526 (adev->gfx.me_feature_version >= 42) &&
527 (adev->gfx.pfp_fw_version >= 0x000000b1) &&
528 (adev->gfx.pfp_feature_version >= 42))
529 adev->gfx.me_fw_write_wait = true;
530
531 if ((adev->gfx.mec_fw_version >= 0x00000192) &&
532 (adev->gfx.mec_feature_version >= 42))
533 adev->gfx.mec_fw_write_wait = true;
534 break;
535 }
536}
537
485static int gfx_v9_0_init_microcode(struct amdgpu_device *adev) 538static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
486{ 539{
487 const char *chip_name; 540 const char *chip_name;
@@ -716,6 +769,7 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
716 } 769 }
717 770
718out: 771out:
772 gfx_v9_0_check_fw_write_wait(adev);
719 if (err) { 773 if (err) {
720 dev_err(adev->dev, 774 dev_err(adev->dev,
721 "gfx9: Failed to load firmware \"%s\"\n", 775 "gfx9: Failed to load firmware \"%s\"\n",
@@ -4353,8 +4407,11 @@ static void gfx_v9_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring,
4353 uint32_t ref, uint32_t mask) 4407 uint32_t ref, uint32_t mask)
4354{ 4408{
4355 int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX); 4409 int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
4410 struct amdgpu_device *adev = ring->adev;
4411 bool fw_version_ok = (ring->funcs->type == AMDGPU_RING_TYPE_GFX) ?
4412 adev->gfx.me_fw_write_wait : adev->gfx.mec_fw_write_wait;
4356 4413
4357 if (amdgpu_sriov_vf(ring->adev)) 4414 if (fw_version_ok)
4358 gfx_v9_0_wait_reg_mem(ring, usepfp, 0, 1, reg0, reg1, 4415 gfx_v9_0_wait_reg_mem(ring, usepfp, 0, 1, reg0, reg1,
4359 ref, mask, 0x20); 4416 ref, mask, 0x20);
4360 else 4417 else