Commit Graph

3040 Commits

Author SHA1 Message Date
Jon Hunter
d021a4fbae drm/tegra: Fix build for Linux v6.4
In Linux v6.4, the various drm_scdc_get/set functions were updated to
take an argument of type 'struct drm_connector'. Add a new test to the
conftest script that checks if this argument is used and use the
definition created by conftest to select which version of the function
is used.

Bug 4221847

Change-Id: Id6b6396bbe875a0268f8fe2f68ae08f78a32c954
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2989035
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-07 13:03:15 -07:00
Jim Lin
5c6720246f usb: typec: Setting same toggle time is not error
Invoking fusb301_set_toggle_time() with input parameter same as
current register value to set toggle time shouldn't be treated as
error.

This patch is to change message level from dev_err() to dev_info()
when above situation is met.

Bug 4218496

Signed-off-by: Jim Lin <jilin@nvidia.com>
Change-Id: Ieab7cfe8ae8496ca4a5f3b514d9e278479f200d0
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2946869
(cherry picked from commit 2a53cb0010a449ffd5ce6d6afe7f39dc5d020e65)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2990991
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Haotien Hsu <haotienh@nvidia.com>
Reviewed-by: WK Tsai <wtsai@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-06 20:12:11 -07:00
Jon Hunter
68d1ae26d6 block: virtual-storage: Drop version check
The function blk_mq_alloc_request() has been exported in the Linux
kernel since v3.16 and the function blk_mq_free_request() has been
exported in the Linux kernel since v3.19. The function

Since Linux v5.0, blk_get_request() has always called
blk_mq_alloc_request() and blk_put_request() has always called
blk_mq_free_request(). Given that kernels newer than v5.0 are now
supported drop the version check around blk_mq_alloc_request() and
blk_mq_free_request() and always use these functions.

Bug 4119327

Change-Id: I018687b340acaa9617c81551efb436a0439b14f1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2991457
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-05 17:57:14 -07:00
Jon Hunter
ce678a37b1 drivers: Add conftest test for class_create
In Linux v6.4, the module pointer argument is removed from the
class_create() function. Add a test to the conftest script that checks
if this argument for the class_create() function has been removed and
use the definition created by conftest to select which version of the
function is used.

Bug 4183168
Bug 4221847

Change-Id: I440e4b318001886cd0319bb3499ba33178475e8c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2989020
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-05 17:54:05 -07:00
Jon Hunter
86dafc35bb tty: serial: ch384: Fix build for Linux v6.4
In Linux v6.4, the macro DEFINE_SEMAPHORE was updated and this breaks
the build for the ch384 serial driver. Add a new test to the conftest
script that checks if the macro DEFINE_SEMAPHORE takes a number argument
and use the definition created by conftest to select which version of
the macro is used.

Bug 4183168
Bug 4221847

Change-Id: Ie1bcb95b07e792c70fa52e22465bdf565dc456af
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2989732
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-05 17:53:54 -07:00
Jon Hunter
ed130f099a net: nvethernet: Fix build for Linux v6.4
In Linux v6.4, commit
3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS")
added a kernel config option for MAX_SKB_FRAGS and change the type of
the definition to integer. This causes the nvethernet driver build to
fail and the following errors are seen ...

 drivers/net/ethernet/nvidia/nvethernet/ether_linux.c:5949:33: error:
  format ‘%ld’ expects argument of type ‘long int’, but argument 4
  has type ‘nveu32_t’ {aka ‘unsigned int’} [-Werror=format=]
    "invalid tx-frames, must be inrange %d to %ld",
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 drivers/net/ethernet/nvidia/nvethernet/ethtool.c:950:28: error: format
  ‘%ld’ expects argument of type ‘long int’, but argument 4 has
  type ‘nveu32_t’ {aka ‘unsigned int’} [-Werror=format=]
    "invalid tx-frames, must be in the range of"
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix this by changing the type in the respective prints to integer. Note
that his is also to make this change for kernel prior to Linux v6.4.

Bug 4183168
Bug 4221847

Change-Id: Ibd9160ad08e65e0b85cae1cf4903075c31a1cd77
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2989002
Reviewed-by: Shanker Donthineni <sdonthineni@nvidia.com>
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-05 04:37:24 -07:00
Jon Hunter
1c89d6b9cd net: r8168: Fix build for Linux v6.5
The r8168 driver fails to build with Linux v6.5 because the
skb_gso_segment() is not found ...

 drivers/net/ethernet/realtek/r8168_n.c:29231:24: error: implicit
  declaration of function ‘skb_gso_segment’; did you mean
  ‘skb_gso_reset’? [-Werror=implicit-function-declaration]
      segs = skb_gso_segment(skb, features);
             ^~~~~~~~~~~~~~~

Commit d457a0e329b0 ("net: move gso declarations and functions to their
own files") moved the definition to a new file 'net/gso.h'. Fix this by
updating the conftest Makefile to check for the presence of this header
file and use the definition generated by conftest accordingly in the
r8168 driver.

Bug 4221847

Change-Id: I6ad83a06602ef0679a76ff1a6e5ddabbcb1bfe00
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2990521
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-04 13:54:55 -07:00
Johnny Liu
e0b77a8761 gpu: host1x: add actmon information for OFA
OFA is one of the host1x clients. One unit actmon is used for OFA.

Bug 4310958

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I27bf72d642530740eb67954ef93177d56e63db87
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2990250
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-04 07:45:02 -07:00
Johnny Liu
0840137ad6 drm/tegra: Enable actmon for OFA
OFA has unit actmon monitoring its active time. Enabling actmon for OFA
to export load information of OFA.

Bug 4310958

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I8df79f266da71c0cc248e603a07fec7508cbb8ce
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2990240
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-04 07:44:57 -07:00
Shubhi Garg
0b989c71b1 drivers: fix CERT-C violations in max77851 driver
Cert-C fixes in max77851 mfd and pinctrl driver.

CID:685661
CID:685622
CID:685626
CID:685637

Bug 3959323

Change-Id: I0a5fbd9d90ecc4c43d0967fdd4a9da7286aab1f5
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2987950
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-04 07:40:33 -07:00
Manish Bhardwaj
25bd4163f9 crypto: increase buffer support for SHA operation
Using this patches we are making below changes:-
1. increase buffer support for SHA operation from 1MB to 2MB
2. get the IVC DB during init call.

Bug 4141706

Change-Id: I8101430117569049f3420db58ed06e0158cc2dcc
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2984637
Reviewed-by: Advaya Andhare <aandhare@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-03 19:01:22 -07:00
Akhil R
e7f2897cee crypto: tegra: Deprecate Tegra Nvhost driver for k5.15
Remove Tegra SE Nvhost driver to deprecate the support for T186
and T194 Security Engines in kernel-5.15.

Bug 4221414
Bug 3579794

Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Change-Id: I425bc7068f2139e73dd14f0187d10ea856260cac
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2984417
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-03 18:59:34 -07:00
Akhil R
2659fcd46a crypto: tegra: Add updated Tegra SE driver
Add the updated Tegra SE driver with the below improvements.
- Remove dependency with nvhost apis and use upstream Host1x APIs.
- Implement software fallbacks for keys/plaintexts unsupported by
hardware.
- Support only T234 and later. Prior chips will use tegra-se-nvhost
driver.

Bug 4221414
Bug 3579794

Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Change-Id: I398a5b7cc3f752b44d01d6d1c81f813f862e4cd9
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2977810
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-03 18:59:24 -07:00
Vedashree Vidwans
cbf177852b drm/tegra: add hwpm support in video ip driver
Add IP-HWPM interface in NVENC, OFA and VIC drivers. This code will
- register with HWPM driver during probe
- expose power management and register read/write function.

Bug 4158030

Change-Id: I9311c9fc31cffadf11c36b6e4516f0da84dcbdf4
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2954070
Reviewed-by: Santosh BS <santoshb@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-03 18:57:48 -07:00
Jon Hunter
ece68dd0d1 net: Use conftest
Instead of relying on kernel version to determine if functions or
specific versions of functions are present in the kernel, add compile
time tests to the conftest.sh script to determine this at compile time
for the kernel being used. This is beneficial for working with 3rd party
Linux kernels that may have back-ported upstream changes into their
kernel and so the kernel version checks do not work.

Bug 4119327

Change-Id: I79e701940ca70ca4d66500c75b5992f9d92b54b0
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2985744
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
rel-36_eng_2023-10-04
2023-10-03 04:01:15 -07:00
Bitan Biswas
3dbf9a344e nvidia-oot: pinmux: Add dummy makefile for pintrl/tegra
Enable drivers/pinmux/tegra build for internal chip.

bug 4197981

Change-Id: I17df765cd3745155855a9b31dfc993e40f03e299
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2984805
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-01 15:21:03 -07:00
Jon Hunter
19fb93666d platform: tegra: dce: Use conftest
Instead of relying on kernel version to determine if the 'tegra_ivc'
structure has a member that is of type 'struct iosys_map', add a compile
time test to the conftest.sh script to determine this at compile time
for the kernel being used. This is beneficial for working with 3rd party
Linux kernels that may have back-ported upstream changes into their
kernel and so the kernel version checks do not work.

Bug 4119327

Change-Id: Ia993ca9df7694347252a795c7dee1e95f2f9fa2f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2985743
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-30 06:46:02 -07:00
Jon Hunter
02d724565b platform: tegra: rtcpu: Use conftest
Instead of relying on kernel version to determine if the 'remove'
callback for the 'bus_type' structure return an integer or void, add a
compile time test to the conftest.sh script to determine this at compile
time for the kernel being used. This is beneficial for working with 3rd
party Linux kernels that may have back-ported upstream changes into
their kernel and so the kernel version checks do not work.

Bug 4119327

Change-Id: I5457300619f5fb3b6afe61742bc6fce4cbefcd5d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2985719
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-30 06:45:51 -07:00
Jon Hunter
634e0c9734 drivers: bmi088: Only build bmi088 if CONFIG_IIO is set
If the bmi088 is built against a kernel that does not have CONFIG_IIO
enabled, then the build fails because the following symbols are not
found ...

 ERROR: modpost: "iio_read_const_attr" [drivers/bmi088/bmi088.ko]
  undefined!
 ERROR: modpost: "iio_kfifo_allocate" [drivers/bmi088/bmi088.ko]
  undefined!
 ERROR: modpost: "devm_iio_device_alloc" [drivers/bmi088/bmi088.ko]
  undefined!
 ERROR: modpost: "__devm_iio_device_register" [drivers/bmi088/bmi088.ko]
  undefined!
 ERROR: modpost: "iio_device_attach_buffer" [drivers/bmi088/bmi088.ko]
  undefined!
 ERROR: modpost: "iio_push_to_buffers" [drivers/bmi088/bmi088.ko]
  undefined!

Fix this by only building the bmi088 driver is CONFIG_IIO is enabled.

Bug 4190630

Change-Id: I9ca80d9a638d33d8996d5197b6f44f1d7382a9d2
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2986513
Reviewed-by: Gautham Srinivasan <gauthams@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-30 03:32:49 -07:00
Jon Hunter
fc7367debb drm/tegra: Fix crash when engine probe fails
If probing of the VIC engine fails then the following crash is observed
...

 tegra-vic 15340000.vic: devfreq_add_device: Unable to find governor for
  the device
 tegra-vic 15340000.vic: failed to init devfreq: -22
 tegra-vic: probe of 15340000.vic failed with error -22
 tegra-nvdec 15480000.nvdec: Adding to iommu group 45
 list_add corruption. prev->next should be next
  (ffff000094505f80), but was 0000000000000000. (prev=ffff000095245cf0).
 ------------[ cut here ]------------
 kernel BUG at lib/list_debug.c:26!
 Internal error: Oops - BUG: 00000000f2000800 [#1] SMP
 ...

 pc : __list_add_valid+0x80/0x84
 lr : __list_add_valid+0x80/0x84
 ...

 Call trace:
 __list_add_valid+0x80/0x84
 host1x_subdev_register+0x80/0x170 [host1x_next]
 __host1x_client_register+0xac/0x160 [host1x_next]
 nvdec_probe+0x1c8/0x58c [tegra_drm_next]
 platform_probe+0x6c/0xe0
 really_probe+0xc4/0x3dc
 __driver_probe_device+0x114/0x190
 driver_probe_device+0x44/0x114
 __driver_attach+0xcc/0x1f0
 bus_for_each_dev+0x78/0xd0
 driver_attach+0x28/0x30
 bus_add_driver+0xbc/0x220
 driver_register+0x70/0x120
 __platform_register_drivers+0x70/0x140
 host1x_drm_init+0x58/0x1000 [tegra_drm_next]
 do_one_initcall+0x48/0x2d0
 do_init_module+0x5c/0x270
 load_module+0xb08/0xc70
 __do_sys_init_module+0x1dc/0x214
 __arm64_sys_init_module+0x20/0x2c
 invoke_syscall.constprop.0+0x7c/0xd0
 el0_svc_common.constprop.0+0x140/0x150
 do_el0_svc+0x38/0xa0
 el0_svc+0x38/0x18c
 el0t_64_sync_handler+0xb4/0x130
 el0t_64_sync+0x17c/0x180
 Code: aa0103e2 910fa000 aa0403e1 941b9509 (d4210000)
 ---[ end trace f8f20f933fe03c7e ]---

The problem is that some of the engines are not cleaning up correctly on
probe failure and so fix this by adding the necessary calls clean up if
probe fails.

Bug 4303860

Change-Id: Ife1e0ce7429458d187422162a298cc140f0e3bc4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2986790
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-28 22:00:56 -07:00
Jon Hunter
07dbfa8de1 gpu: host1x: Make host1x_actmon_unregister() return void
The function host1x_actmon_unregister() never fails and so never returns
an error. Make this function return void to simplify the code.

Bug 4303860

Change-Id: I9e1cd403bd6db8e2d4ac6831ed26e1436638456f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2986789
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-28 22:00:51 -07:00
Uwe Kleine-König
ee866593b7 UPSTREAM: gpu: host1x: Make host1x_client_unregister() return void
This function returned zero unconditionally. Make it return no value and
simplify all callers accordingly.

Bug 4303860

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Change-Id: I07bf696e8af7c3472355b52549fb43ff3987c108
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2986788
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-28 22:00:46 -07:00
Manish Bhardwaj
4df331c666 Revert "nvidia: Optimize the request slots for queueing"
This reverts commit 4c20b236c8523e2af0fcd2f7396577ccf0328eec.
Reason for revert: <Seeing hung issue>

Bug 4260060

Change-Id: Ie9347885dd861ae9afc230c803246f86a0f34615
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2984818
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-28 21:46:55 -07:00
Jon Hunter
b272a83282 video: tegra: nvmap: Use conftest
Instead of relying on kernel version to determine if the
register_shrinker() function has the 'fmt' argument, use the conftest.sh
script to test if this argument is present at compile time. This is
beneficial for working with 3rd party Linux kernels that may have
back-ported upstream changes into their kernel and so the kernel version
checks do not work.

Bug 4119327

Change-Id: I0cbde2dfc2affc41e93eee1f3a195dbc0f8f5667
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2984429
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-28 21:45:38 -07:00
Jon Hunter
ae64ed46c8 gpu: host1x: Add conftest support
Instead of relying on kernel version to determine if certain functions
or structure are present in the kernel, use the conftest.sh script to
test which functions, structures, etc are present at compile time. This
is beneficial for working with 3rd party Linux kernels that may have
back-ported upstream changes into their kernel and so the kernel version
checks do not work.

Bug 4119327

Change-Id: I56281fa5d95862338bd8a43d6e22225c27590462
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2984422
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-28 21:45:27 -07:00
Jon Hunter
5a26b0ef9d drm/tegra: Add conftest support
Instead of relying on kernel version to determine if certain functions
or structure are present in the kernel, use the conftest.sh script to
test which functions, structures, etc are present at compile time. This
is beneficial for working with 3rd party Linux kernels that may have
back-ported upstream changes into their kernel and so the kernel version
checks do not work.

Bug 4119327

Change-Id: If315b18af74c830e9ba3993208de3a3326c4187d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2984415
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-28 21:45:17 -07:00
Jon Hunter
040c0ad65f drivers: nv-p2p: Drop get_user_pages_locked
The nv-p2p driver does not compile against pre-v5.15 kernels and the
following error is seen ...

 drivers/nv-p2p/nvidia-p2p.c:153:24: error: passing argument 1 of
 'mmap_read_lock' from incompatible pointer type
 [-Werror=incompatible-pointer-types]
  153 |         mmap_read_lock(&current->mm);
      |                        ^~~~~~~~~~~~
      |                        |
      |                        struct mm_struct **

The version of the function get_user_pages_unlocked() used in the nv-p2p
driver has been support since v4.6 and so drop usage of
get_user_pages_locked() completely.

Bug 4142533

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I957197825ddee6b705626b345aaff4647de08533
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2983961
Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-28 21:44:29 -07:00
Lovie Wang
2c1450fb2f misc: mods: Remove CONFIG_OF_RESOLVE & CONFIG_OF_DYNAMIC
-OOT drivers are built unconditionally
-MODS selects these two flags in Kconfig while Kconfig is
 not used in OOT drivers. So these two flags can't be selcted
 by default, need to remove the check.

 Bug 4300801

Change-Id: I2e19ecdfd34c499b3000823025d0ad34752ae9aa
Signed-off-by: Lovie Wang <loview@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2981830
Reviewed-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-28 21:38:20 -07:00
Jon Hunter
990ccbf02c block: virtual-storage: Remove unneeded header
The header file 'linux/genhd.h' is not needed for compiling the virtual
storage drivers and so remove this unneeded header file.

Bug 4119327

Change-Id: Ib6dd7bc072b291a5617880fc65c7cd8dbc0b35ab
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2985997
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-27 08:24:49 -07:00
Vishwaroop A
a47fbd17b7 drivers: spi: enable autosupsend delay
Add runtime auto suspend support and provide
a dt option to set this delay for each bus.

Perf drop is seen due to clock switching during
write operation. QSPI flash device write page size
is 256 KB so clock switching was being done for every
256KB due to pm_runtime_put(&pdev->dev) call.

pm_runtime_put() function is called, the Linux kernel
will begin to power down the device. This may involve
disabling clocks, powering down voltage regulators, and
releasing other resources etc.

pm_runtime_set_autosuspend_delay function sets the
autosuspend delay for a device. The autosuspend delay
is the amount of time that the device will remain active
after it has been idle before it is automatically suspended.
The pm_runtime_set_autosuspend_delay() function can be used to
reduce power consumption by automatically suspending devices
when they are not in use.

Bug 4229700

Change-Id: Ib49b02c78ad25957c80d22f5cc316afa55aa24dd
Signed-off-by: Vishwaroop A <va@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2985140
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-27 08:21:40 -07:00
Gautham Srinivasan
6fec90c658 drivers: bmi088: Fix build for post-Linux v6.2
BMI088 driver was failing to build for Kernel version
> 6.2 and the following error is seen:

drivers/bmi088/bmi088_core.c:1043:42: error: 'struct iio_dev'
has no member named 'mlock'
  mutex_lock(&st->snsrs[hw].bmi_iio->mlock);

mlock field is moved from indio_dev to iio_dev_opaque
structure from v6.2 onwards.  Instead of using kernel
version, use conftest.sh script which checks for the
'mlock' field in iio_dev_opaque structure or not.

Bug 4190630

Change-Id: Icc540edd916718d30460b314600c20e70144b1d6
Signed-off-by: Gautham Srinivasan <gauthams@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2983266
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-27 02:27:51 -07:00
Johnny Liu
6323c46280 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: Icf8b3fce960318c129194330c694e47826c440ee
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2983673
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:22:03 -07:00
Viswanath L
e45c6bc8a9 nvadsp: Move DRAM map to custom property
Move DRAM map DT entries from 'reg' to a new custom
property "nvidia,dram_map". This is to restrict the
use of 'reg' only for actual registers, which will
be tightly controlled by 'ranges' property.

Bug 4164138
Bug 3682950

Change-Id: Ia535d136b15a0ba6d7758ed3a2d70ace2c8cf763
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2983549
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-26 12:10:39 -07:00
Viswanath L
fa4a7643c5 nvadsp: Remove ABRIDGE and UNIT_FPGA_RST from DT
Remove redundant DT 'reg' entries ABRIDGE and UNIT_FPGA_RST
and associated code. 0x0 in the reg entry will not be possible
when 'ranges' property explicitly defines the address ranges.

Bug 4164138
Bug 3682950

Change-Id: I4cb11f8d143b1958c586471674e87d1ab243564f
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2983548
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-26 12:10:28 -07:00
Viswanath L
ffdc1ff5c6 nvadsp: Use platform_get_irq to get IRQ num
Use platform_get_irq() instead of platform_get_resource()
to read IRQ num from DT, as platform_get_resource() is not
recommended to read IRQ early in the boot.

Bug 4164138
Bug 3682950

Change-Id: I117e608e6ae798aa2932a3a41f7942a741d3ff9c
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2983098
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:10:18 -07:00
Viswanath L
21a60d1ca1 nvadsp: Load apps only if msgq is initialized
Load static apps only if shared memory is provisioned
and ADSP firmware has initialized message queue.

Bug 4164138
Bug 3682950

Change-Id: I86a9292d8d5f2949595c9a701f0565a9644f3d9a
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2930212
(cherry picked from commit 396b05637869ab2f49e8f3b3358fb9298ba96ae5)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971982
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:10:13 -07:00
Viswanath L
6815f07e8f nvadsp: Restrict ICC API to T23x
Restrict call to icc_get API to T23x family of chips.

Bug 4164138
Bug 3682950

Change-Id: Ie4140b38661dcfd050305c7cdbbbc8c14031bbe7
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2930170
(cherry picked from commit 92e6565e02b32159469ff7562f75fd36c28f7f9d)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971981
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:10:07 -07:00
Viswanath L
e2b06959b7 nvadsp: Generic changes for chip extensions
Below changes are made to support future
extensibility for new chips:

 - Chip data field 'adsp_prid' is added to specify DSP ID
 - Chip data field 'adsp_elf' is added to specify ELF file name
 - DT property "nvidia,cluster_mem" is added to specify cluster
    internal memories; ELF segments will be loaded into these
    using intermediate shadow buffers so that unaligned access
    is avoided
 - "nvidia,adsp_mem" entries are made optional (0x0 in the size
    field will indicate bypass)
 - Chip extension functions 'set_boot_vec' and 'set_boot_freqs'
    are added to support chip specific settings

Bug 4164138
Bug 3682950

Change-Id: I538ae0df57fa199a6eef75441167a9a5ba6924e8
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2894321
(cherry picked from commit fa7fc9d08af5fab9d0b2c5eb1b9b9a78446ade0e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971980
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:10:02 -07:00
Viswanath L
d5138e1c58 nvadsp: Fix build issues and enable
Fix build issues for nvadsp in OOT kernel and enable the build.

 - Below files copied from kernel/nvidia/include/linux/
    - tegra_nvadsp.h (72af3e78a6aff0fa250e9fd36b8414264d0e4c9a)
    - tegra-firmwares.h (700223e52f49f300664dd91335fa11111af733aa)
    - tegra-hsp.h (988be8f05033e1d728e046e918b506d829106082)
 - Below file copied from kernel/nvidia/include/uapi/misc/
    - adsp_console_ioctl.h (72af3e78a6aff0fa250e9fd36b8414264d0e4c9a)
 - Functions that needs additional AGIC APIs not supported in upstream
    are pushed under macro CONFIG_AGIC_EXT_APIS
 - T210 chip_data and references removed

Bug 4164138
Bug 3682950

Change-Id: I5dfb570e578ca3631896de7350cea66698612568
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971924
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:09:57 -07:00
Viswanath L
119c4f87e2 nvadsp: Update license and remove kernel ver check
- Update license of all files in nvadsp that will be used
 - Remove kernel version checks in the code

Bug 4164138
Bug 3682950

Change-Id: Ie1f9ba95c1d46c3dd9bc5614e502b1b444484df6
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2980528
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:09:52 -07:00
Laxman Dewangan
ac4912cb26 device-tree: generic: Add support to scan DT of internal SoCs
Add the support to build the DT of internal SoCs without
adding direct name from the Makefile but passed from the
make command. This will help to make the DT of all internal
SoCs.

Bug 4197981

Change-Id: I03c55cef5903a814a20d6f86d8ecfffe552daf29
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2982406
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-23 14:37:09 -07:00
Jon Hunter
ed3fdebc33 thermal: max77851: Fix build for pre-Linux v6.1 kernels
The max77851 driver is failing to build for Linux kernels v5.16 to v6.0
and the following error is seen ...

 drivers/thermal/max77851_thermal.c:173:30: error: implicit declaration
 of function 'devm_thermal_of_zone_register'; did you mean
 'devm_thermal_zone_of_sensor_register'?
 [-Werror=implicit-function-declaration]
   thermal->tz_device = devm_thermal_of_zone_register(&pdev->dev, 0,
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The function devm_thermal_of_zone_register() was introduced in Linux
kernel v6.1 and not v5.16.

Instead of relying on kernel version to determine if this function is
present using the conftest.sh script which checks the kernel that is
being compiled to see if this function is present or not. This is also
beneficial for working with 3rd party Linux kernels that may have
back-ported upstream changes into their kernel and so the kernel version
checks do not work either.

Bug 200749982

Change-Id: I8d5e70d2d39497d7f513c82cd3a45312b2bc016a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2980925
2023-09-23 14:34:00 -07:00
Manish Bhardwaj
f6227e9c57 crypto: check buffer size before allocing DMA memory
Passing zero size to dma_alloc API is causing below crash.
Added check on requested size before sending request to
dma layer.
[ 4178.581558]  sg_alloc_append_table_from_pages+0x28c/0x480
[ 4178.581790]  sg_alloc_table_from_pages_segment+0x40/0xb0
[ 4178.582009]  __iommu_dma_alloc_noncontiguous.isra.0+0x244/0x3a0
[ 4178.582258]  iommu_dma_alloc+0x280/0x3b0
[ 4178.582424]  dma_alloc_attrs+0xf8/0x110
[ 4178.582588]  tegra_hv_vse_get_db+0x76c/0x70e0 [tegra_hv_vse_safety]
[ 4178.582850]  hash_sendmsg+0xa8/0x290
[ 4178.583001]  sock_sendmsg+0x68/0x90
[ 4178.583146]  __sys_sendto+0xf0/0x170
[ 4178.583298]  __arm64_sys_sendto+0x38/0x60
[ 4178.583466]  invoke_syscall+0x5c/0x150
[ 4178.583628]  el0_svc_common.constprop.0+0x100/0x120
[ 4178.583829]  do_el0_svc+0x3c/0xb0
[ 4178.583966]  el0_svc+0x20/0x70
[ 4178.584098]  el0t_64_sync_handler+0xc0/0xd0
[ 4178.584270]  el0t_64_sync+0x1a4/0x1a8

Bug 4259208

Change-Id: I134bc84e7b5cbda7db4ed7dbcad4e1c6955429d8
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2983402
Reviewed-by: Ashutosh Patel <ashutoshp@nvidia.com>
Reviewed-by: Vipin Kumar <vipink@nvidia.com>
Reviewed-by: Suresh Venkatachalam <skathirampat@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-22 20:08:52 -07:00
Manish Bhardwaj
1b6b4f8746 crypto: Fix compilation warning
Bug 4213877

Change-Id: Ic7fd0496473c5e3225e6235a18176faa8fe3e1be
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2982158
Reviewed-by: Ashutosh Patel <ashutoshp@nvidia.com>
Reviewed-by: Vipin Kumar <vipink@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-21 21:32:13 -07:00
Manish Bhardwaj
90953fc012 Revert "crypto: nvvse: Fix compilation warning"
Bug 4213877

This reverts commit 88af3f4d9f.
Reason for revert: <Proper fix is being merged>

Change-Id: I3442f9a06cd752a5bc9f9c328a8d311a195f1574
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2982104
Reviewed-by: Ashutosh Patel <ashutoshp@nvidia.com>
Reviewed-by: Vipin Kumar <vipink@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-21 21:32:08 -07:00
Sumit Gupta
8a3c5d434b drivers: nv-p2p: fix compilation error in Nvidia Tegra P2P driver
Fix compilation error on making Nvidia Tegra P2P Driver as OOT.
Error coming because the get_user_pages_locked() API is removed now.
 https://lore.kernel.org/all/20220204020010.68930-6-jhubbard@nvidia.com/T/#mebb2b2dd622f702e76120aeca7896a4fd184d5c1

 kernel-oot/kernel-nvidia-oot/nvidia-oot/drivers/nv-p2p/nvidia-p2p.c
 :169:43: error: implicit declaration of function
 _get_user_pages_locked_; did you mean _get_user_pages_unlocked_?
 [-Werror=implicit-function-declaration]
  169 | user_pages = safe_cast_s64_to_s32(get_user_pages_locked
        (vaddr & PAGE_MASK, nr_pages,
      |                                   ^~~~~~~~~~~~~~~~~~~~~
      |                                   get_user_pages_unlocked
 cc1: all warnings being treated as errors

Bug 4142533

Change-Id: Ic368ec288560f8f3c0acea29cfc935059ce2857e
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2978104
Reviewed-by: Preetham Chandru <pchandru@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-21 21:24:10 -07:00
Sumit Gupta
c10e9dee5c drivers: nv-p2p: Move Nvidia Tegra P2P Driver to OOT
Make Nvidia Tegra P2P driver for RDMA as an OOT module.
The driver was earlier merged in Kernel-5.10 in the below cl.
 https://git-master.nvidia.com/r/c/linux-nvgpu/+/1821407

Bug 4142533

Change-Id: I6b24b44832d45fa5abedcd04c94d5d1e2576a6a3
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2978103
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-21 21:24:05 -07:00
Jon Hunter
8409b7c652 net: can: mttcan: Make LED support depend on CAN_LEDS
CONFIG_CAN_LEDS has been marked as BROKEN since Linux v4.19 and was
finally removed in Linux v5.19. Only compile support for LEDS if enabled
in the kernel. Long-term we need to move the MTTCAN driver to use
LEDS_TRIGGER_NETDEV.

This is a better solution for working with 3rd party Linux kernels that
may backport upstream changes to the kernel and hence are not compatible
with these existing version checks.

Bug 4228080
Bug 4283911

Change-Id: I70e800c4a3699af59742d30111bc3a3cbf80bcb5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2982135
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-21 13:11:36 -07:00
Jon Hunter
069925e74b video: tegra: nvmap: Make ioremap_prot depend on GENERIC_IOREMAP
The function ioremap_prot() has been exported by the Linux kernel since
v5.9. However, it is only available if GENERIC_IOREMAP is enabled. Since
Linux v6.0, when the ARM64 __ioremap() function was removed, was
GENERIC_IOREMAP enabled for ARM64 by default. Rather than depend on
kernel version for selecting if ioremap_prot is used, use ioremap_prot
if GENERIC_IOREMAP is enabled.

This is a better solution for working with 3rd party Linux kernels that
may backport upstream changes to the kernel and hence are not compatible
with these existing version checks.

Bug 4119327

Change-Id: I2f5f9a691c66c5fbd83d4aa51062c749d39dd447
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2982126
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-21 13:11:31 -07:00
Jon Hunter
e3f94bde03 block: virt-storage: Fix build for pre-v5.15 kernels
Building the Tegra virtual storage driver for v5.14 kernels fails with
the following error ...

 drivers/block/tegra_virt_storage/tegra_hv_vblk.c:1236:48: error:
 passing argument 1 of '__alloc_disk_node' makes integer from pointer
 without a cast [-Werror=int-conversion]
  vblkdev->gd = __alloc_disk_node(vblkdev->queue, NUMA_NO_NODE);
                                  ~~~~~~~^~~~~~~
                                         |
                                         struct request_queue *

Fix this by correcting the arguments passed to __alloc_disk_node() for
pre-v5.15 kernels.

Bug 3820317

Change-Id: I2f208acb3ef0a009d877ab46fb110a87968862fe
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2978392
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-09-20 18:57:55 -07:00