Commit Graph

2046 Commits

Author SHA1 Message Date
Gerrit Code Review
96d1f511c7 Merge "tsec: Merge the tsec driver from kernel/nvidia to kernel/nvidia-oot" into dev-main 2023-04-06 00:43:21 -07:00
Ankur Pawar
2a2ce69017 media: add imx318 sensor driver
Add imx318 camera sensor driver code,
mode tables and makefile changes.

Bug 3583587

Change-Id: I9854909823b67856edc50c2364e519e853134178
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2870729
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Praveen AC <pac@nvidia.com>
Reviewed-by: Shubham Chandra <shubhamc@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-06 00:42:04 -07:00
Ankur Pawar
4ae4b2d2b2 camera: oot: use reg number as channel id
When parsing sensor DT, use vi input endpoint reg
number as chan id. And allocate as many tegra_mc_vi
objects as vi input endpoints.

Remove port index assignment when creating graph.
This can cause issue when csi port index is more
than MAX_NVCSI_STREAM_IDS(6).

Bug 3583587

Change-Id: Ida0b83797678dd7ecea2732d715dce0f1d3222ad
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2874225
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Semi Malinen <smalinen@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-05 23:02:44 -07:00
Gerrit Code Review
0260612296 Merge "drm: Integrate drm drivers from kernel/nvidia to kernel/nvidia-oot" into dev-main 2023-04-05 06:05:18 -07:00
Jon Hunter
06b833d570 block: virt-storage: tegra: Fix build for Linux v5.14
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>
2023-04-05 06:05:05 -07:00
Sushil Kumar Singh
a986d91aa3 nvethernet: Kernel panic when set jumbo frame
Issue:
Macsec data is NULL for Xavier platforms as no DT macsec
entry is available. This NULL pointer is accessed when
changing MTU, causing kernel panic.

[  110.247070] Unable to handle kernel NULL pointer dereference at virtual address 000000000000015c
[  110.247292] Mem abort info:
[  110.247355]   ESR = 0x96000004
[  110.247423]   EC = 0x25: DABT (current EL), IL = 32 bits
[  110.247534]   SET = 0, FnV = 0
[  110.247616]   EA = 0, S1PTW = 0
[  110.247682] Data abort info:
[  110.247743]   ISV = 0, ISS = 0x00000004
[  110.247823]   CM = 0, WnR = 0
[  110.247889] user pgtable: 4k pages, 48-bit VAs, pgdp=000000010a201000
[  110.248031] [000000000000015c] pgd=0000000000000000, p4d=0000000000000000
[  110.248176] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[  110.248295] Modules linked in:
[  110.248379] CPU: 2 PID: 1423 Comm: ifconfig Not tainted 5.10.120-tegra #11
[  110.248525] Hardware name: Unknown Jetson-AGX/Jetson-AGX, BIOS 0.0-ff9214ce 12/20/2022
[  110.248690] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--)
[  110.249074] pc : ether_change_mtu+0x144/0x220
[  110.249381] lr : ether_change_mtu+0x140/0x220
[  110.250528] sp : ffff800014b1b470
[  110.253853] x29: ffff800014b1b470 x28: ffff0318c9632d00
[  110.259366] x27: ffffb376aafb0978 x26: ffffb376aafb0948
[  110.264636] x25: ffffb376ab3b3aa0 x24: ffffb376abf7edd8
[  110.269870] x23: ffff0318c9632d00 x22: ffffb376abeb97d8
[  110.275569] x21: ffff0318c5dc0940 x20: 0000000000002328
[  110.280806] x19: ffff0318c5dc0000 x18: 0000000000000010
[  110.286401] x17: 0000000000000000 x16: ffffb376aa327910
[  110.291581] x15: ffff0318c9633270 x14: ffffffffffffffff
[  110.297166] x13: ffff800094b1b167 x12: ffff800014b1b16f
[  110.302500] x11: 0000000000000020 x10: ffffb376abbb0aa0
[  110.307770] x9 : ffffb376a9ccba7c x8 : 0000000000000001
[  110.313439] x7 : 0000000000017fe8 x6 : c0000000ffffefff
[  110.318605] x5 : ffff031c3fd60958 x4 : 0000000000000000
[  110.324305] x3 : 0000000000000001 x2 : 0000000000000000
[  110.329369] x1 : 0000000000000000 x0 : 0000000000000000
[  110.334706] Call trace:
[  110.337416]  ether_change_mtu+0x144/0x220
[  110.341187]  dev_set_mtu_ext+0xe8/0x1d0
[  110.345121]  dev_set_mtu+0x44/0xb0
[  110.348616]  dev_ifsioc+0x254/0x4d0
[  110.352115]  dev_ioctl+0x128/0x380
[  110.355270]  sock_do_ioctl+0xd4/0x240
[  110.359027]  sock_ioctl+0x27c/0x510
[  110.362530]  __arm64_sys_ioctl+0xb8/0x100
[  110.366731]  el0_svc_common.constprop.0+0x80/0x1f0
[  110.371540]  do_el0_svc+0x2c/0x90
[  110.374522]  el0_svc+0x20/0x40
[  110.377943]  el0_sync_handler+0xc0/0xd0
[  110.381689]  el0_sync+0x184/0x1c0
[  110.384931] Code: b900e714 5281ef42 941a98a4 f94312a0 (b9415c00)
[  110.390801] ---[ end trace cbec9c44e214f14b ]---
[  110.395602] Kernel panic - not syncing: Oops: Fatal exception
[  110.400962] SMP: stopping secondary CPUs
[  110.404718] Kernel Offset: 0x337699bb0000 from 0xffff800010000000
[  110.410752] PHYS_OFFSET: 0xfffffce840000000
[  110.414945] CPU features: 0x18240002,03802a30
[  110.419490] Memory Limit: none
[  110.422645] ---[ end Kernel panic - not syncing: Oops: Fatal exception ]---

Fix:
Add NULL check for macsec data. Macsec is set to NULL if it is not
supported in DT from macsec probe.

Bug 3952134

Change-Id: I0b292e39f3ec8f8fed0fb3fef5cd9f52f5c0e2a9
Signed-off-by: Sushil Kumar Singh <sushilkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2846676
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2878453
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-05 06:01:49 -07:00
Manish Bhardwaj
ac315cf5ad nvvse: Enable Multipart/Singlepart UserNonce
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>
2023-04-05 05:59:35 -07:00
Laxman Dewangan
7f8cad749d gpu: nvgpu: Remove dummy Makefile of nvgpu
nvgpu is getting build from kernel/nvgpu and it is
not required to copy in nvidia-oot.

Remove the dummy makefile which was added as placeholder
for the nvgpu makefile.

Bug 4038415

Change-Id: I3fa6945a94c0f2233b55ec19d21ec4a92f715fde
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2882139
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 21:58:16 -07:00
Revanth Kumar Uppala
80336d6c96 nvethernet: Fix compilation warnings
1.There is a switch-case where one case is falling to the
next case. This is creating the compilation warning.
Make this fall through as intentional by adding
compiler attribute as "fallthrough".

2.Remove redefinition of macro MII_ADDR_C45

Bug 4055275

Change-Id: I99193b225e97c414588bb306cb48e472ae079f9f
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2882027
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 21:57:46 -07:00
Gerrit Code Review
e257be9884 Merge "tegra_gr_comm: Integrate drivers from kernel/nvidia" into dev-main 2023-04-04 21:57:24 -07:00
Mobile Promotions
f32cb60c46 Merge branch 'promotion_rebase' into promotion_build 2023-04-04 21:57:04 -07:00
Gerrit Code Review
197d2ed9eb Merge "host1x-nvhost: Integrate host1x-nvhost drivers from kernel/nvidia" into dev-main 2023-04-04 21:56:39 -07:00
Gerrit Code Review
730764c558 Merge "host1x: Integrate host1x drivers from kernel/nvidia to kernel/nvidia-oot" into dev-main 2023-04-04 21:56:33 -07:00
Laxman Dewangan
cf15a1f3df i2c: buses: nvvrs11: Copy driver from kernel/nvidia
Make the copy of drivers of i2c/busses/i2c-nvvrs11
from kernel/nvidia to kernel/nvidia-oot.
This will remove the dependency of the OOT drivers
with kernel/nvidia-oot repo.

Bug 4038415

Change-Id: I3353f2744915763c3e5f14164746fc540cd585dc
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2881573
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 21:56:16 -07:00
Nagarjuna Kristam
0221df9441 PCI: edma: Fix Coverity Issues
Perform ULL typecast during total size calculation for numerics.

Bug 3956683

Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Change-Id: Id9671dc37ff8747a6390063cc92a038e355990cc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2881281
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 21:54:45 -07:00
Mohan Thadikamalla
01d8319aae nvethernet: Add Linux safety support
Issue:
Observed compilation issues
on the nvethernet driver
for DRIVE Linux safety builds.

Fix:
Add OSI_STRIPPED_LIB support
on nvethernet driver.

Bug 3939603

Change-Id: Id4213c1cf33dc0e925df3e627072b727ae44fa71
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2842470
(cherry picked from commit ece0eb57a89396ea8bdc412beeaa7dfabbda49b1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2879701
Tested-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 21:49:37 -07:00
Akhilesh Reddy Khumbum
a2163680aa nvidia-oot: Add aon kmd module
- This patch includes AON-KMD module as part of OOT kernel.

Bug 3583580

Change-Id: I531731136189d76ebb4d3f2880e8f46913f390f4
Signed-off-by: Akhilesh Khumbum <akhumbum@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2870990
Reviewed-by: Robert Collins <rcollins@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 21:43:50 -07:00
Manikanta Maddireddy
6afc085f93 PCI: Create a empty Makefile as a placeholder
Create a empty Makefile as a placeholder to copy priviate SoC PCIe driver.

Bug 4000789

Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Change-Id: I38a900eacb8ada86b387e01bb4bfe7f40d08043b
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2870780
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 21:43:45 -07:00
Mayuresh Kulkarni
6e2882db16 tsec: use correct struct in tsec_of_match
bug 3817626

Change-Id: I98d1e5b63a68abc25dee1fcff49c4b090d58b0d1
Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2874293
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@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>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00
Sahil Mukund Patki
6df40510f9 video: tegra: tsec: fix static analysis issues
Remove address space errors by casting properly. Also make variables
static if used within the same translation unit.

Bug 3528414

Change-Id: Id9d566f5b5c9594c69a1483d2945712e6c9f665c
Signed-off-by: Sahil Mukund Patki <spatki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2835170
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:28:43 +00:00
Bharat Nihalani
78db0d7c41 tsec: Conditionally turn off clock in suspend
Problem:
=======
In current implementation of tsec_poweroff, tsec clock is getting
turned off unconditionally.

During suspend-resume operation, there is an issue in MB1 as
explained in bug 3796711 (comment 16). Due to this, when
tsec_poweroff function is called for second suspend operation,
tsec clock is turned off even when the power state variable
"pdata->power_on" is not set to true or 1.

This causes the following warning from clock driver highlighting
that tsec clock is already disabled.

<snip>
[  631.507596] tsec already disabled
[  631.507632] WARNING: CPU: 2 PID: 10535 at drivers/clk/clk.c:1216 clk_core_disable+0x2b4/0x340
[  631.507634] Modules linked in: ... <skipped these prints>
[  631.507714] CPU: 2 PID: 10535 Comm: systemd-sleep Tainted: G           OE     5.10.120-tegra #1
[  631.507716] Hardware name: Unknown t234-Orin-SLT-e2421-1099-e2425-1099/t234-Orin-SLT-e2421-1099-e2425-1099, BIOS buildbrain-gcid-32270834 01/05/2023
[  631.507718] pstate: 60400089 (nZCv daIf +PAN -UAO -TCO BTYPE=--)
[  631.507720] pc : clk_core_disable+0x2b4/0x340
[  631.507722] lr : clk_core_disable+0x2b4/0x340
[  631.507723] sp : ffff80001770b8e0
[  631.507724] x29: ffff80001770b8e0 x28: ffff000081f0d140
[  631.507727] x27: ffff000082345930 x26: ffff8000126b1ee0
[  631.507729] x25: ffff8000126b1f70 x24: ffff800010b75630
[  631.507731] x23: 0000000000000000 x22: ffff8000125f23f8
[  631.507734] x21: ffff8000125f2638 x20: ffff0000869aca00
[  631.507736] x19: ffff0000869aca00 x18: 0000000000000000
[  631.507738] x17: 0000000000000000 x16: ffff800011008460
[  631.507740] x15: 0000000000000000 x14: ffff000080990000
[  631.507742] x13: ffff80079c8dc000 x12: 0000000000000028
[  631.507745] x11: 0000000000000003 x10: 0101010101010101
[  631.507747] x9 : 00000000fffffffe x8 : ffff8000128c2dd8
[  631.507749] x7 : 0000000000000004 x6 : ffff8000128d1e4d
[  631.507751] x5 : ffff0007ae6d8a28 x4 : 0000000100011117
[  631.507754] x3 : 0000000000000001 x2 : ffff0007ae6d8a30
[  631.507756] x1 : 0000000000000000 x0 : 0000000000000000
[  631.507758] Call trace:
[  631.507760]  clk_core_disable+0x2b4/0x340
[  631.507763]  clk_core_disable_lock+0x2c/0x50
[  631.507765]  clk_disable+0x30/0x50
[  631.507769]  tsec_disable_clk+0x4c/0x80
[  631.507771]  tsec_poweroff+0x3c/0x80
[  631.507772]  tsec_module_suspend+0x24/0x40
[  631.507776]  platform_pm_suspend+0x40/0xb0
[  631.507780]  dpm_run_callback+0x60/0x260
[  631.507783]  __device_suspend+0x130/0x560
[  631.507785]  dpm_suspend+0x158/0x390
[  631.507787]  dpm_suspend_start+0xc0/0xf0
[  631.507794]  suspend_devices_and_enter+0x100/0x9f0
[  631.507796]  pm_suspend+0x21c/0x4a0
[  631.507798]  state_store+0xa0/0xd0
[  631.507802]  kobj_attr_store+0x14/0x50
[  631.507806]  sysfs_kf_write+0x60/0x90
[  631.507808]  kernfs_fop_write_iter+0x134/0x1e0
[  631.507811]  new_sync_write+0xfc/0x1d0
[  631.507813]  vfs_write+0x26c/0x3b0
[  631.507815]  ksys_write+0x7c/0x110
[  631.507817]  __arm64_sys_write+0x28/0x40
</snip>

Solution:
========

There is a check present in tsec_poweroff function to conditionally
call tsec_prepare_poweroff only if TSEC is powered on. Use the
same check to conditionally call tsec_disable_clk

Bug 3930482
Bug 3893914

Change-Id: Id1f6a8e42f43db4dd91ef4f6ae39166c13f1ba8f
Signed-off-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2838694
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: Nikesh Oswal <noswal@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00
Sahil Mukund Patki
e15295fcea video: tegra: tsec: Coverity fix
Fix Coverity issue CID 10164610
Initialize values to NULL to avoid uninitialized pointer error.

Bug 3461002

Change-Id: Ia1205b09f418c3aa3b9b4e457b944cb71d8c927a
Signed-off-by: Sahil Mukund Patki <spatki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2836048
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:28:43 +00:00
Nikesh Oswal
f76b77ab85 video: tsec: Add support to alloc GSC memory
For larger commands that do not fit into the
CMD Queue we pass additional parameters and
buffer by using the GSC. DisplayRM uses the
GSC allocation APIs to reserve memory for
such large command parameters.

Bug 3920791

Change-Id: I7a2a9821d32e1a89726cf3fb53cd5647eccbadd7
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2834319
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00
Nikesh Oswal
83576bbd5d video: tegra: tsec: Launch threaded handler only for SWGEN0
Launch threaded handler to drain TSEC messages only for
SWGEN0 interrupt.

If SWGEN1 interrupt is received to pull out print buffer
then ignore it and mask it out so that it is not received
in future

Bug 3897473

Change-Id: I16e2d442ba77141286171f69114ecf309d411ec7
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2822539
Tested-by: Sahil Patki <spatki@nvidia.com>
Reviewed-by: Sahil Patki <spatki@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@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-04 05:28:43 +00:00
Nikesh Oswal
be91d1bd18 video: tegra: tsec: Remove TSEC_RM_ON_DCE
TSEC IPC GSC-CO Permissions have been modified to allow
access to CCPLEX as well, so we no longer need the flag
TSEC_RM_ON_DCE and now CCPLEX and DCE both can access
the GSC-CO memory for IPC with TSEC

Bug 3817626

Change-Id: Ifb60d508327a5939efb64b27e200933cd15e680e
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2818915
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:28:43 +00:00
Nikesh Oswal
096b94b3db video: tegra: tsec: add api to clear init callback
DisplayRm when it unloads will call an API on the tsec
driver to clear the previously registered init message
callback

Bug 3817626

Change-Id: I7d5bd16b3d1040f11d1a85bc2439176002c5a57b
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2818914
Reviewed-by: Sahil Patki <spatki@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00
Nikesh Oswal
5889401827 drivers: tsec: use already exported cache API
Earlier we modified the kernel to expose a low level
cache API namely dcache_clean_inval_poc, instead we
can use the already exported arch_invalidate_pmem API
and for ARM invlidating the cache is same as clean
and invalidate

Bug 3817626

Change-Id: Ideb29f2818aece98753aaa40242eaf1246c928cb
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2801851
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00
Sahil Mukund Patki
4de7c8f6d0 video: tegra: Add T239 support in new TSEC driver
This patch adds T239 support in new TSEC driver and removes the
support from the old driver.

Bug 3817626

Change-Id: I705e0bac25e6a905588145aef4a4cc98d0a81651
Signed-off-by: Sahil Mukund Patki <spatki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2800494
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00
Jon Hunter
7f6f9f5ff5 video: tegra: tsec: Fix build for Linux v5.14
When building the OOT driver for Linux v5.14 the build fails because the
TSEC driver is looking for the downstream tegra_mc.h header file. Fix
this by ensuring we use the upstream header starting with Linux v5.14.

Bug 3817626

Change-Id: Ifecad497349d357eafc6356beb1dee1e0f923ae1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2798773
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00
Nikesh Oswal
31d2e5fff7 video: tegra: tsec: changes to compile for k5.15
This patch does changes needed in cache flush and
carevout related memory apis which are different
between k5.10 and k5.15.

Also Makefile is changed so that driver gets built
as module on k5.15 and as part of kernel image for
the older k5.10 kernel

Bug 3817626

Change-Id: I4050d41efc61353c34d32d347917e813473ba113
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2793274
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00
Nikesh Oswal
d1dc679881 video: tegra: add tsec driver
This driver is inspired from the existing tsec driver
under host1x but its highly simplified to use only
the stuff that is needed and is completely decoupled
from the host1x driver

Bug: 3817626

Change-Id: I8fff7ab539cd5393ea13896c3b056472ca0e0a72
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2785908
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:28:43 +00:00
Laxman Dewangan
02dd70d7b0 tsec: Remove makefile to prepare driver to integrate from kernel/nvidia
Remove Makefile from drivers/video/tegra/tsec to integrate
the drivers from kernel/nvidia. This will avoid conflict.

Bug 4038415

Change-Id: I43352ffe7e677c4388e9ec6799920d0c31fe247a
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-04-04 05:27:11 +00:00
Jon Hunter
0a12bf1be8 devfreq: pod v2: Add support for Linux v6.3
Currently the pod v2 governor only supports kernels upto Linux v6.2.
Now that Linux v6.3-rc1 is available we can enable support for this
kernel by ensuring that the definitions and functions defined in the
governor_v2.h are compatible with upstream.

Bug 4014315

Change-Id: I6a1440fe36887b86946527483d0baecb83c017a7
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2867139
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:18:03 +00:00
Jon Hunter
0852eda522 devfreq: pod v2: Add support for Linux v6.2
Currently the pod v2 governor only supports kernel upto Linux v6.0. Now
that Linux v6.2-rc2 we can enable support for this kernel by ensuring
that the definitions and functions defined in the governor_v2.h are
compatible with upstream.

Note that by enabling support for v6.2 kernels, we want to allow the
driver to be built for all v6.2.x kernels and not just v6.2.0. So enable
building the driver for all kernels less than v6.3.0.

Bug 3820317

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I3087c660c9cd7d4aac016d5e9c8d9a089eea368c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2836690
(cherry picked from commit 7f73ecbdf7d78ae6f61234374706a24bda73e079)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2837247
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-04 05:18:03 +00:00
Andrew Chen
24d4fa2e60 devfreq: wmark: active: add wmark margin attrs
Add configurable high and low watermark margins to wmark_active
governor. As the names suggested, they represent the margins of
a given watermark. A smaller margin means a tighter load threshold
to trigger the frequency adjustment and vice versa.

Bug 200493763

Change-Id: Ie41e311dd483a1ad2f917ac7296f392262b5fd1f
Signed-off-by: Andrew Chen <andrewc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2819287
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: David Ung <davidu@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:18:03 +00:00
Jon Hunter
219d548fd4 devfreq: pod v2: Add support for Linux v6.1
Currently the pod v2 governor only supports kernel upto Linux v6.0.
Now that Linux v6.1-rc1 is released we can enable support for Linux v6.1
by ensuring that the definitions and functions defined in the
governor_v2.h are compatible with upstream.

Bug 3835208

Change-Id: I028346f2ac2c0f8e5c08b75e91355a719803e999
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2793480
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:18:03 +00:00
Jon Hunter
d8383c2fd4 devfreq: pod v2: Add support for Linux v6.0
Currently the pod v2 governor only supports kernel upto Linux v5.19.
Now that Linux v6.0-rc2 we can enable support for this kernel by
ensuring that the definitions and functions defined in the governor_v2.h
are compatible with upstream.

Bug 3767126

Change-Id: I18c055bd8c8c963130921993522aaf52bdc5ec99
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2772878
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 05:18:03 +00:00
Jon Hunter
a50a8e12cc devfreq: pod v2: Add support for Linux v5.19
Currently the pod v2 governor only supports kernel upto Linux v5.17. Now
that Linux v5.19-rc2 we can enable support for this kernel by ensuring
that the definitions and functions defined in the governor_v2.h are
compatible with upstream.

JIRA LS-418
Bug 3674235

Change-Id: I3a42290e5207163b82dea8a13d11bfa6decb8317
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2728508
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Laxman Dewangan
b34923cfa5 devfreq: Enable module build for OOT
If CONFIG_TEGRA_OOT_MODULE is set as m then build devfreq
governor governor_pod_scaling_v2 as module.

Bug 3674466

Change-Id: Idfcc6178b92f304eadd08cc8c8aba0df46ee1238
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2726202
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Jinesh Parakh
19de6baf19 drivers: devfreq: Fix CERT-C Violations
Fix the following CERT-C Violations:
governor_pod_scaling_v2.c : CERT ERR33-C

The violations occur due to non-verification of the snprintf
return values.
Adding WARN_ON statements to verify the return values.

CID 378002
CID 391305
CID 442828
CID 443110

Bug 3512546

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: I91c35ecce9348d4f7127eafa603d2b8c2391ba18
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2723684
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Peng Liu
8a2d6e1b54 devfreq: pod v2: build as ext module for kstable
governor_pod_scaling_v2 will be provided as a kernel module in future
NVIDIA software deliverables for Linux platforms. As of this moment, the
function that returns the range of the device's scaling frequency hasn't
been exposed from Linux kernel for modules to call. A similar function
is implemented in the governor_pod_scaling_v2, but this function cannot
get the frequency constraints put through the PM QOS interface due to
the same reason, lack of kernel API function. An upstream kernel patch
has been proposed by the power management maintainer to provide the
function needed by governor_pod_scaling_v2, but it's not in any release
kernel yet. For now, PM QOS support is removed from
governor_pod_scaling_v2 and it will be added back when the upstream
kernel patch is available in kernel releases.

drivers_devfreq_governor_5_14.h is a copy of drivers/devfreq/governor.h
of Linux kernel 5.14. Having this copy is to avoid introducing the
dependency on Linux source for building the podgov as external module.

JIRA ID: LS-418

Signed-off-by: Peng Liu <pengliu@nvidia.com>
Change-Id: I0c70acf5679fed53f30bc3ba7c01ea571036cc5e
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2638232
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Johnny Liu
97ff547e3c devfreq: wmark: active: add trace log
Add trace log to print load and frequency.

Bug 200493763
Bug 200494025

Change-Id: Ieb1b28c4546230dbdefd14f11e07a92dd91eb702
Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2673488
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: Rajkumar Kasirajan <rkasirajan@nvidia.com>
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Arto Merilainen
abc0d9c44d video: tegra: host Register PDs before drivers
Register power domains before platform drivers to ensure that
the platform drivers get probed during rootfs initcall.

Move devfreq governor initialization to happen at
subsys_initcall() to ensure that the governor is available
at the time VIC is probed.

Bug 3270580

Change-Id: Ifaa958f8c8fd5022ab69de2d04ab46ddc4a9a885
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2497019
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
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Ken Chang
655ee7d9db devfreq: wmark: active: set interrupt_driven
Set interrupt_driven to 1 thus cancel_delayed_work_sync() won't be
called in devfreq_monitor_suspend() when handling DEVFREQ_GOV_SUSPEND
event. This will avoid below warning prints when runtime PM is enabled.

[ 22.121071] INFO: trying to register non-static key.
[ 22.126030] the code is fine but needs lockdep annotation.
[ 22.131501] turning off the locking correctness validator.

The backstrace:
[    9.322855] [<ffffff80080d3b04>] flush_work+0x1fc/0x208
[    9.322858] [<ffffff80080d5180>] __cancel_work_timer+0xa0/0x188
[    9.322862] [<ffffff80080d52bc>] cancel_delayed_work_sync+0x24/0x30
[    9.322867] [<ffffff8008ce1da4>] devfreq_monitor_suspend+0x4c/0x80
[    9.322871] [<ffffff8008ce6d7c>] devfreq_watermark_event_handler+0x3b4/0x458
[    9.322874] [<ffffff8008ce1d20>] devfreq_suspend_device+0x60/0x98
[    9.322878] [<ffffff800852dad4>] nvhost_module_runtime_suspend+0x64/0x160
[    9.322883] [<ffffff800878dc64>] pm_generic_runtime_suspend+0x3c/0x58
[    9.322887] [<ffffff800879e478>] genpd_runtime_suspend+0x98/0x230
[    9.322890] [<ffffff8008790004>] __rpm_callback+0x74/0xa0
[    9.322893] [<ffffff8008790064>] rpm_callback+0x34/0x98
[    9.322896] [<ffffff80087906c8>] rpm_suspend+0x100/0x5f0
[    9.322899] [<ffffff80087921d0>] pm_runtime_work+0x80/0xb8
[    9.322902] [<ffffff80080d4054>] process_one_work+0x1e4/0x4b0
[    9.322904] [<ffffff80080d4370>] worker_thread+0x50/0x4c8
[    9.322908] [<ffffff80080daffc>] kthread+0xec/0xf0
[    9.322911] [<ffffff80080838a0>] ret_from_fork+0x10/0x30

Bug 3128395

Change-Id: I15116cd452a062620c01e91f71eecba7d68cde17
Signed-off-by: Ken Chang <kenc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2418831
(cherry picked from commit b722658b31e1dc622870a9d5f38a8418ef8493ca)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2434773
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Aaron Tian <atian@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Aaron Tian
008fd60935 devfreq: introduce DEVFREQ_GOV_POD_SCALING_V2
Introduce DEVFREQ_GOV_POD_SCALING_V2 for podgov
governor implementation on kernel-5.9 and later
version to address major changes in upstream
devfreq framework.

1. devfreq framework uses devm_pm_qos to store
   "min/max frequency request from user-space",
   which caused 'min_freq' & 'max_freq' field
   in struct devfreq have been removed.
2. DEVFREQ_GOV_INTERVAL renamed as DEVFREQ_GOV_UPDATE_INTERVAL, and
   devfreq_interval_update() renamed as devfreq_update_interval()
3. return type of debugfs_create_u32() changed to void

Bug 200639056

Change-Id: I673ae3ac6b55b26766253ae0f1aeba181e2e0b53
Signed-off-by: Aaron Tian <atian@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2400108
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Mary Do
3961eaa5a4 podgov: Clear history and set freq before suspend
While the device is active, devfreq calls into
podgov to set the device frequency based on the
device workload. When the device goes into
suspension, devfreq would do one last call into
podgov before going into suspension. However,
because podgov decides the frequency based on
the history of previous loads, if the load drops
suddenly (i.e. going from 100% to 0%), this last
call might result in the frequency set high and
kept high until devfreq resumes running.

In this change, podgov would check if the device
has been suspended, and if so, it would clear the
history and set the frequency to min freq before
suspending devfreq. As a result, whenever the
device is suspended, its frequency will be set to
min freq.

Bug 200613859

Change-Id: I1ad2fd563407d53177a84f8fddbf47b699fa97b5
Signed-off-by: Mary Do <mdo@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2358085
(cherry picked from commit 87aa75c4ecd60a13056e32a00876b48591a520ec)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2363435
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Aaron Tian
cd1ab69066 devfreq: wmark: active: config params by sysfs
Configure governor parameters through sysfs instead of
debugfs, add add spinlock for concurrency protection.

Bug 200501949

Change-Id: I0131e6ab0d3befe380ef4774eb4d6193d2266011
Signed-off-by: Aaron Tian <atian@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2267338
(cherry picked from commit 6d2e734e3b1a3d951a7b934c869c91f99dc3f2f7)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2278103
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Aaron Tian
b2ef349be6 devfreq: wmark: active: introduce freq_boost_en knob
There is a freq. boost mechanism in wmark_active governor,
when current loading exceed load_max, directly set target
freq. to fmax.

Introduce 'freq_boost_en' knob to support enable/disable
freq. boost. If performance does not regressed, freq. boost
can be disabled to let DFS smoothly and save power.

Bug 200501949

Change-Id: I6ec7b7079a22a8d974743d766cfd0cc7d0e2dcd4
Signed-off-by: Aaron Tian <atian@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2255082
(cherry picked from commit 30c0d8332a9a36f88c4ba809b94cf5b0669e9b55)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2263228
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Aaron Tian
410b58af61 video: tegra: host: update T186 VIC actmon driver
Modify T186/T210 VIC actmon driver and wmark_active governor
to address the following issues:

1. To let VIC actmon reports accurate VIC active
   cycle counts, set static WEIGHT_COUNT in both
   VIC actmon and VIC IP block. It ensures
   VIC actmon can capture all activity signal
   toggle event from VIC.

   The value of WEIGHT_COUNT are equal to:

   4 * (max VIC freq / VIC_actmon freq)
       = 4 * (1024 / 19.2)
      ~= 213

2. Since VIC actmon reports active "VIC clock
   cycle" instead of "VIC actmon clock cycle",
   "relative loading translation" should consider
   current VIC clock freq.

   E.g.,
     - sample_period = 80 us, VIC freq = 115.2 Mhz
     - 9216 cycles represents 100% loading
       (115.2 * 80)

3. Update upper/lower wmark settings after VIC
   clock scaled completed, to ensure wmark settings
   are equil to 0 ~ 100% loading of current freq.
   - Register 'get_dev_status' instance in
     devfreq_dev_profile, to let wmark active
     governor can query current device freq.
   - Register devfreq transition notifier in
     wmark_active governor. It will query current
     device freq. and update corresponding wmark
     value after VIC freq. changed.

Bug 200501949

Change-Id: Ic159eb93fddc37d55b0c9649a3afcb50ed82cac2
Signed-off-by: Aaron Tian <atian@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2200520
(cherry picked from commit d6c7740ea2ddd9d5087d938e9ee3b3bc2c9b6d0a)
Reviewed-on: https://git-master.nvidia.com/r/2263225
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Peng Liu
0a98957d78 devfreq: recent high as a scaling factor
A circle buffer is introduced to store recent normalized GPU active
cycle counts. The highest value in this buffer marks the busiest
moment in recent history. When podgov decides next GPU freqeuncy, it
makes sure the new frequency level can satisfy the recent high work
load. This can be considered as an adaptive GPU frequency floor. This
feature can reduce stutter for certain use cases where work load
spikes occur without any temporal pattern, such as 4k video playback.

Bug 1963732

Change-Id: I70024f4d3ffb63425852e4f320eeffb6bc77c5e3
Signed-off-by: Peng Liu <pengliu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2114154
GVS: Gerrit_Virtual_Submit
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
Tested-by: Aaron Tian <atian@nvidia.com>
Reviewed-by: David Lock <dlock@nvidia.com>
Reviewed-by: Mubushir Rahman <mubushirr@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00