• Tomi Valkeinen's avatar
    drm/omap: fix memory barrier bug in DMM driver · 538f66ba
    Tomi Valkeinen authored
    A DMM timeout "timed out waiting for done" has been observed on DRA7
    devices. The timeout happens rarely, and only when the system is under
    heavy load.
    
    Debugging showed that the timeout can be made to happen much more
    frequently by optimizing the DMM driver, so that there's almost no code
    between writing the last DMM descriptors to RAM, and writing to DMM
    register which starts the DMM transaction.
    
    The current theory is that a wmb() does not properly ensure that the
    data written to RAM is observable by all the components in the system.
    
    This DMM timeout has caused interesting (and rare) bugs as the error
    handling was not functioning properly (the error handling has been fixed
    in previous commits):
    
     * If a DMM timeout happened when a GEM buffer was being pinned for
       display on the screen, a timeout error would be shown, but the driver
       would continue programming DSS HW with broken buffer, leading to
       SYNCLOST floods and possible crashes.
    
     * If a DMM timeout happened when other user (say, video decoder) was
       pinning a GEM buffer, a timeout would be shown but if the user
       handled the error properly, no other issues followed.
    
     * If a DMM timeout happened when a GEM buffer was being released, the
       driver does not even notice the error, leading to crashes or hang
       later.
    
    This patch adds wmb() and readl() calls after the last bit is written to
    RAM, which should ensure that the execution proceeds only after the data
    is actually in RAM, and thus observable by DMM.
    
    The read-back should not be needed. Further study is required to understand
    if DMM is somehow special case and read-back is ok, or if DRA7's memory
    barriers do not work correctly.
    Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
    Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
    538f66ba
omap_dmm_tiler.c 26.9 KB