Skip to content
  • Jon Bloomfield's avatar
    drm/i915: Serialize GTT/Aperture accesses on BXT · d86b18a0
    Jon Bloomfield authored
    
    
    BXT has a H/W issue with IOMMU which can lead to system hangs when
    Aperture accesses are queued within the GAM behind GTT Accesses.
    
    This patch avoids the condition by wrapping all GTT updates in stop_machine
    and using a flushing read prior to restarting the machine.
    
    The stop_machine guarantees no new Aperture accesses can begin while
    the PTE writes are being emmitted. The flushing read ensures that
    any following Aperture accesses cannot begin until the PTE writes
    have been cleared out of the GAM's fifo.
    
    Only FOLLOWING Aperture accesses need to be separated from in flight
    PTE updates. PTE Writes may follow tightly behind already in flight
    Aperture accesses, so no flushing read is required at the start of
    a PTE update sequence.
    
    This issue was reproduced by running
    	igt/gem_readwrite and
    	igt/gem_render_copy
    simultaneously from different processes, each in a tight loop,
    with INTEL_IOMMU enabled.
    
    This patch was originally published as:
    	drm/i915: Serialize GTT Updates on BXT
    
    [Note: This will cause a performance penalty for some use cases, but
    avoiding hangs trumps performance hits. This may need to be worked
    around in Mesa to recover the lost performance.]
    
    v2: Move bxt/iommu detection into static function
        Remove #ifdef CONFIG_INTEL_IOMMU protection
        Make function names more reflective of purpose
        Move flushing read into static function
    
    v3: Tidy up for checkpatch.pl
    
    Testcase: igt/gem_concurrent_blit
    Signed-off-by: default avatarJon Bloomfield <jon.bloomfield@intel.com>
    Cc: John Harrison <john.C.Harrison@intel.com>
    Cc: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Daniel Vetter <daniel.vetter@intel.com>
    Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Cc: stable@vger.kernel.org
    Link: http://patchwork.freedesktop.org/patch/msgid/1495641251-30022-1-git-send-email-jon.bloomfield@intel.com
    
    
    Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    (cherry picked from commit 0ef34ad6
    
    )
    Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
    d86b18a0