Commit Graph

2890 Commits

Author SHA1 Message Date
Antony Clince Alex
d9d3a5e42c virt: tegra_gr_comm: increase waittime to 40 secs
At present, the timeouts are not handled gracefully and it results
in system crash, therefore increase the timetout to 40 as a WAR.

Bug 200775880

Change-Id: I6ea999d0ae59df5f2c995dd0669149e598bb6e9d
Signed-off-by: Antony Clince Alex <aalex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2604011
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Haley Teng <hteng@nvidia.com>
Reviewed-by: Aparna Das <aparnad@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 17:41:13 +00:00
kdendukuri
33c3cfdf1f virt: tegra_gr_comm: increase waittime to 20 seconds
as we are receiving "tegra_gr_comm_recv: timeout for response!",
increase the waittime to 20 ticks as a WAR.

Bug 2983318

Change-Id: If4e26027e6aba737f6dc3f063eb699b2620f4e62
Signed-off-by: kdendukuri <kdendukuri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2346682
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Vipin Kumar <vipink@nvidia.com>
Reviewed-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-by: Haley Teng <hteng@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 17:41:13 +00:00
Haley Teng
85c3986920 tegra_gr_comm: retry if tegra_gr_comm_send timeout
Bug 2779333

Change-Id: I337ed034258d298f1c46673be6c2ca4006967e6b
Signed-off-by: Haley Teng <hteng@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2268246
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 17:41:13 +00:00
Ketan Patil
7fa087bc72 virt: tegra_gr_comm: fix pointer type
Change the type of ptr to void __iomem * from void *
as ioremap_cache expects the return type to be __iomem *
This fixes the following sparse warning:

tegra_gr_comm.c:243:34:
warning: incorrect type in assignment (different address spaces)

Bug 200434802

Change-Id: I296cc8048da649e84961239cb37bcd99ffe153a7
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1848879
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 17:41:13 +00:00
Richard Zhao
5fb49dd72a video: tegra: virt: remove virt_ctx from tegra_gr_comm
queue index can already index the queues. It also help make the api more
common.

Jira EVLR-2364

Change-Id: I5ba8f03bf8ae9cc8d1a51a6d5c48eef969276ed0
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1646195
Reviewed-by: Damian Halas <dhalas@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nirav Patel <nipatel@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 17:41:13 +00:00
Shridhar Rasal
e651d2e8dd video: tegra: virt: add virt include file
This copies virtualization interface include file in kernel-next

[b99549f] <Aingara Paramakuru> video: tegra: virt: update comm framework
[e0c27a2] <Aingara Paramakuru> video: tegra: virt: add virtualization interfaces

Change-Id: Ie51931ff2fd5c80d430591bba057d123d10c8b7b
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: http://git-master/r/1127824
(cherry picked from commit 39df7d7844fba18e69a317628235570d9b8ed4a5)
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/1314848
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2023-04-03 17:41:13 +00:00
Richard Zhao
bc2c2bcde6 virt: tegra_hv: remove parameter dn from tegra_hv_mempool_reserve()
Device tree node was not used by the function, so remove it to make the
function more common.

Jira EVLR-2364

Change-Id: I0888773fa584eac2c2133c73d9385b700899fdf7
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1647029
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dennis Kou <dkou@nvidia.com>
Reviewed-by: Nirav Patel <nipatel@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 17:41:13 +00:00
Richard Zhao
94f2fb429f video: tegra: virt: remove virt_ctx from tegra_gr_comm
queue index can already index the queues. It also help make the api more
common.

Jira EVLR-2364

Change-Id: I5ba8f03bf8ae9cc8d1a51a6d5c48eef969276ed0
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1646195
Reviewed-by: Damian Halas <dhalas@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nirav Patel <nipatel@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 17:41:13 +00:00
Aniruddha Banerjee
98755f63ca video: tegra: increase wait_event_timout to 500ms
This patch increases the timeout for the wait_event from 250ms to 500ms.

Bug 1653184
Bug 1653182

Change-Id: I339f9d2eef20dcec8cd0a240900ab8af5c710c59
Signed-off-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Reviewed-on: http://git-master/r/1462093
Reviewed-by: Nitin Sehgal <nsehgal@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
2023-04-03 17:41:13 +00:00
Terje Bergstrom
a9442ce5b8 video: tegra: virt: Export functions used by nvgpu
Export functions used by nvgpu so that nvgpu could be built as a
module.

Change-Id: I7cf9162a17c3aaf736d20af8eb0ce623d168ff1d
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1028350
Reviewed-on: http://git-master/r/1198258
Reviewed-on: http://git-master/r/1314837
GVS: Gerrit_Virtual_Submit
Reviewed-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Tested-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Reviewed-by: Timo Alho <talho@nvidia.com>
2023-04-03 17:41:13 +00:00
Richard Zhao
97c0fccbcc video: tegra: virt: fix hung task warnings
add timeout for tegra_gr_comm_recv and fix warnings:

INFO: task gk20a:1085 blocked for more than 120 seconds.
      Tainted: G        W      3.18.21-tegra #9
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
gk20a           D ffffffc000085df8     0  1085      2 0x00000000
Call trace:
[<ffffffc000085df8>] __switch_to+0x94/0xa8
[<ffffffc000a91994>] __schedule+0x2ac/0x7d0
[<ffffffc000a91edc>] schedule+0x24/0x74
[<ffffffc000a94940>] schedule_timeout+0x15c/0x258
[<ffffffc000a93ab0>] __down+0x60/0xa4
[<ffffffc0000e3ff0>] down+0x44/0x60
[<ffffffc0004073a4>] tegra_gr_comm_recv+0x5c/0x100
[<ffffffc0004c0d4c>] vgpu_intr_thread+0x5c/0x10c
[<ffffffc0000bf5fc>] kthread+0xf8/0x110

Bug 1728199

(cherry-picked from commit b9af225268aa6ee42d2bf41df8f6b63f55ddffd2)
Change-Id: Ia07f16a50b226824625131d03e8d677382215315
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: http://git-master/r/1198256
Reviewed-on: http://git-master/r/1314836
GVS: Gerrit_Virtual_Submit
Reviewed-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Tested-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Reviewed-by: Timo Alho <talho@nvidia.com>
2023-04-03 17:41:13 +00:00
Bharat Nihalani
27d4ef0964 video: tegra: virt: fix typo
replace ioremap_cached to ioremap_cache. This should fix the build
break seen due to this symbol.

Change-Id: I574b568493f278aef2afb9c0704ae55b8c60affd
Signed-off-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-on: http://git-master/r/1198249
Reviewed-on: http://git-master/r/1314834
GVS: Gerrit_Virtual_Submit
Reviewed-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Tested-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Reviewed-by: Timo Alho <talho@nvidia.com>
2023-04-03 17:41:13 +00:00
Aingara Paramakuru
e33f9d13f4 video: tegra: virt: update comm framework
The following changes have been made:
- remove support for multiple IVC contexts per queue
- add support for mempools (OOB data support)

JIRA VFND-689

Change-Id: I3a1b8b3d204b579b3a5604858e62283df65b4cb3
Signed-off-by: Aingara Paramakuru <aparamakuru@nvidia.com>
Reviewed-on: http://git-master/r/1198248
Reviewed-on: http://git-master/r/1314833
GVS: Gerrit_Virtual_Submit
Reviewed-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Tested-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Reviewed-by: Timo Alho <talho@nvidia.com>
2023-04-03 17:41:13 +00:00
Peter Daifuku
413331cd4c host1x virtualization: basic support
- Adds a new host1x pushbuffer queue
- Includes support for virtualized VIC

Bug 1509609

(cherry-picked from commit 5589b0ffdaa4b31e7900d23e5d82d8430c710039)
Change-Id: Ie9b604dc8d8e43166dedb13953c4edac813da18b
Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com>
Reviewed-on: http://git-master/r/1198218
Reviewed-on: http://git-master/r/1314832
GVS: Gerrit_Virtual_Submit
Reviewed-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Tested-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Reviewed-by: Timo Alho <talho@nvidia.com>
2023-04-03 17:41:13 +00:00
Aingara Paramakuru
90d91c9462 video: tegra: virt: support IVC reset protocol
As part of the IVC reset protocol, IVC channels need
to be invalidated during init and the interrupt
handler should always handle IVC state changes first.

Bug 1597830

Change-Id: I58807f03c393c7ff0c1140e9180854e2c64c7e24
Signed-off-by: Aingara Paramakuru <aparamakuru@nvidia.com>
Reviewed-on: http://git-master/r/671866
Reviewed-on: http://git-master/r/1198217
Reviewed-on: http://git-master/r/1314831
GVS: Gerrit_Virtual_Submit
Reviewed-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Tested-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Reviewed-by: Timo Alho <talho@nvidia.com>
2023-04-03 17:41:13 +00:00
Aingara Paramakuru
983d45ff71 video: tegra: virt: switch to IVC IRQ
Handling IVC notifications using the callback method is
problematic when trying to handle the IVC reset protocol.
The comm framework now handles IVC IRQs locally.

Bug 1566409

Change-Id: I969500dd5599efb15a49ee44a79a7872ecc48e58
Signed-off-by: Aingara Paramakuru <aparamakuru@nvidia.com>
Reviewed-on: http://git-master/r/671865
Reviewed-on: http://git-master/r/1198216
Reviewed-on: http://git-master/r/1314830
GVS: Gerrit_Virtual_Submit
Reviewed-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Tested-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Reviewed-by: Timo Alho <talho@nvidia.com>
2023-04-03 17:41:13 +00:00
Aingara Paramakuru
0181342c83 video: tegra: virt: fix crash in tegra_gr_comm_init
The clean-up code did not iterate over the correct queue
elements, resulting in a kernel crash.

Change-Id: I48b3d901ad2cddca77a259c628aced65aa262069
Signed-off-by: Aingara Paramakuru <aparamakuru@nvidia.com>
Reviewed-on: http://git-master/r/592208
Reviewed-on: http://git-master/r/1198194
Reviewed-on: http://git-master/r/1314829
GVS: Gerrit_Virtual_Submit
Reviewed-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Tested-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Reviewed-by: Timo Alho <talho@nvidia.com>
2023-04-03 17:41:13 +00:00
Aingara Paramakuru
7328f57280 video: tegra: virt: add virtualization interfaces
Tegra graphics virtualization (host1x syncpoint and gpu) is now
exposed to client drivers (nvhost and nvgpu). These interfaces
rely on a communication framework to communicate with the server
driver that actually implements the back-end routines.

Bug 1509608

Change-Id: I5277f4b024953772a2215d33afa178162f5f9232
Reviewed-on: http://git-master/r/440120
Reviewed-on: http://git-master/r/1198193
Signed-off-by: Aniruddha Banerjee <aniruddhab@nvidia.com>
Reviewed-on: http://git-master/r/1314828
GVS: Gerrit_Virtual_Submit
Reviewed-by: Timo Alho <talho@nvidia.com>
2023-04-03 17:41:13 +00:00
Laxman Dewangan
e50403cefe misc: mods: Integrate mods drivers from kernel/nvidia
Create merge commit for drivers/misc/mods
from kernel/nvidia to merge it to kernel/nvidia-oot

Merge remote-tracking branch 'origin/dev/ldewangan/nvidia-mods-dev-main' into nvidia-oot-mods-dev-main

Bug 4038415

Change-Id: I5fd8da6cd996b0fc2199aab17e9fecd200411e8b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-04-03 07:12:52 -07:00
Laxman Dewangan
631a3bcda2 host1x-nvhost: Integrate host1x-nvhost drivers from kernel/nvidia
Create merge commit for drivers/gpu/host1x-nvhost
from kernel/nvidia to merge it to kernel/nvidia-oot

Merge remote-tracking branch
  'origin/dev/ldewangan/nvidia-host1x-nvhost-dev-main'
  into nvidia-oot-host1x-nvhost-dev-main

Bug 4038415

Change-Id: If4433f8710cb112c3372abd2ebad45ea88a02b3e
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-04-03 14:08:19 +00:00
Mikko Perttunen
10c73be4bf gpu: host1x-nvhost: Fix invalid NULL check
NULL check in is_valid_pt_ext was negated, making this function
useless. Fix the check.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I8764bcfceb457bf26ef79ebffdf17526d4174849
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2861958
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Arvind M
8942623b15 gpu: host1x-nvhost: avoid setting flcn irq at boot
[1] The DLA firmware configures the DEST and MASK registers during
    the initialization.
[2] In OOT, the DLA KMD is accidentally setting the interrupts. This
    will result in enabling additional interrupts that the firmware
    does not handle (like NVDLA_GENERIC_INTR_FAULT_CRITICAL).
[3] This commit fixes the issue by avoiding the interrupt settings
    at the DLA KMD.

Bug 3960841

Change-Id: Ied77ac7564ae3b3202b9cceaf08ad3c7da9f947c
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2861253
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Arvind M
bc86b17fa2 host1x: kmd: enable irq on poweron
[1] Since the irq is not enabled during the power-on, the firmware
    is not communicable state upon module reset.
[2] This commit fixes the issue by enabling irq on power-on.

Bug 3979666
Bug 3975703

Change-Id: I746a9236b390ab2d429df1f4a3f6243745147b65
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2858111
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Ayush Kumar <ayushk@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
2023-04-03 14:06:51 +00:00
Sanif Veeras
b394e81a9e video:tegra:host: add gpu specific syncpt pool
- Support allocation from the GPU specific syncpoint pool
  after reading from the Device Tree
- Expose an interface for the NvGPU driver to allocate
  the syncpoint from the GPU pool

Jira HOSTX-4515

Change-Id: Ie5cc9ec22c039b958b0c0a1750f959ebbf6c6bee
Signed-off-by: Sanif Veeras <sveeras@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2820453
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Raghavendra Vishnu Kumar <rvk@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Mahesh Kumar
88028eda4b gpu: host1x-nvhost: Align syncpt interface APIs
The syncpt interface APIs in the host1x-nvhost driver slightly differ
from those in the legacy nvhost driver because instead of passing the
platform device structure for the host1x device, the platform device
structure for the host1x client device is passed.

By aligning the APIs so that we pass the platform device structure for
the host1x in all implementations, we can simplify the PVA driver and
directly use the APIs in the NVIDIA display driver.

The NVIDIA display driver requires some additional syncpt interface APIs
and so implement these as well.

Bug 3713048

Change-Id: I507e6fd066e6e22c0c47c20ba0dd3be5fa033c59
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2813827
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Jon Hunter
7d40c3953e gpu: host1x-nvhost: Fix mapping of syncpt shim
With Linux v6.1, if CONFIG_PCI_P2PDMA is enabled, then mapping the
syncpt shim causes a kernel paging request fault. The fault occurs when
dma_map_sg_attrs() is called in by nvhost_syncpt_unit_interface_init(),
which is attempting to map the syncpt shim MMIO space.

The function dma_map_sg_attrs() calls iomm_dma_map_sg() and since
upstream Linux commit 30280eee2db1 ("iommu/dma: support PCI P2PDMA pages
in dma-iommu map_sg") was added this now calls is_pci_p2pdma_page(). The
function is_pci_p2pdma_page() requires that there is a 'struct page'
associated with the sg, but this is not the case and so deferencing the
'struct page' pointer returned by sg_page() results in a paging fault.

Using dma_map_sg_attrs() to map MMIO that is not associated with valid
page structures is not guaranteed to work. Therefore, fix this by using
dma_map_resource() to map the syncpt shim instead.

Bug 3871422

Change-Id: I2b08a3b78be0850bff44e62bfc93c8d095eb82a2
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2818417
(cherry picked from commit 97f1282f2959c208effebf93cc5061d6e7fa6c55)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2819086
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Jon Hunter
6cd2f00c46 nvhost: Add clean up function for syncpt interface
Drivers, such as the PVA and DLA driver, that call
nvhost_syncpt_unit_interface_init() during probe are missing a call to
clean-up the DMA mappings this function may create if the driver probe
fails or if the driver is removed. The function
nvhost_syncpt_unit_interface_init() may make a call to
dma_map_sg_attrs() and we need to ensure that dma_unmap_sg_attrs() is
called if the probe of the driver fails or if the driver is unloaded.
Add a new function, nvhost_syncpt_unit_interface_deinit(), that calls
dma_unmap_sg_attrs() if needed for drivers to call.

Bug 3800349

Change-Id: I62a4e19cd42878dac54fa623509440596ffdf17f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2801280
(cherry picked from commit cee12fb989186611aa9deb5ada45831ab5f783aa)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2801934
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Mikko Perttunen
968b6f758f gpu: host1x-nvhost: Adapt for change in host1x_fence_create
Add 'true' parameter to enable internal timeout since there is no
external cancellation mechanism.

Also change kfree to kfree_rcu to ensure workqueue is not freed
during callback.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Ib0ef9a211bafbdd911dc90175a18680880e3e2f8
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2786638
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Jon Hunter
9d0dda14ae gpu: host1x-nvhost: Update include path
When building the host1x-nvhost driver as an external module, the driver
source is now copied into a common location with all the other external
modules. Therefore, we can now use the 'srctree.nvidia' path for finding
the necessary header files for Host1x. Update the include search paths
to use 'srctree.nvidia' when building the driver.

Bug 3817518

Change-Id: I443dd4cb6d01c4e9be8f3c02550b1050d0bcfd28
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2785956
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Jon Hunter
2e94a90e1d gpu: host1x-nvhost: Update syncpt helper functions
- add get aperture API
- add get syncpt offset api

Bug 3768126

Change-Id: I95ae6a149e8a362317f4f1c89e7a1eac3c596fe4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2782259
Tested-by: Omar Nemri <onemri@nvidia.com>
Reviewed-by: Omar Nemri <onemri@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Jon Hunter
b5c5a485da gpu: host1x-nvhost: Add support for Tegra234
Add support for Tegra234 in the host1x-nvhost driver.

Bug 3724727

Change-Id: I3e42d066ce22a461d71f26c120f08aed96f30430
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2759200
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2023-04-03 14:06:51 +00:00
Nan Wang
96d0bbd387 pva: support both upstream and downstream kernel
1. Replace nvhost print functions with PVA driver's private
implementation with similar functionalities.

2. Change syncpoint from host managed to client managed so that
syncpoint max value is tracked inside PVA driver. This change is needed
because upstream host1x driver doesn't allow decrement of max value.

3. Various minor changes for adapting to upstream kernel APIs.

Bug 3662478

Change-Id: I16eff6c06c51afe0f274598e1273404924d18684
Signed-off-by: Nan Wang <nanwa@nvidia.com>
Signed-off-by: Abhinaya Agrawal <abhinayaa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2710684
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 14:06:51 +00:00
Abhinaya Agrawal
c87eb8b8d9 drivers: Fix host1x and nvhost debugfs cleanup
Both host1x and nvhost expose APIs that deinitialize the debugfs
and remove debugfs files/directories that were created. At present,
debugfs_remove() is inovked to do this. However,
debugfs_remove_recursive() should instead be used to ensure that
all files within a debugfs are recursively removed before the
directory is removed.

Bug 3662478

Change-Id: Idb7d1458c02f57f6d656a7bfe1df3adf5e0497aa
Signed-off-by: Abhinaya Agrawal <abhinayaa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2714042
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Omar Nemri <onemri@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Jon Hunter
58159f3b83 gpu: host1x-nvhost: Move falcon initialisation
Some host1x clients, such as PVA, do not have a falcon microprocessor
and currently the host1x-nvhost shim driver assumes that all clients do.
Fix this by moving the falcon initialisation code from the
nvhost_module_init() function and into the
nvhost_flcn_finalize_poweron() function. This aligns with the
implementation in the downstream nvhost driver.

JIRA LS-493

Change-Id: Ic94c3489cefa6fd256f111d8e6c7afb539b5bc8a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2710548
Reviewed-by: Nan Wang <nanwa@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Jon Hunter
ad8058fce9 gpu: host1x-nvhost: Fix client unloading
After unloading the NVDLA driver and then reloading the NVDLA, the
kernel is crashing. The host1x-nvhost driver is missing a call to
class_destroy() in nvhost_client_device_release() which gets called when
removing the DLA driver and this is preventing the DLA driver from
creating the class again when reloading. The crash then occurs because
when the driver is reloaded, creating the class for the DLA driver
fails and then the host1x-nvhost driver incorrectly calls
device_destroy() even though the device has not been created yet. Fix
this by ensuring the class_destroy() is called by
nvhost_client_device_release() and in the necessary error paths and then
remove the call to device_destroy().

Finally, replace request_irq() with devm_request_irq() to ensure that
the interrupts are also released as necessary on removal.

Bug 3641820

Change-Id: Ia328bf63d528e8c31bff1d7b3ac0d5dddc22f1f5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2710546
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Jon Hunter
c103925414 gpu: host1x-nvhost: Fix casting and functions declarations
Sparse reports the following warnings for the host1x-nvhost driver ...

 drivers/gpu/host1x-nvhost/falcon.c:65:27: warning: cast to restricted __le32
 drivers/gpu/host1x-nvhost/nvhost.c:205:22: warning: symbol
	'nvhost_syncpt_get_by_id' was not declared. Should it be static?
 drivers/gpu/host1x-nvhost/nvhost.c:768:5: warning: symbol
 	'nvhost_module_runtime_resume' was not declared. Should it be static?
 drivers/gpu/host1x-nvhost/nvhost.c:796:5: warning: symbol
 	'nvhost_module_runtime_suspend' was not declared. Should it be static?

Fix the above by correcting the cast in falcon_copy_firmware_image(), remove
the function nvhost_syncpt_get_by_id() because it is not used, and make the
nvhost_module_runtime_resume/suspend functions static.

JIRA LS-410

Change-Id: I2c923fccd0b6e53d17198617b90905c6cd06eb5c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2670180
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Jon Hunter
9ecd6942b9 gpu: host1x-nvhost: Fix build for Linux v5.10
When compiling the host1x-nvhost driver for Linux v5.10 it is currently
failing and the following errors are seen ...

 host1x-nvhost/nvhost.c: In function ‘nvhost_intr_do_work’:
 nvhost.c:554:2: error: implicit declaration of function ‘kfree’
 [-Werror=implicit-function-declaration]
  kfree(host1x_cb);
    ^~~~~
 host1x-nvhost/nvhost.c: In function ‘nvhost_intr_register_notifier’:
 nvhost.c:579:7: error: implicit declaration of function ‘kzalloc’
 [-Werror=implicit-function-declaration]
      cb = kzalloc(sizeof(*cb), GFP_KERNEL);
             ^~~~~~~

Fix this by including slab.h.

JIRA LS-410

Change-Id: I8a56d33933d3e57c04b011e2c6da03d5f2bbc707
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2667882
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Jon Hunter
9f0425f9c1 gpu: host1x-nvhost: Fix clock rate setup
The host1x-nvhost driver by default configures the clock rates for
the host1x client devices to the maximum supported rate because
there is runtime clock scaling support yet. However, currently the
host1x-nvhost driver is only setting the rate for the client's first
clock and not the others. Fix this by correcting the index used when
iterating through the list of clocks.

JIRA LS-410

Change-Id: If410ee25548c0dddecc5b0de9d8b6f4f687fd73c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2657897
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Jon Hunter
7343e4379b gpu: host1x-nvhost: Add host1x-nvhost driver
Add a new host1x-nvhost driver that provides an nvhost interface for
the upstream Linux host1x driver so that downstream drivers that use
this interface can be supported on upstream.

Note that some of the nvhost function prototypes are moved from their
default header file to the include/linux/nvhost.h header file so
simplify building with upstream and downstream kernels.

JIRA LS-410

Change-Id: Icdbb34e879dcd91f6e3dd093b7fb400d1be4d561
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2653097
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Arvind M
f16d677563 nvdla: kmd: add support for stride signal action
NVDEV_FENCE_SIGNAL_STRIDE fence action translates to
ACTION_INCREMENT_SEM firmware action.

Jira DLA-4445

Change-Id: Idb537ea784614d031f66c570359dbc7dd74374af
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2548309
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Anup Mahindre <amahindre@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Arvind M
831cb47c60 video: tegra: host: restores sof/eof, TS feature
This commit restores the following,
[1] 890be46 video: tegra: host: dla: refactor and cleanup code
[2] 109f8e8 video: tegra: host: add prefence signal support
[3] 6f683c8 video: tegra: host: add sof/eof taskstatus support
[4] a9cb0c9 video: tegra: host: add sof/eof timestamp support
[5] dcdb0d6 video: tegra: host: increase fw minor version

Jira DLA-1992
Jira DLA-1993

Change-Id: I9844b141b72fc553ba7d886e706e340160586129
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2135092
Tested-by: Mitch Harwell <mharwell@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 14:06:51 +00:00
Sachin Jadhav
8a803afc52 Revert "video: tegra: host: add prefence signal support"
This reverts commit 109f8e8c53e5296ea8c782086500c2e78d99cfbd.

Change-Id: I4fd6f37e271c52f4a1c1b6870c0b1355118a301d
Signed-off-by: Sachin Jadhav <sachinj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2133502
2023-04-03 14:06:51 +00:00
Arvind M
c165791a7b video: tegra: host: add prefence signal support
[1] Adds support for prefence signal support
[2] Facilitates handling of SOF feature request from higher
    levels
[3] Update ioctl structure for emu_submit to allow prefence
    with signal action

Jira DLA-1992
Jira DLA-1993

Change-Id: Id0fe8a7a3ff46227121ec5342197b1da2a3f346d
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2121530
Reviewed-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 14:06:51 +00:00
Dmitry Antipov
a03ddacc0d eventlib: unify NVDLA/PVA fence types and add fence recording
Bug 2170736

Change-Id: If4fdeda140bf2474a08beb2a0d7c3fc1737a1a66
Signed-off-by: Dmitry Antipov <dantipov@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1750906
Reviewed-by: Saleh Dindar <sdindar@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Colin Tracey <ctracey@nvidia.com>
Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 14:06:51 +00:00
Deepak Nibade
fd1ad24e14 video: tegra: host: move exported APIs to public header
Exported APIs like below are defined in private header file
nvhost_syncpt_unit_interface.h
nvhost_syncpt_unit_interface_get_aperture()
nvhost_syncpt_unit_interface_get_byte_offset()

This causes linking problems if these functions are needed
by some other driver outside nvhost

Hence move these exported APIs into a new public
header in include/linux/nvhost_t194.h

Change-Id: Ib70177da71c2cc6aee1c6da2668b0a92ea01ccf7
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1480588
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Tested-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2023-04-03 14:06:51 +00:00
Laxman Dewangan
a9a13406dd host1x-nvhost: Remove Makefile to prepare integration
The host1x-nvhost drivers are available in kernel/nvidia
and to integrate the drivers to the kernel/nvidia-oot,
remove the dummy Makefile.

Bug 4038415

Change-Id: I2179a9e4cc096bf9b8534b3415b595d185785e06
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-04-03 14:06:21 +00:00
Laxman Dewangan
e96169c0ea host1x: Integrate host1x drivers from kernel/nvidia to kernel/nvidia-oot
Create merge commit for drivers/gpu/host1x from kernel/nvidia
to merge it to kernel/nvidia-oot

Merge remote-tracking branch 'origin/dev/ldewangan/nvidia-host1x-dev-main' into nvidia-oot-host1x-dev-main

Bug 4038415

Change-Id: I1c162ddf8a0fada922087e0840a9223eaf488083
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-04-03 06:51:11 -07:00
Laxman Dewangan
c73d7d8635 kernel-src-copy-list: Remove mods driver copy
Mods drivers are integrated to kernel/nvidia-oot,
hence it is no more required to copy from kernel/nvidia.

Bug 4038415

Change-Id: I31c063d51f84d295c6e8afc4f70a1cda5fe59118
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-04-03 13:28:49 +00:00
Chris Dragan
cb0c45b6dd misc: mods: update from Perforce
Bug 3992588

Change-Id: I04aad94aebef7a48d9afac528347fc50c219d888
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2872373
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Carl Dong <carld@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 13:27:53 +00:00
Dong Qiang
dbced7f181 drivers: Fix mods arm ffa error for kernel 6.2
Updated from ffa_ops to msg_ops for ffa api

Bug 3974855

Change-Id: Ice2ccea2c860f05dbd862a49837eba071d563311
Signed-off-by: Dong Qiang <carld@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2865316
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 13:27:53 +00:00