[PATCH 4/5] drm/amdgpu: assign VM invalidation engine manually

Alex Deucher alexdeucher at gmail.com
Wed Apr 5 18:51:33 UTC 2017


On Wed, Apr 5, 2017 at 12:21 PM, Christian König
<deathsimple at vodafone.de> wrote:
> From: Christian König <christian.koenig at amd.com>
>
> For Vega10 we have 18 VM invalidation engines for each VMHUB.
>
> Start to assign them manually to the rings.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  1 +
>  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c    |  2 +-
>  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 12 ++++++++++++
>  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   |  2 +-
>  drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c    |  4 ++--
>  drivers/gpu/drm/amd/amdgpu/vce_v4_0.c    |  2 +-
>  6 files changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> index 45bb87b..5786cc3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
> @@ -179,6 +179,7 @@ struct amdgpu_ring {
>         unsigned                cond_exe_offs;
>         u64                     cond_exe_gpu_addr;
>         volatile u32            *cond_exe_cpu_addr;
> +       unsigned                vm_inv_eng;
>  #if defined(CONFIG_DEBUG_FS)
>         struct dentry *ent;
>  #endif
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index dce2950..79bfbbe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -3150,7 +3150,7 @@ static void gfx_v9_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
>         struct amdgpu_vmhub *hub = &ring->adev->vmhub[AMDGPU_GFXHUB];
>         int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
>         uint32_t req = ring->adev->gart.gart_funcs->get_invalidate_req(vm_id);
> -       unsigned eng = ring->idx;
> +       unsigned eng = ring->vm_inv_eng;
>
>         pd_addr = pd_addr | 0x1; /* valid bit */
>         /* now only use physical base address of PDE and valid */
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index e1637d5..4f6000b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -386,6 +386,18 @@ static int gmc_v9_0_early_init(void *handle)
>  static int gmc_v9_0_late_init(void *handle)
>  {
>         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> +       unsigned vm_inv_eng[AMDGPU_MAX_VMHUBS] = { 0 };
> +       unsigned i;
> +
> +       for(i = 0; i < adev->num_rings; ++i) {
> +               struct amdgpu_ring *ring = adev->rings[i];
> +               unsigned vmhub = ring->funcs->vmhub;
> +
> +               ring->vm_inv_eng = vm_inv_eng[vmhub]++;
> +               dev_info(adev->dev, "ring %u uses VM inv eng %u on hub %u\n",
> +                        ring->idx, ring->vm_inv_eng, ring->funcs->vmhub);
> +       }
> +
>         return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0);
>  }
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index 06826a0..90440e0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> @@ -1041,7 +1041,7 @@ static void sdma_v4_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
>  {
>         struct amdgpu_vmhub *hub = &ring->adev->vmhub[AMDGPU_MMHUB];
>         uint32_t req = ring->adev->gart.gart_funcs->get_invalidate_req(vm_id);
> -       unsigned eng = ring->idx;
> +       unsigned eng = ring->vm_inv_eng;
>
>         pd_addr = pd_addr | 0x1; /* valid bit */
>         /* now only use physical base address of PDE and valid */
> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
> index 772c0f2..cc4f8f4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
> @@ -1037,7 +1037,7 @@ static void uvd_v7_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
>         struct amdgpu_vmhub *hub = &ring->adev->vmhub[AMDGPU_MMHUB];
>         uint32_t req = ring->adev->gart.gart_funcs->get_invalidate_req(vm_id);
>         uint32_t data0, data1, mask;
> -       unsigned eng = ring->idx;
> +       unsigned eng = ring->vm_inv_eng;
>
>         pd_addr = pd_addr | 0x1; /* valid bit */
>         /* now only use physical base address of PDE and valid */
> @@ -1078,7 +1078,7 @@ static void uvd_v7_0_enc_ring_emit_vm_flush(struct amdgpu_ring *ring,
>  {
>         struct amdgpu_vmhub *hub = &ring->adev->vmhub[AMDGPU_MMHUB];
>         uint32_t req = ring->adev->gart.gart_funcs->get_invalidate_req(vm_id);
> -       unsigned eng = ring->idx;
> +       unsigned eng = ring->vm_inv_eng;
>
>         pd_addr = pd_addr | 0x1; /* valid bit */
>         /* now only use physical base address of PDE and valid */
> diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
> index 5e4f243..66474e8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
> @@ -975,7 +975,7 @@ static void vce_v4_0_emit_vm_flush(struct amdgpu_ring *ring,
>  {
>         struct amdgpu_vmhub *hub = &ring->adev->vmhub[AMDGPU_MMHUB];
>         uint32_t req = ring->adev->gart.gart_funcs->get_invalidate_req(vm_id);
> -       unsigned eng = ring->idx;
> +       unsigned eng = ring->vm_inv_eng;
>
>         pd_addr = pd_addr | 0x1; /* valid bit */
>         /* now only use physical base address of PDE and valid */
> --
> 2.5.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list