drm/amdgpu:fw bo should be in VRAM for SRIOV
authorFrank Min <Frank.Min@amd.com>
Wed, 27 Apr 2016 12:02:57 +0000 (20:02 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Oct 2016 18:38:22 +0000 (14:38 -0400)
for GTT memory SMC can only access it within PF space, which is not
used for SRIOV case, thus for SRIOV case, we let SMC use FB space for
ucode bo.

Signed-off-by: Frank Min <frank.min@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c

index cb3d252f3c78cb03b30252e4b558ccd5c1b6b866..b7b82a27042040583de1a8c615b9fa89681b5932 100644 (file)
@@ -247,7 +247,8 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev)
        const struct common_firmware_header *header = NULL;
 
        err = amdgpu_bo_create(adev, adev->firmware.fw_size, PAGE_SIZE, true,
-                              AMDGPU_GEM_DOMAIN_GTT, 0, NULL, NULL, bo);
+                               amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
+                               0, NULL, NULL, bo);
        if (err) {
                dev_err(adev->dev, "(%d) Firmware buffer allocate failed\n", err);
                goto failed;
@@ -259,7 +260,8 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev)
                goto failed_reserve;
        }
 
-       err = amdgpu_bo_pin(*bo, AMDGPU_GEM_DOMAIN_GTT, &fw_mc_addr);
+       err = amdgpu_bo_pin(*bo, amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
+                               &fw_mc_addr);
        if (err) {
                dev_err(adev->dev, "(%d) Firmware buffer pin failed\n", err);
                goto failed_pin;