Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christian König and committed by
Alex Deucher
f75e237c f7d015b9

+9 -23
-5
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 304 304 /* set pte flags based per asic */ 305 305 uint64_t (*get_vm_pte_flags)(struct amdgpu_device *adev, 306 306 uint32_t flags); 307 - }; 308 - 309 - /* provided by the mc block */ 310 - struct amdgpu_mc_funcs { 311 307 /* adjust mc addr in fb for APU case */ 312 308 u64 (*adjust_mc_addr)(struct amdgpu_device *adev, u64 addr); 313 309 }; ··· 609 613 u64 private_aperture_end; 610 614 /* protects concurrent invalidation */ 611 615 spinlock_t invalidate_lock; 612 - const struct amdgpu_mc_funcs *mc_funcs; 613 616 }; 614 617 615 618 /*
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
··· 571 571 { 572 572 u64 addr = mc_addr; 573 573 574 - if (adev->mc.mc_funcs && adev->mc.mc_funcs->adjust_mc_addr) 575 - addr = adev->mc.mc_funcs->adjust_mc_addr(adev, addr); 574 + if (adev->gart.gart_funcs->adjust_mc_addr) 575 + addr = adev->gart.gart_funcs->adjust_mc_addr(adev, addr); 576 576 577 577 return addr; 578 578 }
+7 -16
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
··· 331 331 return pte_flag; 332 332 } 333 333 334 + static u64 gmc_v9_0_adjust_mc_addr(struct amdgpu_device *adev, u64 mc_addr) 335 + { 336 + return adev->vm_manager.vram_base_offset + mc_addr - adev->mc.vram_start; 337 + } 338 + 334 339 static const struct amdgpu_gart_funcs gmc_v9_0_gart_funcs = { 335 340 .flush_gpu_tlb = gmc_v9_0_gart_flush_gpu_tlb, 336 341 .set_pte_pde = gmc_v9_0_gart_set_pte_pde, 337 - .get_vm_pte_flags = gmc_v9_0_get_vm_pte_flags 342 + .get_vm_pte_flags = gmc_v9_0_get_vm_pte_flags, 343 + .adjust_mc_addr = gmc_v9_0_adjust_mc_addr, 338 344 }; 339 345 340 346 static void gmc_v9_0_set_gart_funcs(struct amdgpu_device *adev) ··· 349 343 adev->gart.gart_funcs = &gmc_v9_0_gart_funcs; 350 344 } 351 345 352 - static u64 gmc_v9_0_adjust_mc_addr(struct amdgpu_device *adev, u64 mc_addr) 353 - { 354 - return adev->vm_manager.vram_base_offset + mc_addr - adev->mc.vram_start; 355 - } 356 - 357 - static const struct amdgpu_mc_funcs gmc_v9_0_mc_funcs = { 358 - .adjust_mc_addr = gmc_v9_0_adjust_mc_addr, 359 - }; 360 - 361 - static void gmc_v9_0_set_mc_funcs(struct amdgpu_device *adev) 362 - { 363 - adev->mc.mc_funcs = &gmc_v9_0_mc_funcs; 364 - } 365 - 366 346 static int gmc_v9_0_early_init(void *handle) 367 347 { 368 348 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 369 349 370 350 gmc_v9_0_set_gart_funcs(adev); 371 - gmc_v9_0_set_mc_funcs(adev); 372 351 gmc_v9_0_set_irq_funcs(adev); 373 352 374 353 return 0;