• Chris Wilson's avatar
    drm/i915: Introduce guard pages to i915_vma · 61102251
    Chris Wilson authored
    Introduce the concept of padding the i915_vma with guard pages before
    and after. The major consequence is that all ordinary uses of i915_vma
    must use i915_vma_offset/i915_vma_size and not i915_vma.node.start/size
    directly, as the drm_mm_node will include the guard pages that surround
    our object.
    
    The biggest connundrum is how exactly to mix requesting a fixed address
    with guard pages, particularly through the existing uABI. The user does
    not know about guard pages, so such must be transparent to the user, and
    so the execobj.offset must be that of the object itself excluding the
    guard. So a PIN_OFFSET_FIXED must then be exclusive of the guard pages.
    The caveat is that some placements will be impossible with guard pages,
    as wrap arounds need to be avoided, and the vma itself will require a
    larger node. We must not report EINVAL but ENOSPC as these are unavailable
    locations within the GTT rather than conflicting user requirements.
    
    In the next patch, we start using guard pages for scanout objects. While
    these are limited to GGTT vma, on a few platforms these vma (or at least
    an alias of the vma) is shared with userspace, so we may leak the
    existence of such guards if we are not careful to ensure that the
    execobj.offset is transparent and excludes the guards. (On such platforms
    like ivb, without full-ppgtt, userspace has to use relocations so the
    presence of more untouchable regions within its GTT such be of no further
    issue.)
    Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: default avatarTejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com>
    Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Signed-off-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
    Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20221201203912.346110-1-andi.shyti@linux.intel.com
    61102251
i915_vma.c 56.1 KB