diff options
author | Yong Zhao <Yong.Zhao@amd.com> | 2019-01-09 23:31:14 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-02-18 18:00:50 -0500 |
commit | 234441dd49bcd917d0acd23290d1c49f332a816b (patch) | |
tree | 1db39283533efb180baa2013baccc7cc2a10690f /drivers/gpu/drm/amd/amdgpu | |
parent | 1f86805adc3432e92e7d87e1ff5da9826ef56eab (diff) |
drm/amdkfd: Optimize out sdma doorbell array in kgd2kfd_shared_resources
We can directly calculate sdma doorbell indexes in the process doorbell
pages through the doorbell_index structure in amdgpu_device, so no need
to cache them in kgd2kfd_shared_resources any more. This alleviates the
adaptation needs when new SDMA configurations are introduced.
Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 41 |
1 files changed, 10 insertions, 31 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c index 30e2b371578e..fe1d7368c1e6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | |||
@@ -131,7 +131,7 @@ static void amdgpu_doorbell_get_kfd_info(struct amdgpu_device *adev, | |||
131 | 131 | ||
132 | void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) | 132 | void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) |
133 | { | 133 | { |
134 | int i, n; | 134 | int i; |
135 | int last_valid_bit; | 135 | int last_valid_bit; |
136 | 136 | ||
137 | if (adev->kfd.dev) { | 137 | if (adev->kfd.dev) { |
@@ -142,7 +142,9 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) | |||
142 | .gpuvm_size = min(adev->vm_manager.max_pfn | 142 | .gpuvm_size = min(adev->vm_manager.max_pfn |
143 | << AMDGPU_GPU_PAGE_SHIFT, | 143 | << AMDGPU_GPU_PAGE_SHIFT, |
144 | AMDGPU_GMC_HOLE_START), | 144 | AMDGPU_GMC_HOLE_START), |
145 | .drm_render_minor = adev->ddev->render->index | 145 | .drm_render_minor = adev->ddev->render->index, |
146 | .sdma_doorbell_idx = adev->doorbell_index.sdma_engine, | ||
147 | |||
146 | }; | 148 | }; |
147 | 149 | ||
148 | /* this is going to have a few of the MSBs set that we need to | 150 | /* this is going to have a few of the MSBs set that we need to |
@@ -172,31 +174,6 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) | |||
172 | &gpu_resources.doorbell_aperture_size, | 174 | &gpu_resources.doorbell_aperture_size, |
173 | &gpu_resources.doorbell_start_offset); | 175 | &gpu_resources.doorbell_start_offset); |
174 | 176 | ||
175 | if (adev->asic_type < CHIP_VEGA10) { | ||
176 | kgd2kfd_device_init(adev->kfd.dev, &gpu_resources); | ||
177 | return; | ||
178 | } | ||
179 | |||
180 | n = (adev->asic_type < CHIP_VEGA20) ? 2 : 8; | ||
181 | |||
182 | for (i = 0; i < n; i += 2) { | ||
183 | /* On SOC15 the BIF is involved in routing | ||
184 | * doorbells using the low 12 bits of the | ||
185 | * address. Communicate the assignments to | ||
186 | * KFD. KFD uses two doorbell pages per | ||
187 | * process in case of 64-bit doorbells so we | ||
188 | * can use each doorbell assignment twice. | ||
189 | */ | ||
190 | gpu_resources.sdma_doorbell[0][i] = | ||
191 | adev->doorbell_index.sdma_engine[0] + (i >> 1); | ||
192 | gpu_resources.sdma_doorbell[0][i+1] = | ||
193 | adev->doorbell_index.sdma_engine[0] + 0x200 + (i >> 1); | ||
194 | gpu_resources.sdma_doorbell[1][i] = | ||
195 | adev->doorbell_index.sdma_engine[1] + (i >> 1); | ||
196 | gpu_resources.sdma_doorbell[1][i+1] = | ||
197 | adev->doorbell_index.sdma_engine[1] + 0x200 + (i >> 1); | ||
198 | } | ||
199 | |||
200 | /* Since SOC15, BIF starts to statically use the | 177 | /* Since SOC15, BIF starts to statically use the |
201 | * lower 12 bits of doorbell addresses for routing | 178 | * lower 12 bits of doorbell addresses for routing |
202 | * based on settings in registers like | 179 | * based on settings in registers like |
@@ -205,10 +182,12 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) | |||
205 | * 12 bits of its address has to be outside the range | 182 | * 12 bits of its address has to be outside the range |
206 | * set for SDMA, VCN, and IH blocks. | 183 | * set for SDMA, VCN, and IH blocks. |
207 | */ | 184 | */ |
208 | gpu_resources.non_cp_doorbells_start = | 185 | if (adev->asic_type >= CHIP_VEGA10) { |
209 | adev->doorbell_index.first_non_cp; | 186 | gpu_resources.non_cp_doorbells_start = |
210 | gpu_resources.non_cp_doorbells_end = | 187 | adev->doorbell_index.first_non_cp; |
211 | adev->doorbell_index.last_non_cp; | 188 | gpu_resources.non_cp_doorbells_end = |
189 | adev->doorbell_index.last_non_cp; | ||
190 | } | ||
212 | 191 | ||
213 | kgd2kfd_device_init(adev->kfd.dev, &gpu_resources); | 192 | kgd2kfd_device_init(adev->kfd.dev, &gpu_resources); |
214 | } | 193 | } |