summaryrefslogtreecommitdiff
path: root/drivers/video/tegra
AgeCommit message (Collapse)Author
2017-11-29tegra: align graphics drivers with android binariesApalis-TK1_LXDE-Image_2.7b5-20171201Dominik Sliwa
Some functionality used by android binary drivers were missing. Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-11-29Merge tag 'tegra-l4t-r21.6' into toradex_tk1_l4t_r21.6Marcel Ziswiler
Merge NVIDIA's latest Linux for Tegra aka L4T R21.6 Linux kernel changes from git://nv-tegra.nvidia.com/linux-3.10.git commit: b271e8fa67a6d9c4600274a25636cfe00fdd1b68 Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
2017-09-20dp.c: fix compilation with gcc 7Max Krummenacher
With gcc 7 the following compile time error occurs: | drivers/video/tegra/dc/dp.c:1178:12: error: the omitted middle operand in ?: will always be 'true', suggest explicit middle operand [-Werror=parentheses] | cr_done ? : ({ret = -EINVAL; goto fail; }); | ^ | drivers/video/tegra/dc/dp.c:1186:12: error: the omitted middle operand in ?: will always be 'true', suggest explicit middle operand [-Werror=parentheses] | lt_done ? : ({ret = -EINVAL; goto fail; }); | ^ Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-09-20dsi.c: fix compilation with gcc 7Max Krummenacher
With gcc 7 the following compile time error occurs: | drivers/video/tegra/dc/dsi.c:766:34: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] | drivers/video/tegra/dc/dsi.c:757:1: | (platform_t_phy_ps) ? ( \ | ~~~~~~~~~~~~~~~~~~~ | kernel-source/drivers/video/tegra/dc/dsi.c:766:34: | dsi->info.phy_timing.t_tlpx_ns * 1000, | drivers/video/tegra/dc/dsi.c:757:2: note: in definition of macro 'SELECT_T_PHY' | (platform_t_phy_ps) ? ( \ | ^~~~~~~~~~~~~~~~~ Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-07-26video: tegra: nvmap: fix nvmap create handle vulnerabilityKrishna Reddy
Handle the race condition between malicious fd close and copy_to_user error, which can create use after free condition. This is fixed by deferring the fd install, which eliminates the race that leads to use after free condition. Fixing Google Bug 32160775. Bug 1835857 Change-Id: I337807e4360661beced8f9e1155c47b66607b8df Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/1248391 Reviewed-on: https://git-master.nvidia.com/r/1512958 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Tested-by: Bibek Basu <bbasu@nvidia.com>
2017-06-30video: tegra: sor: set drive current for lane4WayneWWW
Drive current for LANE4 was not set if configured as 24bpp LVDS out. Fix it by programming proper drive current register if using 24bpp out. https://devtalk.nvidia.com/default/topic/1003030 Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
2017-06-29video: tegra: dsi: Set max limit for reading panelPavan Kunapuli
In the debugfs support for reading panel registers, max payload needs to be limited to the buff array size to avoid stack corruption. Bug 1873360 Change-Id: Ibee7bd81027d2669297942c09b905f1dd3bb09ee Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com> Signed-off-by: sakets <sakets@nvidia.com> Reviewed-on: https://git-master/r/1507653 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2017-06-21video: tegra: nvmap: fix information leak in pin/unpinSri Krishna chowdary
When the NVMAP_IOC_PIN_MULT_32 and NVMAP_IOC_UNPIN_MULT_32 are called it is possible that the op.addr is not initialized. This can cause write to some random address thus causing corruption. This patch fixes Google Bug 31668540 bug 1832092 Change-Id: I4d12d1a6c777131ba1fa2a753ea640861f8e82a6 Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com> Reviewed-on: http://git-master/r/1314406 (cherry picked from commit da0c43534bb61e2e0849e297d389517d5e4ed168) Reviewed-on: http://git-master/r/1504673 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Tested-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: Winnie Hsu <whsu@nvidia.com>
2017-06-09video: tegra: nvmap: Fix NULL pointer dereferenceSri Krishna chowdary
Consider the following case: 1. NVMAP_IOC_CREATE on IOVMM gives a valid fd to user space 2. user space does not call NVMAP_IOC_ALLOC. 3. user space calls a client driver IOCTL which calls dma_buf_map_attachment 4. call to dma_buf_map_attachment propagates till__nvmap_sg_table which has heap_pgalloc as true and tries to access pages[] which has all NULL. 5. Similarly, a dma_buf_kmap() can result in __nvmap_kmap() being called which again results in NULL dereference if pages[] is accessed. A valid __nvmap_sg_table should occur only when h->alloc is true. So, add check for it. bug 1838597 bug 1883708 Change-Id: I400d9d8a94ff1003db207fc9c252b9256d796f60 Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com> Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> (cherry picked from commit 8244d104b7635cb0b26b651b6851498b9a84d7d6) Reviewed-on: http://git-master/r/1489579 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Tested-by: Bibek Basu <bbasu@nvidia.com>
2017-05-26video: tegra: nvmap: Fix security issue in NVMAP_IOC_PARAMGagan Grover
Initialized the uninitialized variables and handled return status from nvmap_get_handle_param. Bug 1884311 Bug 1820242 Change-Id: I2390c859d2b2af39eaff44749ca64e60920fe944 Signed-off-by: Gagan Grover <ggrover@nvidia.com> Reviewed-on: http://git-master/r/1259560 Reviewed-on: http://git-master/r/1489707 GVS: Gerrit_Virtual_Submit Tested-by: Sumit Gupta <sumitg@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2017-05-25video: tegra: nvmap: Fix OOB vulnerabilitySagar Kadamati
Check all pages' parameters before reserve pages. Bug 1883463 Bug 1831426 Bug 200247013 Manual port: http://git-psac/r/9287 (cherry picked from commit 61a05b52b8a17593e2817076b9bf59efdd9268ad) Change-Id: I2f47c385ff8f4a9ca6bf37ee41749bd684ca1a20 Signed-off-by: Xia Yang <xiay@nvidia.com> Signed-off-by: Sagar Kadamati <skadamati@nvidia.com> Reviewed-on: http://git-master/r/1273326 Reviewed-on: http://git-master/r/1488769 GVS: Gerrit_Virtual_Submit Tested-by: Sumit Gupta <sumitg@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2017-05-05video: tegra: host: Add submit checksMikko Perttunen
Currently nvhost performs minimal checking for submits it passes to hardware: The kernel does not check if job syncpoints are allocated and the gather classes are not verified currently. This patch adds checks for syncpoint ids and gather classes. Adapted from 0abcbd69c4cbd0093e223b6c248fdd53c2886951. Bug 1831406 Change-Id: Ifb9d2090009d16d0f56bc11546036167c7f72228 Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Reviewed-on: http://git-master/r/1242190 Reviewed-by: Winnie Hsu <whsu@nvidia.com> Tested-by: Winnie Hsu <whsu@nvidia.com>
2017-05-05video: tegra: host: Protect channel ioctlArto Merilainen
Channel ioctl interface is not multithreading safe and as the common case is that we have only a single active user for an open fd, add a mutex to force serialization of ioctl calls. Bug 1830021 Change-Id: Ifa6595a105b913345104f216f0541c371e89efe5 (cherry picked from commit 7b24caa9a8d2ab08fe0c7be112e805e44906d956) Signed-off-by: Gagan Grover <ggrover@nvidia.com> Reviewed-on: http://git-master/r/1248801 Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit
2017-05-05video: tegra: nvmap: fix possible use after freeGagan Grover
Fix possible use after free issue. Bug 1814555 Bug 1884319 Change-Id: I826aa34f61d43fda5419a528697ce84ba2ce1eae Reviewed-on: http://git-master/r/1221643 Signed-off-by: Gagan Grover <ggrover@nvidia.com> Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-on: http://git-master/r/1257999 (cherry picked from commit b1647da33cff0c498ca8439a722ea1962ecf6901 in rel-24) Reviewed-on: http://git-master/r/1461184 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Tested-by: Bibek Basu <bbasu@nvidia.com>
2017-05-05video: tegra: host: Fix overflow issue allocationMikko Perttunen
Change kmalloc to kmalloc_array to prevent overflow issues caused by large values supplied by user. Based on "video: tegra: host: Fix overflow issues in allocation" in nvhost/. Coverity ID 27942 Bug 1856419 Change-Id: I5e96d0ec184543782dfe8814ad7e856b3b71221c Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Reviewed-on: http://git-master/r/1295062 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2017-05-05video: tegra: nvmap: Check if handle holds a buffer before mapSri Krishna chowdary
Consider the following case: 1. NVMAP_IOC_CREATE gives a valid fd to user space 2. user space calls NVMAP_IOC_ALLOC and it fails. So, all of the handle's allocation fields are zero. 3. Subsequent dma_buf_vmap, mmap on fd leads to __nvmap_mmap call. 4. handle is valid but h->alloc, h->carveout, h->heap_pgalloc, h->vaddr all are 0. 5. We check for h->heap_pgalloc which is false, so proceed and dereference h->carveout leading to NULL pointer exception. A valid __nvmap_mmap should occur only when h->alloc is true. So, add check for it. bug 1837468 Change-Id: I9be9d94f9b74c25b9b588fb1a16a74e96161ceda Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com> Reviewed-on: http://git-master/r/1253236 (cherry picked from commit c5da78cf3d0c19f1e04501a4b3f64a5acacd0ff3) Reviewed-on: http://git-master/r/1312264 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Tested-by: Bibek Basu <bbasu@nvidia.com>
2017-04-04tegra: video: use modedb to specify frame buffer resolutionBhuvanchandra DV
Allow to specify framebuffer videomode using kernel command line parameters. NVIDIAs binary X driver later on picks up those settings and start X with current mode settings, if no EDID data are available. Reused some of the implementation from Stefan's work for modedb support[1] on Tegra20/30 [1] http://git.toradex.com/cgit/linux-toradex.git/commit/?h=tegra-next&id=1d3625dd9903bcc59e2df56836565ebb682948c1 Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-04-04apalis-tk1: fix lp1 sleepDominik Sliwa
Fix suspend and resume for LP1 sleep. Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2017-03-20video: tegra: nvmap: fix time-of-check,time-of-use vulnerabilitySri Krishna chowdary
Validate the region specified by offset and size before performing the operations like nvmap_prot_handle, nvmap_cache_maint and nvmap_handle_mk*. This validation of offset and size once the values are in local variables guarantees that even though user space changes the values in user buffers, nvmap continues to perform operations with the contents that are validated. Fixes Google Bug 34113000. bug 1862379 Change-Id: Ief81887b3d94b49f3dcf4d2680d9d7b257c54092 Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com> Signed-off-by: Bibek Basu <bbasu@nvidia.com> Reviewed-on: http://git-master/r/1298712 (cherry picked from commit f45441da608d8015ece73d253d4bdb48863f99e2) Reviewed-on: http://git-master/r/1310316 (cherry picked from commit 57367ab3be5f1c52dd6b885f114ae90dfce5a363) Reviewed-on: http://git-master/r/1319910 GVS: Gerrit_Virtual_Submit
2016-11-08video: tegra: host: Prevent the race between channel open and closeGagan Grover
Moved fd_install() at the end of the channel_open ioctl. So, the fd can't be used until open ioctl completes. Bug 1832094 Change-Id: Ib33d43bf5164418a38f98677d4e3295f3d1c1450 Signed-off-by: Gagan Grover <ggrover@nvidia.com> Reviewed-on: http://git-master/r/1248180 (cherry picked from commit e6a41d5c0049c2878543006b67b7ee2b2bbda2ab) Reviewed-on: http://git-master/r/1249505 Reviewed-by: Winnie Hsu <whsu@nvidia.com> Tested-by: Winnie Hsu <whsu@nvidia.com>
2016-11-08video: tegra: host: add lower bound to num_syncpt_incrsGagan Grover
Check if there is at least one syncpt_incrs in each job. Bug 1812182 Change-Id: I0bd0b2e7c4d01641c83ba729ec34390ddea81496 Reviewed-on: http://git-master/r/1221226 Signed-off-by: Gagan Grover <ggrover@nvidia.com> Reviewed-on: http://git-master/r/1248797 GVS: Gerrit_Virtual_Submit Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
2016-09-29video: tegra: dc: fix gcc-6 compilationApalis_TK1_LinuxImageV2.6.1Beta1_20160929Marcel Ziswiler
drivers/video/tegra/dc/dc.c:116:3: error: 'can_filter' defined but not used [-Werror=unused-const-variable=] } can_filter[] = { ^~~~~~~~~~ Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
2016-07-28video: tegra: host: fix integer overflowDeepak Nibade
Below addition on 32 bit architecture machines could cause integer overflow since we will assign overflowed value to "num_unpins" s64 num_unpins = num_cmdbufs + num_relocs Fix this and other calculations by explicitly typecasting variables to u64 first Bug 1781393 Change-Id: Ib7d9c0be4ac61dc404512b4bb0331aa20a6978bc Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1171748 (cherry picked from commit 8f00b96c137b9c4cb43a8dbe2e153fae49524113) Reviewed-on: http://git-master/r/1172519 (cherry picked from commit 61229625b1e19d5a93a9458f04e0cce356dbdee3) Reviewed-on: http://git-master/r/1190218 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Jeetesh Burman <jburman@nvidia.com> Tested-by: Jeetesh Burman <jburman@nvidia.com> Reviewed-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: Winnie Hsu <whsu@nvidia.com>
2016-07-28video: tegra: host: fix possible overflow with num_syncpt_incrsDeepak Nibade
We allocate below without checking if num_syncpt_incrs is valid or not struct nvhost_ctrl_sync_fence_info pts[num_syncpt_incrs]; If UMD passes a negative value in num_syncpt_incrs, then it is possible to corrupt the stack Hence, first check if num_syncpt_incrs is valid (i.e. not negative) And then allocate the array dynamically using kzalloc instead of allocating it on stack Bug 1781393 Change-Id: I5389fd271149b457f63831a41c104c9814299ddf Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1171747 (cherry picked from commit 07fb347b4060a888b19df3524f36fcf7974a79d1) Reviewed-on: http://git-master/r/1172518 (cherry picked from commit 1db2d69b6abeb6fc9d4257db88f631d9c8aef74d) Reviewed-on: http://git-master/r/1190211 GVS: Gerrit_Virtual_Submit Reviewed-by: Jeetesh Burman <jburman@nvidia.com> Tested-by: Jeetesh Burman <jburman@nvidia.com> Reviewed-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: Winnie Hsu <whsu@nvidia.com>
2016-07-26video: tegra: hdmi: choose clk rate above 100MHzNaveen Kumar S
pll_d2 runs at a minimum of 100MHz on T124. Update logic to choose parent clock rate more than 100MHz. e.g.: A mode with 32MHz pclk chooses parent clock of 96MHz with a divider of 3.0, which fails as pll_d can't be pulled below 100MHz. bug 1785365 Change-Id: I12400549a3ed42295ddd46adcb6493232f2d896a Signed-off-by: Naveen Kumar S <nkumars@nvidia.com> Reviewed-on: http://git-master/r/1184235 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Aleksandr Frid <afrid@nvidia.com> Reviewed-by: Aly Hirani <ahirani@nvidia.com> Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2016-06-29video: tegra: correct lvds clk sequenceMarcel Ziswiler
Patch taken from Manoj Gupta's post on NVIDIA's public embedded systems forum: https://devtalk.nvidia.com/default/topic/822612/jetson-tk1/-issue-lvds-panel-enabled-effect-hdmi-out-image-pull-down-menu-items/post/4673174/#4673174 Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
2016-06-29video: tegra: fix build with enabled tegra lvds driverMarcel Ziswiler
This fixes the following build time error in case CONFIG_TEGRA_LVDS is enabled: drivers/video/tegra/dc/sor.h: In function 'tegra_sor_clk_enable': drivers/video/tegra/dc/sor.h:180:2: error: implicit declaration of function 'clk_prepare_enable' [-Werror=implicit-function-declaration] clk_prepare_enable(sor->sor_clk); ^ drivers/video/tegra/dc/sor.h: In function 'tegra_sor_clk_disable': drivers/video/tegra/dc/sor.h:185:2: error: implicit declaration of function 'clk_disable_unprepare' [-Werror=implicit-function-declaration] clk_disable_unprepare(sor->sor_clk); ^ In file included from drivers/video/tegra/dc/dc_priv_defs.h:26:0, from drivers/video/tegra/dc/dc_priv.h:23, from drivers/video/tegra/dc/lvds.c:23: include/linux/clk.h: At top level: include/linux/clk.h:330:19: error: static declaration of 'clk_prepare_enable' follows non-static declaration static inline int clk_prepare_enable(struct clk *clk) ^ In file included from drivers/video/tegra/dc/lvds.h:20:0, from drivers/video/tegra/dc/lvds.c:22: drivers/video/tegra/dc/sor.h:180:2: note: previous implicit declaration of 'clk_prepare_enable' was here clk_prepare_enable(sor->sor_clk); ^ In file included from drivers/video/tegra/dc/dc_priv_defs.h:26:0, from drivers/video/tegra/dc/dc_priv.h:23, from drivers/video/tegra/dc/lvds.c:23: include/linux/clk.h:345:20: error: conflicting types for 'clk_disable_unprepare' [-Werror] static inline void clk_disable_unprepare(struct clk *clk) ^ include/linux/clk.h:345:20: error: static declaration of 'clk_disable_unprepare' follows non-static declaration In file included from drivers/video/tegra/dc/lvds.h:20:0, from drivers/video/tegra/dc/lvds.c:22: drivers/video/tegra/dc/sor.h:185:2: note: previous implicit declaration of 'clk_disable_unprepare' was here clk_disable_unprepare(sor->sor_clk); ^ Final patch taken from Manoj Gupta's post on NVIDIA's public embedded systems forum: https://devtalk.nvidia.com/default/topic/822612/jetson-tk1/-issue-lvds-panel-enabled-effect-hdmi-out-image-pull-down-menu-items/post/4663817/#4663817 Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
2016-05-24video: tegra: host: Fix ch open error handlingArto Merilainen
In case kernel fails to open a channel (e.g. due to inability to allocate hardware context or turn on the device), the channel open function releases the resources that were already allocated successfully. However, currently the error path additionally calls the channel release function for putting the channel pointer after the private data structures have been freed - thereby causing use-after-free memory usage. This patch reworks error handling in channel open to release channel without risking usage of already freed memory. Bug 1763577 Change-Id: Ic7562e69f2babad653afc7a11e413701494a30b4 Signed-off-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-on: http://git-master/r/1148081 Reviewed-by: Winnie Hsu <whsu@nvidia.com> Tested-by: Winnie Hsu <whsu@nvidia.com>
2016-05-23video: tegra: host: check if offset is u32 alignedDeepak Nibade
In nvhost_ioctl_ctrl_module_regrdwr(), we copy offset to read/write from user space but we do not have any check on it So it is possible for user space to add unaligned offset and request read/write which would crash the system Fix this by explicitly checking alignment of the offset passed by user space Bug 1739935 Change-Id: Iea2a07c60500af876b732a0e9d9d08535aa53b5c Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1029405 (cherry picked from commit 422baa09a17a6a17f4e572aa5441ca174634de0d) Reviewed-on: http://git-master/r/1123363 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Tested-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
2016-04-28video: tegra: nvmap: Add ref count in nvmap_vma_listSri Krishna chowdary
Add ref count to prevent invalid vma removal from the h->vmas list and also allow addition of a different vma which also has same nvmap_vma_priv as vm_private_data into the h->vmas list. Both cases are allowed in valid usage of nvmap_vma_open/nvmap_vma_close. Bug 200164002 Change-Id: Ifc4d281dd91e1d072a9a3ee85e925040bd65a6bc Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com> Signed-off-by: Bryan Wu <pengw@nvidia.com> Reviewed-on: http://git-master/r/1133708 Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
2016-03-14video: tegra: host: validate error notifier offsetKonsta Holtta
Make sure that the notifier object fits within the supplied buffer. Bug 1739183 Change-Id: Ifbf46eddea86bedf0236851ea1c3f73e5f820beb Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/1026409 (cherry picked from commit 4086d2137e9b51137aa335fa264d924c73dea5fc) Reviewed-on: http://git-master/r/1029074 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Matthew Pedro <mapedro@nvidia.com> Reviewed-by: Shridhar Rasal <srasal@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
2015-11-04video: tegra: host: Query vi/isp max clk-rateSudhir Vyas
Query max vi/isp clk-rate runtime to calcuate max BW. Remove max-bw defines. Bug 1538490 Bug 1695435 Change-Id: I86a5c22fa3c7c9582351bbe9a95776aaea6a613d Signed-off-by: Sudhir Vyas <svyas@nvidia.com> Reviewed-on: http://git-master/r/461278 (cherry picked from commit bbcd86c917430ceea1603e03964296ca4e26ac3a) Reviewed-on: http://git-master/r/825139 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Jihoon Bang <jbang@nvidia.com> Tested-by: Frank Shi <fshi@nvidia.com> Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
2015-08-25video: tegra: dc: handle tegra_dc_sync_windows errorBibek Basu
In case tegra_dc_sync_windows is interrupted by signal, return the error to caller application Bug 200090492 Change-Id: Id69fbe38d0abe0b3e71eb5a413db241ebcf0a0ae Signed-off-by: Bibek Basu <bbasu@nvidia.com> Reviewed-on: http://git-master/r/784754 GVS: Gerrit_Virtual_Submit Reviewed-by: Winnie Hsu <whsu@nvidia.com>
2015-06-18video: tegra: dsi: add delay after register writeNaveen Kumar S
Providing a small delay after writing to dc registers while stopping dc stream helps in stabilizing the registers. This helps in resolving the intermittent register read failure issue. bug 200087039 Change-Id: I159d1d75aa2472b9e33bc42d890382f33def218a Signed-off-by: Naveen Kumar S <nkumars@nvidia.com> Reviewed-on: http://git-master/r/746062 (cherry picked from commit d29669af88735a2aeeb87b26f8794c9bcbb9f058) Reviewed-on: http://git-master/r/756015 Reviewed-by: Pankaj Dabade <pdabade@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Venkat Moganty <vmoganty@nvidia.com> Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
2015-06-01video: tegra: host: pod: change vic freq tuningArun Kannan
Tune nvhost_podgov scaling algo params for vic03 frequency scaling. Bug 1640539 Change-Id: Id5583b5cd60d6b4449470d8c3df1e5d06bc4aedb Signed-off-by: Arun Kannan <akannan@nvidia.com> Reviewed-on: http://git-master/r/741438 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Kamal Balagopalan <kbalagopalan@nvidia.com> Reviewed-by: Ming Wong <miwong@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
2015-05-20video : hdmi: Add more checks in mode filterPankaj Dabade
While programming DC controller it is decided at runtime if a particular mode can be satisfied. This check relies on the parent pixel clock settings. This patch adds same check in the mode filter function for HDMI, eliminating entries from modelist which will not be supported. Bug 200080781 Change-Id: I6e39249e419bc83d549e561267a57ad25d4652ad Signed-off-by: Pankaj Dabade <pdabade@nvidia.com> Reviewed-on: http://git-master/r/741686 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Miguel Angel Vico Moya <mvicomoya@nvidia.com> Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
2015-05-19video: tegra: hdmi: Fix potential crash when setting up HDMIAlban Bedel
The HDMI state machine registers an IRQ handler before all the resources it needs are available. Ideally the IRQ handler should be registered later, however it would mean a quite large change. Instead we just add some check to avoid running the state machine as long as the framebuffer hasn't been registered. While at it also prevent scheduling the state machine if it hasn't been initialized yet. Bug 1618089 Change-Id: I8f9dc07d2a4bf7e33e869206ad83ed80af93f566 Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de> Signed-off-by: Bibek Basu <bbasu@nvidia.com> Reviewed-on: http://git-master/r/741616 GVS: Gerrit_Virtual_Submit Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
2015-05-14video: tegra: nvmap: clean L1 on all coresKrishna Reddy
Clean L2 by set/ways doesn't ensure that L1 is cleaned on A15 and A57. Clean L1 on all cores before cleaning L2. Bug 20007733 Change-Id: I8a389317571060ba4716663c03ab75896aa13612 Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/742255 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2015-05-12video: tegra: nvmap: clean cache during page allocations into page poolKrishna Reddy
Clean cache during page allocations into page pool to avoid cache clean overhead at the time of allocation. Increase page pool refill size to 1MB from 512KB. Bug 1539190 Change-Id: I6c45782e54879541f7b518bbbb016383b24e376b Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/453197 Reviewed-by: Sri Krishna Chowdary <schowdary@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Michael I Gold <gold@nvidia.com> [ccross: moved on top of background zeroing patches, replaced atomic with bool since it has to be protected by a lock anyways] Signed-off-by: Colin Cross <ccross@android.com> Reviewed-on: http://git-master/r/664676 Reviewed-on: http://git-master/r/736430 Tested-by: Alex Waterman <alexw@nvidia.com>
2015-05-12nvmap: page pools: fix lockdep splatColin Cross
lockdep complains about the alloc_page call under the pool lock in nvmap_page_pool_init because the pool lock is also taken during reclaim in nvmap_page_pool_shrink. Rewrite nvmap_page_pool_init to perform the allocation in PENDING_PAGES_SIZE chunks outside the lock. Also move the global pending_pages to a static copy in nvmap_pp_do_background_zero_pages and a kcalloc'd array during init to avoid conflicts when two threads try to use the same array. [ 57.734407] ================================= [ 57.738786] [ INFO: inconsistent lock state ] [ 57.743198] 3.10.40-ge3b2801-dirty #145 Tainted: G W [ 57.749135] --------------------------------- [ 57.753521] inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-W} usage. [ 57.760082] kswapd0/41 [HC0[0]:SC0[0]:HE1:SE1] takes: [ 57.765159] (&pool->lock#2){+.+.?.}, at: [<ffffffc000404d28>] nvmap_page_pool_shrink+0x48/0x9c [ 57.773953] {RECLAIM_FS-ON-W} state was registered at: [ 57.779118] [<ffffffc000106964>] mark_lock+0x1d0/0x7a8 [ 57.784938] [<ffffffc000107004>] mark_held_locks+0xc8/0x184 [ 57.791543] [<ffffffc000107bd0>] lockdep_trace_alloc+0xb4/0xf8 [ 57.797594] [<ffffffc00015ce24>] __alloc_pages_nodemask+0x98/0x7f8 [ 57.803987] [<ffffffc0004051d8>] nvmap_page_pool_init+0x19c/0x220 [ 57.810287] [<ffffffc0003fbf20>] nvmap_probe+0x9c/0x78c [ 57.815713] [<ffffffc00049c588>] platform_drv_probe+0x18/0x24 [ 57.821662] [<ffffffc00049aadc>] driver_probe_device+0xa8/0x3a8 [ 57.827783] [<ffffffc00049aed0>] __driver_attach+0xa0/0xa8 [ 57.833466] [<ffffffc000498d64>] bus_for_each_dev+0x58/0x9c [ 57.839238] [<ffffffc00049a9d0>] driver_attach+0x1c/0x28 [ 57.844746] [<ffffffc000499828>] bus_add_driver+0x1d8/0x294 [ 57.850517] [<ffffffc00049ba10>] driver_register+0x68/0x174 [ 57.856289] [<ffffffc00049cfe0>] platform_driver_register+0x54/0x60 [ 57.862759] [<ffffffc000d61354>] nvmap_init_driver+0x24/0x40 [ 57.868617] [<ffffffc000d328d4>] do_one_initcall+0xac/0x164 [ 57.874387] [<ffffffc000d32af8>] kernel_init_freeable+0x158/0x1f8 [ 57.880678] [<ffffffc0009e7d40>] kernel_init+0x10/0x158 [ 57.886103] [<ffffffc000084cfc>] ret_from_fork+0xc/0x1c [ 57.891526] irq event stamp: 803 [ 57.894763] hardirqs last enabled at (803): [<ffffffc0009fc208>] _raw_spin_unlock_irqrestore+0x64/0x94 [ 57.904211] hardirqs last disabled at (802): [<ffffffc0009fbfa8>] _raw_spin_lock_irqsave+0x24/0x9c [ 57.913202] softirqs last enabled at (0): [<ffffffc0000a508c>] copy_process.part.55+0x448/0x1150 [ 57.922108] softirqs last disabled at (0): [< (null)>] (null) [ 57.929530] [ 57.929530] other info that might help us debug this: [ 57.936074] Possible unsafe locking scenario: [ 57.936074] [ 57.942008] CPU0 [ 57.944456] ---- [ 57.946905] lock(&pool->lock#2); [ 57.950338] <Interrupt> [ 57.952960] lock(&pool->lock#2); [ 57.956565] [ 57.956565] *** DEADLOCK *** [ 57.956565] [ 57.962502] 1 lock held by kswapd0/41: [ 57.966257] #0: (shrinker_rwsem){++++..}, at: [<ffffffc0001651cc>] shrink_slab+0x54/0x3b0 [ 57.974677] [ 57.974677] stack backtrace: [ 57.979063] CPU: 0 PID: 41 Comm: kswapd0 Tainted: G W 3.10.40-ge3b2801-dirty #145 [ 57.987434] Call trace: [ 57.989888] [<ffffffc0000887e4>] dump_backtrace+0x0/0x188 [ 57.995300] [<ffffffc00008897c>] show_stack+0x10/0x1c [ 58.000363] [<ffffffc0009f3490>] dump_stack+0x1c/0x28 [ 58.005428] [<ffffffc0009f0d6c>] print_usage_bug.part.37+0x28c/0x2a8 [ 58.011799] [<ffffffc0001068f0>] mark_lock+0x15c/0x7a8 [ 58.016951] [<ffffffc000109f50>] __lock_acquire+0x7c0/0xd24 [ 58.022536] [<ffffffc00010ada8>] lock_acquire+0xa8/0x148 [ 58.027862] [<ffffffc0009f870c>] mutex_lock_nested+0x80/0x3e0 [ 58.033623] [<ffffffc000404d24>] nvmap_page_pool_shrink+0x44/0x9c [ 58.039731] [<ffffffc000165364>] shrink_slab+0x1ec/0x3b0 [ 58.045056] [<ffffffc000168554>] balance_pgdat+0x4d0/0x5d4 [ 58.050555] [<ffffffc0001687d0>] kswapd+0x178/0x45c [ 58.055448] [<ffffffc0000d0fa0>] kthread+0xd0/0xdc [ 69.502055] dhd_set_suspend: Remove extra suspend setting [ 69.787786] dhd_set_suspend: force extra Suspend setting Change-Id: I41e908da9c51f353300f32c50354b4f48b2424c5 Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/664675 GVS: Gerrit_Virtual_Submit Reviewed-on: http://git-master/r/736429 Reviewed-by: Alex Waterman <alexw@nvidia.com> Tested-by: Alex Waterman <alexw@nvidia.com>
2015-05-12nvmap: page pools: replace background allocator with background zeroerColin Cross
The background allocator rapidly becomes useless once the system has filled memory with cached pages. It refuses to allocate when free memory < 128MB (which it always is, the kernel is aiming to keep very little free), and freed pages are not returned to the page pool when zero_memory=1. Remove the background allocator completely, and instead return freed memory to the page pool in a separate list to be zeroed in the background. This results in a self-balancing pool of memory available to graphics, and reduces presure on the kernel's page allocator. If the pool grows too big it will get reduced by the shrinker. If it gets too small, the next allocation will fall back to the page allocator, and then later return those pages to the pool. Before this change incremental page pool hit rate reported by /d/nvmap/pagepool/page_pool_hits vs. /d/nvmap/pagepool/page_pool_misses goes to 0% after boot. After this change it is near 100% for small app launches and 75% for larger app launches. Change-Id: I4bc914498d7d0369eef9e621bda110d9b8be90b2 Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/664674 GVS: Gerrit_Virtual_Submit Reviewed-on: http://git-master/r/736428 Reviewed-by: Alex Waterman <alexw@nvidia.com> Tested-by: Alex Waterman <alexw@nvidia.com>
2015-05-12nvmap: page pool: fix background threadColin Cross
Fix a race condition in the background allocator where wake_up_process could be called just before set_current_state changed the state to TASK_INTERRUPTIBLE, causing the thread not to wake. Use a waitqueue instead. Also make the background allocator nicer by marking it freezable so it doesn't compete with suspend, and setting it SCHED_IDLE so it only runs when no other threads want to run. Change-Id: If95da005bb1fc4c9b5e802d40730803a57057fe1 Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/664673 GVS: Gerrit_Virtual_Submit Reviewed-on: http://git-master/r/736427 Reviewed-by: Alex Waterman <alexw@nvidia.com> Tested-by: Alex Waterman <alexw@nvidia.com>
2015-05-12nvmap: combine two methods of requesting zeroed memoryColin Cross
Combine CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES and the zero_memory modparam into a single option by forcing zero_memory=1 when CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES is set, and always using zero_memory to decided whether to zero or not. Change-Id: I9ce0106cfaea950bd9494b697916fbc2a03329ea Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/664672 GVS: Gerrit_Virtual_Submit Reviewed-on: http://git-master/r/736426 Reviewed-by: Alex Waterman <alexw@nvidia.com> Tested-by: Alex Waterman <alexw@nvidia.com>
2015-05-12nvmap: page pools: hide internal lock from nvmap_handle.cColin Cross
The internal pool lock is exported so that nvmap_handle can lock it, call a *_locked function, and then unlock it. Provide a version of the *_locked functions that takes the lock, remove the lock and unlock helpers, and make the lock private to the pools again. Change-Id: I5a99753058e43161d50a0c61f3a984655cd7cd35 Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/664671 GVS: Gerrit_Virtual_Submit Reviewed-on: http://git-master/r/736425 Reviewed-by: Alex Waterman <alexw@nvidia.com> Tested-by: Alex Waterman <alexw@nvidia.com>
2015-05-12nvmap: replace page pool array with a listColin Cross
struct page already has a list node that is available to use by whoever got the page with alloc_page. Use it to keep the free pages in the pool in a list instead of a circular buffer in an array. Change-Id: I0377633be7d620b59daf34799bd4ebc5fd9443fb Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/664670 GVS: Gerrit_Virtual_Submit Reviewed-on: http://git-master/r/736424 Reviewed-by: Alex Waterman <alexw@nvidia.com> Tested-by: Alex Waterman <alexw@nvidia.com>
2015-05-12Revert "video: tegra: nvmap: clean cache during page allocations into page pool"Krishna Reddy
This reverts commit b1d8c6c9415df111e4af1425a3d84b25c00a9c06. Change-Id: Ide7e78780722bdd30426089f38155c7cabf28934 Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/664669 GVS: Gerrit_Virtual_Submit Reviewed-on: http://git-master/r/736423 Reviewed-by: Alex Waterman <alexw@nvidia.com> Tested-by: Alex Waterman <alexw@nvidia.com>
2015-03-18video: tegra: hdmi: fix parent clock searchIvan Raul Guadarrama
Fix the parent clock search for the display controller. It addresses the corner case when the divider difference is just smaller than the chosen precision and wrongly assumed zero. An explicit ceiling function is applied for corretness. Bug 1580265 Bug 1552739 Change-Id: I47312116c19813260941abcae42e4067a57f3d2c Signed-off-by: Ivan Raul Guadarrama <iguadarrama@nvidia.com> Reviewed-on: http://git-master/r/714972 GVS: Gerrit_Virtual_Submit Reviewed-by: Pankaj Dabade <pdabade@nvidia.com> Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
2015-03-02tegra: dsi: Deselect CSI pads during calibrationPankaj Dabade
Zeroing out mipical register space during DSI calibration may lead to timeouts with camera(CSI) interface. Instead, This fix deselects the required CSI pads for DSI calibration to succeed Bug 1581879 Change-Id: I535debc233589924a9548a2a1839b617e8d9da0c Reviewed-on: http://git-master/r/665124 (cherry picked from commit f01329808d2cb0f01d6add88ed6904dfff665d74) Signed-off-by: Vineel Kumar Reddy Kovvuri <vineelkumarr@nvidia.com> Signed-off-by: Pankaj Dabade <pdabade@nvidia.com> Reviewed-on: http://git-master/r/711996 GVS: Gerrit_Virtual_Submit Reviewed-by: Matthew Pedro <mapedro@nvidia.com> Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
2015-02-17video: fbcon: Keep atleast one mode in modelistPankaj Dabade
Framebuffer console init requires atleast one valid mode to exist for it to succeed. Virtual terminals relies on the success of fbcon_init without really checking the return value of this function. Bug 200036424 Change-Id: Ia34da6ab3814f667a485d23ef88e1a52f8b5519b Signed-off-by: Pankaj Dabade <pdabade@nvidia.com> Reviewed-on: http://git-master/r/707309 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: Venkat Moganty <vmoganty@nvidia.com> Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
2015-02-10tegra: fb: Check DC max pixel clock supportedPankaj Dabade
Check max clock supported by DC before programming it with that mode. If the requested pixel clock is greater than the maximum supported, fall back to default mode. Bug 200031813 Change-Id: I9c5d4373ff0ee8de039af42f46323909b0bec272 Signed-off-by: Pankaj Dabade <pdabade@nvidia.com> Reviewed-on: http://git-master/r/676941 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Matthew Pedro <mapedro@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: Winnie Hsu <whsu@nvidia.com>