Patch "drm/amdgpu: restrict bo mapping within gpu address limits" has been added to the 5.4-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    drm/amdgpu: restrict bo mapping within gpu address limits

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-amdgpu-restrict-bo-mapping-within-gpu-address-li.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3624709478999bd014a55c32b0abfecf8c8fed59
Author: Rajneesh Bhardwaj <rajneesh.bhardwaj@xxxxxxx>
Date:   Sat Apr 25 01:01:12 2020 -0400

    drm/amdgpu: restrict bo mapping within gpu address limits
    
    [ Upstream commit 8b80d74bdb2285d3022b349c8451eb16535f7906 ]
    
    Have strict check on bo mapping since on some systems, such as A+A or
    hybrid, the cpu might support 5 level paging or can address memory above
    48 bits but gpu might be limited by hardware to just use 48 bits. In
    general, this applies to all asics where this limitation can be checked
    against their max_pfn range. This restricts the range to map bo within
    pratical limits of cpu and gpu for shared virtual memory access.
    
    Reviewed-by: Oak Zeng <oak.zeng@xxxxxxx>
    Reviewed-by: Christian König <christian.koenig@xxxxxxx>
    Reviewed-by: Hawking Zhang <Hawking.Zhang@xxxxxxx>
    Acked-by: Alex Deucher <alexander.deucher@xxxxxxx>
    Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@xxxxxxx>
    Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
    Stable-dep-of: 6fef2d4c00b5 ("drm/amdgpu: validate the parameters of bo mapping operations more clearly")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index dcf23b43f323c..88f2707c69ce7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2130,7 +2130,8 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
 	/* make sure object fit at this offset */
 	eaddr = saddr + size - 1;
 	if (saddr >= eaddr ||
-	    (bo && offset + size > amdgpu_bo_size(bo)))
+	    (bo && offset + size > amdgpu_bo_size(bo)) ||
+	    (eaddr >= adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT))
 		return -EINVAL;
 
 	saddr /= AMDGPU_GPU_PAGE_SIZE;
@@ -2195,7 +2196,8 @@ int amdgpu_vm_bo_replace_map(struct amdgpu_device *adev,
 	/* make sure object fit at this offset */
 	eaddr = saddr + size - 1;
 	if (saddr >= eaddr ||
-	    (bo && offset + size > amdgpu_bo_size(bo)))
+	    (bo && offset + size > amdgpu_bo_size(bo)) ||
+	    (eaddr >= adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT))
 		return -EINVAL;
 
 	/* Allocate all the needed memory */




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux