HACK: gfx: drv: when resuming make sure power is on
authorPauli Nieminen <pauli.nieminen@linux.intel.com>
Fri, 20 Jan 2012 12:59:36 +0000 (14:59 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:29:35 +0000 (12:29 +0300)
The PVR driver expects ospm_power_using_hw_begin to return only when
power is already on. But at the moment that function will only call
pm_runtime_get which is asynchronous. This can lead to the PVR driver
accessing its HW registers before the HW is powered and cause a CPU
fabric error hung.

To work around this call the sync version of pm_runtime_get if we are
not in atomic context. In fact I can't see any reason to call it
atomically, since then power on can't be guaranteed on return anyway.
But to clean up that we should check all call-sites for correctness.

Jani Nikula is currently reworking ospm_power_using_hw_begin() and
related parts that will give us a clean solution. Until that's done we'd
like this hack applied to let us resolve other PM related issues that
are currently hidden by this bug.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
drivers/staging/mrst/drv/psb_powermgmt.c

index 7923d50..6628b4b 100644 (file)
@@ -1598,7 +1598,10 @@ bool ospm_power_using_hw_begin(int hw_island, UHBUsage usage)
        IMG_UINT32 deviceID = 0;
        bool force_on = usage ? true : false;
 
-       pm_runtime_get(&drm_dev->pdev->dev);
+       if (b_atomic)
+               pm_runtime_get(&drm_dev->pdev->dev);
+       else
+               pm_runtime_get_sync(&drm_dev->pdev->dev);
 
        /*quick path, not 100% race safe, but should be enough comapre to current other code in this file */
        if (!force_on) {