sgx.git
11 years agogpu: pvr: add snprint_edm_trace
Imre Deak [Tue, 14 Dec 2010 00:48:37 +0000 (02:48 +0200)]
gpu: pvr: add snprint_edm_trace

Needed by an upcoming patch adding a debugfs entry to dump the trace.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: make debugfs available in release build too
Imre Deak [Mon, 13 Dec 2010 17:40:00 +0000 (19:40 +0200)]
gpu: pvr: make debugfs available in release build too

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: move debugfs entries under a new pvr dir
Imre Deak [Tue, 14 Dec 2010 01:42:39 +0000 (03:42 +0200)]
gpu: pvr: move debugfs entries under a new pvr dir

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: remove runtime dependency on the EDM trace option
Imre Deak [Tue, 14 Dec 2010 01:08:12 +0000 (03:08 +0200)]
gpu: pvr: remove runtime dependency on the EDM trace option

So that we can use the same kernel driver with user space having the
option either configured or not.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: fix Kconfig description for EDM tracing
Imre Deak [Tue, 14 Dec 2010 02:58:43 +0000 (04:58 +0200)]
gpu: pvr: fix Kconfig description for EDM tracing

We don't have a dependency on user space configuration any more, so
fix the description accordingly.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: make the IOCTL i/f compatible for old ABI users
Imre Deak [Tue, 14 Dec 2010 01:04:33 +0000 (03:04 +0200)]
gpu: pvr: make the IOCTL i/f compatible for old ABI users

The previous patch breaks the IOCTL i/f for current user space code.
This change will notice such calls based on the IOCTL parameter size and
fix up the param struct accordingly.

This patch can be reverted once applications are converted to use the new
ABI.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: remove build time ABI dependency on the EDM trace option
Imre Deak [Tue, 14 Dec 2010 01:00:35 +0000 (03:00 +0200)]
gpu: pvr: remove build time ABI dependency on the EDM trace option

So that we can build user / kernel space independently on the EDM
tracing option being configured or not.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: add slab.h include in order to make driver build on 2.6.35.3
Carsten Valdemar Munk [Wed, 15 Dec 2010 18:57:52 +0000 (13:57 -0500)]
gpu: pvr: add slab.h include in order to make driver build on 2.6.35.3

Forward port to 2.6.35.3

Signed-off-by: Carsten Munk <carsten@maemo.org>
11 years agogpu: pvr: Snapshot pending write ops during event request
Ville Syrjälä [Fri, 5 Nov 2010 18:45:55 +0000 (20:45 +0200)]
gpu: pvr: Snapshot pending write ops during event request

The render sync event should only wait until write operations
that are pending when the event is requested have completed.
New operations started after requesting the event should not
delay the event delivery, nor should any read operations.

Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Expose new display events to user space
Pauli Nieminen [Tue, 2 Nov 2010 08:40:10 +0000 (10:40 +0200)]
gpu: pvr: Expose new display events to user space

This exposes the new dss event that can be used for more fine grained
synchronization with display updates.

This change is backward compatible with old user space.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: wire in the dynamic power-down delay calculation
Imre Deak [Fri, 15 Oct 2010 17:25:43 +0000 (20:25 +0300)]
gpu: pvr: wire in the dynamic power-down delay calculation

Support for this was added in the previous patch.

We're considering only the TA/3D and 2D blit commands to be part of a
command burst. The rest of the commands are power management related and
we can ignore them when detecting repeated burst patterns.

Fixes: NB#195379 - SGX sleep causes performance penalty

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
11 years agogpu: pvr: add support for dynamic timing of SGX HW power down
Imre Deak [Fri, 15 Oct 2010 14:25:33 +0000 (17:25 +0300)]
gpu: pvr: add support for dynamic timing of SGX HW power down

This is needed by the next patch, which actually enables the support.

Currently the driver implements an aggressive power management policy
and powers down the HW very shortly (1 ms) after each completed command.
The resulting power-down and -up sequence between commands are relatively
long (~250usec), causing a delayed command execution and unnecessary CPU
load.

There is a deadline at the end of each display Vsync period, by which
all commands for the next frame must be completed. If the deadline is
missed FPS goes down. To increase the chance that we meet the deadline
we want to cut down on the above overhead.

One way to reduce the overhead is to get rid of the power-down/up
sequences between commands. The downside is the possibly higher power
consumption, so a solution has to minimize this side effect. Simply
increasing the power-down delay would result in a constant power
consumption increase. To see this let's consider the following two
cases given a 16 ms Vsync period.

Case a:

1.  SGX command#1 for frame#N    -  3 ms
2.  SGX idle                     -  3 ms
3.  SGX command#2 for frame#N    -  3 ms
4.  SGX idle                     -  3 ms
5.  SGX command#3 for frame#N    -  3 ms
6.  SGX idle                     -  1 ms
7.  Vsync
8.  SGX command#1 for frame#N+1  -  3 ms
9.  SGX idle                     -  3 ms
10. SGX command#2 for frame#N+1  -  3 ms
11. SGX idle                     -  3 ms
12. SGX command#3 for frame#N+1  -  3 ms
13. SGX idle                     -  1 ms
14. Vsync
... same pattern repeating for several frames

Here we need to increase the power-down delay to 4 ms, to avoid the
overhead at 2.,4.,9.,11. and to increase the chance to meet the deadlines
at 7. and 14.

Case b:

1.  SGX command#1 for frame#N    -  1 ms
2.  SGX idle                     -  1 ms
3.  SGX command#2 for frame#N    -  1 ms
4.  SGX idle                     -  1 ms
5.  SGX command#3 for frame#N    -  1 ms
6.  SGX idle                     - 11 ms
7.  Vsync
8.  SGX command#1 for frame#N+1  -  1 ms
9.  SGX idle                     -  1 ms
10. SGX command#2 for frame#N+1  -  1 ms
11. SGX idle                     -  1 ms
12. SGX command#3 for frame#N+1  -  1 ms
13. SGX idle                     - 11 ms
14. Vsync
... same pattern repeating for several frames

Here we don't have a risk of missing the deadlines, so we could
power-down immediately after 5. and 12. but we will delay the power-down
by 4 ms due to the constraint in case a. This energy waste will be
incured in each of the following frames having a similar command
scheduling pattern.

The solution in the following patch minimizes the energy waste while
achieving the original goal, by tracking "command bursts". In a burst
command execution periods are separated by idle periods of less than a
fixed amount of time (3 ms). Power-down is avoided between commands
within one burst, but it's performed immediately after the last command
of the burst. For example all commands in case a constitute one burst,
so we won't have any power-down there. In case b we have two bursts:
first burst consisting of 1.,3.,5. second burst consisting of 8.,10.,12.,
so we will power down immediately after 5. and 12.

In cases where commands are interleaved (well behaving applications)
we'll see power consumption decreasing due to the immediate power down
vs. the current 1ms delay. For other cases we might see a slight
increase in power consumption due to not powering down between commands,
but these are the very cases where we have a risk of not meeting the frame
deadlines, so the compromise looks like justified.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
11 years agogpu: pvr: fix SysGetSGXTimingInformation for cases when the HW is off
Imre Deak [Mon, 18 Oct 2010 17:14:25 +0000 (20:14 +0300)]
gpu: pvr: fix SysGetSGXTimingInformation for cases when the HW is off

This function doesn't do anything that requires the HW to be on, so
remove the assert about it. This will be needed by an upcoming patch,
requiring this information with HW off.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
11 years agogpu: pvr: split out setting power down delay into its own function
Imre Deak [Mon, 18 Oct 2010 17:14:05 +0000 (20:14 +0300)]
gpu: pvr: split out setting power down delay into its own function

This will be needed by an upcoming patch setting the power-down delay
dynamically.

No functional change.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Reviewed-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
11 years agogpu: pvr: fix typo in SGXDoKickBW
Imre Deak [Thu, 14 Oct 2010 12:00:04 +0000 (15:00 +0300)]
gpu: pvr: fix typo in SGXDoKickBW

This leads to the IOCTL failing in case the new structure format is used
with it. Also fixes bounds checking for the old format.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: remove unnecessary udelay from the HW poll loop
Imre Deak [Mon, 4 Oct 2010 13:36:52 +0000 (16:36 +0300)]
gpu: pvr: remove unnecessary udelay from the HW poll loop

At the moment the HW polling loop does a 50 usec delay between
each reading of the HW flag in question. Since this delay is no
worse than just reading the HW flag continuously, get rid of it.

This will reduce the wait time from 50 usec to 25 usec in the
general case.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: fix locking on the HW recovery reset error path
Imre Deak [Thu, 30 Sep 2010 09:36:15 +0000 (12:36 +0300)]
gpu: pvr: fix locking on the HW recovery reset error path

pvr_dev_lock is unbalanced on the code path where HW recovery reset
fails.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Fixed error path in cache flush function.
Janusz Sobczak [Wed, 11 Aug 2010 13:00:12 +0000 (15:00 +0200)]
gpu: pvr: Fixed error path in cache flush function.

PVRSRVCacheFlushDRIBW returns in the error path without releasing
current->mm->mmap_sem semaphore.
The client application stalls forever and cannot be killed.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Increase the max number of 3D TA status vals in kick requests
Imre Deak [Wed, 15 Sep 2010 10:54:29 +0000 (13:54 +0300)]
gpu: pvr: Increase the max number of 3D TA status vals in kick requests

This is needed to support the to-be-added fence sync mechanism in
the user space part. The change involves an ABI change, to make
the transition smooth keep support for the old format as well.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: pass IOCTL in param size to dispatch func
Imre Deak [Wed, 15 Sep 2010 10:52:32 +0000 (13:52 +0300)]
gpu: pvr: pass IOCTL in param size to dispatch func

This is needed by an upcoming patch that differentiates between
IOCTL parameter format based on it's size.

Also some ws change to silence checkpatch.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Check SysAcquireData return value.
Janusz Sobczak [Mon, 9 Aug 2010 11:23:36 +0000 (13:23 +0200)]
gpu: pvr: Check SysAcquireData return value.

SysAcquireData() could theoretically fail.
This patch adds missing return value check in SGXReadDiffCountersKM().

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Remove SysAcquireData call in pvr_cleanup.
Janusz Sobczak [Mon, 9 Aug 2010 11:23:25 +0000 (13:23 +0200)]
gpu: pvr: Remove SysAcquireData call in pvr_cleanup.

Remove obsolete SysAcquireData() call.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Check OSAllocMem return value.
Janusz Sobczak [Mon, 9 Aug 2010 11:23:16 +0000 (13:23 +0200)]
gpu: pvr: Check OSAllocMem return value.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Check OSAllocMem return value.
Janusz Sobczak [Mon, 9 Aug 2010 11:23:07 +0000 (13:23 +0200)]
gpu: pvr: Check OSAllocMem return value.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Check OSAllocMem return value.
Janusz Sobczak [Mon, 9 Aug 2010 11:22:59 +0000 (13:22 +0200)]
gpu: pvr: Check OSAllocMem return value.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Removed needless NULL check in MMU_BIFResetPDAlloc.
Janusz Sobczak [Mon, 9 Aug 2010 11:22:50 +0000 (13:22 +0200)]
gpu: pvr: Removed needless NULL check in MMU_BIFResetPDAlloc.

pui8MemBlock cannot be NULL, so remove the check.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Remove FIRST_PHYSICAL_PFN define.
Janusz Sobczak [Mon, 9 Aug 2010 11:22:42 +0000 (13:22 +0200)]
gpu: pvr: Remove FIRST_PHYSICAL_PFN define.

The unsigned comparison pfn >= 0 is always true.
Removed FIRST_PHYSICAL_PFN define and simplified the condition.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Check OSAllocMem return value.
Janusz Sobczak [Mon, 9 Aug 2010 11:22:22 +0000 (13:22 +0200)]
gpu: pvr: Check OSAllocMem return value.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Check OSAllocMem return value.
Janusz Sobczak [Mon, 9 Aug 2010 11:22:13 +0000 (13:22 +0200)]
gpu: pvr: Check OSAllocMem return value.

Check OSAllocMem() return value instead of checking the pointer returned
as a positional parameter.

This change makes static analysis tool happy.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Changed ReallocMem.
Janusz Sobczak [Mon, 9 Aug 2010 11:22:04 +0000 (13:22 +0200)]
gpu: pvr: Changed ReallocMem.

A static analysis tool showed a possible defect in ReallocMem() -
derefencing a null pointer. It was a false positive.

This patch slightly modifies ReallocMem() to avoid this warning.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Changed error-path condtion.
Janusz Sobczak [Mon, 9 Aug 2010 11:21:47 +0000 (13:21 +0200)]
gpu: pvr: Changed error-path condtion.

Changed the condition to equivalent but less confusing one.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Remove needless NULL check in PVRSRVWrapExtMemoryKM.
Janusz Sobczak [Mon, 9 Aug 2010 11:21:36 +0000 (13:21 +0200)]
gpu: pvr: Remove needless NULL check in PVRSRVWrapExtMemoryKM.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Remove needless NULL check in BM_CreateHeap.
Janusz Sobczak [Mon, 9 Aug 2010 11:21:27 +0000 (13:21 +0200)]
gpu: pvr: Remove needless NULL check in BM_CreateHeap.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Remove needless NULL check in WrapMemory.
Janusz Sobczak [Mon, 9 Aug 2010 11:21:19 +0000 (13:21 +0200)]
gpu: pvr: Remove needless NULL check in WrapMemory.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Fixed formatting in buffer_manager.c
Janusz Sobczak [Mon, 9 Aug 2010 11:21:08 +0000 (13:21 +0200)]
gpu: pvr: Fixed formatting in buffer_manager.c

Fixed indentation and mixed code and declarations.
No functional change.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Remove needless NULL check in BM_DestroyHeap.
Janusz Sobczak [Mon, 9 Aug 2010 11:20:52 +0000 (13:20 +0200)]
gpu: pvr: Remove needless NULL check in BM_DestroyHeap.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Remove needless NULL check in BM_ImportMemory.
Janusz Sobczak [Mon, 9 Aug 2010 11:20:44 +0000 (13:20 +0200)]
gpu: pvr: Remove needless NULL check in BM_ImportMemory.

Signed-off-by: Janusz Sobczak <janusz.sobczak@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: fix locking around HWRecoveryResetSGX
Imre Deak [Tue, 3 Aug 2010 10:40:32 +0000 (13:40 +0300)]
gpu: pvr: fix locking around HWRecoveryResetSGX

On the MISR / HW recovery path the pvr_dev_lock was taken twice
leading to a dead-lock. This regression was introduced by commit
ec53aaa940a4e40786eb7512b6a46ce347c95303.

Spotted-by: Luc Verhaegen <luc.verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: rename pvr_dvfs_lock to pvr_dev_lock
Imre Deak [Mon, 26 Jul 2010 19:22:07 +0000 (22:22 +0300)]
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 <imre.deak@nokia.com>
11 years agogpu: pvr: add dvfs lock
Imre Deak [Mon, 26 Jul 2010 19:22:07 +0000 (22:22 +0300)]
gpu: pvr: add dvfs lock

We need to protect the SGX HW access with a separate lock as the
pvr_lock. This is to overcome a lockdep issue between the clock
change notification lock and pvr_lock.

Fixes: NB#181087 - pvrsrvkm: possible circular locking dependency detected

Signed-off-by: Imre Deak <imre.deak@gmail.com>
11 years agogpu: pvr: add SGXScheduleProcessQueues to prepare for pvr_dev_lock
Imre Deak [Tue, 27 Jul 2010 13:24:56 +0000 (16:24 +0300)]
gpu: pvr: add SGXScheduleProcessQueues to prepare for pvr_dev_lock

This will be needed to do things done in SGXScheduleProcessQueuesKM
locklessly when pvr_dev_lock is added.

No functional change.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: omaplfb: remove unnecessary fb unblanking
Imre Deak [Thu, 22 Jul 2010 11:00:12 +0000 (14:00 +0300)]
gpu: pvr: omaplfb: remove unnecessary fb unblanking

This is unnecessary and is causing a lockdep problem with the DSS
driver.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Use DSS notifier to signal flip complete events
Ville Syrjälä [Tue, 25 May 2010 20:30:41 +0000 (23:30 +0300)]
gpu: pvr: Use DSS notifier to signal flip complete events

Utilize to the DSS GO notifier to get callbacks when the flip
has completed.

Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: Reduce code duplication
Ville Syrjälä [Tue, 25 May 2010 20:32:05 +0000 (23:32 +0300)]
gpu: pvr: Reduce code duplication

pvr_signal_sync_event() can be used twice with just a tiny
modification to the list handling.

Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
11 years agogpu: pvr: Add support for flip complete events
Ville Syrjälä [Tue, 25 May 2010 20:31:24 +0000 (23:31 +0300)]
gpu: pvr: Add support for flip complete events

Add framework for flip complete events. The events are supposed to be
signalled when a flip has completed. For now signal them immediately
to avoid clients blocking indefinitely.

Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: fix handle allocation when sharing sync objects
Imre Deak [Mon, 10 May 2010 14:31:50 +0000 (17:31 +0300)]
gpu: pvr: fix handle allocation when sharing sync objects

This is needed by an upcoming patch fixing sync object sharing, which
requires support for multiple sync object handles pointing to the same
sync object. This will work if the handles are allocated in different
processes, but will fail if allocted within a single process. Fix this
by explicitly allowing the handle framework to allocate multiple
handles for the same object within a single process.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Reuse the same syncobject across all wraps
Mark Underwood [Fri, 14 May 2010 16:08:23 +0000 (18:08 +0200)]
gpu: pvr: Reuse the same syncobject across all wraps

Create a hash table and store all the syncobjects that we create for
wrapped memory using the address of the buffer as the key. When a wrap
happens we check the hash table to see if the buffer has already been
wrapped and if so we retrieve the sync object and reuse it. When the
last wrap that is using a syncobject is freed then we remove the
syncobject from the hash table and free it.

Signed-off-by: Mark Underwood <mark.underwood@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: Disable driver if SGX HW recovery fails
Imre Deak [Wed, 5 May 2010 15:21:40 +0000 (18:21 +0300)]
gpu: pvr: Disable driver if SGX HW recovery fails

At the moment SGX HW recovery doesn't succeed always and keeps the
processes using the driver blocked. To avoid this give up after a
number of retries and disable further IOCTLs or interaction with
the HW. This would still allow a complete restart of the graphics
stack including reloading the drivers and restarting the relevant
processes.

The final fix is of course to find out why the recovery doesn't
succeed.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: optimize pvr_lock() by inlining it
Imre Deak [Thu, 6 May 2010 11:47:49 +0000 (14:47 +0300)]
gpu: pvr: optimize pvr_lock() by inlining it

Also replace pvr_init_lock() by a static initializer.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: move ocp_cleanup() later during device deinit
Imre Deak [Thu, 29 Apr 2010 12:48:26 +0000 (15:48 +0300)]
gpu: pvr: move ocp_cleanup() later during device deinit

Unmap the OCP register range only after it's not needed any more.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: fix lockdep problem
Imre Deak [Thu, 29 Apr 2010 11:28:37 +0000 (14:28 +0300)]
gpu: pvr: fix lockdep problem

On the CLK_PRE_RATE_CHANGE:
1. lock A           <- __blocking_notifier_call_chain:nh->rwsem
2. lock B           <- vdd2_pre_post_func:gPVRSRVLock
3. unlock A

On the CLK_POST_RATE_CHANGE/CLK_ABORT_RATE_CHANGE:
4. lock A
5. unlock B
6. unlock A

The above has an ABA lock pattern which triggers the warning. This can't
lead to a dead lock though since at 3. we always release A, before it's
again acquired at 4. To avoid the warning use a wait queue based approach
so that we can unlock B before 3.

Fixes: NB#166168 - PVR: possible circular locking dependency detected

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: more accurate error reporting when clk_set_rate fails
Imre Deak [Wed, 28 Apr 2010 12:02:19 +0000 (15:02 +0300)]
gpu: pvr: more accurate error reporting when clk_set_rate fails

We reported a rounded-down MHz value when clk_set_rate failed,
but this didn't make the reason clear when the Hz value didn't
match exactly any supported rate. So report Hz values instead.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: support for user data in events
Topi Pohjolainen [Tue, 27 Apr 2010 11:14:21 +0000 (13:14 +0200)]
gpu: pvr: support for user data in events

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: enable render complete events
Topi Pohjolainen [Tue, 27 Apr 2010 11:14:20 +0000 (13:14 +0200)]
gpu: pvr: enable render complete events

In DRM style events are associated with the driver private
part of the driver file descriptor. In order for the poll
and read methods to access the event list one needs to pass
the file private through the IOCTL stack.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: support for render complete events
Topi Pohjolainen [Tue, 27 Apr 2010 11:14:19 +0000 (13:14 +0200)]
gpu: pvr: support for render complete events

In DRM vertical blank event style, add support for userspace
to register for events signaling completion of rendering.
Driver is augmented with a list of pending events each
representing request to monitor a particular render completion.
Interrupt handler checks for the list and for the corresponding
state of the target surface. Once a complete render is
encountered, the handler simply moves the corresponding event
from the pending list to the unread list.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: support for polling events
Topi Pohjolainen [Tue, 27 Apr 2010 11:14:18 +0000 (13:14 +0200)]
gpu: pvr: support for polling events

In DRM style provide means for userspace to monitor availability
of events via the poll syscall.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: support for events
Topi Pohjolainen [Tue, 27 Apr 2010 11:14:17 +0000 (13:14 +0200)]
gpu: pvr: support for events

In DRM vertical blank event style, introduce support for the
driver to issue and for the userspace to read events. Driver
file node is extended with a list holding unread events and
with a wait queue representing processes interested receiving
events.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: replace boolean by flags in blits complete query
Topi Pohjolainen [Tue, 27 Apr 2010 11:14:16 +0000 (13:14 +0200)]
gpu: pvr: replace boolean by flags in blits complete query

In preparation for adding third mode of query. In DRM one
has a specific IOCTL for requesting the DRM kernel driver to
issue events when a particular vertical blanking period
passes. Here one aims to introduce similar IOCTL for requesting
PVR kernel driver to issue events whenever a particular frame
gets rendered in full. And instead of introducing entirely new
IOCTL, one instead aims to extend an existing call with a new
mode. This is accomplished by replacing the boolean selector
with an integer.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: round the SGX fclock rate to the nearest supported
Imre Deak [Tue, 20 Apr 2010 12:00:39 +0000 (15:00 +0300)]
gpu: pvr: round the SGX fclock rate to the nearest supported

This is needed since clk_set_rate accepts only exact values.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: remove support for broken LINUX_MEM_AREAS_DEBUG
Imre Deak [Tue, 13 Apr 2010 23:38:05 +0000 (02:38 +0300)]
gpu: pvr: remove support for broken LINUX_MEM_AREAS_DEBUG

Since implementation of the relevant function is missing, enabling
this will lead to a build problem. Hence removing it.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: fix PDUMP configuartion in release build
Imre Deak [Tue, 6 Apr 2010 08:54:16 +0000 (11:54 +0300)]
gpu: pvr: fix PDUMP configuartion in release build

PDUMP can be enabled in release builds too, but so far it was only enabled
in debug builds, so fix this.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: remove unrelevant comments about caller ID
Imre Deak [Mon, 5 Apr 2010 23:16:06 +0000 (02:16 +0300)]
gpu: pvr: remove unrelevant comments about caller ID

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: remove unused function args from SGXTestActivePowerEvent
Imre Deak [Mon, 5 Apr 2010 23:14:32 +0000 (02:14 +0300)]
gpu: pvr: remove unused function args from SGXTestActivePowerEvent

See the similar commits earlier in the patchset to see why this is
justified.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: remove unused function args from SGXPostActivePowerEvent
Imre Deak [Mon, 5 Apr 2010 23:09:40 +0000 (02:09 +0300)]
gpu: pvr: remove unused function args from SGXPostActivePowerEvent

See the similar commits earlier on why this is justified.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: no need to delay queue processing in SGXPostActivePowerEvent
Imre Deak [Mon, 5 Apr 2010 23:06:52 +0000 (02:06 +0300)]
gpu: pvr: no need to delay queue processing in SGXPostActivePowerEvent

At the moment processing of the command queue is delayed in case
SGXPostActivePowerEvent in the HW interrupt code path. This would be
only justified in case of being in interrupt context. This might have
been the case at one point in the history, but now HW interrupts
result in a work scheduled and thus calling the queue processing
function is safe in all cases.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: no need to check for retry failures in SGXTestActivePowerEvent
Imre Deak [Mon, 5 Apr 2010 23:02:29 +0000 (02:02 +0300)]
gpu: pvr: no need to check for retry failures in SGXTestActivePowerEvent

Powering off can't fail now with a 'retry' error, so we can't have the
corresponding condition here. See the similar commits earlier in the
patchset for a more detailed explanation.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: no need to check for IRQ context in SGXCommandComplete
Imre Deak [Mon, 5 Apr 2010 22:48:58 +0000 (01:48 +0300)]
gpu: pvr: no need to check for IRQ context in SGXCommandComplete

This function isn't called in IRQ context from anywhere, so remove
the related checks.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: no need to check for retry failures in SGXScheduleCCBCommandKM
Imre Deak [Mon, 5 Apr 2010 22:43:29 +0000 (01:43 +0300)]
gpu: pvr: no need to check for retry failures in SGXScheduleCCBCommandKM

Powering on the device can't fail any more with a 'retry' error so we can't
have the corresponding condition here. See the similar commit earlier in the
patchset for a more detailed explanation.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: remove unused function args from HWRecoveryResetSGX
Imre Deak [Mon, 5 Apr 2010 22:08:25 +0000 (01:08 +0300)]
gpu: pvr: remove unused function args from HWRecoveryResetSGX

See the similar commits earlier in the patchset on why this is
justified.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: no need to check for retry failures in PVRSRVMISR
Imre Deak [Mon, 5 Apr 2010 22:03:48 +0000 (01:03 +0300)]
gpu: pvr: no need to check for retry failures in PVRSRVMISR

ProcessQueues can't fail any more with a 'retry' error, so checking for
this is not needed. Previously ProcessQueues could fail if sQProcessResource
is locked by someone else. Since sQProcessResource is removed by a previous
change in this patchset that race condition can't happen.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: remove unused function args from PVRSRVProcessQueues
Imre Deak [Mon, 5 Apr 2010 22:01:56 +0000 (01:01 +0300)]
gpu: pvr: remove unused function args from PVRSRVProcessQueues

See the earlier commit with a similar change on why this is justified.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: remove unused function args from PVRSRVSetDevicePowerStateKM
Imre Deak [Mon, 5 Apr 2010 21:49:06 +0000 (00:49 +0300)]
gpu: pvr: remove unused function args from PVRSRVSetDevicePowerStateKM

The CallerID parameter was anyway a horrible concept in terms of
understanding what the function is supposed to do when ISR_ID, KERNEL_ID
or TIMER_ID is passed. Function arguments should never have such "high
level" meaning, but rather denote much more concrete things. In this case
for example whether we should mutex_lock() or mutex_trylock() for a
certain lock. Better yet we should have separate functions for the two
cases to keep the function body as simple as possible.

Happily the CallerID and RetainMutex arguments are unused now, so they
can be removed.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: remove sQProcessResource/OSLockResource interface
Imre Deak [Mon, 5 Apr 2010 21:24:41 +0000 (00:24 +0300)]
gpu: pvr: remove sQProcessResource/OSLockResource interface

The relevent parts are already protected by pvr_lock(), so no
need for sQProcessResource, which was anyway racy and required
the occasional retrying of any operations performed on the
protected object.

The OSLockResource interface thus becomes unused, so remove it
too.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: remove sPowerStateChangeResource lock
Imre Deak [Mon, 5 Apr 2010 21:12:43 +0000 (00:12 +0300)]
gpu: pvr: remove sPowerStateChangeResource lock

This lock was only created / destroyed, but nowhere actually used.
Remove it.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: remove PVRSRVPowerLock()
Imre Deak [Mon, 5 Apr 2010 20:56:34 +0000 (23:56 +0300)]
gpu: pvr: remove PVRSRVPowerLock()

For the relevant paths we already hold pvr_lock(), so we this lock
is unnecessary.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: fix locking on the DVFS path
Imre Deak [Mon, 5 Apr 2010 20:18:24 +0000 (23:18 +0300)]
gpu: pvr: fix locking on the DVFS path

The HW state is protected by pvr_lock(), so acquire it for the
duration of clock rate changes. We can also remove PVRSRVDvfsLock()
that thus becomes unneded.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: fix locking on SGX load calculating thread
Imre Deak [Mon, 5 Apr 2010 15:08:05 +0000 (18:08 +0300)]
gpu: pvr: fix locking on SGX load calculating thread

psDeviceNodeList et al is protected by pvr_lock, so we need to
acquire it here.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: enable debug trace for basic debug build
Imre Deak [Tue, 6 Apr 2010 09:09:47 +0000 (12:09 +0300)]
gpu: pvr: enable debug trace for basic debug build

Enable debug messages for basic debug type builds.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: add option for extra debugging information
Imre Deak [Thu, 1 Apr 2010 14:44:37 +0000 (17:44 +0300)]
gpu: pvr: add option for extra debugging information

This is basically a sed -i 's/\<DEBUG\>/CONFIG_PVR_DEBUG_EXTRA' *.[ch] .

Currently a driver built in debug mode will only work together with the
relevant PVR/OGLES user space libraries being built in debug mode too.
This is becuase the ABI is different in debug and release build.

This is not very flexible when one wants to only debug the kernel driver
and not care about the user space part, let alone figuring out where to
get the sources for that and rebuild it in debug mode too.

Mark the current user space dependent debug code parts with a new
CONFIG_PVR_DEBUG_EXTRA option instead of DEBUG, so that later we can
selectively add back basic debugging facilities like debug traces and
mark them with CONFIG_PVR_DEBUG.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
11 years agogpu: pvr: dump process info at HW recovery reset
Carsten Valdemar Munk [Wed, 15 Dec 2010 14:33:26 +0000 (09:33 -0500)]
gpu: pvr: dump process info at HW recovery reset

Print process ID and command name during HW recovery reset.

Based on a patch from Mark Underwood <mark.underwood@imgtec.com>.

Forward port to 2.6.35

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Carsten Munk <carsten@maemo.org>
11 years agogpu: pvr: add helpers to look up resource context and proc info
Imre Deak [Tue, 30 Mar 2010 12:36:24 +0000 (15:36 +0300)]
gpu: pvr: add helpers to look up resource context and proc info

These are needed by an upcoming patch showing process info.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: clean up FreeResourceByCriteria
Imre Deak [Tue, 30 Mar 2010 13:26:40 +0000 (16:26 +0300)]
gpu: pvr: clean up FreeResourceByCriteria

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: add support for finding the BM context from the DL
Mark Underwood [Mon, 15 Mar 2010 12:01:29 +0000 (13:01 +0100)]
gpu: pvr: add support for finding the BM context from the DL

This allows us to find the BM context from the value of the directory list.
This is required for the next patch.

Signed-off-by: Mark Underwood <mark.underwood@imgtec.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: make sure the device is powered on in SGX_MISRHandler
Imre Deak [Wed, 31 Mar 2010 20:01:36 +0000 (23:01 +0300)]
gpu: pvr: make sure the device is powered on in SGX_MISRHandler

While SGX_MISRHandler is scheduled another code path of the driver
(IOCTL, SGXOSTimer) can race with it and turn the power off before
it starts to execute.

When this happens we get the following oops backtrace:

 HWRecoveryResetSGX: SGX Hardware Recovery triggered
 Unhandled fault: external abort on non-linefetch (0x1008)
 PC is at HWRecoveryResetSGX+0x74/0x1b8 [pvrsrvkm]
 LR is at preempt_schedule+0x44/0x54
 (HWRecoveryResetSGX+0x0/0x1b8) from (SGX_MISRHandler+0x5c/0x60)
 (SGX_MISRHandler+0x0/0x60) from (PVRSRVMISR+0x44/0xa0)
  r5:bf0a29cc r4:dfbbbcc0
 (PVRSRVMISR+0x0/0xa0) from (MISRWrapper+0x14/0x18)
  r5:00000002 r4:00000000
 (MISRWrapper+0x0/0x18) from (worker_thread+0x1d0/0x2cc)
 (worker_thread+0x0/0x2cc) from (kthread+0x88/0x90)
 (kthread+0x0/0x90) from (do_exit+0x0/0x680)

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: remove unused per device variable
Imre Deak [Wed, 31 Mar 2010 16:51:04 +0000 (19:51 +0300)]
gpu: pvr: remove unused per device variable

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: fix indent error
Imre Deak [Wed, 31 Mar 2010 16:40:42 +0000 (19:40 +0300)]
gpu: pvr: fix indent error

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: BUG if pvr_lock is not held in HWRecoveryResetSGX
Imre Deak [Wed, 31 Mar 2010 14:08:51 +0000 (17:08 +0300)]
gpu: pvr: BUG if pvr_lock is not held in HWRecoveryResetSGX

Adding the check only to this one place, more can be added later.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: fix locking in pvr_dbg_reset
Imre Deak [Wed, 31 Mar 2010 14:19:22 +0000 (17:19 +0300)]
gpu: pvr: fix locking in pvr_dbg_reset

HWRecoverResetSGX needs to be called with the pvr_lock held.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: acquire the pvr lock on the SGX HW recovery path
Imre Deak [Wed, 31 Mar 2010 12:50:28 +0000 (15:50 +0300)]
gpu: pvr: acquire the pvr lock on the SGX HW recovery path

We need to take the lock protecting all SW and HW state tracking
objects on the recovery reset path, since we are accessing objects
like the SGX command queue, or the per process memory and resource
management contexts.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: fix locking on the HW interrupt path
Imre Deak [Wed, 31 Mar 2010 13:56:53 +0000 (16:56 +0300)]
gpu: pvr: fix locking on the HW interrupt path

- take pvr_lock in the interrupt handling work (MISR) thread, as from
  there we can call functions accessing HW and SW state tracking objects.
  An example is the SGX HW recovery function.

- make SGXOSTimerCancel asynchronous. This is safe now as a previous
  patch made sure that the timer will not run after cancelled. We can't
  do synchronous cancellation, because there would be an ABBA lockdep
  problem involving the SGXOSTimer's mutex and pvr_lock:

  MISR / IOCTL thread:
    1. pvr_lock in PVRSRV_BridgeDispatchKM
    2. timer's lock through SGXPrePowerState -> SGXOSTimerCancel

  SGXOSTimer's thread:
    1. timer's lock already taken when SGXOSTimer is called
    2. pvr_lock in SGXOSTimer

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: bail out from SGXOSTimer if it's been canceled
Imre Deak [Wed, 31 Mar 2010 14:53:20 +0000 (17:53 +0300)]
gpu: pvr: bail out from SGXOSTimer if it's been canceled

At the moment cancelling the timer is done in a synchronous way, so
we don't need to have the extra check. But a later patch will add
additional locking around the HW interrupt from where the timer can
be cancelled as well. Because of lock dependency issues described
in that patch we have to switch to an asynchronous way of cancelling
this timer and it means we need to have the extra check.

Also reset the flag indicating that the timer is cancelled when
destroying it. Currently we are both cancelling and destroying the
timer, but we really should just require calling the destroy function.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: add pvr_lock/remove unneeded lock headers
Imre Deak [Wed, 31 Mar 2010 11:55:54 +0000 (14:55 +0300)]
gpu: pvr: add pvr_lock/remove unneeded lock headers

- Add a public interface for accessing this lock. It has been used
  as a public interface anyway and an upcoming patch needs to access
  it as well.

- Remove headers becoming unnecessary by this refactoring.

Note:
  Currently this lock provides for a course level locking protecting
  all HW and SW state tracking objects. We'll need to revise the use
  of the following additional locks in the driver. Their existance
  might not be justified, in which case we could just substitute
  them with pvr_lock:

  PVRSRVDvfsLock
  PVRSRVPowerLock

Signed-off-by: Imre Deak <imre.deak@nokia.com>
11 years agogpu: pvr: add support to set board specific max SGX functional clk rate
Imre Deak [Fri, 19 Mar 2010 22:08:32 +0000 (23:08 +0100)]
gpu: pvr: add support to set board specific max SGX functional clk rate

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
11 years agogpu: pvr: move device registration into board file
Carsten Valdemar Munk [Wed, 15 Dec 2010 14:24:25 +0000 (09:24 -0500)]
gpu: pvr: move device registration into board file

Needed by an upcoming patch adding board specific device parameters.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Adapt for Nokia N900 MeeGo kernel

Signed-off-by: Carsten Munk <carsten@maemo.org>
11 years agogpu: pvr: compilation fixes for kernel > 2.6.33
Ameya Palande [Wed, 2 Jun 2010 12:04:01 +0000 (15:04 +0300)]
gpu: pvr: compilation fixes for kernel > 2.6.33

Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
11 years agomeego-device-adaptation import version
Nokia [Sat, 19 May 2012 14:13:28 +0000 (17:13 +0300)]
meego-device-adaptation import version

  * PVR: upgrade to version 1.4
  * PVR: fix memory corruption due to incorrect cache flushing
  * pvr: fix SGX HW recovery resets seen during boot
  * pvr: preparation for page flipping
  * PVR: SGX 530r125 support
  * PVR: add support for runtime detection of SGX HW revision
  * PVR: fix SGX power management
  * Fixes: NB#156444 - PVR: kernel crash when binding large texture

11 years ago20100903+0m5
Nokia [Sat, 19 May 2012 13:39:19 +0000 (16:39 +0300)]
20100903+0m5

  * Fixes: NB#149006 - PVR: fix kernel crash due to freeing resource still in
    use
  * Increase stability by removing race conditions in the PVR driver
  * Fixes: NB#150134 - PVR: Fix races in the SGXOSTimer path
  * Fixes: NB#140581 - PVR crashes kernel when flushing the Dcache

11 years ago20094803.3+0m5
Nokia [Sat, 19 May 2012 13:19:45 +0000 (16:19 +0300)]
20094803.3+0m5

  * Fixes: NB#141271 - Reduce MPU wakeups caused by SGX lockup
    monitoring
  * Fixes: NB#140010 - Fix PVR driver's cache flush IOCTL checking
  * Fixes: NB#140591 - Fix PVR driver reading regs when the SGX HW is
    off

11 years ago20094102.3+0m5
Nokia [Sat, 19 May 2012 13:00:19 +0000 (16:00 +0300)]
20094102.3+0m5

  * Fixes: NB#144114 - SGX HW locking up due to errors in PVR driver
    memory mapping
  * Fixes: NB#106381 - PVR kernel driver source incompatible with Linux
    standards

11 years ago20093908+0m5+flat+Lindent
Nokia [Sat, 19 May 2012 12:52:35 +0000 (15:52 +0300)]
20093908+0m5+flat+Lindent

  * Fixes: NB#129392 - fix object reference counting in the PVR video
    driver
  * Fixes: NB#132086 - Framebuffer resets are ignored by the PVR driver
  * Preparation for a change in the SGX library
  * Fixes: NB#129389 - fix random PVR driver breakage
  * Fixes: NB#128247 - fix size checking for PVR memory mapping requests
  * Fixes: NB#126777 - PVR module can cause dead-lock at reboot time
  * Fixes: NB#125756 - PVR triggers a lockdep warning
  * Fixes: NB#111084 - SGX compilation warnings
  * Fixes: NB#122294 - Performance regression in SGX operations caused
    by DVFS
  * Fixes: NB#121668 - PVR: error returned by drm_ttm_create is ignored
  * Fixes: NB#121947 - PVR: memory should not be released twice
  * Fixes: NB#119655 - PVR: random allocation failure for sizes > 4k
  * Introduce a patch related to NB#108042 -
    PVR: wrapped memory space runs out (not a complete fix)
  * Fixes: NB#112118 - Fix PVR breakage when using DVFS
  * Fix crashes due to power/clock state transitions in PVR
  * Fixes: NB#110835 - PVR: lock dependency bug
  * Enable dynamic power management for SGX
  * upgrade to SGX 1.3 (fingers crossed)