Re: [PATCH 28/29] drm/amdgpu: wait_for_idle for each vcn instance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 24, 2024 at 10:36 PM <boyuan.zhang@xxxxxxx> wrote:
>
> From: Boyuan Zhang <boyuan.zhang@xxxxxxx>
>
> Perform wait_for_idle only for the instance of the current vcn IP block,
> instead of perform it for all vcn instances.
>
> v2: remove unneeded local variable initialization.
>
> Signed-off-by: Boyuan Zhang <boyuan.zhang@xxxxxxx>

Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>

> ---
>  drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c   | 16 +++++++---------
>  drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c   | 15 ++++++---------
>  drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c   | 15 ++++++---------
>  drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 11 ++++-------
>  drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 15 ++++++---------
>  drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 15 ++++++---------
>  6 files changed, 35 insertions(+), 52 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
> index 2e5888b905fb..34d94b09f04c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
> @@ -1777,16 +1777,14 @@ static bool vcn_v2_5_is_idle(void *handle)
>  static int vcn_v2_5_wait_for_idle(struct amdgpu_ip_block *ip_block)
>  {
>         struct amdgpu_device *adev = ip_block->adev;
> -       int i, ret = 0;
> +       int inst = ip_block->instance;
> +       int ret;
>
> -       for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
> -               if (adev->vcn.harvest_config & (1 << i))
> -                       continue;
> -               ret = SOC15_WAIT_ON_RREG(VCN, i, mmUVD_STATUS, UVD_STATUS__IDLE,
> -                       UVD_STATUS__IDLE);
> -               if (ret)
> -                       return ret;
> -       }
> +       if (adev->vcn.harvest_config & (1 << inst))
> +               return 0;
> +
> +       ret = SOC15_WAIT_ON_RREG(VCN, inst, mmUVD_STATUS, UVD_STATUS__IDLE,
> +               UVD_STATUS__IDLE);
>
>         return ret;
>  }
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
> index 0d1c1534db40..451858f86272 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
> @@ -2105,17 +2105,14 @@ static bool vcn_v3_0_is_idle(void *handle)
>  static int vcn_v3_0_wait_for_idle(struct amdgpu_ip_block *ip_block)
>  {
>         struct amdgpu_device *adev = ip_block->adev;
> -       int i, ret = 0;
> +       int inst = ip_block->instance;
> +       int ret;
>
> -       for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
> -               if (adev->vcn.harvest_config & (1 << i))
> -                       continue;
> +       if (adev->vcn.harvest_config & (1 << inst))
> +               return 0;
>
> -               ret = SOC15_WAIT_ON_RREG(VCN, i, mmUVD_STATUS, UVD_STATUS__IDLE,
> -                       UVD_STATUS__IDLE);
> -               if (ret)
> -                       return ret;
> -       }
> +       ret = SOC15_WAIT_ON_RREG(VCN, inst, mmUVD_STATUS, UVD_STATUS__IDLE,
> +               UVD_STATUS__IDLE);
>
>         return ret;
>  }
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
> index e9a8e027d5f9..fa7cf10e8900 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
> @@ -1968,17 +1968,14 @@ static bool vcn_v4_0_is_idle(void *handle)
>  static int vcn_v4_0_wait_for_idle(struct amdgpu_ip_block *ip_block)
>  {
>         struct amdgpu_device *adev = ip_block->adev;
> -       int i, ret = 0;
> +       int inst = ip_block->instance;
> +       int ret;
>
> -       for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
> -               if (adev->vcn.harvest_config & (1 << i))
> -                       continue;
> +       if (adev->vcn.harvest_config & (1 << inst))
> +               return 0;
>
> -               ret = SOC15_WAIT_ON_RREG(VCN, i, regUVD_STATUS, UVD_STATUS__IDLE,
> -                       UVD_STATUS__IDLE);
> -               if (ret)
> -                       return ret;
> -       }
> +       ret = SOC15_WAIT_ON_RREG(VCN, inst, regUVD_STATUS, UVD_STATUS__IDLE,
> +               UVD_STATUS__IDLE);
>
>         return ret;
>  }
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
> index 716bc85141cb..d05dcadb3e81 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
> @@ -1566,14 +1566,11 @@ static bool vcn_v4_0_3_is_idle(void *handle)
>  static int vcn_v4_0_3_wait_for_idle(struct amdgpu_ip_block *ip_block)
>  {
>         struct amdgpu_device *adev = ip_block->adev;
> -       int i, ret = 0;
> +       int inst = ip_block->instance;
> +       int ret;
>
> -       for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
> -               ret = SOC15_WAIT_ON_RREG(VCN, GET_INST(VCN, i), regUVD_STATUS,
> -                                        UVD_STATUS__IDLE, UVD_STATUS__IDLE);
> -               if (ret)
> -                       return ret;
> -       }
> +       ret = SOC15_WAIT_ON_RREG(VCN, GET_INST(VCN, inst), regUVD_STATUS,
> +                                UVD_STATUS__IDLE, UVD_STATUS__IDLE);
>
>         return ret;
>  }
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c
> index b74b2c0942c9..307c8e204456 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c
> @@ -1465,17 +1465,14 @@ static bool vcn_v4_0_5_is_idle(void *handle)
>  static int vcn_v4_0_5_wait_for_idle(struct amdgpu_ip_block *ip_block)
>  {
>         struct amdgpu_device *adev = ip_block->adev;
> -       int i, ret = 0;
> +       int inst = ip_block->instance;
> +       int ret;
>
> -       for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
> -               if (adev->vcn.harvest_config & (1 << i))
> -                       continue;
> +       if (adev->vcn.harvest_config & (1 << inst))
> +               return 0;
>
> -               ret = SOC15_WAIT_ON_RREG(VCN, i, regUVD_STATUS, UVD_STATUS__IDLE,
> -                       UVD_STATUS__IDLE);
> -               if (ret)
> -                       return ret;
> -       }
> +       ret = SOC15_WAIT_ON_RREG(VCN, inst, regUVD_STATUS, UVD_STATUS__IDLE,
> +               UVD_STATUS__IDLE);
>
>         return ret;
>  }
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c
> index 3fbc2aafcd29..50022bbb276e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c
> @@ -1192,17 +1192,14 @@ static bool vcn_v5_0_0_is_idle(void *handle)
>  static int vcn_v5_0_0_wait_for_idle(struct amdgpu_ip_block *ip_block)
>  {
>         struct amdgpu_device *adev = ip_block->adev;
> -       int i, ret = 0;
> +       int inst = ip_block->instance;
> +       int ret;
>
> -       for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
> -               if (adev->vcn.harvest_config & (1 << i))
> -                       continue;
> +       if (adev->vcn.harvest_config & (1 << inst))
> +               return 0;
>
> -               ret = SOC15_WAIT_ON_RREG(VCN, i, regUVD_STATUS, UVD_STATUS__IDLE,
> -                       UVD_STATUS__IDLE);
> -               if (ret)
> -                       return ret;
> -       }
> +       ret = SOC15_WAIT_ON_RREG(VCN, inst, regUVD_STATUS, UVD_STATUS__IDLE,
> +               UVD_STATUS__IDLE);
>
>         return ret;
>  }
> --
> 2.34.1
>




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux