Commit f75e237c authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: move adjust_mc_addr into amdgpu_gart_funcs

We should probably rename amdgpu_gart_funcs sooner or later.
Reviewed-by: default avatarJunwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f7d015b9
...@@ -304,10 +304,6 @@ struct amdgpu_gart_funcs { ...@@ -304,10 +304,6 @@ struct amdgpu_gart_funcs {
/* set pte flags based per asic */ /* set pte flags based per asic */
uint64_t (*get_vm_pte_flags)(struct amdgpu_device *adev, uint64_t (*get_vm_pte_flags)(struct amdgpu_device *adev,
uint32_t flags); uint32_t flags);
};
/* provided by the mc block */
struct amdgpu_mc_funcs {
/* adjust mc addr in fb for APU case */ /* adjust mc addr in fb for APU case */
u64 (*adjust_mc_addr)(struct amdgpu_device *adev, u64 addr); u64 (*adjust_mc_addr)(struct amdgpu_device *adev, u64 addr);
}; };
...@@ -613,7 +609,6 @@ struct amdgpu_mc { ...@@ -613,7 +609,6 @@ struct amdgpu_mc {
u64 private_aperture_end; u64 private_aperture_end;
/* protects concurrent invalidation */ /* protects concurrent invalidation */
spinlock_t invalidate_lock; spinlock_t invalidate_lock;
const struct amdgpu_mc_funcs *mc_funcs;
}; };
/* /*
......
...@@ -571,8 +571,8 @@ static u64 amdgpu_vm_adjust_mc_addr(struct amdgpu_device *adev, u64 mc_addr) ...@@ -571,8 +571,8 @@ static u64 amdgpu_vm_adjust_mc_addr(struct amdgpu_device *adev, u64 mc_addr)
{ {
u64 addr = mc_addr; u64 addr = mc_addr;
if (adev->mc.mc_funcs && adev->mc.mc_funcs->adjust_mc_addr) if (adev->gart.gart_funcs->adjust_mc_addr)
addr = adev->mc.mc_funcs->adjust_mc_addr(adev, addr); addr = adev->gart.gart_funcs->adjust_mc_addr(adev, addr);
return addr; return addr;
} }
......
...@@ -331,30 +331,22 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev, ...@@ -331,30 +331,22 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev,
return pte_flag; return pte_flag;
} }
static const struct amdgpu_gart_funcs gmc_v9_0_gart_funcs = {
.flush_gpu_tlb = gmc_v9_0_gart_flush_gpu_tlb,
.set_pte_pde = gmc_v9_0_gart_set_pte_pde,
.get_vm_pte_flags = gmc_v9_0_get_vm_pte_flags
};
static void gmc_v9_0_set_gart_funcs(struct amdgpu_device *adev)
{
if (adev->gart.gart_funcs == NULL)
adev->gart.gart_funcs = &gmc_v9_0_gart_funcs;
}
static u64 gmc_v9_0_adjust_mc_addr(struct amdgpu_device *adev, u64 mc_addr) static u64 gmc_v9_0_adjust_mc_addr(struct amdgpu_device *adev, u64 mc_addr)
{ {
return adev->vm_manager.vram_base_offset + mc_addr - adev->mc.vram_start; return adev->vm_manager.vram_base_offset + mc_addr - adev->mc.vram_start;
} }
static const struct amdgpu_mc_funcs gmc_v9_0_mc_funcs = { static const struct amdgpu_gart_funcs gmc_v9_0_gart_funcs = {
.flush_gpu_tlb = gmc_v9_0_gart_flush_gpu_tlb,
.set_pte_pde = gmc_v9_0_gart_set_pte_pde,
.get_vm_pte_flags = gmc_v9_0_get_vm_pte_flags,
.adjust_mc_addr = gmc_v9_0_adjust_mc_addr, .adjust_mc_addr = gmc_v9_0_adjust_mc_addr,
}; };
static void gmc_v9_0_set_mc_funcs(struct amdgpu_device *adev) static void gmc_v9_0_set_gart_funcs(struct amdgpu_device *adev)
{ {
adev->mc.mc_funcs = &gmc_v9_0_mc_funcs; if (adev->gart.gart_funcs == NULL)
adev->gart.gart_funcs = &gmc_v9_0_gart_funcs;
} }
static int gmc_v9_0_early_init(void *handle) static int gmc_v9_0_early_init(void *handle)
...@@ -362,7 +354,6 @@ static int gmc_v9_0_early_init(void *handle) ...@@ -362,7 +354,6 @@ static int gmc_v9_0_early_init(void *handle)
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
gmc_v9_0_set_gart_funcs(adev); gmc_v9_0_set_gart_funcs(adev);
gmc_v9_0_set_mc_funcs(adev);
gmc_v9_0_set_irq_funcs(adev); gmc_v9_0_set_irq_funcs(adev);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment