@@ -1817,7 +1817,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
mutex_init(&adev->mman.gtt_window_lock);
/* No others user of address space so set it to 0 */
- r = ttm_device_init(&adev->mman.bdev, &amdgpu_bo_driver, adev->dev,
+ r = ttm_device_init(&adev->mman.bdev, &amdgpu_bo_driver, adev_to_drm(adev),
adev_to_drm(adev)->anon_inode->i_mapping,
adev_to_drm(adev)->vma_offset_manager,
adev->need_swiotlb,
@@ -1002,7 +1002,7 @@ static int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev,
vmm->vram_base = vram_base;
vmm->vram_size = vram_size;
- ret = ttm_device_init(&vmm->bdev, &bo_driver, dev->dev,
+ ret = ttm_device_init(&vmm->bdev, &bo_driver, dev,
dev->anon_inode->i_mapping,
dev->vma_offset_manager,
false, true);
@@ -33,7 +33,7 @@ int intel_region_ttm_device_init(struct drm_i915_private *dev_priv)
struct drm_device *drm = &dev_priv->drm;
return ttm_device_init(&dev_priv->bdev, i915_ttm_driver(),
- drm->dev, drm->anon_inode->i_mapping,
+ drm, drm->anon_inode->i_mapping,
drm->vma_offset_manager, false, false);
}
@@ -548,7 +548,7 @@ int lsdc_ttm_init(struct lsdc_device *ldev)
unsigned long num_gtt_pages;
int ret;
- ret = ttm_device_init(&ldev->bdev, &lsdc_bo_driver, ddev->dev,
+ ret = ttm_device_init(&ldev->bdev, &lsdc_bo_driver, ddev,
ddev->anon_inode->i_mapping,
ddev->vma_offset_manager, false, true);
if (ret)
@@ -299,7 +299,7 @@ nouveau_ttm_init(struct nouveau_drm *drm)
drm->agp.cma = pci->agp.cma;
}
- ret = ttm_device_init(&drm->ttm.bdev, &nouveau_bo_driver, drm->dev->dev,
+ ret = ttm_device_init(&drm->ttm.bdev, &nouveau_bo_driver, dev,
dev->anon_inode->i_mapping,
dev->vma_offset_manager,
drm_need_swiotlb(drm->client.mmu.dmabits),
@@ -688,7 +688,7 @@ int radeon_ttm_init(struct radeon_device *rdev)
int r;
/* No others user of address space so set it to 0 */
- r = ttm_device_init(&rdev->mman.bdev, &radeon_bo_driver, rdev->dev,
+ r = ttm_device_init(&rdev->mman.bdev, &radeon_bo_driver, rdev->ddev,
rdev->ddev->anon_inode->i_mapping,
rdev->ddev->vma_offset_manager,
rdev->need_swiotlb,
@@ -16,7 +16,7 @@ int ttm_device_kunit_init(struct ttm_test_devices *priv,
struct drm_device *drm = priv->drm;
int err;
- err = ttm_device_init(ttm, &ttm_dev_funcs, drm->dev,
+ err = ttm_device_init(ttm, &ttm_dev_funcs, drm,
drm->anon_inode->i_mapping,
drm->vma_offset_manager,
use_dma_alloc, use_dma32);
@@ -179,7 +179,7 @@ EXPORT_SYMBOL(ttm_device_swapout);
*
* @bdev: A pointer to a struct ttm_device to initialize.
* @funcs: Function table for the device.
- * @dev: The core kernel device pointer for DMA mappings and allocations.
+ * @drm: drm_device pointer
* @mapping: The address space to use for this bo.
* @vma_manager: A pointer to a vma manager.
* @use_dma_alloc: If coherent DMA allocation API should be used.
@@ -190,7 +190,7 @@ EXPORT_SYMBOL(ttm_device_swapout);
* !0: Failure.
*/
int ttm_device_init(struct ttm_device *bdev, const struct ttm_device_funcs *funcs,
- struct device *dev, struct address_space *mapping,
+ struct drm_device *drm, struct address_space *mapping,
struct drm_vma_offset_manager *vma_manager,
bool use_dma_alloc, bool use_dma32)
{
@@ -213,7 +213,8 @@ int ttm_device_init(struct ttm_device *bdev, const struct ttm_device_funcs *func
bdev->funcs = funcs;
ttm_sys_man_init(bdev);
- ttm_pool_init(&bdev->pool, dev, NUMA_NO_NODE, use_dma_alloc, use_dma32);
+ ttm_pool_init(&bdev->pool, drm?drm->dev:NULL, NUMA_NO_NODE,
+ use_dma_alloc, use_dma32);
bdev->vma_manager = vma_manager;
spin_lock_init(&bdev->lru_lock);
@@ -1047,7 +1047,7 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)
}
ret = ttm_device_init(&dev_priv->bdev, &vmw_bo_driver,
- dev_priv->drm.dev,
+ &dev_priv->drm,
dev_priv->drm.anon_inode->i_mapping,
dev_priv->drm.vma_offset_manager,
dev_priv->map_mode == vmw_dma_alloc_coherent,
@@ -191,7 +191,7 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
if (IS_ERR(xe))
return xe;
- err = ttm_device_init(&xe->ttm, &xe_ttm_funcs, xe->drm.dev,
+ err = ttm_device_init(&xe->ttm, &xe_ttm_funcs, &xe->drm,
xe->drm.anon_inode->i_mapping,
xe->drm.vma_offset_manager, false, false);
if (WARN_ON(err))
@@ -29,6 +29,7 @@
#include <linux/workqueue.h>
#include <drm/ttm/ttm_resource.h>
#include <drm/ttm/ttm_pool.h>
+#include <drm/drm_device.h>
struct ttm_device;
struct ttm_placement;
@@ -288,7 +289,7 @@ static inline void ttm_set_driver_manager(struct ttm_device *bdev, int type,
}
int ttm_device_init(struct ttm_device *bdev, const struct ttm_device_funcs *funcs,
- struct device *dev, struct address_space *mapping,
+ struct drm_device *drm, struct address_space *mapping,
struct drm_vma_offset_manager *vma_manager,
bool use_dma_alloc, bool use_dma32);
void ttm_device_fini(struct ttm_device *bdev);
Change the 3rd parameter of ttm_device_init from struct device * to struct drm_device *. This is a prepare work for moving lru_lock from ttm_device to drm_device. Signed-off-by: Oak Zeng <oak.zeng@intel.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- drivers/gpu/drm/drm_gem_vram_helper.c | 2 +- drivers/gpu/drm/i915/intel_region_ttm.c | 2 +- drivers/gpu/drm/loongson/lsdc_ttm.c | 2 +- drivers/gpu/drm/nouveau/nouveau_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 2 +- drivers/gpu/drm/ttm/ttm_device.c | 7 ++++--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +- drivers/gpu/drm/xe/xe_device.c | 2 +- include/drm/ttm/ttm_device.h | 3 ++- 11 files changed, 15 insertions(+), 13 deletions(-)