Building the NVDLA against the upstream kernel v5.16 is failing and
errors such as the following are seen.
ERROR: modpost: module nvhost-nvdla uses symbol dma_buf_detach from
namespace DMA_BUF, but does not import it.
ERROR: modpost: module nvhost-nvdla uses symbol dma_buf_put from
namespace DMA_BUF, but does not import it.
ERROR: modpost: module nvhost-nvdla uses symbol dma_buf_get from
namespace DMA_BUF, but does not import it.
Following upstream commit 16b0314aa746 ("dma-buf: move dma-buf symbols
into the DMA_BUF module namespace"), it is now necessary to import the
DMA_BUF module namespace into the Tegra DRM driver to fix this.
JIRA LS-410
Change-Id: I31f43fd4425ce80c975651d902b66f56464b0465
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2661773
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
The Linux v5.10 kernel defines a 'spec_bar()' macro to inhibit
speculation for ARM64 and so if we use this macro, then we can
remove the downstream speculation_barrier(). Please note that
it is important to remove such downstream macros because these
prevent us getting the various NVIDIA kernel drivers from
working with upstream Linux kernels.
Bug 3409896
Bug 3477445
Change-Id: Ie8d44f219d2dded2fc7bd36f24980b91c92395d9
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2643778
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Update the DLA driver to add support for the upstream host1x driver.
The driver is built for upstream kernels only when the configuration
option CONFIG_TEGRA_HOST1X_NEXT is defined.
For the supporting the upstream host1x driver, the DLA driver is
registered with the upstream host1x driver by calling
host1x_driver_register().
Please note that for upstream Linux, the firmware naming conventions
used for upstream are preferred. So that although the same firmware
is used with both upstream and downstream, it is simply the filename
that is changed.
The 'spec_bar()' macro was removed from Linux v5.13 because there were
no upstream users. Include the downstream header arm64-barrier.h that
adds the spec_bar() from upstream so that we can build NVDLA for Linux
v5.13+ kernels.
Finally, add the necessary stub functions to the nvhost.h header file
to allow the driver to build. Please note that these functions are
not used and so stub functions are sufficient.
Bug 3409896
JIRA LS-410
Change-Id: Ifb8f269b260056da0fba6e5e2f88aa813178bff3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2653103
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
The referencing of syncpts in the upstream host1x Linux driver is
different to the downstream nvhost driver. By migrating the DLA driver
to use the '_ext' implementations of the various nvhost functions, we
can implement a use a common nvhost interface for both the upstream and
downstream kernels.
JIRA LS-410
Change-Id: Ibd16dfed53edf7173d44fdfaacb4080788f3ba2c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2653102
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
To build the NVDLA driver as a standalone driver for supporting upstream
Linux kernels, it is simpler to move the DLA device data into the
driver. This greatly simplifies the process of building the driver as an
external module, because we only need the single Makefile that resides
within the 'nvdla' directory.
JIRA LS-410
Change-Id: I235008188e1c1ebda2fcb25fd58b868ff67f0352
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2653101
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
To support NVDLA with upstream kernels where the NVHOST driver does not
exist, add a copy of the Falcon register definitions in a local NVDLA
header file. There is no functional change by adding these definitions
and this aligns with how the register definitions are defined for QNX.
JIRA LS-410
Change-Id: I83751671ec78c2df60e59fafe9be1c1612cb44d2
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2656680
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
[1] SC7 power state switches off all modules except for RAM and
AON regions.
[2] DLA suspend operation is responsible for the following.
- Readiness: Checks if there are no outstanding tasks in queues.
- Suspend: Initiates power-off sequence.
[3] DLA resume operation is responsible for the following.
- Resume: Initiates power-on sequence.
[4] In addition, each module maintains is_suspended flag to
communicate the state of suspension.
Jira DLA-5365
Change-Id: I594a1a2731a4f28f552e4be06338fca2fa4e7ca1
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2659248
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
- Fix following CERT-C violation by typecasting __u32 to __s32 as per
API.
cert_int31_c_violation: Casting "desc->import_id" from "unsigned int" to
"int" without checking its value may result in lost or misinterpreted
data.
Bug 3470815
Change-Id: I3599bbbbf10f28d3cefb037ca907a0b8519b2f38
Signed-off-by: Amit Sharma <amisharma@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2659347
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Arvind M <am@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
[1]: Add import_id field in `nvdla_mem_share_handle`.
[2]: Use import_id for creating the dma buf.
[3]: Use share_id/handle as key for search/insert the vm tree.
[4]: Optimize code and avoid un-necessary dma_buf_get/put which
become possible with [3]
Bug 3470815
Change-Id: Idb1df6ef04301e1ade4e39d3489502759e7d8462
Signed-off-by: Amit Sharma <amisharma@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2645563
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Praveen K <kpraveen@nvidia.com>
Reviewed-by: Arvind M <am@nvidia.com>
GVS: Gerrit_Virtual_Submit
The fuse function tegra_get_sku_id() does not exist in upstream and so
when building downstream drivers against an upstream kernel, the build
fails. The tegra_get_sku_id() calls the function tegra_fuse_readl()
which is supported in upstream and exported so can be used by external
kernel modules. The implementation of the tegra_get_sku_id() has been
moved to the header file 'fuse-helpers.h' that can be used by drivers
and allow drivers to be built as external modules. Therefore, migrate
drivers to use this implementation so we can move the implementation
from the downstream kernel.
Bug 2444929
Change-Id: I5a71044a11b63becc726784b9afb31c6384cb651
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2653442
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
The NVDLA driver uses the nvhost_err() and nvhost_dbg_fn() macros which
simply call dev_err() and dev_info(), respectively. When compiling the
NVDLA driver against an upstream Linux kernel, nvhost_err() and
nvhost_dbg_fn() are not found and compilation fails. Fix this by
replacing nvhost_err() with either dev_err() or pr_err() and replace
nvhost_dbg_fn() with nvdla_dbg_fn().
JIRA LS-410
Change-Id: Ib89a187f330a4a80bd0b0329171a02f6336565ff
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2643161
Reviewed-by: Arvind M <am@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Praveen K <kpraveen@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
This reverts commit b72050fa13465850279850c8594f3be4fbf9066f.
[1] WAR is enabled through debugfs node.
[2] WAR is present only on linux and it is applicable only on T194-A01.
Considering the above, this WAR shall be removed from linux as well.
In addition, this commit removes some dependency on fuse for chip id and
revision (tegra_get_chip_id and tegra_chip_get_revision).
Bug 200524968
Jira DLA-5054
Change-Id: Ic1c73ad6d9570d39fbea0b54be4853c734630fa5
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2615127
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Anup Mahindre <amahindre@nvidia.com>
Reviewed-by: Praveen K <kpraveen@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
[1] NVDLA_SUBMIT_FLAGS_BYPASS_EXEC flag allows its clients
(UMD or nvdla_kmd_sanity) to bypass execution for a
submission. This flag is a property of submission and
shall directly apply on all tasks within that submit.
[2] With above flag set, it propagates information to firmware
through task descriptor and firmware shall be responsible
for bypassing the execution.
Jira DLA-4443
Change-Id: I70000ef486905c812fec65f265a378a99844c10a
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2544802
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Anup Mahindre <amahindre@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@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
[1] In the absence of synchronization to access task pool, submission may
happen at faster rate than cleanups. This shall lead to frequent
out-of-memory error.
[2] This commit fixes the issues through retries before throwing OOM.
a. Sets up a communication between cleanup & submit.
b. Retries for allocating task memory
- Retry period: 1 ms
- Total timeout: 10 ms
Bug 200680501
Change-Id: Iea25fbe6e7891938f6318285d4824bc1c54ddb05
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2518193
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ken Adams <kadams@nvidia.com>
Reviewed-by: Anup Mahindre <amahindre@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
The differences between sync_fence ("android sync")
and dma_fence are abstracted away by nvhost in the
nvhost_fence interface. So this change removes use
of sync_fence APIs and replaces them with nvhost_fence
APIs. The nvhost_fence APIs will further either call
sync_fence APIs or dma_fence APIs for given config.
The sync_fence APIs from android staging branch is now
moved to kernel so this change removes header from
android staging branch.
Bug 200624256
Change-Id: Ib25385aec35befd29e04481f612b43cc4159ed6e
Signed-off-by: Anup Mahindre <amahindre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2367281
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: Ken Adams <kadams@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
The constants defined in dla_*_fw_version.h have UL suffix which
translates to 64 bit unsigned integer on 64 bit architectures and 32
bit unsigned integers on 32 bit architectures such as falcon.
To be MISRA rule 10.3 compliant on both, use explicit typecast to
uint32_t which should work across both.
This change does not fix any violations in here but reflects an
update to this file that helps fix 10.3 violation in QNX KMD.
Change-Id: Ia47c2f97ee8c18bfeea071861d5dbab15293551a
Signed-off-by: Anup Mahindre <amahindre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2369151
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
The constants defined in dla_t19x_fw_version.h have UL suffix which
translates to 64 bit unsigned integer on 64 bit architectures and 32
bit unsigned integers on 32 bit architectures such as falcon.
To be MISRA rule 10.3 compliant on both, use explicit typecast to
uint32_t which should work across both.
This change does not fix any violations in here but reflects an
update to this file that helps fix 10.3 violation in QNX KMD.
Change-Id: I18102f037f15568954dfe47467e20058308b0405
Signed-off-by: Anup Mahindre <amahindre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2367282
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This issue mostly seen in T210 when resource policy for modules are set to
RESOURCE_PER_DEVICE and test with kernel_submit regression, Then it generally
leads to a crash in second or forthcoming iteration of kernel_submit.
Observation:
After completion of channel's job, module gets suspended without freeing the
channel, And when module resume, it's start submiting job on the channel's
syncpoint which is already freed by others.
This scenario occurs in two cases with VIC module,
1 A user application(Ex: nvgpu) freed the syncpoint and VIC module is
in suspend, Now when module will resume it will expect same syncpt
active and belongs to it.
2 In between of 1st possibility If other module(Ex: nvenc) gets the
syncpoint from free list when the first module(VIC) is suspended,
Now when first module(VIC) resume and start submiting job on the same
syncpoint which is already acquired by other module.
Changes made :
o Now, Channel will be freed on channel dma completion
o Channel will be re-acquire on every submit
o Syncpoint will not be freed when channel gets free.
o Syncpoint will be acquire once by user space and will be
freed when use space release the device
o Now, Syncpoints gets mark used and unused using chid
o Set resource policy to RESOURCE_PER_DEVICE for msenc, nvdec,
nvjpg and vic
Bug 200582662
Change-Id: Ief7658974cbd958f883e7b83add5902f766826df
Signed-off-by: Ankit Patel <anpatel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2352726
(cherry picked from commit 745c3c8d46c23353a81e5e6035af3ed3848b02eb)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2366098
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
To allow building nvhost as a module, clean up the Makefile,
Kconfig and config symbol references:
* Add most stuff into the nvhost-y/m object list, rather
than having separate targets.
* Make Kconfig symbols that are not the root GRHOST symbol
bool rather than tristate.
* Update most references to config symbols to use
IS_ENABLED rather than defined.
* While at it, make pre-T234 support be built in always.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I9eded315067239da7dfd3677a69e7b707cfdc127
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2363201
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
- update DLA1 FW version for multichip support
- include DLA2 driver's build path
- For firmware verification with multi-chip support,
- Need to get way to distinuguish chip.
- Use tegra_get_chip_id() is not recommended practice
- Alternately, using nvhost_device_data's "version" param which distinguishes
chip specific data at compile time
- So encode fw version into "version" param
- include firmware version header to encode
- Inline function can't be used at compile to encode "version" param
through macro
Jira DLA-3182
Change-Id: Id958133739acba583690b9fdf440fa1729b2b51e
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2359966
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
- Adds DLA2 firmware version interface for version
verification
- Include DLA driver's t23x build path
- For firmware verification with multi-chip support,
- Use nvhost_device_data's "version" param which distinguishes
chip specific data at compile time
- So encode fw version into "version" param.
- Inline function can't be used at compile so use available macro
Jira DLA-3182
Change-Id: Id9185c98ae924faea7a16d5f88d30c9b183c94f2
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2359968
Reviewed-by: Praveen K <kpraveen@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>