mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
drm/rockchip: gem: Fix alloc size setting for IOMMU device
For IOMMU devices, the mapped size may be larger than the requested
alloc size, which may result in inconsistent sizes being used for
unmap.
[ 12.286016] iova: 0x0000000000000000 already mapped to 0x000000000c201000 cannot remap to phys: 0x000000001369f000 prot: 0x3
[ 12.287163] [drm:rockchip_gem_iommu_map] *ERROR* failed to map buffer: size=-98 request_size=4096
[ 12.299439] iova: 0x0000000000000000 already mapped to 0x000000000c201000 cannot remap to phys: 0x000000000c2b8000 prot: 0x3
[ 12.300541] [drm:rockchip_gem_iommu_map] *ERROR* failed to map buffer: size=-98 request_size=2785280
Fixes: 2ba5e1d681 ("drm/rockchip: gem: Set size of the allocated object when create gem")
Change-Id: I3496544e5a4eb65dde657f8ed3890f4db933258f
Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
This commit is contained in:
@@ -67,6 +67,8 @@ static int rockchip_gem_iommu_map(struct rockchip_gem_object *rk_obj)
|
||||
|
||||
iommu_flush_iotlb_all(private->domain);
|
||||
|
||||
rk_obj->size = ret;
|
||||
|
||||
return 0;
|
||||
|
||||
err_remove_node:
|
||||
@@ -649,6 +651,15 @@ rockchip_gem_create_object(struct drm_device *drm, unsigned int size,
|
||||
if (ret)
|
||||
goto err_free_rk_obj;
|
||||
|
||||
/**
|
||||
* For iommu device, this size will be set in rockchip_gem_iommu_map().
|
||||
* The actual mapped size may be larger than the request size.
|
||||
*
|
||||
* For non-iommu device, set to the requested fb size.
|
||||
*/
|
||||
if (rk_obj->size == 0)
|
||||
rk_obj->size = size;
|
||||
|
||||
return rk_obj;
|
||||
|
||||
err_free_rk_obj:
|
||||
@@ -729,7 +740,6 @@ rockchip_gem_create_with_handle(struct drm_file *file_priv,
|
||||
return ERR_CAST(rk_obj);
|
||||
|
||||
obj = &rk_obj->base;
|
||||
rk_obj->size = size;
|
||||
|
||||
/*
|
||||
* allocate a id of idr table where the obj is registered
|
||||
|
||||
Reference in New Issue
Block a user