drm/amdgpu: limit the VM address space with older VCE FW versions
authorChristian König <christian.koenig@amd.com>
Mon, 29 Jan 2018 15:03:50 +0000 (16:03 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 19 Feb 2018 19:19:05 +0000 (14:19 -0500)
Older VCE FW versions are buggy and can't work with 48bit address
spaces.

RFC: Should we limit the address space or just reject loading the older
VCE firmware?

Signed-off-by: Christian König <christian.koenig@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_kms.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h

index f828096..e851c66 100644 (file)
@@ -581,6 +581,11 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 
                vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
                vm_size -= AMDGPU_VA_RESERVED_SIZE;
+
+               /* Older VCE FW versions are buggy and can handle only 40bits */
+               if (adev->vce.fw_version < AMDGPU_VCE_FW_53_45)
+                       vm_size = min(vm_size, 1ULL << 40);
+
                dev_info.virtual_address_offset = AMDGPU_VA_RESERVED_SIZE;
                dev_info.virtual_address_max =
                        min(vm_size, AMDGPU_VA_HOLE_START);
index 0fd378a..7178126 100644 (file)
@@ -30,6 +30,8 @@
 #define AMDGPU_VCE_HARVEST_VCE0 (1 << 0)
 #define AMDGPU_VCE_HARVEST_VCE1 (1 << 1)
 
+#define AMDGPU_VCE_FW_53_45    ((53 << 24) | (45 << 16))
+
 struct amdgpu_vce {
        struct amdgpu_bo        *vcpu_bo;
        uint64_t                gpu_addr;