Commit Graph

406 Commits

Author SHA1 Message Date
vasukis
7789bd9c0a tegra: hwpm: VIC: HWPM-NvHost Profiling support
Add support to profile NvHost IPs on various chips
by HWPM module.

Bug 4170421
DOS-SHR-7966

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: I42ac3b5fa79d7b6f97e66098cb84277cda2aff4d
2025-07-24 10:19:09 +00:00
Santosh BS
021bbbedb0 drm/tegra: nvhost virtualisation support for t264
Add compatibility string for virtualised nodes

Bug 4587237
Jira HOSTX-5297

Change-Id: I53ff8b03989f4001dee73dc2d3d64ba60a0e3ae3
Signed-off-by: Santosh BS <santoshb@nvidia.com>
2025-07-24 10:19:09 +00:00
Johnny Liu
897629c033 gpu: host1x-fence: share host1x compatible string
Same compatible string can be shared between host1x_next and
host1x_fence kernel modules so that those two modules will get
automatically loaded.

Bug 4291144

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I9901f4e094d1d6484f6d6cec6b9890c9a51ad1f6
2025-07-24 10:19:09 +00:00
jianjunm
a9701b22c1 gpu: host1x-fence: support for t264
host1x-fence driver is updated to support t264.

Bug 4132685

Change-Id: I239d12864d6336cc6acca2265dbec3cd05ee629b
Signed-off-by: jianjunm <jianjunm@nvidia.com>
2025-07-24 10:19:09 +00:00
Santosh BS
c508c47cfa gpu: host1x-nvhost: syncpoint shim support for t264
Update syncpoint shim base and page size for t264.

Bug 4132685

Change-Id: If66987245e0df7552059e0db61d33d952ec427b1
Signed-off-by: Santosh BS <santoshb@nvidia.com>
2025-07-24 10:19:09 +00:00
Santosh BS
26b1cb4a82 drm/tegra: nvhost support for t264
- VIC RISC-V EB boot support
- Programming sequence modification needed for Thor
- Reloc block linear addressing not needed for t264

Bug 4132685

Signed-off-by: Santosh BS <santoshb@nvidia.com>
Change-Id: I8ad47cce31cfd06020e33d3457a0d674a11e4d49
2025-07-24 10:19:09 +00:00
Santosh BS
340bd4418f gpu: host1x: add t264 hw specific nvhost changes
- Add chip specific nvhost files for t264
- Programming sequence modification needed for Thor
- Update the register addresses accordingly for
  mmio-vm, classid-vm, streamid base-limit, channel,
  gating registers .etc

Bug 4132685

Change-Id: I03e710c0941a68e0b6bc1352134eae6d6fd9c2b0
Signed-off-by: Santosh BS <santoshb@nvidia.com>
2025-07-24 10:19:09 +00:00
Jon Hunter
f01227d4ea drivers: Drop inline from driver remove wrapper
The driver remove function is a function pointer and therefore, it does
not make sense to define the function as an 'inline'. Update the
coccinelle script and drivers to remove the inline statement.

Bug 4749580

Change-Id: Ia03691b75c4edffe609f27468b911a92a5ddbd68
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233980
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:08 +00:00
Mainak Sen
da4fcf255a gpu: host1x: Remove spin loop from Host1x Syncpoint Wait Path
CL 2916412 added a spin loop in Host1x Syncpoint Wait driver to detect
syncpoint threshold expiry condition for the tasks expected
to be completed in a very short time. The objective of this change
was to avoid the creation of Host1x dma fence for very short syncpoint
waits. The downside of this change is adding an extra 5usec penalty
for unexpired syncpoint wait causing perf regression.

This reverts CL 2916412.

Bug 4803002

Change-Id: Ib543a06f4bc3c56123c19375d332b58da650680d
Signed-off-by: Mainak Sen <msen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3217067
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2025-07-24 10:19:07 +00:00
Mainak Sen
7afa86700c drm/tegra: Add sysfs to trigger SOC power mode change.
For Sentry Mode SHR, Host1x client engine clock needs to configured
to a lower rate or clock-gated. a new IVC comand is added to send
power mode change notification to NvHost Server to perform the clock
rate update.

Jira HOSTX-5373

Change-Id: I9039c5243d5fd40f1da2f11e4449ea2e9b0dfc42
Signed-off-by: Mainak Sen <msen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3181703
(cherry picked from commit dab7c0e0537cf1c18697f69fe9eba8a150b2245a)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3220776
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Raghavendra Vishnu Kumar <rvk@nvidia.com>
Reviewed-by: Sourab Gupta <sourabg@nvidia.com>
2025-07-24 10:19:07 +00:00
Jon Hunter
33ffbe3ff2 gpu: host1x-emu: Fix build for Linux v6.11
In Linux v6.11, the 'platform_driver' structure 'remove' callback was
updated to return void instead of 'int'. Update the host1x-emu drivers
as necessary to fix this.

Bug 4749580

Change-Id: I9b4bddd4ae57087c34ce34cea7e8b54b14d4793c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3202780
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2025-07-24 10:19:07 +00:00
Santosh BS
98a6db4289 gpu: host1x-fence: fence support for multi-instance host1x
Update host1x-fence driver for handling fences for
multi-instance host1x

Bug 4793553
Jira HOSTX-5413

Signed-off-by: Santosh BS <santoshb@nvidia.com>
Change-Id: Ice32d6f7ffe5bced50e2d50abe71530a5c75928f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3198410
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2025-07-24 10:19:06 +00:00
Omar Nemri
edf6adc357 gpu: host1x-nvhost: export nvhost_get_host1x_device API
Export the API, that can be used by other modules, for retrieving
the host1x platform_device data for the right host1x instance.

Bug 4793553
Jira HOSTX-5414

Signed-off-by: Santosh BS <santoshb@nvidia.com>
Change-Id: Iadfb9f1f28468a4ff470ea505512a27f9092e2f2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3196481
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2025-07-24 10:19:06 +00:00
amitabhd
872cead7b6 host1x: Emulated Syncpoint KMD Driver
1. Update Host1x-Syncpt
   - add syncpt-list in syncpoint-pool structure.
   - add exported "host1x-syncpt-*" interface and supporting private interface.
2. Update Host1x-NvHost
   - add support for nvhost-syncpt and nvhost-client interface and supporting private interface.
   - falcon and pm interface not supported
3. Update Host1x-Fence
   - add exported "host1x-fence-*" interface and supporting private interface.
4. Add Host1x-Poll
   - Per Pool polling workequeue created
   - add poll supporting private interface.
5. Add new IOCTL

Jira HOSTX-5514

Change-Id: I187fa7ed89a3479e51b79f9d8d438ede75e1a36a
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3136834
Tested-by: Amitabh Dutta <amitabhd@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Amitabh Dutta <amitabhd@nvidia.com>
2025-07-24 10:18:57 +00:00
Mikko Perttunen
e594972dd7 drm/tegra: virt: Fix nvenc usage measurement
Communication with BPMP attempted to use 'msenc' as engine name.
Correct this to use 'nvenc' while keeping userspace debugfs directory
as 'msenc'.

Bug 4559545

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I4fef852dd3312c763c5845bf8b43fac082863bad
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3141443
(cherry picked from commit f2543128b14fb5df7764df7bfa3456bf0df4f945)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3193472
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-08-15 16:57:04 -07:00
jianjunm
783f728b32 Restore "host1x-fence:Free the kzalloc mem"
Restore the memory leak fix that was reverted
due to it caused[k6.8/l4t/]ap_compute_level1_test
to fail in GVS.

New fix is intended to ensure that the fence
and callback cannot be referenced after release.

This reverts commit 42645ad049.

Bug 4779016

Change-Id: Ie2845e1830bb00cb49e7a3c03a91129b28ca62e9
Signed-off-by: jianjunm <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3188619
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-08-13 23:46:48 -07:00
Jason Mei
9d2dcd5e46 host1x-fence: Remove callback and cancel fence
Issue: [k6.8/l4t/] ap_compute_level1_test is failing in GVS
[ 2720.076010] Call trace:
[ 2720.078520]  kmalloc_trace+0xa8/0x270
[ 2720.082275]  0xffffcb8bdce9f9ac
[ 2720.085497]  __arm64_sys_ioctl+0xa8/0x100
[ 2720.089618]  invoke_syscall+0x44/0x128
[ 2720.093466]  el0_svc_common.constprop.0+0x3c/0xec
[ 2720.098290]  do_el0_svc+0x1c/0x2c
[ 2720.101690]  el0_svc+0x30/0xbc
[ 2720.104831]  el0t_64_sync_handler+0x13c/0x158
[ 2720.109304]  el0t_64_sync+0x16c/0x170
[ 2720.113060] Code: aa1403e1 f9405e64 8b000282 dac00c42 (f8606a95)
[ 2720.119320] ---[ end trace 0000000000000000 ]---
[ 2720.212951] Kernel panic - not syncing: Oops: Fatal exception

Fix: Remove callback and cancel fence in poll

Bug 4779016

Change-Id: I49f2a67cdcb7e8882664fa203fcc90adf8c9341a
Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3187581
(cherry picked from commit ae8e0690e8)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3188581
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2024-08-13 23:46:39 -07:00
Santosh BS
8ad09fb980 gpu: host1x: utility for local<->global syncpt id conversion
Expose utilities for converting:
- Local syncpoint id to global syncpoint id
- Gobal syncpoint id to local syncpoint id

Bug 4793553
Jira HOSTX-5413

Change-Id: I956ef05a929547aaad4ecf0d1627a6e061618856
Signed-off-by: Santosh BS <santoshb@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3191230
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-08-13 10:55:47 -07:00
Jon Hunter
951b2423a8 drivers: Fix platform_driver remove for Linux v6.11
In Linux v6.11, the 'platform_driver' structure 'remove' callback was
updated to return void instead of 'int'. Update all the impacted drivers
as necessary to fix this.

Bug 4749580

Change-Id: I3bb5c549777f7ccad0e3f870373fdd25726ad7ed
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3182878
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Tested-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-08-11 17:20:34 -07:00
Mikko Perttunen
e19e56a251 gpu: host1x: Remove mid-job CDMA flushes
The current code can issue CDMA flushes (DMAPUT bumps) in the middle
of a job, before all opcodes have been written into the pushbuffer.
This can happen when pushbuffer fills up. Presumably this made sense
at some point in the past, but it doesn't anymore, as it cannot lead
to more space appearing in the pushbuffer as it is only cleaned full
jobs at a time.

Mid-job flushes can also cause problems, as in an extreme situation
(seen in practice), the hardware can run through the entire pushbuffer
including the prefix of a partially written job without the driver
being able to process any CDMA updates. This can cause the engine
MLOCK to be taken and held for extended periods as the tail of the
job is not yet available to hardware.

Bug 4606343

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I68ca317150e917428d757d4ee8a68c2c15eaf8de
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3186138
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Santosh BS <santoshb@nvidia.com>
2024-08-06 15:51:12 -07:00
Laxman Dewangan
42645ad049 Revert "host1x-fence:Free the kzalloc mem"
This reverts the commit 20c43e79ff ("host1x-fence:Free
the kzalloc mem")

This change is causing the kernel crash when running the
ap_compue_level_1 on kernel 6.8 and kernel 6.9.

Reverting the change while more investigation is in progress
for proper fix of memory leak.

Bug 4779016

Change-Id: Ib7a1cf81cbc2f23d2e0a64115b4374da34a2961b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3184970
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-08-01 19:07:51 -07:00
Thierry Reding
61c41d5dc9 gpu: host1x: Do not setup DMA for virtual devices
The host1x devices are virtual compound devices and do not perform DMA
accesses themselves, so they do not need to be set up for DMA.

Ideally we would also not need to set up DMA masks for the virtual
devices, but we currently still need those for legacy support on old
hardware.

Tested-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240314154943.2487549-1-thierry.reding@gmail.com

Bug 4473025

Change-Id: I09b108a6ee8ed22fa6758c70f7b453de21fd110e
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3176001
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-08-01 19:03:53 -07:00
Jon Hunter
fc171fe539 drivers: Fix bus->match for Linux v6.11
In Linux v6.11, the 'bus_type' structure match() callback was updated to
make its 'drv' argument constant. Add a conftest test to detect this and
update the relevant drivers according to fix building them for Linux
v6.11.

Bug 4749580

Change-Id: I895d97241a7357074bb34b8e7a5bdfa2e31d5ca5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3183068
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-07-31 08:06:48 -07:00
Mikko Perttunen
ec4681358b drm/tegra: nvdec: Enable SLCG/PG
Add register writes to enable second level clock gating /
power gating. For now only for Tegra234.

Bug 4475968

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Ie2e3b6d375bb6b7772b71999df81d73bea7ad550
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3116201
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-07-30 08:52:07 -07:00
jianjunm
20c43e79ff host1x-fence:Free the kzalloc mem
Issue: ioctl call host1x-fence cause memory leak
The kmemleak log shows:
  unreferenced object 0xffff0001ac305500 (size 128):
  comm "deepstream-test", pid 4370, jiffies 4295045195 (age 133.220s)
  hex dump (first 32 bytes):
    00 01 00 00 00 00 ad de 22 01 00 00 00 00 ad de  ........".......
    28 aa 67 bf 00 00 ff ff 00 7c ed 1f 01 00 ff ff  (.g......|......
  backtrace:
    [<000000000d2d94dc>] kmem_cache_alloc_trace+0x2bc/0x3d0
    [<000000006a957993>] dev_file_ioctl+0x588/0x86c [host1x_fence]
    [<000000003528f698>] __arm64_sys_ioctl+0xb4/0x100
    [<00000000d39dabe0>] invoke_syscall+0x5c/0x130
    [<00000000aee791e3>] el0_svc_common.constprop.0+0x64/0x110
    [<0000000050bcd11c>] do_el0_svc+0x74/0xa0
    [<00000000530f0cc4>] el0_svc+0x28/0x80
    [<00000000b6d076a3>] el0t_64_sync_handler+0xa4/0x130
    [<000000008943bb27>] el0t_64_sync+0x1a4/0x1a8

Fix: release the kzalloc memory after finish using

Bug 4738188

Change-Id: Ifeb316a2a52432f0199ad22d3de277b123acda24
Signed-off-by: jianjunm <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3175899
(cherry picked from commit 84de937501)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3181288
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Santosh BS <santoshb@nvidia.com>
2024-07-27 07:54:53 -07:00
Mikko Perttunen
60b43d6545 gpu: host1x: Request syncpoint IRQs only during probe
Syncpoint IRQs are currently requested in a code path that runs
during resume. Due to this, we get multiple overlapping registered
interrupt handlers as host1x is suspended and resumed.

Rearrange interrupt code to only request IRQs during initialization.

Bug 4658418

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I25e129452aeb39c23aa2d6f6a54729f60390d088
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3145171
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-07-06 00:09:14 -07:00
Santosh BS
776ab71140 gpu: host1x-nvhost: fetch host1x data based on instance
Get the right host1x data pointer according to the instance passed.

Bug 4505161
Jira NVGPU-11046

Change-Id: I2bf671236a2fb3a89c87c22d2d7b5f81cf035524
Signed-off-by: Santosh BS <santoshb@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3149447
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Tested-by: Seema Khowala <seemaj@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-06-04 12:03:25 -07:00
Santosh BS
566858f37f gpu: host1x: multi device support
Update the node names to support multi device config.

Bug 4505161
Jira NVGPU-11046

Signed-off-by: Santosh BS <santoshb@nvidia.com>
Change-Id: Id5cc345d9ee2eab96e0c999c9e6b510642a398d9
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3142192
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2024-05-23 08:48:35 -07:00
Jon Hunter
cb8b9f5a53 drivers: Fix missing vmalloc.h for Linux v6.10
Upstream commit 690da22dbfa8 ("asm-generic/io.h: kill vmalloc.h
dependency") removed the vmalloc.h header file from io.h and this breaks
building various drivers with the latest -next kernels. Fix this
by ensuring vmalloc.h is included and in most cases slab is not actually
needed and so remove this where possible. Note that it is fine to make
this change for all current supported kernels.

Bug 4593750

Change-Id: I003d1302bda226d356467e6ede99949b2716940a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3141984
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-05-22 09:19:24 -07:00
Mikko Perttunen
8d8699b29e drm/tegra: Enable CRC generation on multimedia engines
Enable CRC generation feature on VIC, OFA, and NVENC where
possible. Whether CRC generation can be enabled depends on
whether the engine's SEC register aperture is writable, based
on platform configuration.

The firewall configuration is for now determined in a hacky
way using ioremap, pending design decisions on how to do it
in a cleaner way.

Bug 4273775

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Ia7507f4cce2b49703328d5dfdd74aaac8cff8153
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3120662
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-04-27 09:00:32 -07:00
Mikko Perttunen
26987b5170 gpu: host1x-nvhost: Add MODULE_DEVICE_TABLE
To autoload the host1x-nvhost module based on device tree,
add a MODULE_DEVICE_TABLE declaration.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I8a215163d1cd8473a6fa761d540352bab445bf18
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3116026
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-04-18 16:12:28 -07:00
Mikko Perttunen
4f69d815e6 drm/tegra: ofa: Only enable safety RAM if specified
Fix OFA boot sequence to only enable safety RAM if the configuration
specifies doing so.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Id427dee5cfcda036b3f71b89e5d11a4a842964f1
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3103404
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
2024-03-26 00:30:19 -07:00
Mikko Perttunen
d1fe820393 gpu: host1x: fence: Disable timeout on pre-silicon
Timing can be wonky on pre-silicon platforms, so disable fence timeouts
on pre-silicon platforms.

Bug 4458477

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I16221bbb568fe685cff7b3f7edddc7936325c86f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3098558
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Santosh BS <santoshb@nvidia.com>
2024-03-22 12:14:28 -07:00
Mikko Perttunen
6025535763 drm/tegra: Enable job timestamping for NVJPG
NVJPG firmware now supports timestamping, so enable use of it.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I5a21f51e29ac19a95d36bb435dc884a440095ac2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3070327
Reviewed-by: Satvik Raj Gupta <satvikrajg@nvidia.com>
Tested-by: Satvik Raj Gupta <satvikrajg@nvidia.com>
2024-03-18 23:36:31 -07:00
Mikko Perttunen
c2d209f066 drm/tegra: gem: Don't attach dma-bufs when not needed
The dma-buf import code currently attaches and maps all imported
dma-bufs to the drm device to get their sgt for mapping to the
directly managed IOMMU domain.

In many cases, like for newer chips (Tegra186+), the directly
managed IOMMU domain is, however, not used. Mapping to the drm
device can also cause issues e.g. with swiotlb since it is not
a real device.

To improve the situation, only attach and map imported dma-bufs
when required.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: If73cc4e9419a2eebf67269eadb34050986f73077
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3090413
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-15 13:05:54 -07:00
Mikko Perttunen
a050b8203b drm/tegra: gem: Open code drm_prime_gem_destroy
Since we aren't using drm_gem_prime_import(_dev), for clarity don't
use the corresponding destroy function either.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I024a78a6378d0fa6f0134958904122b8d201d99c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3090412
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Santosh BS <santoshb@nvidia.com>
2024-03-15 13:05:49 -07:00
Jon Hunter
a6d28bc2c8 gpu: host1x-nvhost: Remove unused functions
The functions nvhost_job_put() and nvhost_syncpt_set_minval() are no
longer used so remove these functions.

The flag CONFIG_TEGRA_HOST1X is always true for out-of-tree drivers and
so remove the legacy code for when this flag is not defined.

Bug 4475969

Change-Id: I88c89d30bfc9be4b8628f115ea96835cb5f6f295
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3091653
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2024-03-12 13:32:13 -07:00
Jon Hunter
eee13a1edb drivers: Drop '-next' from driver names
The OOT variants of the host1x and tegra-drm drivers originally had
a '-next' suffix in the name to differentiate these from the upstream
versions. Now that the OOT drivers are installed under the 'updates'
directory, the '-next' suffix can be dropped because 'kmod' will
prioritise loading the variant in 'updates' over those built from the
kernel tree.

Bug 4410785

Change-Id: I29287ddb935b681a5ee8a3326428eba82715da76
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3065465
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-24 05:24:02 -08:00
Mikko Perttunen
e062e9d49c gpu: host1x: Memory context stealing
Currently, each process holding an open TegraDRM channel reserves
for itself one of the limited number of hardware memory contexts.
Attempting to allocate a channel when all contexts are in use
results in failure.

While we cannot have more contexts than the hardware supports in
active use, idle channels don't necessarily need to have a backing
memory context. As such, in this patch, we add another layer
to allow hardware memory contexts to be "stolen away" by channels
that are in active use, from idle processes.

The way this is implemented, is by keeping track of memory
mappings on each abstracted memory context. If we need to
steal that memory context's backing hardware context, we unmap
everything from it and give it away. When that abstracted
memory context is needed again (re-activated), we attempt
to allocate or steal another hardware context and re-map
the previously unmapped buffers.

Unfortunately, this means additional overhead and unpredictability
at submit time. Submit can fail if we cannot re-allocate a
backing memory context. Future work includes a provision for
un-stealable backing hardware memory contexts for processes
requiring more determinism, as well as optimization and cosmetic
improvements.

Bug 4403250
Bug 4399310

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I3d13e3476f1bff3c4757152254496cddaaafd76a
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3058905
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-16 03:04:44 -08:00
Jon Hunter
7e85d429e7 drm/tegra: Don't print error on probe defer
The following error messages are sometimes observed on boot ...

 tegra-nvjpg 15380000.nvjpg: failed to get icc write handle
 tegra-nvdec 15480000.nvdec: failed to get icc write handle
 tegra-nvjpg 15540000.nvjpg: failed to get icc write handle
 tegra-nvenc 154c0000.nvenc: failed to get icc write handle
 tegra-vic 15340000.vic: failed to get icc write handle
 tegra-nvjpg 15380000.nvjpg: failed to get icc write handle

The above messages are harmless because the ICC core is returning
-EPROBE_DEFER to indicate that the ICC provider is not available. When
-EPROBE_DEFER is returned the kernel will attempt to probe the device
again and so print an error on -EPROBE_DEFER can be misleading. Fix the
above by using the function dev_err_probe() to print error messages
because this function will only print an error message if the error code
is not -EPROBE_DEFER.

Bug 3436156
Bug 4496044

Change-Id: I47b77e5a0f2bdb817a832daa305246c8803f456b
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3075237
(cherry picked from commit 61319aef4d)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3075849
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-13 20:11:45 -08:00
Jon Hunter
5d2c7b6e3a nvhost: Remove legacy NVHOST support
Remove the legacy NVHOST support from the nvhost.h file that is no
longer needed. Eventually we will remove this file completely, but it is
currently still needed as it provides a shim layer for working with the
upstream host1x driver.

Bug 4475969

Change-Id: Id4d97b41de2590800e321e4eeb9c03b434e00dc5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3065976
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-31 21:27:07 -08:00
Jon Hunter
ab65399274 drivers: Fix missing headers for Linux v6.8
For Linux v6.8, commit ef175b29a242 ("of: Stop circularly including
of_device.h and of_platform.h") updated the OF headers included by these
header files. This breaks the build for various drivers and so fix this
by including the headers that are actually needed for each driver.

Bug 4448428

Change-Id: Ia40ab13f865d5631c96855ecc49145848f99c996
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3032442
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
2024-01-25 09:11:21 -08:00
Jon Hunter
8d5286c379 gpu/drm: tegra: Fix build for Linux v6.8
Building the Tegra DRM driver with Linux v6.8 fails with the following
error ...

 drivers/gpu/drm/tegra/hdmi.c:623:25: error: implicit declaration of
 function ‘drm_eld_size’; did you mean ‘mm_cid_size’?
 [-Werror=implicit-function-declaration]
  623 |    size_t length = drm_eld_size(hdmi->output.connector.eld), i;
      |                    ^~~~~~~~~~~~

Commit ("8eb80946ab0c drm/edid: split out drm_eld.h from drm_edid.h")
added the header file 'drm/drm_eld.h' which now needs to be included to
build the Tegra DRM driver. Fix the build issue by using conftest to
detect the presence of the header 'drm/drm_eld.h' and include this
header if present.

Bug 4448428

Change-Id: Ifb17648d1dc721e1f0de3f864f4cc76450eea394
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027485
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-16 15:23:09 -08:00
Mikko Perttunen
0be6f60c9e gpu: host1x: Handle CDMA wraparound when debug printing
During channel debug information dump, when printing CDMA
opcodes, the circular nature of the CDMA pushbuffer wasn't being
taken into account, sometimes accessing past the end. Change
the printing to take this into account.

Bug 4398831
Bug 4386806

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I3a24da2c310e9414882f7cabbbda5158b6da00a2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3034409
Reviewed-by: Rongrong Zhou <rongrongz@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-09 02:54:43 -08:00
Jon Hunter
d5391a25ab drivers: Enable -Wmissing-prototypes
The compiler option -Wmissing-prototypes is being enabled globally in
the upstream Linux kernel and this causes build failures for various
drivers. The build failures occur because either the driver is missing
an include file which has the prototype or because the function is not
declared statically when it should be (ie. there are no external users).

Fix the various build failures and enable -Wmissing-prototypes to
prevent any new instances from occurring. Note that the only driver that
is not fixed at the moment is rtl8822ce due to large number of failures
and so build this with '-Wno-missing-prototypes' for now, which is not
different to how it was being compiled prior to this change.

Bug 4404965

Change-Id: Ie5572d23659e0346fa035d645d9043b0a6da5fdc
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027488
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-14 02:07:24 -08:00
Mikko Perttunen
281f74c323 gpu: host1x: Increase pushbuffer slots to 1023
To avoid CDMA waiting when many jobs are queued, double
pushbuffer size.

Bug 4386806

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I80841fdec96ba3c203c070bcc1f5c7fd1c3a7cbc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3032829
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-12 16:35:15 -08:00
Laxman Dewangan
1ae406004f drm/tegra: Use conftest for drm_debugfs_remove_files()
The function drm_debugfs_remove_file() has extra argument in
Linux 6.7 with change commit 8e455145d8f16 ("drm/debugfs: rework
drm_debugfs_create_files implementation v2")

Use conftest to findout this new argument presence.

Bug 4346767

Change-Id: I77346a85c8841f915f4a8f3f471af1e03240fa62
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028576
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-08 18:28:23 -08:00
Jon Hunter
086fc6d3da drm/tegra: Avoid kernel version checks
Instead of using kernel version checks in the Tegra DRM driver for the
tegra_fb_ops structure, just check if the appropriate definition is
defined and if so use it. This fixes building the Tegra DRM driver
against some 3rd party kernels that include backports from upstream.

Note that this also aligns the driver closer to the upstream code by
using the same definitions that the upstream driver uses.

Bug 4346767

Change-Id: I8cb40899d0bf7cdc233e5f4cee7b6afb6f12d015
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027832
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-07 08:10:01 -08:00
Jon Hunter
91c367006c drm/tegra: Drop version check
The version check in the Tegra DRM GEM code is not necessary because
this is a fix to the code and so remove the version check.

Bug 3820317

Change-Id: Ib7f5bd2bdb61af50e17399079aa2439bf8d352b1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026925
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-06 16:36:37 -08:00
Jon Hunter
d0e427c6e1 drivers: Use conftest for vm_flags
The conftest script has a test for checking if the vm_area struct has a
const vm_flags member. So enable this test and use the definition
generated in the appropriate drivers.

Bug 4374520

Change-Id: I0e7bd105fe8a821b0af23c0a5553b8d4468fa8c4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026924
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-06 16:36:32 -08:00