aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-03-30 09:55:07 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-04-04 23:34:21 -0400
commitf75e237c41587b5e438cbf5d5c90ffcda4080955 (patch)
tree5fa33cc860718b3251f427f062360b6e532102fc
parentf7d015b90dd48c94ab43380a735acf2b3c2c62bf (diff)
drm/amdgpu: move adjust_mc_addr into amdgpu_gart_funcs
We should probably rename amdgpu_gart_funcs sooner or later. Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h5
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c23
3 files changed, 9 insertions, 23 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 46c22e7df99d..0a617601fcca 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -304,10 +304,6 @@ struct amdgpu_gart_funcs {
304 /* set pte flags based per asic */ 304 /* set pte flags based per asic */
305 uint64_t (*get_vm_pte_flags)(struct amdgpu_device *adev, 305 uint64_t (*get_vm_pte_flags)(struct amdgpu_device *adev,
306 uint32_t flags); 306 uint32_t flags);
307};
308
309/* provided by the mc block */
310struct amdgpu_mc_funcs {
311 /* adjust mc addr in fb for APU case */ 307 /* adjust mc addr in fb for APU case */
312 u64 (*adjust_mc_addr)(struct amdgpu_device *adev, u64 addr); 308 u64 (*adjust_mc_addr)(struct amdgpu_device *adev, u64 addr);
313}; 309};
@@ -613,7 +609,6 @@ struct amdgpu_mc {
613 u64 private_aperture_end; 609 u64 private_aperture_end;
614 /* protects concurrent invalidation */ 610 /* protects concurrent invalidation */
615 spinlock_t invalidate_lock; 611 spinlock_t invalidate_lock;
616 const struct amdgpu_mc_funcs *mc_funcs;
617}; 612};
618 613
619/* 614/*
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 9225493c8366..14f0889f7563 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -571,8 +571,8 @@ static u64 amdgpu_vm_adjust_mc_addr(struct amdgpu_device *adev, u64 mc_addr)
571{ 571{
572 u64 addr = mc_addr; 572 u64 addr = mc_addr;
573 573
574 if (adev->mc.mc_funcs && adev->mc.mc_funcs->adjust_mc_addr) 574 if (adev->gart.gart_funcs->adjust_mc_addr)
575 addr = adev->mc.mc_funcs->adjust_mc_addr(adev, addr); 575 addr = adev->gart.gart_funcs->adjust_mc_addr(adev, addr);
576 576
577 return addr; 577 return addr;
578} 578}
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 8dd99b2a0026..268cedb421d2 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -331,30 +331,22 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev,
331 return pte_flag; 331 return pte_flag;
332} 332}
333 333
334static const struct amdgpu_gart_funcs gmc_v9_0_gart_funcs = {
335 .flush_gpu_tlb = gmc_v9_0_gart_flush_gpu_tlb,
336 .set_pte_pde = gmc_v9_0_gart_set_pte_pde,
337 .get_vm_pte_flags = gmc_v9_0_get_vm_pte_flags
338};
339
340static void gmc_v9_0_set_gart_funcs(struct amdgpu_device *adev)
341{
342 if (adev->gart.gart_funcs == NULL)
343 adev->gart.gart_funcs = &gmc_v9_0_gart_funcs;
344}
345
346static u64 gmc_v9_0_adjust_mc_addr(struct amdgpu_device *adev, u64 mc_addr) 334static u64 gmc_v9_0_adjust_mc_addr(struct amdgpu_device *adev, u64 mc_addr)
347{ 335{
348 return adev->vm_manager.vram_base_offset + mc_addr - adev->mc.vram_start; 336 return adev->vm_manager.vram_base_offset + mc_addr - adev->mc.vram_start;
349} 337}
350 338
351static const struct amdgpu_mc_funcs gmc_v9_0_mc_funcs = { 339static const struct amdgpu_gart_funcs gmc_v9_0_gart_funcs = {
340 .flush_gpu_tlb = gmc_v9_0_gart_flush_gpu_tlb,
341 .set_pte_pde = gmc_v9_0_gart_set_pte_pde,
342 .get_vm_pte_flags = gmc_v9_0_get_vm_pte_flags,
352 .adjust_mc_addr = gmc_v9_0_adjust_mc_addr, 343 .adjust_mc_addr = gmc_v9_0_adjust_mc_addr,
353}; 344};
354 345
355static void gmc_v9_0_set_mc_funcs(struct amdgpu_device *adev) 346static void gmc_v9_0_set_gart_funcs(struct amdgpu_device *adev)
356{ 347{
357 adev->mc.mc_funcs = &gmc_v9_0_mc_funcs; 348 if (adev->gart.gart_funcs == NULL)
349 adev->gart.gart_funcs = &gmc_v9_0_gart_funcs;
358} 350}
359 351
360static int gmc_v9_0_early_init(void *handle) 352static int gmc_v9_0_early_init(void *handle)
@@ -362,7 +354,6 @@ static int gmc_v9_0_early_init(void *handle)
362 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 354 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
363 355
364 gmc_v9_0_set_gart_funcs(adev); 356 gmc_v9_0_set_gart_funcs(adev);
365 gmc_v9_0_set_mc_funcs(adev);
366 gmc_v9_0_set_irq_funcs(adev); 357 gmc_v9_0_set_irq_funcs(adev);
367 358
368 return 0; 359 return 0;