NvMap is using bitmap_allocate_region while doing allocation from IVM
carveout. It expects size to be always power of 2, this is resulting
into memory shortage. Better way to handle this is to use the function
bitmap_find_next_zero_area which expects bitmap size rather than order.
Then use bitmap_set to set the allocated bits from the bitmap.
Similarly, while freeing the buffer, use bitmap_clear instead of
bitmap_release_region.
Bug 3923812
Change-Id: I91005d16f678405f341c4fc620509f56af538e1c
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2839848
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
get_task_struct increment the ref count over task struct, and it will be
decremented as part of put_task_struct. task_struct won't be freed
unless it's refcount becomes 0. Hence the missing put_task_struct in
nvmap code was resulting into kmemleak. Fix it by add this missing call.
Also, mutex_unlock was missing in one of the return path, add it.
Bug 3901618
Change-Id: I630eac19e628a549179a8ddaad86ad4d2c9b9a53
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2837383
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This patch fixes the following issues:
- When the handle associated with the sub-buffer is freed, the call to
the nvmap_page_pool_fill_lots is made, which would free the pages when
the refcount on the pages is > 1, even though the main handle is not
freed, hence add a check for sub-handle.
- In cpu unmap code, list_for_each_entry is used for iterating over the
vma list and in the same loop list_del is aldo being called, this can
lead to undefined behavior, instead use list_for_each_entry_safe which
is safe against removal of list entry.
- Mutex of sub-handle is not initialized, fix it by initializing it.
- Set error value when handle creation failed.
Bug 3494980
Change-Id: I0659d7f70b44814e87e3081702352e891d9191f7
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2824668
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Some of the libraries may be linked into different namespaces, but they
belong to same process. So each namespace can open the /dev/nvmap node
and call nvmap ioctls, instead of reusing the already opened /dev/nvmap
FD. Because of this, memory handles created by one namespace can't be
used by other namespaces, even though they belong to same process.
Fix this issue by following:
- When /dev/nvmap node is opened, check if there is already any nvmap
client with same pid, if yes use that client; otherwise, create new
nvmap client.
- Track the number of namespaces via count field.
- When /dev/nvmap node is closed, destroy the nvmap client only when
count reaches to 0.
Bug 3689604
Change-Id: I4c91db36b88e78b7526dd63b006e562c8f66c7ae
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2819915
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-by: Ivan Raul Guadarrama <iguadarrama@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
On TOT, in nvmap probe function, platform_set_drvdata is called after
misc register. So nvmap node is created and clients can open it even
before platform driver data is set. Because of which, the call to
dev_get_drvdata returns NULL and BUG_ON condition is hit. Move misc
register call towards end of the nvmap probe, so that /dev/nvmap is
exposed once all initilization is completed.
As misc register being moved to end of probe, the functions which are
called before misc register and which make use of dev_user field from
nvmap_device for calling dev_err/dev_info function will see the dev
field as NULL. Hence replace such calls with pr_err/pr_info.
Bug 3853486
Change-Id: Ifdd8443812a621aceada7739cf9b02fcf00568b4
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2803672
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>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
On TOT, in case of carveouts, nvmap performs cache flush operation
during carveout creation, buffer allocation and buffer release. Due to
cache flush for entire carveout at creation time, nvmap takes ~430 ms
for probe. This is affecting boot KPIs.
Fix this by performing cache flush only at buffer allocation time,
instead of carveout creation and buffer release. This is reducing nvmap
probe time to ~0.69 ms.
Bug 3821631
Change-Id: I54da7dd179f8d30b8b038daf3eceafb355b2e789
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2802353
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Ashish Mhetre <amhetre@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Merge all nvsciipc headers required for the nvsciipc drivers from
kerne/nvidia to kernel/nvidia-oot to get rid of kernel/nvidia repo.
Merge remote-tracking branch
'origin/dev/ldewangan/nvidia-nvsciipc-header-dev-main'
into
nvidia-oot-nvsciipc-header-dev-main
Bug 4038415
Change-Id: Ib0414977f650161cb32995d95192783086222146
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Added missing fs.h to fix build error.
Added debug info for root user only.
Added alternative header path for x86 build.
Fixed NvSciIpcEndpointMapVuid() API.
remove mutex except for SET_DB IOCTL (lockless for read operation).
Added more ioctl commands.
- NVSCIIPC_IOCTL_GET_DB_BY_NAME
- NVSCIIPC_IOCTL_GET_DB_BY_VUID
JIRA NVIPC-227
Change-Id: I95fc6f9fff36c9c1df999b11109236b1b3481d62
Signed-off-by: joshuac <joshuac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2755193
Reviewed-by: Kurt Yi <kyi@nvidia.com>
GVS: Gerrit_Virtual_Submit
The drivers of host1x, host1x-nvhost, tegra_gr_comm are
integrated from kernel/nvidia to kernel/nvidia-oot. Hence,
it is not required to do copy of the driver during build
time.
Remove the copy of these drivers.
Bug 4038415
Change-Id: I94934e09835bad48a551109d9a68a2810b3b3209
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2882789
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
For Linux v5.14, the function device_add_disk() has a void return type
and compilation now fails with ...
nvidia-oot/drivers/block/tegra_virt_storage/tegra_hv_vblk.c:1162:8:
error: invalid use of void expression
1162 | (void)!device_add_disk(vblkdev->device, vblkdev->gd, NULL);
| ^
Fix the build for kernels prior to v5.15 by not attempting to access
the return value. Finally, for kernels v5.15 and newer, do not ignore
the return value and report an error if device_add_disk() fails.
Bug 4052299
Change-Id: I975f30bc67661eacf74634b5edb70e5ad5fc1a8d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2881453
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
crypto: hvvse: UserNonce enable for CBC/CTR
- Using SE server for CBC mode
- Updating counter for CTR mode
- Copying IV to userspace from kernelspace only for non userNonce
Jira ESSS-467
crypto: Support Multipart CBC/CTR
- Updated update_counter function
- Added support for mulitpart CBC/CTR
Jira ESSS-525
Signed-off-by: Advaya Andhare <aandhare@nvidia.com>
Change-Id: I3a85f510d28a6bd26b4b6b5b216c2659ec4052c6
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2874482
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Merge all the history of podgov driver from kernel/nvidia to
kernel/nvidia-oot to get rid of kernel/nvidia for OOT drivers.
Merge remote-tracking branch 'origin/dev/ldewangan/nvidia-podgov-dev-main' into nvidia-oot-podgov-dev-main
Change log are:
a48408903 devfreq: pod v2: Add support for Linux v6.3
533399ed4 devfreq: pod v2: Add support for Linux v6.2
64c5dd4de devfreq: wmark: active: add wmark margin attrs
dac541822 devfreq: pod v2: Add support for Linux v6.1
45b486353 devfreq: pod v2: Add support for Linux v6.0
0f5fa7538 devfreq: pod v2: Add support for Linux v5.19
7ab0296e0 devfreq: Enable module build for OOT
dbada9fa1 drivers: devfreq: Fix CERT-C Violations
b24019936 devfreq: pod v2: build as ext module for kstable
c5478eb1d devfreq: wmark: active: add trace log
2834d2183 video: tegra: host Register PDs before drivers
408295020 devfreq: wmark: active: set interrupt_driven
14f26892e devfreq: introduce DEVFREQ_GOV_POD_SCALING_V2
53da44c75 podgov: Clear history and set freq before suspend
9f1caf010 devfreq: wmark: active: config params by sysfs
428c30559 devfreq: wmark: active: introduce freq_boost_en knob
ad17c22a3 video: tegra: host: update T186 VIC actmon driver
79ce3f6aa devfreq: recent high as a scaling factor
4080e458d devfreq: podgov: use cycles/sec to estimate load
0f2fe9c3e devfreq: add core kernel directory to include path
39d5a4f8e video: tegra: host: podgov: add trace events
de9df1f6c devfreq: add Makefile and Kconfig for Nvidia governors
4eaf77da2 devfreq: wmark: active: add GPL module license
11a2d1a24 Fix include paths for in-tree builds
fd6458bae devfreq: stop podgov polling when disabled through sysfs
c479079b0 devfreq: Clean up podgov parameter initialization
23835ef96 devfreq: Use devfreq timers for podgov
f3c01ef1b devfreq: don't set last_scale for same freq
9a955a070 devfreq: tegra: use soc/tegra/chip-id.h for soc header
643e69a1c devfreq: remove throughput hints from podgov
80dca368b devfreq: set current freq in case no change required
985df8785 devfreq: remove FREQ_DONTSCALE return if same freq
b6ea64687 devfreq: wmark: fix compilation on kernel 4.4
c00e68510 devfreq: wmark: active: init average target freq
559e2351a devfreq: Improvements watermark active policy
0cf8ae932 devfreq: Improve wmark_active initialization
6c7bf5d6b devfreq: Add Active Watermark governor
bc031add8 devfreq: Add debugfs interface to simple watermark
831d08cdc devfreq: Rename watermark governor
622eede67 devfreq: governor_pod_scaling: Fix build errors
4ade76010 devfreq: compare previous_freq only if podgov disabled
897ce797c devfreq: get dev status after checking if scaling is enabled
7a5aeae4f devfreq: tegra: add support for t18x
d15333eb7 video: tegra: host: move pod_scaling.c
Bug 4038415
Change-Id: I390d9f5dfbda8ed21cdd66fd3b977ed6a068ab60
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Merge all the history of tsec driver from kernel/nvidia to
kernel/nvidia-oot to get rid of kernel/nvidia for OOT drivers.
Merge remote-tracking branch 'origin/dev/ldewangan/nvidia-tsec-dev-main' into nvidia-oot-tsec-dev-main
Change log:
11a2230e3 tsec: use correct struct in tsec_of_match
65b5496fa video: tegra: tsec: fix static analysis issues
20d55b179 tsec: Conditionally turn off clock in suspend
9897754e2 video: tegra: tsec: Coverity fix
66d070383 video: tsec: Add support to alloc GSC memory
791ff3eba video: tegra: tsec: Launch threaded handler only for SWGEN0
b52c828d1 video: tegra: tsec: Remove TSEC_RM_ON_DCE
77dc36500 video: tegra: tsec: add api to clear init callback
b00798044 drivers: tsec: use already exported cache API
2d212bce4 video: tegra: Add T239 support in new TSEC driver
d5768ade6 video: tegra: tsec: Fix build for Linux v5.14
0a219e1b4 video: tegra: tsec: changes to compile for k5.15
c7dce4b1f video: tegra: add tsec driver
Bug 4038415
Change-Id: I578e1599ee46f4bbee55b650c7826c960dd6ca7d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>