• Alexandre Courbot's avatar
    drm/nouveau/gem: allow user-space to specify an object should be coherent · 996f545f
    Alexandre Courbot authored
    User-space use mappable BOs notably for fences, and expects that a
    value update by the GPU will be immediatly visible through the
    user-space mapping.
    
    ARM has a property that may prevent this from happening though: memory
    can be mapped multiple times only if the different mappings share the
    same caching properties. However all the lowmem memory is already
    identity-mapped into the kernel with cache enabled, so when user-space
    requests an uncached mapping, we actually get an "undefined caching
    policy" one and this has strange side-effects described on Freedesktop
    bug 86690.
    
    To prevent this from happening, allow user-space to explicitly specify
    which objects should be coherent, and create such objects with the
    TTM_PL_FLAG_UNCACHED flag. This will make TTM allocate memory using the
    DMA API, which will fix the identify mapping and allow us to safely map
    the objects to user-space uncached.
    Signed-off-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
    Reviewed-by: default avatarLucas Stach <dev@lynxeye.de>
    Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
    996f545f
nouveau_gem.c 23.3 KB