• Chris Wilson's avatar
    drm/i915/gem: Prepare gen7 cmdparser for async execution · 32d94048
    Chris Wilson authored
    The gen7 cmdparser is primarily a promotion-based system to allow access
    to additional registers beyond the HW validation, and allows fallback to
    normal execution of the user batch buffer if valid and requires
    chaining. In the next patch, we will do the cmdparser validation in the
    pipeline asynchronously and so at the point of request construction we
    will not know if we want to execute the privileged and validated batch,
    or the original user batch. The solution employed here is to execute
    both batches, one with raised privileges and one as normal. This is
    because the gen7 MI_BATCH_BUFFER_START command cannot change privilege
    level within a batch and must strictly use the current privilege level
    (or undefined behaviour kills the GPU). So in order to execute the
    original batch, we need a second non-priviledged batch buffer chain from
    the ring, i.e. we need to emit two batches for each user batch. Inside
    the two batches we determine which one should actually execute, we
    provide a conditional trampoline to call the original batch.
    
    Implementation-wise, we create a single buffer and write the shadow and
    the trampoline inside it at different offsets; and bind the buffer into
    both the kernel GGTT for the privileged execution of the shadow and into
    the user ppGTT for the non-privileged execution of the trampoline and
    original batch. One buffer, two batches and two vma.
    Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20191211230858.599030-1-chris@chris-wilson.co.uk
    32d94048
i915_drv.h 57.8 KB