Re: [PATCH] drm/radeon: re-order firmware loading in preparation for dpm rework

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

 



On Wed, Mar 12, 2014 at 11:20:41AM -0400, Alex Deucher wrote:
> We need to reorder the driver init sequence to better accomodate
> dpm which needs to be loaded earlier in the init sequence.  Move
> fw init up so that it's available for dpm init.
> 
> This also fixes a bad failure case when firmware is not available.
> 
> This is a cherry-pick of the fix from 3.14.
> 
> Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
> (cherry picked from commit 01ac8794a77192236a4b91c33adf4177ac5a21f0)

Thank you Alex, I'll queue this for the 3.11 kernel.

Cheers,
--
Luís

> ---
>  drivers/gpu/drm/radeon/cik.c       | 42 ++++++++++++++++++++------------------
>  drivers/gpu/drm/radeon/evergreen.c | 33 ++++++++++++++++--------------
>  drivers/gpu/drm/radeon/ni.c        | 36 +++++++++++++++++---------------
>  drivers/gpu/drm/radeon/r600.c      | 16 +++++++--------
>  drivers/gpu/drm/radeon/rv770.c     | 16 +++++++--------
>  drivers/gpu/drm/radeon/si.c        | 18 ++++++++--------
>  6 files changed, 84 insertions(+), 77 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index e9cde26..d955c39 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -7498,26 +7498,7 @@ static int cik_startup(struct radeon_device *rdev)
>  
>  	cik_mc_program(rdev);
>  
> -	if (rdev->flags & RADEON_IS_IGP) {
> -		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw ||
> -		    !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw) {
> -			r = cik_init_microcode(rdev);
> -			if (r) {
> -				DRM_ERROR("Failed to load firmware!\n");
> -				return r;
> -			}
> -		}
> -	} else {
> -		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw ||
> -		    !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw ||
> -		    !rdev->mc_fw) {
> -			r = cik_init_microcode(rdev);
> -			if (r) {
> -				DRM_ERROR("Failed to load firmware!\n");
> -				return r;
> -			}
> -		}
> -
> +	if (!(rdev->flags & RADEON_IS_IGP)) {
>  		r = ci_mc_load_microcode(rdev);
>  		if (r) {
>  			DRM_ERROR("Failed to load MC firmware!\n");
> @@ -7830,6 +7811,27 @@ int cik_init(struct radeon_device *rdev)
>  	if (r)
>  		return r;
>  
> +	if (rdev->flags & RADEON_IS_IGP) {
> +		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw ||
> +		    !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw) {
> +			r = cik_init_microcode(rdev);
> +			if (r) {
> +				DRM_ERROR("Failed to load firmware!\n");
> +				return r;
> +			}
> +		}
> +	} else {
> +		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw ||
> +		    !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw ||
> +		    !rdev->mc_fw) {
> +			r = cik_init_microcode(rdev);
> +			if (r) {
> +				DRM_ERROR("Failed to load firmware!\n");
> +				return r;
> +			}
> +		}
> +	}
> +
>  	ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
>  	ring->ring_obj = NULL;
>  	r600_ring_init(rdev, ring, 1024 * 1024);
> diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
> index 95ffe2a..0d4a56a 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -5110,26 +5110,11 @@ static int evergreen_startup(struct radeon_device *rdev)
>  	evergreen_mc_program(rdev);
>  
>  	if (ASIC_IS_DCE5(rdev)) {
> -		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) {
> -			r = ni_init_microcode(rdev);
> -			if (r) {
> -				DRM_ERROR("Failed to load firmware!\n");
> -				return r;
> -			}
> -		}
>  		r = ni_mc_load_microcode(rdev);
>  		if (r) {
>  			DRM_ERROR("Failed to load MC firmware!\n");
>  			return r;
>  		}
> -	} else {
> -		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
> -			r = r600_init_microcode(rdev);
> -			if (r) {
> -				DRM_ERROR("Failed to load firmware!\n");
> -				return r;
> -			}
> -		}
>  	}
>  
>  	if (rdev->flags & RADEON_IS_AGP) {
> @@ -5357,6 +5342,24 @@ int evergreen_init(struct radeon_device *rdev)
>  	if (r)
>  		return r;
>  
> +	if (ASIC_IS_DCE5(rdev)) {
> +		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) {
> +			r = ni_init_microcode(rdev);
> +			if (r) {
> +				DRM_ERROR("Failed to load firmware!\n");
> +				return r;
> +			}
> +		}
> +	} else {
> +		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
> +			r = r600_init_microcode(rdev);
> +			if (r) {
> +				DRM_ERROR("Failed to load firmware!\n");
> +				return r;
> +			}
> +		}
> +	}
> +
>  	rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL;
>  	r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024);
>  
> diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
> index 9eeb2a9..2443d11 100644
> --- a/drivers/gpu/drm/radeon/ni.c
> +++ b/drivers/gpu/drm/radeon/ni.c
> @@ -1876,23 +1876,7 @@ static int cayman_startup(struct radeon_device *rdev)
>  
>  	evergreen_mc_program(rdev);
>  
> -	if (rdev->flags & RADEON_IS_IGP) {
> -		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
> -			r = ni_init_microcode(rdev);
> -			if (r) {
> -				DRM_ERROR("Failed to load firmware!\n");
> -				return r;
> -			}
> -		}
> -	} else {
> -		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) {
> -			r = ni_init_microcode(rdev);
> -			if (r) {
> -				DRM_ERROR("Failed to load firmware!\n");
> -				return r;
> -			}
> -		}
> -
> +	if (!(rdev->flags & RADEON_IS_IGP)) {
>  		r = ni_mc_load_microcode(rdev);
>  		if (r) {
>  			DRM_ERROR("Failed to load MC firmware!\n");
> @@ -2143,6 +2127,24 @@ int cayman_init(struct radeon_device *rdev)
>  	if (r)
>  		return r;
>  
> +	if (rdev->flags & RADEON_IS_IGP) {
> +		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
> +			r = ni_init_microcode(rdev);
> +			if (r) {
> +				DRM_ERROR("Failed to load firmware!\n");
> +				return r;
> +			}
> +		}
> +	} else {
> +		if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) {
> +			r = ni_init_microcode(rdev);
> +			if (r) {
> +				DRM_ERROR("Failed to load firmware!\n");
> +				return r;
> +			}
> +		}
> +	}
> +
>  	ring->ring_obj = NULL;
>  	r600_ring_init(rdev, ring, 1024 * 1024);
>  
> diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
> index 51cbb60..2d75542 100644
> --- a/drivers/gpu/drm/radeon/r600.c
> +++ b/drivers/gpu/drm/radeon/r600.c
> @@ -2776,14 +2776,6 @@ static int r600_startup(struct radeon_device *rdev)
>  
>  	r600_mc_program(rdev);
>  
> -	if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
> -		r = r600_init_microcode(rdev);
> -		if (r) {
> -			DRM_ERROR("Failed to load firmware!\n");
> -			return r;
> -		}
> -	}
> -
>  	if (rdev->flags & RADEON_IS_AGP) {
>  		r600_agp_enable(rdev);
>  	} else {
> @@ -2971,6 +2963,14 @@ int r600_init(struct radeon_device *rdev)
>  	if (r)
>  		return r;
>  
> +	if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
> +		r = r600_init_microcode(rdev);
> +		if (r) {
> +			DRM_ERROR("Failed to load firmware!\n");
> +			return r;
> +		}
> +	}
> +
>  	rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL;
>  	r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024);
>  
> diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
> index 9f58467..45774ff 100644
> --- a/drivers/gpu/drm/radeon/rv770.c
> +++ b/drivers/gpu/drm/radeon/rv770.c
> @@ -1665,14 +1665,6 @@ static int rv770_startup(struct radeon_device *rdev)
>  
>  	rv770_mc_program(rdev);
>  
> -	if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
> -		r = r600_init_microcode(rdev);
> -		if (r) {
> -			DRM_ERROR("Failed to load firmware!\n");
> -			return r;
> -		}
> -	}
> -
>  	if (rdev->flags & RADEON_IS_AGP) {
>  		rv770_agp_enable(rdev);
>  	} else {
> @@ -1876,6 +1868,14 @@ int rv770_init(struct radeon_device *rdev)
>  	if (r)
>  		return r;
>  
> +	if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
> +		r = r600_init_microcode(rdev);
> +		if (r) {
> +			DRM_ERROR("Failed to load firmware!\n");
> +			return r;
> +		}
> +	}
> +
>  	rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL;
>  	r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024);
>  
> diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
> index 6ff3f1a..4a2e532 100644
> --- a/drivers/gpu/drm/radeon/si.c
> +++ b/drivers/gpu/drm/radeon/si.c
> @@ -6328,15 +6328,6 @@ static int si_startup(struct radeon_device *rdev)
>  
>  	si_mc_program(rdev);
>  
> -	if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw ||
> -	    !rdev->rlc_fw || !rdev->mc_fw) {
> -		r = si_init_microcode(rdev);
> -		if (r) {
> -			DRM_ERROR("Failed to load firmware!\n");
> -			return r;
> -		}
> -	}
> -
>  	r = si_mc_load_microcode(rdev);
>  	if (r) {
>  		DRM_ERROR("Failed to load MC firmware!\n");
> @@ -6604,6 +6595,15 @@ int si_init(struct radeon_device *rdev)
>  	if (r)
>  		return r;
>  
> +	if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw ||
> +	    !rdev->rlc_fw || !rdev->mc_fw) {
> +		r = si_init_microcode(rdev);
> +		if (r) {
> +			DRM_ERROR("Failed to load firmware!\n");
> +			return r;
> +		}
> +	}
> +
>  	ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
>  	ring->ring_obj = NULL;
>  	r600_ring_init(rdev, ring, 1024 * 1024);
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]