From e7bfb391309ecba73ed380546b04755eddb38722 Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Mon, 26 Jul 2010 22:22:07 +0300 Subject: [PATCH] gpu: pvr: rename pvr_dvfs_lock to pvr_dev_lock The new name better reflects what is actually protected. No fuctional change. Signed-off-by: Imre Deak --- pvr/pvr_bridge_k.c | 24 ++++++++++++------------ pvr/pvr_bridge_km.h | 4 ++-- pvr/sgxinit.c | 40 +++++++++++++++++++++------------------- pvr/sgxutils.c | 14 +++++++------- pvr/sysutils.c | 6 +++--- 5 files changed, 45 insertions(+), 43 deletions(-) diff --git a/pvr/pvr_bridge_k.c b/pvr/pvr_bridge_k.c index 698e363..4cbc041 100644 --- a/pvr/pvr_bridge_k.c +++ b/pvr/pvr_bridge_k.c @@ -42,8 +42,8 @@ /* Global driver lock protecting all HW and SW state tracking objects. */ DEFINE_MUTEX(gPVRSRVLock); -static int pvr_dvfs_active; -static DECLARE_WAIT_QUEUE_HEAD(pvr_dvfs_wq); +static int pvr_dev_locked; +static DECLARE_WAIT_QUEUE_HEAD(pvr_dev_wq); int pvr_disabled; /* @@ -64,23 +64,23 @@ int pvr_disabled; * again acquired at 4. To avoid the warning use a wait queue based approach * so that we can unlock B before 3. */ -void pvr_dvfs_lock(void) +void pvr_dev_lock(void) { - while (cmpxchg(&pvr_dvfs_active, 0, 1)) { - DEFINE_WAIT(pvr_dvfs_wait); - prepare_to_wait(&pvr_dvfs_wq, &pvr_dvfs_wait, + while (cmpxchg(&pvr_dev_locked, 0, 1)) { + DEFINE_WAIT(pvr_dev_wait); + prepare_to_wait(&pvr_dev_wq, &pvr_dev_wait, TASK_UNINTERRUPTIBLE); - if (pvr_dvfs_active) + if (pvr_dev_locked) schedule(); - finish_wait(&pvr_dvfs_wq, &pvr_dvfs_wait); + finish_wait(&pvr_dev_wq, &pvr_dev_wait); } } -void pvr_dvfs_unlock(void) +void pvr_dev_unlock(void) { - BUG_ON(!pvr_dvfs_active); - pvr_dvfs_active = 0; - wake_up(&pvr_dvfs_wq); + BUG_ON(!pvr_dev_locked); + pvr_dev_locked = 0; + wake_up(&pvr_dev_wq); } #if defined(DEBUG_BRIDGE_KM) diff --git a/pvr/pvr_bridge_km.h b/pvr/pvr_bridge_km.h index a338ff6..55392f2 100644 --- a/pvr/pvr_bridge_km.h +++ b/pvr/pvr_bridge_km.h @@ -34,8 +34,8 @@ #include "pvr_bridge.h" #include "perproc.h" -extern void pvr_dvfs_lock(void); -extern void pvr_dvfs_unlock(void); +extern void pvr_dev_lock(void); +extern void pvr_dev_unlock(void); extern struct mutex gPVRSRVLock; extern int pvr_disabled; diff --git a/pvr/sgxinit.c b/pvr/sgxinit.c index 01b8697..35f3d5f 100644 --- a/pvr/sgxinit.c +++ b/pvr/sgxinit.c @@ -452,11 +452,11 @@ enum PVRSRV_ERROR DevInitSGXPart2KM(struct PVRSRV_PER_PROCESS_DATA *psPerProc, PVR_ASSERT(psDeviceNode->pfnDeviceISR == SGX_ISRHandler); - pvr_dvfs_lock(); + pvr_dev_lock(); l = readl(&psDevInfo->psSGXHostCtl->ui32PowerStatus); l |= PVRSRV_USSE_EDM_POWMAN_NO_WORK; writel(l, &psDevInfo->psSGXHostCtl->ui32PowerStatus); - pvr_dvfs_unlock(); + pvr_dev_unlock(); eDefaultPowerState = PVRSRV_POWER_STATE_D3; eError = PVRSRVRegisterPowerDevice(psDeviceNode->sDevId.ui32DeviceIndex, @@ -678,7 +678,8 @@ void HWRecoveryResetSGX(struct PVRSRV_DEVICE_NODE *psDeviceNode) BUG_ON(!pvr_is_locked()); - pvr_dvfs_lock(); + pvr_dev_lock(); + l = readl(&psSGXHostCtl->ui32InterruptClearFlags); l |= PVRSRV_USSE_EDM_INTERRUPT_HWR; writel(l, &psSGXHostCtl->ui32InterruptClearFlags); @@ -703,7 +704,7 @@ void HWRecoveryResetSGX(struct PVRSRV_DEVICE_NODE *psDeviceNode) pvr_disable(); PDUMPRESUME(); - pvr_dvfs_unlock(); + pvr_dev_unlock(); return; } @@ -712,7 +713,7 @@ void HWRecoveryResetSGX(struct PVRSRV_DEVICE_NODE *psDeviceNode) SGXScheduleProcessQueues(psDeviceNode); - pvr_dvfs_unlock(); + pvr_dev_unlock(); PVRSRVProcessQueues(IMG_TRUE); } @@ -751,7 +752,7 @@ static void SGXOSTimer(struct work_struct *work) if (bPoweredDown) { ui32LockupCounter = 0; } else { - pvr_dvfs_lock(); + pvr_dev_lock(); ui32CurrentEDMTasks = OSReadHWReg(psDevInfo->pvRegsBaseKM, psDevInfo->ui32EDMTaskReg0); if (psDevInfo->ui32EDMTaskReg1 != 0) @@ -774,7 +775,7 @@ static void SGXOSTimer(struct work_struct *work) ui32EDMTasks = ui32CurrentEDMTasks; ui32NumResets = psDevInfo->ui32NumResets; } - pvr_dvfs_unlock(); + pvr_dev_unlock(); } bLockup |= cmpxchg(&sgx_reset_forced, 1, 0); @@ -784,11 +785,11 @@ static void SGXOSTimer(struct work_struct *work) psDevInfo->psSGXHostCtl; u32 l; - pvr_dvfs_lock(); + pvr_dev_lock(); l = readl(&psSGXHostCtl->ui32HostDetectedLockups); l++; writel(l, &psSGXHostCtl->ui32HostDetectedLockups); - pvr_dvfs_unlock(); + pvr_dev_unlock(); HWRecoveryResetSGX(psDeviceNode); } @@ -917,13 +918,14 @@ static void SGX_MISRHandler(void *pvData) dev_idx = psDeviceNode->sDevId.ui32DeviceIndex; - pvr_dvfs_lock(); + pvr_dev_lock(); err = PVRSRVSetDevicePowerStateKM(dev_idx, PVRSRV_POWER_STATE_D0); BUG_ON(err != PVRSRV_OK); l1 = readl(&psSGXHostCtl->ui32InterruptFlags); l2 = readl(&psSGXHostCtl->ui32InterruptClearFlags); + if ((l1 & PVRSRV_USSE_EDM_INTERRUPT_HWR) && !(l2 & PVRSRV_USSE_EDM_INTERRUPT_HWR)) HWRecoveryResetSGX(psDeviceNode); @@ -933,7 +935,7 @@ static void SGX_MISRHandler(void *pvData) SGXTestActivePowerEvent(psDeviceNode); - pvr_dvfs_unlock(); + pvr_dev_unlock(); } enum PVRSRV_ERROR SGXRegisterDevice(struct PVRSRV_DEVICE_NODE *psDeviceNode) @@ -1409,7 +1411,7 @@ enum PVRSRV_ERROR SGXGetMiscInfoKM(struct PVRSRV_SGXDEV_INFO *psDevInfo, return PVRSRV_ERROR_INVALID_PARAMS; } - pvr_dvfs_lock(); + pvr_dev_lock(); ui32MatchingFlags = readl(&psDevInfo-> psSGXHostCtl->ui32HWPerfFlags); ui32MatchingFlags &= @@ -1427,7 +1429,7 @@ enum PVRSRV_ERROR SGXGetMiscInfoKM(struct PVRSRV_SGXDEV_INFO *psDevInfo, writel(psMiscInfo->uData.ui32NewHWPerfStatus, &psDevInfo->psSGXHostCtl->ui32HWPerfFlags); - pvr_dvfs_unlock(); + pvr_dev_unlock(); #if defined(PDUMP) PDUMPCOMMENTWITHFLAGS(PDUMP_FLAGS_CONTINUOUS, "SGX ukernel HWPerf status %u\n", @@ -1454,19 +1456,19 @@ enum PVRSRV_ERROR SGXGetMiscInfoKM(struct PVRSRV_SGXDEV_INFO *psDevInfo, psHWPerfCB->ui32OrdinalGRAPHICS = 0xffffffffUL; - pvr_dvfs_lock();; + pvr_dev_lock();; l = readl(&psDevInfo->psSGXHostCtl->ui32HWPerfFlags); l |= PVRSRV_SGX_HWPERF_GRAPHICS_ON; writel(l, &psDevInfo->psSGXHostCtl->ui32HWPerfFlags); - pvr_dvfs_unlock(); + pvr_dev_unlock(); return PVRSRV_OK; } case SGX_MISC_INFO_REQUEST_HWPERF_CB_OFF: { - pvr_dvfs_lock(); + pvr_dev_lock(); writel(0, &psDevInfo->psSGXHostCtl->ui32HWPerfFlags); - pvr_dvfs_unlock(); + pvr_dev_unlock(); return PVRSRV_OK; } @@ -1550,7 +1552,7 @@ enum PVRSRV_ERROR SGXReadDiffCountersKM(void *hDevHandle, u32 ui32Reg, *pbActive = bPowered; - pvr_dvfs_lock(); + pvr_dev_lock(); { struct PVRSRV_SGXDEV_DIFF_INFO sNew, @@ -1620,7 +1622,7 @@ enum PVRSRV_ERROR SGXReadDiffCountersKM(void *hDevHandle, u32 ui32Reg, SGXTestActivePowerEvent(psDeviceNode); - pvr_dvfs_unlock(); + pvr_dev_unlock(); return PVRSRV_OK; } diff --git a/pvr/sgxutils.c b/pvr/sgxutils.c index 616aad4..ba14487 100644 --- a/pvr/sgxutils.c +++ b/pvr/sgxutils.c @@ -253,7 +253,7 @@ enum PVRSRV_ERROR SGXScheduleCCBCommandKM( PDUMPSUSPEND(); - pvr_dvfs_lock(); + pvr_dev_lock(); eError = PVRSRVSetDevicePowerStateKM(psDeviceNode->sDevId.ui32DeviceIndex, @@ -266,7 +266,7 @@ enum PVRSRV_ERROR SGXScheduleCCBCommandKM( } else { PVR_DPF(PVR_DBG_ERROR, "%s: can't power on device (%d)", __func__, eError); - pvr_dvfs_unlock(); + pvr_dev_unlock(); return eError; } @@ -276,7 +276,7 @@ enum PVRSRV_ERROR SGXScheduleCCBCommandKM( if (ui32CallerID != ISR_ID) SGXTestActivePowerEvent(psDeviceNode); - pvr_dvfs_unlock(); + pvr_dev_unlock(); return eError; } @@ -319,9 +319,9 @@ enum PVRSRV_ERROR SGXScheduleProcessQueuesKM(struct PVRSRV_DEVICE_NODE { enum PVRSRV_ERROR eError; - pvr_dvfs_lock(); + pvr_dev_lock(); eError = SGXScheduleProcessQueues(psDeviceNode); - pvr_dvfs_unlock(); + pvr_dev_unlock(); return eError; } @@ -367,7 +367,7 @@ void SGXCleanupRequest(struct PVRSRV_DEVICE_NODE *psDeviceNode, #endif u32 l; - pvr_dvfs_lock(); + pvr_dev_lock(); if (readl(&psSGXHostCtl->ui32PowerStatus) & PVRSRV_USSE_EDM_POWMAN_NO_WORK) { ; @@ -456,7 +456,7 @@ void SGXCleanupRequest(struct PVRSRV_DEVICE_NODE *psDeviceNode, sizeof(u32), 0, hUniqueTag); #endif } - pvr_dvfs_unlock(); + pvr_dev_unlock(); } struct SGX_HW_RENDER_CONTEXT_CLEANUP { diff --git a/pvr/sysutils.c b/pvr/sysutils.c index a1dda0f..33a8057 100644 --- a/pvr/sysutils.c +++ b/pvr/sysutils.c @@ -144,16 +144,16 @@ static int vdd2_pre_post_func(struct notifier_block *n, unsigned long event, cnd->rate); if (CLK_PRE_RATE_CHANGE == event) { - pvr_dvfs_lock(); + pvr_dev_lock(); PVR_TRACE("vdd2_pre_post_func: CLK_PRE_RATE_CHANGE event"); vdd2_pre_func(n, event, ptr); } else if (CLK_POST_RATE_CHANGE == event) { PVR_TRACE("vdd2_pre_post_func: CLK_POST_RATE_CHANGE event"); vdd2_post_func(n, event, ptr); - pvr_dvfs_unlock(); + pvr_dev_unlock(); } else if (CLK_ABORT_RATE_CHANGE == event) { PVR_TRACE("vdd2_pre_post_func: CLK_ABORT_RATE_CHANGE event"); - pvr_dvfs_unlock(); + pvr_dev_unlock(); } else { printk(KERN_ERR "vdd2_pre_post_func: unexpected event (%lu)\n", event); -- 2.39.5