Hi,

I've checked in the first shot at a "Translation Table Map" TTM interface in drm-ttm-branch. The interface is intended to be a low-level support structure for an AGP memory manager.

A ttm is conceptually a shared memory map, part of which can be bound to a translation table, typically the GTT. They are created with a fixed size, but pages aren't actually allocated until they are used by the user's virtual mapping or bound into the TT. Either the whole map or multiple parts of it can be bound.

There can be different kinds of translation tables so a backend object is needed. This object holds private data and a set of functions to manipulate the translation tables. Currently there is an implementation of an AGP backend in drm_agpsupport.c, and each driver has a function pointer to the function creating a backend object. In that way device independent caching policies, translation table types and multiple apertures are handled.

The backend _may_ tell the TTM interface that pages should be mapped uncached while bound. In that case, before pages are bound into the TT, they are unmapped from all VMAs referencing them, and then the kernel virtual mapping is adjusted to be non-cached. When the user references a page through a VMA, it is re-mapped also to user-space with the new caching policy. When unbound the old caching policy is restored in the same way. There are devices that can map cached pages into GTT and for those, the above operation is not done. In this way we always ensure consistent mappings.

When the file used to create a TTM is closed, the TTM it is removed unless the user had done it already.

To speed up map (both TTM and ordinary map) lookups in the vm part of drm, a hashing approach is used instead of the old linked-list lookup. This means that quite arbitrary page-aligned 32-bit user-tokens are generated for maps, so drivers assuming that the handle returned by drmAddMap is actually the physical address will fail. I'm not sure that there are such drivers left except the via DDX? Should we handle this at the DRM level?

The hash tables are closed (for speed) and they fail when full. However, this protects against an arbitrary number of maps or bound regions. The tables hold (void *) pointers but a good policy is to have a hash table holding pointers to one object type only. In that way one knows that a populated hash table entry always points to a valid object of a certain type, and fields within that object may always be accessed.

The concept requires minimal changes to the AGP drivers. An example for the intel-agp driver is posted on bugzilla bug #5709, and there is a user-space test program in test/ttmtest.

Comments on this would be appreciated. Particularly on the "anonymous" map handle approach.

/Thomas.



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to