While enabling 'CONFIG_TEGRA_ADSP_FILEIO' following build error
is seen with v5.9-rc4 build.
ERROR: modpost: "sched_setscheduler" [drivers/platform/tegra/
nvadsp/nvadsp.ko] undefined!
This happens because sched_setscheduler() export is removed with
commit 616d91b68cd5 ("sched: Remove sched_setscheduler*() EXPORTs")
in upstream. The reason for removal is below.
Upstream commit 7318d4cc14c8 ("sched: Provide sched_set_fifo()")
provides sched_set_*() functions and suggests to convert existing
sched_setscheduler_*() calls to sched_set_*(). As per this
following updates are made for ADSP driver to work for v5.9.
- Use sched_set_fifo() whenever a high priority is required.
(However by default priority is set to MAX_RT/2)
- Use sched_set_fifo_low() whenever priority needs to be above
SCHED_NORMAL.
Since it is a recent change in upstream kernel above changes are
not applicable for previous kernels (v4.14 and v4.9). Hence these
can continue to use existing calls. Thus above changes are protected
under kernel version checks.
Bug 200657500
Change-Id: I763fb7d1461e23e1eeb26d7c49a295172450e54d
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2417919
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@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>
After v5.9-rc4 merge in dev-main-5.9 many build errors are seen with
ADSP config CONFIG_TEGRA_ADSP_LPTHREAD. Some of these build errors
are listed below.
* kernel/nvidia/drivers/platform/tegra/nvadsp/adsp_lpthread.c:15:0:
kernel-5.9/include/linux/uaccess.h: In function ‘force_uaccess_begin’:
kernel-5.9/include/linux/uaccess.h:20:2: error: implicit declaration
of function ‘set_fs’; did you mean ‘get_fs’?
[-Werror=implicit-function-declaration]
set_fs(USER_DS);
^~~~~~
* kernel-5.9/arch/arm64/include/asm/uaccess.h: In function
‘__uaccess_mask_ptr’:
kernel-5.9/arch/arm64/include/asm/uaccess.h:240:41: error: invalid type
argument of ‘->’ (have ‘int’) : "r" (ptr), "r"
(current_thread_info()->addr_limit),
^~
...
The errors appear to be related to 'uaccess.h' header and following
inclusion order is causing build failures for some reason. Checked with
other source files with below and same behavior is seen.
#include <asm/uaccess.h>
#include <linux/uaccess.h>
...
Issue goes away after replacing 'asm/uaccess.h' with 'linux/uaccess.h'.
It should be noted that latter header by default includes the former one.
For consistency this is done for other relevant ADSP files too.
Bug 200657500
Change-Id: I7ce98c46327a825711c4fa9ab791afc65b1cbf1b
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2417265
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Following build errors are seen when ADSP configs CONFIG_TEGRA_ADSP_FILEIO
and CONFIG_TEGRA_ADSP_LPTHREAD are enabled.
* Error due to "segment.h"
adsp_lpthread.c:14:10: fatal error: asm/segment.h: No such file or
directory
adspff.c:17:10: fatal error: asm/segment.h: No such file or directory
(asm/segment.h inclusion is removed as asm/uaccess.h already takes care
of required dependencies)
* Error due to unavailable structure "sched_param"
adspff.c:517:21: error: variable ‘param’ has initializer but incomplete
type
adspff.c:518:3: error: ‘const struct sched_param’ has no member named
‘sched_priority’
(Replace <linux/sched/types.h> with <uapi/linux/sched/types.h> to fix
this build issue)
* Error due to unavailable "get_ds()"
adspff.c:63:9: error: implicit declaration of function ‘get_ds’; did you
mean ‘get_fs’? [-Werror=implicit-function-declaration]
(Fixed by replacing get_ds() with KERNEL_DS. The get_ds() support is
removed from upstream kernel)
Bug 200593718
Bug 200657500
Change-Id: I8b9cbed5ee42f34cf3731ea2d2f06aa760c28358
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2412299
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
- ADSP thread was waiting on a sempaphore to wake up
- In case of shutdown when kthread_stop is called, kthread_should_stop
- will not be called if thread is not woken up
- Solution: Replace semaphore with wait_queue and use
- wait_event_interruptible
- wake up the thread if either there is a message in the list or
- kthread_should_stop is true
Bug 2739934
Bug 200560194
Bug 200463529
Change-Id: Iea04e0100248f554076aaed8627d40f5b96df2bf
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2232868
(cherry picked from commit a3a81a984a933a8f580154b76098119427f5e19e)
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2238825
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Swati Sachdeva <ssachdeva@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
- Implement file list rather than fixed length array
- Fix issues related to file mode handling
- Change file not found validation with respect to commit c136844cd414
("nvadsp: adspff: use kthread to schedule file io")
Bug 2538512
Change-Id: I1cd8fa065887effa6073d963df62f6e1bb877a1d
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2102696
(cherry picked from commit ea7d4ea78a22b7d8675966f2b2f85343c488d059)
Reviewed-on: https://git-master.nvidia.com/r/2150780
Tested-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
- Workqueue scheduling latency causes issues for
adsp apps requiring real time behaviour. Hence
use RT kthread to schedule the file io functions
- file open with O_TRUNC flag may take long time
Hence we open the file just once and just reset
the read/write pointers in a file close call
- Expose sysfs entry to actually close all files
opened by kernel
Bug 1846449
Jira EMA-847
Change-Id: I3c130b36e5f5f5a0e65ddb4c44efc8754fb006d2
Signed-off-by: Gaurav Tendolkar <gtendolkar@nvidia.com>
Reviewed-on: http://git-master/r/1314984
(cherry picked from commit 00f5d0b48aa0df9a720c6fd15b4cffd827408375)
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2029203
(cherry picked from commit 6760f7d61a589b90a8c156a38e4453b518a20b05)
Reviewed-on: https://git-master.nvidia.com/r/2030551
(cherry picked from commit c136844cd4147c25478fe39a15122a1f43553079)
Reviewed-on: https://git-master.nvidia.com/r/2150778
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Niranjan Dighe <ndighe@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Check file->fp for NULL before returning the file handle to
ADSP in adspff_fopen, which otherwise results in a kernel crash
on successive file operations using the same file handle if the
requested file does not exist.
Jira: EMA-1152
Change-Id: I307cc82dd3a2135039b819d1f746ee8164568110
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929809
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>