There is a decompress_done flag in the adsp OS firmware
that was earlier used to indicate that decompress is done
at the adsp os cold boot
However this flag cannot be part of firmware
as fw needs to authenticated at the sc7 resume as well and
hence the fw should not have modifications
On fw side, the flag is removed. Instead the same information
is preserved across sc7 cycles via HWMBOX5 and this driver
enables the decompress bit to indicate the same to adsp at
cold start
Bug 3491011
Change-Id: I77d1ff6defdf1228f4cd4278cf5bb667df51fad1
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2660706
Tested-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
GVS: Gerrit_Virtual_Submit
It may be useful at times to boot ADSP via backdoor, even
while system boots via front door. MB2 sets the ACAST in
front door, so ACAST setting from nvadsp driver is skipped
if that region is already enabled.
Above scheme will work for ADSP backdoor boot via SMMU
mapped memory, but not for physical memory, as the underlying
carveout memory is different between frontdoor and backdoor.
Bug 200745826
Change-Id: I718da97e3f06eb86b3e40efab91275f2d5958dd4
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2675786
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
GVS: Gerrit_Virtual_Submit
ACAST settings are expected to be done by the driver in backdoor
boot. Provision is added to read the ACAST address ranges and
the SMMU stream ID from DT.
ACAST settings are done either for physical memory, or for SMMU
mapped memory, as per the backdoor boot configuration.
Also, call to ACAST init function is moved from runtime resume
to device probe.
Bug 200745795
Bug 200746669
Bug 200773359
Change-Id: Ia53820968ce4d48966c39d72b4c2106be99815fa
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2644989
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Provision is made to pass the Tegra platform information to ADSP
("nvidia,tegra_platform" DT property, as per enum tegra_platform);
this will be useful to convey whether the platform is CMODEL, in
which case the ADSP may take CMODEL specific paths, like using
HSP shared interrupts.
Upper 16 bits of nvadsp_os_args.chip_id is used to convey the
platform information; this may be improved in future as a
separate structure member.
Bug 200745795
Bug 200746669
Change-Id: Ibd9423eebb06fc4d243c132ab1cb7c6dc558ba5e
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2622156
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
In cold boot stress test, it is observed that adsp OS
hung intermittently(1/276). Due to which
1) app init of adspff is not able to
complete as it does not receive start ack from adsp
2) wdt handler is triggered as adsp is hung for more
than 10 seconds.
When poweroff is issued in such case,
the alsactl save/restore job which is part of shutdown
sequence is hung as its unable to acquire lock held by
host adsp audio driver fn that initiated nvadsp_os_start.
Therefore, timeout is added while waiting for app init.
If app init fails to happen within timeout duration,
error status is received by nvadsp_os_start
which inturn is received by host side adsp audio driver.
This ensures that lock is released in case of adsff_init
failure in nvadsp_os_start function so that shutdown
can proceed without issue.
Bug 3391964
Change-Id: Ieca54fe9dd21bf9de70d781cfaceb5ffe83809ef
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2626892
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
The chip_id type in shared struct is u8 where as across the adsp firmwares
the chip_id type is of type uint32_t. This causes shared structure sizes
to be different causing firmwares and causes different address of the shared
struct variables when accessed from the Host and the adsp firmware.
Bug 200692666
Change-Id: I6ad23f021f64458d87596b9d6c47c9df38e3689b
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2524414
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Nikesh Oswal <noswal@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Add Interconnect API support for ADSP Memory bandwidth requirement
handling.
From Kernel 4.14 and beyond
- On T23X and newer platforms, the interconnects driver will be initialized
and calls to BWMGR will be stubbed out.
- On T194 and earlier platforms, BWMGR driver will be initialized and calls
to interconnect framework will be stubbed out.
Added code check with K5.9 as mc_utils.h header is present from K5.9 build
For Kernel 4.9 and earlier
- T23x will not be supported.
- T194 and earlier platforms will use BWMGR. Interconnect framework is not
available.
JIRA TAS-1060
Change-Id: Ie0b4040f374a3c6102cb7aff2506d8cf2f0eab69
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2414369
Reviewed-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
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
Fix build linux-5.7-rc5 errors including following:
- change timespec to timespec64. replace getnstimeofday
with ktime_get_ts64
- replace usage of macro FIELD_SIZEOF with sizeof_field in ethtool.c
nvethernet and eqos files.
- support 2 arguments for of_get_phy_mode call
bug 200617764
Change-Id: I46067d7d36d08ee9556b2722e9ccec707b8853d4
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2347244
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
On 5.4 kernel clk_round_rate(), for ACLK with ULONG_MAX request, is
returning minimum possible value for ACLK and this is causing a
failure with ADSP OS load. The issue is found in BPMP where there
is a problem with data mis-alignment. Till this gets addressed a TEMP
change is provided here to unblock ADSP audio related work.
This can be reverted once original BPMP fix is merged.
Bug 200593718
Change-Id: I1965986770424f2a8560e011ca892b700cdc0258
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2345133
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@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
Build error is seen on 5.4 kernel due to 'elf_hwcap' not being available.
Commit aec0bff757c9 ("arm64: HWCAP: encapsulate elf_hwcap") in upstream
removes direct expose of 'elf_hwcap' and instead provides a helper function
cpu_get_elf_hwcap() for it.
To fix build error this patch includes 'asm/hwcap.h' which works well for
all supported kernel versions in downstream. The macro ELF_HWCAP, from this
header, can be used for this purpose.
* For kernel < 5.4 : ELF_HWCAP --> elf_hwcap
* For kernel >= 5.4 : ELF_HWCAP --> cpu_get_elf_hwcap()
Bug 200593718
Change-Id: I3ef3527be5972d6f6ba6ab6ef6dc50936dff73fd
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2341654
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
5.4 kernel no longer uses chip-id.h and instead fuse.h is used.
Currently this causes build issues in ADSP driver code and hence
related drivers are updated to make use of references as per
fuse.h for 5.4 kernel.
The issue is not seen on TOT because ADSP is not yet enabled.
Bug 200593718
Change-Id: I82af6a4f02ce64da4b20875a28f8ef9488b92e54
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2341652
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@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>
Change exposes lpthread/adsp usage trigger via
amixer. This is needed to make sound card aware
of lpthread state. Without this STR adsp feature
breaks as currently lpthread is written in such
a manner which does not allow adsp to suspend.
Bug 200552183
Change-Id: I2cc1e0fd805a982686bbd034b2c6e094b56df23b
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2198693
(cherry picked from commit e9bd14fd6eb0305cc583092752e6bdccc9c5e76a)
Reviewed-on: https://git-master.nvidia.com/r/2250202
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Swati Sachdeva <ssachdeva@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Uday Gupta <udayg@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>
-Made necessary Kconfig and makefile changes
required to make ADSP CPU driver a loadable kernel
module.
-Had to replace nsec_to_clock_t api with functions that are
available as exported symbols as nsec_to_clock_t is not an
exported symbol
Bug 200560561
Change-Id: Ia2fa069d9bb234b57f19cbf919c9e6d7567f3d7b
Signed-off-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2215613
(cherry picked from commit 519a4618c452e3a62550d4fdf3ec5b52acf8b9c8)
Reviewed-on: https://git-master.nvidia.com/r/2228337
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
adsp_logger file could not be re-opened after closing and open call
always returned -EBUSY. This was because logger->is_opened was never
reset in the file close path. Setting it to 0 in .release callback
solves the problem.
Jira EMA-1321
Change-Id: I42834fa7af19bacc4326cd32745996b6f4e47686
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2153912
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>