[PATCH] drm/amdgpu: Do not program IH_CHICKEN in vega20_ih.c under SRIOV

Alex Deucher alexdeucher at gmail.com
Fri Feb 16 15:29:07 UTC 2024


On Tue, Feb 13, 2024 at 5:43 PM Victor Lu <victorchengchi.lu at amd.com> wrote:
>
> IH_CHICKEN is blocked for VF writes; this access should be skipped.
>
> Signed-off-by: Victor Lu <victorchengchi.lu at amd.com>

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

> ---
>  drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 38 ++++++++++++++------------
>  1 file changed, 20 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_ih.c b/drivers/gpu/drm/amd/amdgpu/vega20_ih.c
> index db66e6cccaf2..b9e785846637 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vega20_ih.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vega20_ih.c
> @@ -291,27 +291,29 @@ static int vega20_ih_irq_init(struct amdgpu_device *adev)
>
>         adev->nbio.funcs->ih_control(adev);
>
> -       if ((amdgpu_ip_version(adev, OSSSYS_HWIP, 0) == IP_VERSION(4, 2, 1)) &&
> -           adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
> -               ih_chicken = RREG32_SOC15(OSSSYS, 0, mmIH_CHICKEN);
> -               if (adev->irq.ih.use_bus_addr) {
> -                       ih_chicken = REG_SET_FIELD(ih_chicken, IH_CHICKEN,
> -                                                  MC_SPACE_GPA_ENABLE, 1);
> +       if (!amdgpu_sriov_vf(adev)) {
> +               if ((amdgpu_ip_version(adev, OSSSYS_HWIP, 0) == IP_VERSION(4, 2, 1)) &&
> +                   adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
> +                       ih_chicken = RREG32_SOC15(OSSSYS, 0, mmIH_CHICKEN);
> +                       if (adev->irq.ih.use_bus_addr) {
> +                               ih_chicken = REG_SET_FIELD(ih_chicken, IH_CHICKEN,
> +                                                          MC_SPACE_GPA_ENABLE, 1);
> +                       }
> +                       WREG32_SOC15(OSSSYS, 0, mmIH_CHICKEN, ih_chicken);
>                 }
> -               WREG32_SOC15(OSSSYS, 0, mmIH_CHICKEN, ih_chicken);
> -       }
>
> -       /* psp firmware won't program IH_CHICKEN for aldebaran
> -        * driver needs to program it properly according to
> -        * MC_SPACE type in IH_RB_CNTL */
> -       if ((amdgpu_ip_version(adev, OSSSYS_HWIP, 0) == IP_VERSION(4, 4, 0)) ||
> -           (amdgpu_ip_version(adev, OSSSYS_HWIP, 0) == IP_VERSION(4, 4, 2))) {
> -               ih_chicken = RREG32_SOC15(OSSSYS, 0, mmIH_CHICKEN_ALDEBARAN);
> -               if (adev->irq.ih.use_bus_addr) {
> -                       ih_chicken = REG_SET_FIELD(ih_chicken, IH_CHICKEN,
> -                                                  MC_SPACE_GPA_ENABLE, 1);
> +               /* psp firmware won't program IH_CHICKEN for aldebaran
> +                * driver needs to program it properly according to
> +                * MC_SPACE type in IH_RB_CNTL */
> +               if ((amdgpu_ip_version(adev, OSSSYS_HWIP, 0) == IP_VERSION(4, 4, 0)) ||
> +                   (amdgpu_ip_version(adev, OSSSYS_HWIP, 0) == IP_VERSION(4, 4, 2))) {
> +                       ih_chicken = RREG32_SOC15(OSSSYS, 0, mmIH_CHICKEN_ALDEBARAN);
> +                       if (adev->irq.ih.use_bus_addr) {
> +                               ih_chicken = REG_SET_FIELD(ih_chicken, IH_CHICKEN,
> +                                                          MC_SPACE_GPA_ENABLE, 1);
> +                       }
> +                       WREG32_SOC15(OSSSYS, 0, mmIH_CHICKEN_ALDEBARAN, ih_chicken);
>                 }
> -               WREG32_SOC15(OSSSYS, 0, mmIH_CHICKEN_ALDEBARAN, ih_chicken);
>         }
>
>         for (i = 0; i < ARRAY_SIZE(ih); i++) {
> --
> 2.34.1
>


More information about the amd-gfx mailing list