Re: [PATCH v3 2/8] ttm: turn ttm_bo_device.vma_manager into a pointer

From: Thomas HellstrÃm (VMware)
Date: Thu Aug 08 2019 - 08:43:25 EST


On 8/8/19 2:02 PM, Daniel Vetter wrote:
On Thu, Aug 08, 2019 at 12:35:21PM +0200, Gerd Hoffmann wrote:
On Thu, Aug 08, 2019 at 09:48:49AM +0000, Koenig, Christian wrote:
Am 08.08.19 um 11:36 schrieb Gerd Hoffmann:
Rename the embedded struct vma_offset_manager, it is named _vma_manager
now. ttm_bo_device.vma_manager is a pointer now, pointing to the
embedded ttm_bo_device._vma_manager by default.

Add ttm_bo_device_init_with_vma_manager() function which allows to
initialize ttm with a different vma manager.
Can't we go down the route of completely removing the vma_manager from
TTM? ttm_bo_mmap() would get the BO as parameter instead.
It surely makes sense to target that. This patch can be a first step
into that direction. It allows gem and ttm to use the same
vma_offset_manager (see patch #3), which in turn makes various gem
functions work on ttm objects (see patch #4 for vram helpers).
+1 on cleaning this up for good, at least long-term ...

That would also make the verify_access callback completely superfluous
and looks like a good step into the right direction of de-midlayering.
Hmm, right, noticed that too while working on another patch series.
Guess I'll try to merge those two and see where I end up ...
... but if it gets too invasive I'd vote for incremental changes. Even if
we completely rip out the vma/mmap lookup stuff from ttm, we still need to
keep a copy somewhere for vmwgfx. Or would the evil plan be the vmwgfx
would use the gem mmap helpers too?

I don't think it would be too invasive. We could simply move ttm_bo_vm_lookup into a vmw_mmap.

/Thomas




-Daniel