summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/host/nvhost_cdma.c
AgeCommit message (Collapse)Author
2012-06-14video: tegra: host: Parametrize host1xTerje Bergstrom
Add parameters in host1x nvhost_device on * number of sync points * number of wait bases * number of channels * number of mlocks * client managed bitmask * naming of sync points Add automatically generated headers and use symbols from them to access hardware. Move host1x device definition from generic host1x to SoC specific source files t20.c and t30.c. Bug 982965 Change-Id: Ibec84be22d75b363900d10bcbd59d4d8321d54a1 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/104974 Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
2012-06-11video: tegra: host: Abstract nvmap supportTerje Bergstrom
Abstract nvmap support to one file, and use it via function pointers from other parts of nvhost. Bug 965206 Change-Id: I4e5e7de4271e0797d117ac8210af4732b6018973 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/105665 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
2012-05-29video: tegra: host: Throttle lower priority jobsTerje Bergstrom
Implement per channel counter for jobs in each priority level. If there are jobs active with higher priority than the one being submitted, throttle. Bug 926690 Change-Id: I5fed341e3f248325873b31d1c53bf57bf0a78074 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/104939 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com> Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
2012-05-24video: tegra: host: rewrite nvhost_job_pin/unpin APIsMayuresh Kulkarni
- remove usage of custom interface of nvmap to patch the relocs and and pin the gathers/relocs - convert code that references nvmap_handle to nvmap_handle_ref - add logic to pin and map only unique gathers and relocs - rename nvhost_channel_gather to nvhost_job_gather, because it's used in nvhost_job code only Bug 965206 Change-Id: Iaa7fbac9e4a7b08c0a7c1e184b8dd3566e1edfe2 Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/95299 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
2012-05-17video: tegra: host: Yield in case of race of waitsTerje Bergstrom
If two threads need to wait for CDMA to become quiet at the same time, the second one will cause a BUG(). Replace the BUG() with a code to yield and try again. Change-Id: I7925ad0cc0e8292919e54d0fa45f7837f453358d Reviewed-on: http://git-master/r/102437 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> GVS: Gerrit_Virtual_Submit
2012-05-17video: tegra: host: Simplify robustnessTerje Bergstrom
nvhost attempts to purge all buffers from timed out contexts. This is very error prone, and not necessary. Change behavior so that only the hung job, and the immediately following jobs from same context are purged. This simplifies code, and corrects bug where the push buffer modifications caused panics. Bug 982946 Change-Id: Ifb26484cf02ef40f8d5b20338eebc0a731f453cf Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/102234 Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
2012-05-11video: tegra: host: move chip_support out of nvhost_masterMayuresh Kulkarni
- currently, nvhost_master holds the reference to struct chip_support - the struct chip_support hides the chip specific implementation for channel submit, cdma, push buffer operations etc. so it exposed all the internal structures through nvhost_master - move chip_support to be a part of nvhost_bus since it only has function pointers to chip specific api implementations - nvhost_master is host1x device specific private data so ideally it should not hold reference to chip specifics Bug 871237 Change-Id: I4f3f48ee5fc47a90288d110ea8eef905150275a0 Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Reviewed-on: http://git-master/r/94421 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> GVS: Gerrit_Virtual_Submit
2012-05-10video: tegra: host: Add context switch to trace dumpTerje Bergstrom
Add context switch to the ftrace dump. Change-Id: I5df032273982b919fb94263cff38d8b8b6b6be45 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/101523 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
2012-05-04video: early exit from update_cdmaPranav Chaturvedi
when update_cdma_locked() is invoked, CDMA is not running implies that the queue is cleared and we can return immediately. Bug 960487 Change-Id: I599027906dc405f4490590443d4f4d5a3202b5b0 Reviewed-on: http://git-master/r/96650 (cherry picked from commit f297b4812d15540f4b14c87178662a7ca6575ce9) Reviewed-on: http://git-master/r/99994 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
2012-05-04video: tegra: host: Clean up includesTerje Bergstrom
Clean up #includes. Replace #includes with forward declarations where possible, and remove extraneous #includes. Bug 871237 Change-Id: I6942e0c632b42ad7009589ebdd78def88ae4baa4 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/99046 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
2012-03-20video: tegra: host: Fix sync point comparisonTerje Bergstrom
Fix sync point comparison to take into account old expired values, and do proper comparison taking into account wrapping. Bug 941327 Change-Id: I70724637ba870b2e29bac695abc0ea2b968394d7 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/84808 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Ilan Aelion <iaelion@nvidia.com> Reviewed-by: Acorn Pooley <apooley@nvidia.com>
2012-03-15video: tegra: host: Replace license informationTerje Bergstrom
Replace license information in nvhost with GPLv2. Also adds copyright year 2012 in files which have been changed in 2012. Change-Id: I86e8ed27095df13d99e0250e57e244d531fdacec Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/89735 Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
2012-02-22video: tegra: host: Change sync queue to a listTerje Bergstrom
Sync queue is the list of jobs still in flight. As context priorities requires possibility to insert a job in the middle of the queue, the structure needs to be changed into a linked list. Bug 926690 Change-Id: Id257a11f18476c70dd69e36ba44ed2d380c80040 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/83127
2012-01-30video: tegra: host: Fix timeout syncpt incrsTerje Bergstrom
In timeout, if there were more than one submits in queue, timeout accumulated the sync point increments incorrectly. Fix accounting of sync point increments. Bug 915715 Reviewed-on: http://git-master/r/76831 Change-Id: I03223b1f65a4bdbae19e9c1b927451a80122bec4 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/77729 Reviewed-by: Automatic_Commit_Validation_User
2012-01-12video: tegra: host: Move device data to nvhost_deviceTerje Bergstrom
Move all device data from nvhost_channeldesc, nvhost_moduledesc and nvhost_module to nvhost_device. nvhost_devices are also assigned into a hierarchy to prepare for implementation of runtime power management. Change-Id: I1e18daae8fe538086cd1f453d316e0f73e9d7d92 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/72844 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Reviewed-on: http://git-master/r/74560 Reviewed-by: Varun Wadekar <vwadekar@nvidia.com> Tested-by: Varun Wadekar <vwadekar@nvidia.com>
2011-12-22video: tegra: host: Move timeout to hwctx & job structsTerje Bergstrom
Timeout struct contains fields which are accessed even after client has quit. Move the fields to hwctx and nvhost_job so that they can be accessed when submits complete. Bug 917340 Change-Id: I322c38d32bc801aa9b061355a17be7f605692e18 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/71004 Reviewed-by: Automatic_Commit_Validation_User Tested-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
2011-12-21video: tegra: host: Use nvhost_job for tracking submitTerje Bergstrom
When a submit arrive in kernel, package it as a new data type nvhost_job and use that for submitting to channel. That data type is used for tracking the state of the job through its lifetime. Change-Id: I0cfdb1721cc6c08efbd215917f5f46fdb7131ca0 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/67682 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2011-12-15video: tegra: host: Use polling in nvhost_cdma_flush()Terje Bergstrom
nvhost_cdma_flush() waits for channel to become empty before returning. If there is already another process waiting for semaphore, nvhost_cdma_flush() needs to use polling. Change-Id: Ic0c3d7adc68b3ed93056ec73c16f685d6f1ba15e Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/68163 Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
2011-11-30video: tegra: host: Sync 3D wait base only on timeoutTerje Bergstrom
Synchronize 3D wait base only when there is a timeout. Bug 886411 Reviewed-on: http://git-master/r/62656 (cherry picked from commit 1f660b9ea615331624dcf8a923e7779fa3bcd48a) Conflicts: drivers/video/tegra/host/t30/channel_t30.c Change-Id: I667dd628902906cdae983d314b0df96e39843fad Reviewed-on: http://git-master/r/64021 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: Rcc6e21a4c01a55cfab5b44c4d4bc6557a810c95e
2011-11-30video: tegra: host: Keep wait bases in syncTerje Bergstrom
Add opcodes to synchronize the wait base for each channel at the beginning of each submit. This adds robustness towards misbehaving user space. Context clear for robustness clears the opcodes for synchronizing the wait base. This change also removes that part of robustness. Bug 886411 Reviewed-on: http://git-master/r/60423 (cherry picked from commit c3740abf73ef6b7fd9b7de5bc4b6615ba25adf5e) Change-Id: I67dfe3d2303ea373e3119be49a568d64932d8016 Reviewed-on: http://git-master/r/62359 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com> Rebase-Id: R842ee4eee4b738d012eb065ac71448fd2684ca66
2011-11-30video: tegra: host: Add timeout to low-pri throttleTerje Bergstrom
Add timeout to throttling low-priority thread. Low priority threads are allowed to push work either when push buffer is empty, or when they've waited for a pre-defined period. Setting the period to 50ms for now. Bug 864407 Reviewed-on: http://git-master/r/58330 (cherry picked from commit a9469db8c4c04fa7cd8f080bafdca26d99a3018c) Change-Id: I5fa310acf6cf5563eda6b7343ad82679f76162af Reviewed-on: http://git-master/r/61734 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com> Rebase-Id: R587f052c75a23b1a5a2349d4bf0feecc49cad898
2011-11-30video: tegra: host: Check for allocation failuresTerje Bergstrom
Adds checks for memory allocation failures, and proper propagation of error conditions. Adds clearing of pointers after free or unpin has been called to catch use after free. Bug 877551 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/54027 Reviewed-by: Antti Miettinen <amiettinen@nvidia.com> Reviewed-by: Hiroshi Doyu <hdoyu@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> Reviewed-by: Krishna Reddy <vdumpa@nvidia.com> Tested-by: Gerrit_Virtual_Submit (cherry picked from commit bfbf2766d11a5f85781532ddce3a87b7ae762ba3) Change-Id: I04171ee5db6a42bb1689221d4f80d5f3d35e7399 Reviewed-on: http://git-master/r/57462 Rebase-Id: Rc9f43312c8b818869d746f4b73700d8b56e4569d
2011-11-30tegra: nvhost: Retrieve phys address from nvmapTerje Bergstrom
Debug code used to rely on being able to calculate the base address of a pinned page by masking it. Now we always retrieve the physical address from nvmap and find the correct command buffer using that. Bug 840976 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/48105 Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> (cherry picked from commit 0ef5f2d4d94464b8d5562327c9cf5b56fe93fff5) Change-Id: I1a17665cf19d8758f154d4fd05f6a5ec6c07caff Reviewed-on: http://git-master/r/56266 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: R12cdbf7b335ca46cd063cdf9dd7783b18255a3f1
2011-11-30video: tegra: nvhost: add submit timeout supportChris Johnson
In this change, nvhost_cdma starts a timer (if a timeout is specified in the userctx), for the buffer at the head of the sync_queue that has not reached its syncpt threshold. If the timeout fires, nvhost_cdma initiates a channel / module reset. It then detects up to where in the sync_queue it stopped execution (based on the current HW syncpt value). For any remaining uncompleted buffers in the context, nvhost_cdma NOPs the entry and CPU incrs the syncpt to where it should be had it completed. If one of the sync_queue entries belongs to another context, it still does the syncpt incrs for this context, but via the PB as a GATHER opcode, At the end, CDMA is restarted, so buffers are refetched (either with NOP slots, or GATHERs to incr syncpts). This appears as though the buffer has completed (and the associated resources released). For testing, debugfs entries have been added under /d/tegra_nvhost force_timeout_val - set the timeout value, in ms force_timeout_channel - channel ID, were timeouts checks occur force_timeout_pid - process ID to set the userctx The idea is to set the timeout_val, then the timeout_channel (e.g. for 3D, the channel ID is 1) and then the process ID, gotten from running adb shell ps. Bug 625545 Original-Change-Id: I659e9255f1105f3439ce23e9169a19739b83ea52 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/42655 Reviewed-by: Scott Williams <scwilliams@nvidia.com> Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: R89759c129e2db8f7dbf83a6066fc29947f95cc27
2011-11-30nvhost: Fix tegra_host/status debug outputTerje Bergstrom
Add tracking of mapping between push buffer gathers and nvmap handles. Use the mapping to access contents of gather buffers. Bug 840976 Original-Change-Id: Ic6fe2fc7a83e8f14cd606a9e638b6420aa714495 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/44779 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: Rd0c946095890cfe15a68d3c5eaa181a9ac02cf07
2011-11-30nvhost: Add tracing for submit activity and cdmaTerje Bergstrom
Adds trace commands for times when a command buffer has been submitted and when the channel's command buffer has been processed. Also adds tracing when cdma buffer is full. This patch fixes a spelling mistake in waitchk trace function. Original-Change-Id: Ib5609a56c6c2d9ce6cbd019a94f3e102d419bb60 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/36863 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: R34c172eff1e9c128a7748bb4f9af0cf05a30aa7d
2011-11-30video: tegra: refactor for multiple chip supportKen Adams
Original-Change-Id: Ia203886a3b013612b4159393ff43a25a313d1ece Reviewed-on: http://git-master/r/35911 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: R01b763362c13e09111f60700c3d3a7d2a9a3fc1c
2011-11-30video: tegra: host: Renovate debug codeAndrew Howe
Bring in changes to enable dumping the debug state to the kernel log (used when module suspend times out). Rewrote debug code to get that working more cleanly (no 16K buffer). Refactored & cleaned up debug code to make it easier to understand. Original-Change-Id: I22db36a627bfb1815a46866dfe23a5d3aa693edc Reviewed-on: http://git-master/r/24157 Reviewed-by: Scott Williams <scwilliams@nvidia.com> Tested-by: Scott Williams <scwilliams@nvidia.com> Original-Change-Id: I92d7dcc4ede088179a5a1bca982fdfba1eeb3553 Rebase-Id: Ra013bf33c1002d2e37a7c97b7d4b441ad51f7211
2011-11-30[ARM/tegra] nvhost: Merge NVIDIA changes into Google's nvhostAndrew Howe
Google's 2.6.36 nvhost driver branched from NVIDIA's 2.6.32 nvhost at some point before it was actually committed to 2.6.32, but the former's original commit included some fixes that were added to the latter after that. Confusing... Also Google's version has some changes that we like so they will remain, but that makes merging difficult. Anyway, this commit brings the rest of our 2.6.32 changes into 2.6.36 and cleans it up a bit. It might be nicer to break this up into a load of smaller commits but it turned out to be very difficult to do that. Original-Change-Id: I828b624b089b811d6130173e55258da8f52a5cc2 Reviewed-on: http://git-master/r/12563 Tested-by: Jussi Rasanen <jrasanen@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> Tested-by: Wei Sun <wsun@nvidia.com> Original-Change-Id: I72fbcff16ec6df62cc7299052a84b91db252c8d1 Rebase-Id: Rb3aa29f2ecbecf889bbc6ccf7d0b26925f7b94fb
2011-11-30video: tegra: add some missing mutex locking to nvhost_cdmaPrajakta Gudadhe
Change-Id: Ie4606d9a5154090274168babc110ea2d79747c05 Signed-off-by: Erik Gilling <konkers@android.com>
2011-11-30video: tegra: dump current pushbuffer from channel debuggerMichael I. Gold
Signed-off-by: Erik Gilling <konkers@android.com> Change-Id: Ia14a2bad23ae1c6401755d413ffdc32c9f35b0fd
2011-11-30video: tegra: host1x driverGary King
the graphics and display hardware on tegra SoCs is accessed through a command DMA front-end called host1x host driver clients place commands into memory objects called streams, and submit a stream on one of 8 channels: the assignment of streams-to-channels depends on the hardware module(s) programmed by the stream: for example, all streams which program the 3D hardware are submitted on channel 1. the host1x hardware includes two synchronization primitives to allow command streams to synchronize access to memory or to hardware engines shared across channels (e.g. the 2D blitter): sync points and module mutexes. both primitives can also be used to synchronize with the CPU. the host1x driver performs power management for all modules behind the host block: once a module is idle (i.e., the last stream which accesses it has completed, indicated by a syncpoint) and has remained idle for an extended period of time, the module's clock (and power gate island, if the module is uniquely power-gated) is disabled, and will be automatically re-enabled when a new stream is submitted for that module. includes channel debugging support originally implemented by Erik Gilling <konkers@google.com> Original Author: Antti Hatala <ahatala@nvidia.com> Signed-off-by: Gary King <gking@nvidia.com> Change-Id: Idf0ecc8e7710f3839903a9fbfbe5650990a96b2c