diff options
author | Andres Rodriguez <andresx7@gmail.com> | 2017-02-01 19:08:23 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-05-31 16:48:52 -0400 |
commit | 42794b27cc628d44db28f62f3333bd12416b597f (patch) | |
tree | 893f1c3b7572c1baadcaacb61dce15d8881efe2b /drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | |
parent | d59095f7dd8810e67bdad7a65131903646ebc444 (diff) |
drm/amdgpu: take ownership of per-pipe configuration v3
Make amdgpu the owner of all per-pipe state of the HQDs.
This change will allow us to split the queues between kfd and amdgpu
with a queue granularity instead of pipe granularity.
This patch fixes kfd allocating an HDP_EOP region for its 3 pipes which
goes unused.
v2: support for gfx9
v3: fix gfx7 HPD intitialization
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index b12a60924e71..8258e3359c17 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | |||
@@ -2827,6 +2827,7 @@ static int gfx_v7_0_mec_init(struct amdgpu_device *adev) | |||
2827 | { | 2827 | { |
2828 | int r; | 2828 | int r; |
2829 | u32 *hpd; | 2829 | u32 *hpd; |
2830 | size_t mec_hpd_size; | ||
2830 | 2831 | ||
2831 | /* | 2832 | /* |
2832 | * KV: 2 MEC, 4 Pipes/MEC, 8 Queues/Pipe - 64 Queues total | 2833 | * KV: 2 MEC, 4 Pipes/MEC, 8 Queues/Pipe - 64 Queues total |
@@ -2834,13 +2835,26 @@ static int gfx_v7_0_mec_init(struct amdgpu_device *adev) | |||
2834 | * Nonetheless, we assign only 1 pipe because all other pipes will | 2835 | * Nonetheless, we assign only 1 pipe because all other pipes will |
2835 | * be handled by KFD | 2836 | * be handled by KFD |
2836 | */ | 2837 | */ |
2837 | adev->gfx.mec.num_mec = 1; | 2838 | switch (adev->asic_type) { |
2838 | adev->gfx.mec.num_pipe = 1; | 2839 | case CHIP_KAVERI: |
2839 | adev->gfx.mec.num_queue = adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe * 8; | 2840 | adev->gfx.mec.num_mec = 2; |
2841 | break; | ||
2842 | case CHIP_BONAIRE: | ||
2843 | case CHIP_HAWAII: | ||
2844 | case CHIP_KABINI: | ||
2845 | case CHIP_MULLINS: | ||
2846 | default: | ||
2847 | adev->gfx.mec.num_mec = 1; | ||
2848 | break; | ||
2849 | } | ||
2850 | adev->gfx.mec.num_pipe_per_mec = 4; | ||
2851 | adev->gfx.mec.num_queue_per_pipe = 8; | ||
2840 | 2852 | ||
2853 | mec_hpd_size = adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe_per_mec | ||
2854 | * GFX7_MEC_HPD_SIZE * 2; | ||
2841 | if (adev->gfx.mec.hpd_eop_obj == NULL) { | 2855 | if (adev->gfx.mec.hpd_eop_obj == NULL) { |
2842 | r = amdgpu_bo_create(adev, | 2856 | r = amdgpu_bo_create(adev, |
2843 | adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe * GFX7_MEC_HPD_SIZE * 2, | 2857 | mec_hpd_size, |
2844 | PAGE_SIZE, true, | 2858 | PAGE_SIZE, true, |
2845 | AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL, | 2859 | AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL, |
2846 | &adev->gfx.mec.hpd_eop_obj); | 2860 | &adev->gfx.mec.hpd_eop_obj); |
@@ -2870,7 +2884,7 @@ static int gfx_v7_0_mec_init(struct amdgpu_device *adev) | |||
2870 | } | 2884 | } |
2871 | 2885 | ||
2872 | /* clear memory. Not sure if this is required or not */ | 2886 | /* clear memory. Not sure if this is required or not */ |
2873 | memset(hpd, 0, adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe * GFX7_MEC_HPD_SIZE * 2); | 2887 | memset(hpd, 0, mec_hpd_size); |
2874 | 2888 | ||
2875 | amdgpu_bo_kunmap(adev->gfx.mec.hpd_eop_obj); | 2889 | amdgpu_bo_kunmap(adev->gfx.mec.hpd_eop_obj); |
2876 | amdgpu_bo_unreserve(adev->gfx.mec.hpd_eop_obj); | 2890 | amdgpu_bo_unreserve(adev->gfx.mec.hpd_eop_obj); |
@@ -2917,16 +2931,18 @@ struct hqd_registers | |||
2917 | u32 cp_mqd_control; | 2931 | u32 cp_mqd_control; |
2918 | }; | 2932 | }; |
2919 | 2933 | ||
2920 | static void gfx_v7_0_compute_pipe_init(struct amdgpu_device *adev, int me, int pipe) | 2934 | static void gfx_v7_0_compute_pipe_init(struct amdgpu_device *adev, |
2935 | int mec, int pipe) | ||
2921 | { | 2936 | { |
2922 | u64 eop_gpu_addr; | 2937 | u64 eop_gpu_addr; |
2923 | u32 tmp; | 2938 | u32 tmp; |
2924 | size_t eop_offset = me * pipe * GFX7_MEC_HPD_SIZE * 2; | 2939 | size_t eop_offset = (mec * adev->gfx.mec.num_pipe_per_mec + pipe) |
2940 | * GFX7_MEC_HPD_SIZE * 2; | ||
2925 | 2941 | ||
2926 | mutex_lock(&adev->srbm_mutex); | 2942 | mutex_lock(&adev->srbm_mutex); |
2927 | eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + eop_offset; | 2943 | eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + eop_offset; |
2928 | 2944 | ||
2929 | cik_srbm_select(adev, me, pipe, 0, 0); | 2945 | cik_srbm_select(adev, mec + 1, pipe, 0, 0); |
2930 | 2946 | ||
2931 | /* write the EOP addr */ | 2947 | /* write the EOP addr */ |
2932 | WREG32(mmCP_HPD_EOP_BASE_ADDR, eop_gpu_addr >> 8); | 2948 | WREG32(mmCP_HPD_EOP_BASE_ADDR, eop_gpu_addr >> 8); |
@@ -3208,9 +3224,9 @@ static int gfx_v7_0_cp_compute_resume(struct amdgpu_device *adev) | |||
3208 | tmp |= (1 << 23); | 3224 | tmp |= (1 << 23); |
3209 | WREG32(mmCP_CPF_DEBUG, tmp); | 3225 | WREG32(mmCP_CPF_DEBUG, tmp); |
3210 | 3226 | ||
3211 | /* init the pipes */ | 3227 | /* init all pipes (even the ones we don't own) */ |
3212 | for (i = 0; i < adev->gfx.mec.num_mec; i++) | 3228 | for (i = 0; i < adev->gfx.mec.num_mec; i++) |
3213 | for (j = 0; j < adev->gfx.mec.num_pipe; j++) | 3229 | for (j = 0; j < adev->gfx.mec.num_pipe_per_mec; j++) |
3214 | gfx_v7_0_compute_pipe_init(adev, i, j); | 3230 | gfx_v7_0_compute_pipe_init(adev, i, j); |
3215 | 3231 | ||
3216 | /* init the queues */ | 3232 | /* init the queues */ |