drm/amdgpu: add check when no firmware need to load

Submitted by Huang, Ray on June 14, 2017, 7:27 a.m.

Details

Message ID 1497425261-16658-1-git-send-email-ray.huang@amd.com
State New
Headers show
Series "drm/amdgpu: add check when no firmware need to load" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Huang, Ray June 14, 2017, 7:27 a.m.
Signed-off-by: Huang Rui <ray.huang@amd.com>
---

Hi Alex, Ken,

This patch is fixing the check to let driver be able to work only enabling
common/gmc/ih/psp blocks. It's useful to debug issue.

Thanks,
Ray

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index 076253e..4794d26 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -347,6 +347,11 @@  int amdgpu_ucode_init_bo(struct amdgpu_device *adev)
 	struct amdgpu_firmware_info *ucode = NULL;
 	const struct common_firmware_header *header = NULL;
 
+	if (!adev->firmware.fw_size) {
+		dev_warn(adev->dev, "No ip firmware need to load\n");
+		return 0;
+	}
+
 	err = amdgpu_bo_create(adev, adev->firmware.fw_size, PAGE_SIZE, true,
 				amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
 				0, NULL, NULL, bo);
@@ -428,6 +433,9 @@  int amdgpu_ucode_fini_bo(struct amdgpu_device *adev)
 	int i;
 	struct amdgpu_firmware_info *ucode = NULL;
 
+	if (!adev->firmware.fw_size)
+		return 0;
+
 	for (i = 0; i < adev->firmware.max_ucodes; i++) {
 		ucode = &adev->firmware.ucode[i];
 		if (ucode->fw) {

Comments

On Wed, Jun 14, 2017 at 3:27 AM, Huang Rui <ray.huang@amd.com> wrote:
> Signed-off-by: Huang Rui <ray.huang@amd.com>
> ---
>
> Hi Alex, Ken,
>
> This patch is fixing the check to let driver be able to work only enabling
> common/gmc/ih/psp blocks. It's useful to debug issue.
>
> Thanks,
> Ray

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

>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> index 076253e..4794d26 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> @@ -347,6 +347,11 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev)
>         struct amdgpu_firmware_info *ucode = NULL;
>         const struct common_firmware_header *header = NULL;
>
> +       if (!adev->firmware.fw_size) {
> +               dev_warn(adev->dev, "No ip firmware need to load\n");
> +               return 0;
> +       }
> +
>         err = amdgpu_bo_create(adev, adev->firmware.fw_size, PAGE_SIZE, true,
>                                 amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
>                                 0, NULL, NULL, bo);
> @@ -428,6 +433,9 @@ int amdgpu_ucode_fini_bo(struct amdgpu_device *adev)
>         int i;
>         struct amdgpu_firmware_info *ucode = NULL;
>
> +       if (!adev->firmware.fw_size)
> +               return 0;
> +
>         for (i = 0; i < adev->firmware.max_ucodes; i++) {
>                 ucode = &adev->firmware.ucode[i];
>                 if (ucode->fw) {
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx