MGS-3848-3 [#imx-854] correct command commit synchronization between pm and other...
authorXianzhong <xianzhong.li@nxp.com>
Wed, 25 Apr 2018 19:58:25 +0000 (03:58 +0800)
committerXianzhong <xianzhong.li@nxp.com>
Thu, 26 Apr 2018 15:39:22 +0000 (23:39 +0800)
commit40a15b534b0551f8026fd85ab9d9dcd7ca7874af
tree99b02bd3a404df79ac2573e97115e1d94efb7d61
parent01b102fbc553608cf567a4f2a1932627a84d9af9
MGS-3848-3 [#imx-854] correct command commit synchronization between pm and other threads

When power ON to other mode with broadcast (SUSPEND_BROADCAST,
IDLE_BROADCAST, OFF_BROADCAST), command->powerSemaphore is acquired after check idle.
code sequence:
    check commit atom
    check idle
    >>> at this point, other thread may have new commits at this
    >>> point.
    Acquire command->powerSemaphore
    ... do clock off

This can cause unexpected interrupts after clock OFF or power
OFF.

To fix: try to acquire powerSemaphore before check commit atom,
abort when failure, because command commit is in progress.

fix bug #19216, #19230.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 5228271314e8f575e4bbd9d3087c220b6a344b7d)
drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c