diff options
author | Oak Zeng <ozeng@amd.com> | 2018-11-19 16:59:53 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-11-28 15:55:32 -0500 |
commit | c93aa77586c2ffe328cca32b40fc988bde8318b2 (patch) | |
tree | a6e52fb5a450268c336c5a13fd04aaef6109ae06 /drivers | |
parent | 4e2c1ac2027d1ad99109b676450db8759779222c (diff) |
drm/amdgpu: Doorbell layout for vega20 and future asic
This introduces new doorbell layout for vega20 and future asics
v2: Use enum definition instead of hardcoded value
Signed-off-by: Oak Zeng <ozeng@amd.com>
Suggested-by: Felix Kuehling <Felix.Kuehling@amd.com>
Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 50 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/soc15.c | 22 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/soc15.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c | 33 |
4 files changed, 105 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 7e9d9b97183a..9ec5f5a6ac39 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -392,6 +392,56 @@ struct amdgpu_doorbell { | |||
392 | u32 num_doorbells; /* Number of doorbells actually reserved for amdgpu. */ | 392 | u32 num_doorbells; /* Number of doorbells actually reserved for amdgpu. */ |
393 | }; | 393 | }; |
394 | 394 | ||
395 | typedef enum _AMDGPU_VEGA20_DOORBELL_ASSIGNMENT | ||
396 | { | ||
397 | /* Compute + GFX: 0~255 */ | ||
398 | AMDGPU_VEGA20_DOORBELL_KIQ = 0x000, | ||
399 | AMDGPU_VEGA20_DOORBELL_HIQ = 0x001, | ||
400 | AMDGPU_VEGA20_DOORBELL_DIQ = 0x002, | ||
401 | AMDGPU_VEGA20_DOORBELL_MEC_RING0 = 0x003, | ||
402 | AMDGPU_VEGA20_DOORBELL_MEC_RING1 = 0x004, | ||
403 | AMDGPU_VEGA20_DOORBELL_MEC_RING2 = 0x005, | ||
404 | AMDGPU_VEGA20_DOORBELL_MEC_RING3 = 0x006, | ||
405 | AMDGPU_VEGA20_DOORBELL_MEC_RING4 = 0x007, | ||
406 | AMDGPU_VEGA20_DOORBELL_MEC_RING5 = 0x008, | ||
407 | AMDGPU_VEGA20_DOORBELL_MEC_RING6 = 0x009, | ||
408 | AMDGPU_VEGA20_DOORBELL_MEC_RING7 = 0x00A, | ||
409 | AMDGPU_VEGA20_DOORBELL_USERQUEUE_START = 0x00B, | ||
410 | AMDGPU_VEGA20_DOORBELL_USERQUEUE_END = 0x08A, | ||
411 | AMDGPU_VEGA20_DOORBELL_GFX_RING0 = 0x08B, | ||
412 | /* SDMA:256~335*/ | ||
413 | AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE0 = 0x100, | ||
414 | AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE1 = 0x10A, | ||
415 | AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE2 = 0x114, | ||
416 | AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE3 = 0x11E, | ||
417 | AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE4 = 0x128, | ||
418 | AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE5 = 0x132, | ||
419 | AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE6 = 0x13C, | ||
420 | AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE7 = 0x146, | ||
421 | /* IH: 376~391 */ | ||
422 | AMDGPU_VEGA20_DOORBELL_IH = 0x178, | ||
423 | /* MMSCH: 392~407 | ||
424 | * overlap the doorbell assignment with VCN as they are mutually exclusive | ||
425 | * VCE engine's doorbell is 32 bit and two VCE ring share one QWORD | ||
426 | */ | ||
427 | AMDGPU_VEGA20_DOORBELL64_VCN0_1 = 0x188, /* lower 32 bits for VNC0 and upper 32 bits for VNC1 */ | ||
428 | AMDGPU_VEGA20_DOORBELL64_VCN2_3 = 0x189, | ||
429 | AMDGPU_VEGA20_DOORBELL64_VCN4_5 = 0x18A, | ||
430 | AMDGPU_VEGA20_DOORBELL64_VCN6_7 = 0x18B, | ||
431 | |||
432 | AMDGPU_VEGA20_DOORBELL64_UVD_RING0_1 = 0x188, | ||
433 | AMDGPU_VEGA20_DOORBELL64_UVD_RING2_3 = 0x189, | ||
434 | AMDGPU_VEGA20_DOORBELL64_UVD_RING4_5 = 0x18A, | ||
435 | AMDGPU_VEGA20_DOORBELL64_UVD_RING6_7 = 0x18B, | ||
436 | |||
437 | AMDGPU_VEGA20_DOORBELL64_VCE_RING0_1 = 0x18C, | ||
438 | AMDGPU_VEGA20_DOORBELL64_VCE_RING2_3 = 0x18D, | ||
439 | AMDGPU_VEGA20_DOORBELL64_VCE_RING4_5 = 0x18E, | ||
440 | AMDGPU_VEGA20_DOORBELL64_VCE_RING6_7 = 0x18F, | ||
441 | AMDGPU_VEGA20_DOORBELL_MAX_ASSIGNMENT = 0x18F, | ||
442 | AMDGPU_VEGA20_DOORBELL_INVALID = 0xFFFF | ||
443 | } AMDGPU_VEGA20_DOORBELL_ASSIGNMENT; | ||
444 | |||
395 | /* | 445 | /* |
396 | * 64bit doorbell, offset are in QWORD, occupy 2KB doorbell space | 446 | * 64bit doorbell, offset are in QWORD, occupy 2KB doorbell space |
397 | */ | 447 | */ |
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index bc59f52da0b6..b318950ebbaa 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c | |||
@@ -609,6 +609,23 @@ static const struct amdgpu_asic_funcs soc15_asic_funcs = | |||
609 | .init_doorbell_index = &vega10_doorbell_index_init, | 609 | .init_doorbell_index = &vega10_doorbell_index_init, |
610 | }; | 610 | }; |
611 | 611 | ||
612 | static const struct amdgpu_asic_funcs vega20_asic_funcs = | ||
613 | { | ||
614 | .read_disabled_bios = &soc15_read_disabled_bios, | ||
615 | .read_bios_from_rom = &soc15_read_bios_from_rom, | ||
616 | .read_register = &soc15_read_register, | ||
617 | .reset = &soc15_asic_reset, | ||
618 | .set_vga_state = &soc15_vga_set_state, | ||
619 | .get_xclk = &soc15_get_xclk, | ||
620 | .set_uvd_clocks = &soc15_set_uvd_clocks, | ||
621 | .set_vce_clocks = &soc15_set_vce_clocks, | ||
622 | .get_config_memsize = &soc15_get_config_memsize, | ||
623 | .flush_hdp = &soc15_flush_hdp, | ||
624 | .invalidate_hdp = &soc15_invalidate_hdp, | ||
625 | .need_full_reset = &soc15_need_full_reset, | ||
626 | .init_doorbell_index = &vega20_doorbell_index_init, | ||
627 | }; | ||
628 | |||
612 | static int soc15_common_early_init(void *handle) | 629 | static int soc15_common_early_init(void *handle) |
613 | { | 630 | { |
614 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 631 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
@@ -626,11 +643,11 @@ static int soc15_common_early_init(void *handle) | |||
626 | adev->se_cac_rreg = &soc15_se_cac_rreg; | 643 | adev->se_cac_rreg = &soc15_se_cac_rreg; |
627 | adev->se_cac_wreg = &soc15_se_cac_wreg; | 644 | adev->se_cac_wreg = &soc15_se_cac_wreg; |
628 | 645 | ||
629 | adev->asic_funcs = &soc15_asic_funcs; | ||
630 | 646 | ||
631 | adev->external_rev_id = 0xFF; | 647 | adev->external_rev_id = 0xFF; |
632 | switch (adev->asic_type) { | 648 | switch (adev->asic_type) { |
633 | case CHIP_VEGA10: | 649 | case CHIP_VEGA10: |
650 | adev->asic_funcs = &soc15_asic_funcs; | ||
634 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | | 651 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | |
635 | AMD_CG_SUPPORT_GFX_MGLS | | 652 | AMD_CG_SUPPORT_GFX_MGLS | |
636 | AMD_CG_SUPPORT_GFX_RLC_LS | | 653 | AMD_CG_SUPPORT_GFX_RLC_LS | |
@@ -654,6 +671,7 @@ static int soc15_common_early_init(void *handle) | |||
654 | adev->external_rev_id = 0x1; | 671 | adev->external_rev_id = 0x1; |
655 | break; | 672 | break; |
656 | case CHIP_VEGA12: | 673 | case CHIP_VEGA12: |
674 | adev->asic_funcs = &soc15_asic_funcs; | ||
657 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | | 675 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | |
658 | AMD_CG_SUPPORT_GFX_MGLS | | 676 | AMD_CG_SUPPORT_GFX_MGLS | |
659 | AMD_CG_SUPPORT_GFX_CGCG | | 677 | AMD_CG_SUPPORT_GFX_CGCG | |
@@ -676,6 +694,7 @@ static int soc15_common_early_init(void *handle) | |||
676 | adev->external_rev_id = adev->rev_id + 0x14; | 694 | adev->external_rev_id = adev->rev_id + 0x14; |
677 | break; | 695 | break; |
678 | case CHIP_VEGA20: | 696 | case CHIP_VEGA20: |
697 | adev->asic_funcs = &vega20_asic_funcs; | ||
679 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | | 698 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | |
680 | AMD_CG_SUPPORT_GFX_MGLS | | 699 | AMD_CG_SUPPORT_GFX_MGLS | |
681 | AMD_CG_SUPPORT_GFX_CGCG | | 700 | AMD_CG_SUPPORT_GFX_CGCG | |
@@ -698,6 +717,7 @@ static int soc15_common_early_init(void *handle) | |||
698 | adev->external_rev_id = adev->rev_id + 0x28; | 717 | adev->external_rev_id = adev->rev_id + 0x28; |
699 | break; | 718 | break; |
700 | case CHIP_RAVEN: | 719 | case CHIP_RAVEN: |
720 | adev->asic_funcs = &soc15_asic_funcs; | ||
701 | if (adev->rev_id >= 0x8) | 721 | if (adev->rev_id >= 0x8) |
702 | adev->external_rev_id = adev->rev_id + 0x81; | 722 | adev->external_rev_id = adev->rev_id + 0x81; |
703 | else if (adev->pdev->device == 0x15d8) | 723 | else if (adev->pdev->device == 0x15d8) |
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.h b/drivers/gpu/drm/amd/amdgpu/soc15.h index d37c57d09976..a66c8bfbbaa6 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.h +++ b/drivers/gpu/drm/amd/amdgpu/soc15.h | |||
@@ -59,4 +59,5 @@ int vega10_reg_base_init(struct amdgpu_device *adev); | |||
59 | int vega20_reg_base_init(struct amdgpu_device *adev); | 59 | int vega20_reg_base_init(struct amdgpu_device *adev); |
60 | 60 | ||
61 | void vega10_doorbell_index_init(struct amdgpu_device *adev); | 61 | void vega10_doorbell_index_init(struct amdgpu_device *adev); |
62 | void vega20_doorbell_index_init(struct amdgpu_device *adev); | ||
62 | #endif | 63 | #endif |
diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c b/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c index d13fc4fcb517..edce413fda9a 100644 --- a/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c +++ b/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c | |||
@@ -54,4 +54,37 @@ int vega20_reg_base_init(struct amdgpu_device *adev) | |||
54 | return 0; | 54 | return 0; |
55 | } | 55 | } |
56 | 56 | ||
57 | void vega20_doorbell_index_init(struct amdgpu_device *adev) | ||
58 | { | ||
59 | adev->doorbell_index.kiq = AMDGPU_VEGA20_DOORBELL_KIQ; | ||
60 | adev->doorbell_index.mec_ring0 = AMDGPU_VEGA20_DOORBELL_MEC_RING0; | ||
61 | adev->doorbell_index.mec_ring1 = AMDGPU_VEGA20_DOORBELL_MEC_RING1; | ||
62 | adev->doorbell_index.mec_ring2 = AMDGPU_VEGA20_DOORBELL_MEC_RING2; | ||
63 | adev->doorbell_index.mec_ring3 = AMDGPU_VEGA20_DOORBELL_MEC_RING3; | ||
64 | adev->doorbell_index.mec_ring4 = AMDGPU_VEGA20_DOORBELL_MEC_RING4; | ||
65 | adev->doorbell_index.mec_ring5 = AMDGPU_VEGA20_DOORBELL_MEC_RING5; | ||
66 | adev->doorbell_index.mec_ring6 = AMDGPU_VEGA20_DOORBELL_MEC_RING6; | ||
67 | adev->doorbell_index.mec_ring7 = AMDGPU_VEGA20_DOORBELL_MEC_RING7; | ||
68 | adev->doorbell_index.userqueue_start = AMDGPU_VEGA20_DOORBELL_USERQUEUE_START; | ||
69 | adev->doorbell_index.userqueue_end = AMDGPU_VEGA20_DOORBELL_USERQUEUE_END; | ||
70 | adev->doorbell_index.gfx_ring0 = AMDGPU_VEGA20_DOORBELL_GFX_RING0; | ||
71 | adev->doorbell_index.sdma_engine0 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE0; | ||
72 | adev->doorbell_index.sdma_engine1 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE1; | ||
73 | adev->doorbell_index.sdma_engine2 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE2; | ||
74 | adev->doorbell_index.sdma_engine3 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE3; | ||
75 | adev->doorbell_index.sdma_engine4 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE4; | ||
76 | adev->doorbell_index.sdma_engine5 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE5; | ||
77 | adev->doorbell_index.sdma_engine6 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE6; | ||
78 | adev->doorbell_index.sdma_engine7 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE7; | ||
79 | adev->doorbell_index.ih = AMDGPU_VEGA20_DOORBELL_IH; | ||
80 | adev->doorbell_index.uvd_vce.uvd_ring0_1 = AMDGPU_VEGA20_DOORBELL64_UVD_RING0_1; | ||
81 | adev->doorbell_index.uvd_vce.uvd_ring2_3 = AMDGPU_VEGA20_DOORBELL64_UVD_RING2_3; | ||
82 | adev->doorbell_index.uvd_vce.uvd_ring4_5 = AMDGPU_VEGA20_DOORBELL64_UVD_RING4_5; | ||
83 | adev->doorbell_index.uvd_vce.uvd_ring6_7 = AMDGPU_VEGA20_DOORBELL64_UVD_RING6_7; | ||
84 | adev->doorbell_index.uvd_vce.vce_ring0_1 = AMDGPU_VEGA20_DOORBELL64_VCE_RING0_1; | ||
85 | adev->doorbell_index.uvd_vce.vce_ring2_3 = AMDGPU_VEGA20_DOORBELL64_VCE_RING2_3; | ||
86 | adev->doorbell_index.uvd_vce.vce_ring4_5 = AMDGPU_VEGA20_DOORBELL64_VCE_RING4_5; | ||
87 | adev->doorbell_index.uvd_vce.vce_ring6_7 = AMDGPU_VEGA20_DOORBELL64_VCE_RING6_7; | ||
88 | adev->doorbell_index.max_assignment = AMDGPU_VEGA20_DOORBELL_MAX_ASSIGNMENT << 1; | ||
89 | } | ||
57 | 90 | ||