Am 17.01.2018 um 07:24 schrieb Chunming Zhou: > I'm not sure if this is a good ongoing, as I know, our per IP topology > is intended for every generation asic bringup. Actually the intention goes beyond that, e.g. we want to reuse IPs for newer ASICs as well when they haven't changed. > > I think there are many similar logics which we can abstract, but we > don't do that. > > For emit_wreg above patches, they only can be used by vm flush part, > but they are common func fallback. > > Can we only make emit_wreg as static in their files, and replace every > where they are used? Not sure what you are suggesting here? Regards, Christian. > > Regards, > David Zhou > On 2018å¹´01æ??17æ?¥ 03:40, Christian König wrote: >> Add a new GMC function to unify vm flushing. >> >> Signed-off-by: Christian König <christian.koenig at amd.com> >> --- >>  drivers/gpu/drm/amd/amdgpu/amdgpu.h    | 1 + >>  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 3 +++ >>  2 files changed, 4 insertions(+) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> index 93eae393b08d..230826718c98 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> @@ -1779,6 +1779,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring) >>  #define amdgpu_asic_flush_hdp(adev) >> (adev)->asic_funcs->flush_hdp((adev)) >>  #define amdgpu_asic_invalidate_hdp(adev) >> (adev)->asic_funcs->invalidate_hdp((adev)) >>  #define amdgpu_gmc_flush_gpu_tlb(adev, vmid) >> (adev)->gmc.gmc_funcs->flush_gpu_tlb((adev), (vmid)) >> +#define amdgpu_gmc_emit_flush_gpu_tlb(r, vmid, pasid, addr) >> (r)->adev->gmc.gmc_funcs->emit_flush_gpu_tlb((r), (vmid), (pasid), >> (addr)) >>  #define amdgpu_gmc_set_pte_pde(adev, pt, idx, addr, flags) >> (adev)->gmc.gmc_funcs->set_pte_pde((adev), (pt), (idx), (addr), (flags)) >>  #define amdgpu_gmc_get_vm_pde(adev, level, dst, flags) >> (adev)->gmc.gmc_funcs->get_vm_pde((adev), (level), (dst), (flags)) >>  #define amdgpu_gmc_get_pte_flags(adev, flags) >> (adev)->gmc.gmc_funcs->get_vm_pte_flags((adev),(flags)) >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h >> index a4a8374f7f3f..114350a4693f 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h >> @@ -52,6 +52,9 @@ struct amdgpu_gmc_funcs { >>      /* flush the vm tlb via mmio */ >>      void (*flush_gpu_tlb)(struct amdgpu_device *adev, >>                    uint32_t vmid); >> +   /* flush the vm tlb via ring */ >> +   uint64_t (*emit_flush_gpu_tlb)(struct amdgpu_ring *ring, >> unsigned vmid, >> +                      unsigned pasid, uint64_t pd_addr); >>      /* write pte/pde updates using the cpu */ >>      int (*set_pte_pde)(struct amdgpu_device *adev, >>                 void *cpu_pt_addr, /* cpu addr of page table */ >