Currently we disable Non secure watchdog during suspend and
re-enable it during resume. This leaves suspend / resume path
unprotected by Non secure watchdog. There is a feature in
hardware where watchdog freezes automatically when all online
cores are in suspend and unfreezes watchdog upon wakeup event
from low power mode. Set the bit in watchdog control register to
enable this feature and protect suspend / resume path by Non
secure watchdog.
Change-Id: Ibca425a661c74bd1d46513783780ea213a51f87f
Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>
Virtual and physical memory allocators may return buffers
that are at physical addresses higher than 4GB. When
passing addresses to TZ, don't assume otherwise. Fix the
code to not truncate down to 32 bits (the assignment operation
u64 = u32 = u64 truncates down 64 bit addresses to 32 bits)
unnecessarily; perform the assignment in two discrete steps
to allow the desc.args[X] field to store the full 64 bit
address.
Change-Id: I7f3139dee27f22c5b713ba8b6221bc3551699f32
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
The scm library has added support for a new secure world
interface that is more aligned to the ARMv8 SMC calling
convention. Use the new API while maintaining backward
compatibility.
Change-Id: Id5a75936f6c1881add09b3dc9b07abecbda694eb
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
This is a snapshot of the watchdog_v2 driver as of msm-3.10 commit
acdce027751d5a7488b283f0ce3111f873a5816d (Merge "defconfig: arm64:
Enable ONESHOT_SYNC for msm8994")
Change-Id: I8cd7a84e0cbb45c3ac20d4c84f5603ab5df1edae
Signed-off-by: Andy Gross <agross@codeaurora.org>
[abhimany: resolve trivial merge conflicts]
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
To disable and enable Kryo hardware errata 76 workaround at
runtime, expose a debugfs interface. Wrote codes using e74/e76
API and data as a starting point.
/sys/kernel/debug/scm_errata/kryo_e76
This allows Kryo errata 76 workaround to be toggled
off or on (on affected devices) by echoing 0 or 1 to the file.
Change-Id: I3d682021aa98eef5421ac2e7578da02f2ea98081
Signed-off-by: Se Wang (Patrick) Oh <sewango@codeaurora.org>
Currently, when deciding which version of scm call to make in scm_call2,
we check the scm_version variable. However, the scm_version variable is
only initialized as a side-effect of calling is_scm_armv8, which isn't
called anywhere in scm_call2. So if someone makes an scm_call2 before
is_scm_armv8 has been called then they could get the wrong scm version.
Fix this by calling is_scm_armv8 at the top of the scm_call2
function (and bailing out if it's not v8 since scm_call2 only supports
v8 forward). Similarly for scm_call2_atomic.
Since is_scm_armv8 caches its result the performance overhead of calling
on every invocation of scm_call2 should be negligible.
Change-Id: I46d2423ae2e4b5204fc5eefa1c6660c3c95a95b0
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
This driver exposes a debugfs interface intended for advanced
system debugging/profiling usecases where it may be desirable
to enable or disable certain hardware errata workarounds at
runtime, via an scm call.
Presently, a single debugfs node is implemented:
/sys/kernel/debug/scm_errata/kryo_e74_e75
This allows Kryo errata 74 and 75 workarounds to be toggled
off or on (on affected devices) by echoing 0 or 1 to the file.
Change-Id: I6edf39757416130a7b716dcdab1a601f27dfac5a
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
The existing scm-xpu implementation makes an unconditional scm
call at boot. The assumption was that such errors would be non-
fatal by default, and so a desired behavior could be achieved
by controlling whether the driver was compiled.
On recent targets like msm8996, XPU errors are treated as
fatal by default. To support cases where it may be desirable
to treat them as non-fatal, the driver must be changed to
make the appropriate scm call based on a new Kconfig choice.
Change-Id: Ibb55c062937f130c13538f049582575d9a6f52ad
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
This snapshot is taken as of msm-3.10 commit:
e3a3f66e47 ("Merge "soc: qcom: pil-q6v5-mss: Do not free memory
allocated to modem pil")
When compiled, the scm-xpu driver makes a single scm call at boot
to enable treatment of XPU errors as fatal.
Change-Id: Id33c2b73f4ed7ba8a07c5affebbe66eb5eba7951
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Non-atomic scm call which could be interrupted, trustzone will store
the session id in a register(x6) which will be used when trustzone resumes
the call.
To avoid x6 being used by compiler, HLOS now uses it to send a zero before
making scm call.
This is the same change as in the 32bit scm call.
Change-Id: If7a3ee28bdbf22acf447531603819a6f4f1603ca
Signed-off-by: Se Wang (Patrick) Oh <sewango@codeaurora.org>
It is required on some hardware that the Limits Management
secure API be executed in mutual exclusion with certain
other hardware-accessing drivers. Provide a mutex to achieve
this.
Change-Id: Ie0db516e335c29b79e959a0a6e6fb76231af6bf4
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
This is a snapshot of the scm driver as of
msm-3.14 commit:
3bc54cf86bdc7affa7cd4bf7faa3c57fe8f8819d (Merge "msm:
camera: Add dummy sub module in sensor pipeline")
Change-Id: Ida15e7da1a8c92e96b4f59feecb4d9dbaf667273
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
This reverts the upstream commit 68234df.
This is required internally for certain use-cases like flushing cache
before reboot to ensure all the data is available in the ramdump.
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Fix control register offsets for SDC1 and SDC2 pingroups
Change-Id: Ib373d17d512aeed64c16b5831ac20e03ab43ffe0
Signed-off-by: Sanrio Alvares <salvares@codeaurora.org>
The GPLv2 copyright statement includes an attribution
to Sony which was accidentally copied from another file.
Since the 8996 pinctrl driver does not leverage code
from sources besides the Linux Foundation,
clean-up the copyright text accordingly.
Change-Id: I324088aea2abde4fe34769a63d4ab55b35e13b81
Signed-off-by: Sanrio Alvares <salvares@codeaurora.org>
Based on the upstream change add gpio functions and
pingroups to msm8996 soc file
Change-Id: Iffc92a84d31b02efe29319dbdbb65c870c959cfd
Signed-off-by: Sanrio Alvares <salvares@codeaurora.org>
Use appropriate SOC name. Also replace all
instances of thulia with kryo.
Change-Id: Idd9acaae0688b7c125b85462bd99d01a3303fd09
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
The APIs __dma_inv_range() and __dma_clean_range() were
not exported by the third party patch. Since the functions
starting with underscores are not to be directly used by drivers,
related functions without the underscores are provided
which have the same name and functionality as the 32 bit APIs.
Change-Id: Ie0e681614307d9d9a19e58cacfb9b5dff4528977
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
arm64: add defines for dmac_*_range for compatibility with arm32
An earlier patch created defines for dma_*_range APIs to be
compatible with arm 32 bit, however it appears
these API names have not (at least yet) appeared there, so
revise the names to dmac_*_range, which is defined
for arm 32 bit so that there is one name defined
for both architectures.
Change-Id: I6456c02bad73fb54a874dc9925d3d43d9b8be2f2
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
(cherry picked from commit 0930bab0db67cc0d91e52e385e3e061871c6be05)
This makes locating our files less convoluted, since the
arch/arm/boot/dts directory is now quite bloated. So
move the dts into a "qcom" subdirectory.
The dtb output objects will still remain in the usual place,
out/arch/arm/boot/dts.
Change-Id: I9147b76c5385d77b5e350e2daa623747034dc96e
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
(cherry picked from commit 850759efa7e7b99fed479c8875439bfcfa06a340)
Conflicts:
arch/arm/Makefile
arch/arm/boot/dts/Makefile
Allow CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES to specify
a space separated list of dtbs to append to the zImage,
and name the resulting file zImage-dtb
Change-Id: I36d9108a2349bdbb373e95076dcb1417d8c7dce6
Signed-off-by: Colin Cross <ccross@android.com>
(cherry picked from commit 1307afc31753a515832702ff17e788de4f6f5d7c)
Allows a defconfig to set a list of dtbs to concatenate with an
Image.gz to create a Image.gz-dtb.
Change-Id: I0dc3935e57f01b517aa64eda0c27b0101e9ea3b2
Signed-off-by: Alex Ray <aray@google.com>
(cherry picked from commit 082d89f7f2ae529e2d7b50f6259e4430472cf4ed)
Memory model feature register specifies the supported
page granules. Some ARM cpus may have support for
16KB granules.
However currently we donot support 16KB pages sizes.
Explicitly mask off that capability if advertised by
the cpu.
Change-Id: I7daf3f179a5ce103aec7cf103ac198cf64800543
Signed-off-by: Hanumant Singh <hanumant@codeaurora.org>
The style used by 4fe343f94858 ("arm64: entry: add support for
CONFIG_ARM64_REG_REBALANCE_ON_CTX_SW") is inconsistent with other code
in the same file. Clean this up by using tabs instead of spaces, and
lower-case instead of upper-case instructions. No functional change
is expected.
Change-Id: Ia0d27e8b96fbde18f1c77f0728205a8e4109c114
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
When a process A unwind the stack frame of process B,
the stack of B can be modified and updated in other CPU
concurrently. So KASan could examine stack address with
out of date shadow mask value. To avoid this incorrect
KASan report, disable KASan during unwinding a frame of
a different task.
Following is the Kasan error log for the reference.
==================================================================
BUG: KASan: out of bounds access in unwind_frame+0x9c/0xf8 at addr ffffffc0462b76f0
Read of size 8 by task Signal Catcher/1282
page:ffffffbac7bdb260 count:0 mapcount:0 mapping: (null) index:0x0
flags: 0x0()
page dumped because: kasan: bad access detected
Call trace:
[<ffffffc00008c010>] dump_backtrace+0x0/0x250
[<ffffffc00008c270>] show_stack+0x10/0x1c
[<ffffffc001b6e628>] dump_stack+0x74/0xfc
[<ffffffc0002dd7c4>] kasan_report_error+0x2b0/0x408
[<ffffffc0002dd9f8>] kasan_report+0x34/0x40
[<ffffffc0002dda78>] __asan_report_load8_noabort+0x14/0x20
[<ffffffc00008b984>] unwind_frame+0x98/0xf8
[<ffffffc00008ba14>] walk_stackframe+0x30/0x48
[<ffffffc00008bba4>] save_stack_trace_tsk+0x178/0x254
[<ffffffc0003a5bc4>] proc_pid_stack+0xf0/0x198
[<ffffffc0003a11b0>] proc_single_show+0xe8/0x130
[<ffffffc000330e0c>] seq_read+0x524/0xaf0
[<ffffffc0002e9c74>] vfs_read+0x120/0x270
[<ffffffc0002eb208>] SyS_read+0xec/0x198
Memory state around the buggy address:
ffffffc0462b7580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffffc0462b7600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffffc0462b7680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffffffc0462b7700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffffc0462b7780: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00
==================================================================
Change-Id: I0e35e6721417fa7a5bffb41be67443cd906e256a
Signed-off-by: Se Wang (Patrick) Oh <sewango@codeaurora.org>
Add support for re-balancing register rename pools on context
switches, for a potential performance boost on some ARM64 targets.
Change-Id: I7577c11fac566ae91a210787c70b23591bfbd693
Signed-off-by: Sanrio Alvares <salvares@codeaurora.org>
These message are printed every time a CPU in hotplugged out,
resulting in log noise and hurting hotplug latency. Silence them
by default, by dropping them to pr_debug.
Change-Id: I21632c1dbf54342b5980a82ab7389713e943bf6c
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
This message is printed every time a CPU in hotplugged in,
resulting in log noise and hurting hotplug latency. Silence
it by default, by dropping it to a pr_debug.
Change-Id: I05b643a90abc17e0134830874555e79138237261
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Move topology_init to postcore initcall to retrive
cpu frequency table early in boot from OPP.
Change-Id: I814a022f646878ee608f18ff740b5dc29c77a3c7
Signed-off-by: Shiju Mathew <shijum@codeaurora.org>
Commit 02df19b422 ("ARM:
7424/1: update die handler from x86") refactored the ARM
die() logic to avoid a deadlock if a kernel oops happens
while holding a spinlock that may also be used in an IRQ
handler. Refactor the ARM64 die() handler in a similar way,
to avoid similar deadlocks, which would have otherwise
prevented the kernel from printing the full panic output
and properly completing the panic() path.
Change-Id: I217a8d719f64b54467fa88a583d83f72193d7580
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Define boot_reason and cold_boot variables in the arm64 version
of setup.c so that arm64 targets can export the boot_reason and
cold_boot sysctl entries.
This feature is required by the qpnp-power-on driver.
Change-Id: Id2d4ff5b8caa2e6a35d4ac61e338963d602c8b84
Signed-off-by: David Collins <collinsd@codeaurora.org>
[osvaldob: resolved trival merge conflicts]
Signed-off-by: Osvaldo Banuelos <osvaldob@codeaurora.org>
Nothing stops a process from hotplugging in a CPU concurrently
with a sys_reboot() call. In such a situation we could have
ipi_cpu_stop() mark a cpu as 'offline' and _cpu_up() ignore the
fact that the CPU is not really offline and call the
CPU_UP_PREPARE notifier. When this happens stop_machine code will
complain that the cpu thread already exists and BUG_ON().
CPU0 CPU1
sys_reboot()
kernel_restart()
machine_restart()
machine_shutdown()
smp_send_stop()
... ipi_cpu_stop()
set_cpu_online(1, false)
local_irq_disable()
while(1)
<PREEMPT>
cpu_up()
_cpu_up()
if (!cpu_online(1))
__cpu_notify(CPU_UP_PREPARE...)
cpu_stop_cpu_callback()
BUG_ON(stopper->thread)
This is easily reproducible by hotplugging in and out in a tight
loop while also rebooting.
Since the CPU is not really offline and hasn't gone through the
proper steps to be marked as such, let's mark the CPU as inactive.
This is just as easily testable as online and avoids any possibility
of _cpu_up() trying to bring the CPU back online when it never was
offline to begin with. Based on the similar patchset by for arm
targets 040c163( "ARM: smp: Fix cpu_up() racing with sys_reboot)"
CRs-fixed: 758395
Change-Id: Ia13a3aad8cd6616119a07b5114350591173a5d03
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
Currently, CPU online messages are printed using printk(),
and CPU offline messages are printed using pr_notice().
It seems rather silly to have the (otherwise symmetric)
messages to be printed using different log levels. Change
both messages to be printed using pr_debug() to match the
ARM implementation, to avoid disparities in log spam on
ARM/ARM64 with otherwise identical loglevel settings.
Change-Id: I58ce95c5b76093ee27678de497cf5c4cab4ad3aa
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
With multiple CPUs online, these memory dumps may consume a very
large amount of log buffer space, pushing out useful information.
Drop the call to dump_mem() for stack memory. The actual string-
formatted call stack will still be printed, which should be sufficient
for identifying the context of a panic. Stack memory can be collected
from full memory ramdumps if needed.
Change-Id: I2d08b49217b3838d3d3e7f8deceb937bb90ffaf7
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Due to the verbosity of printing, dumping memory regions for all
register when many CPUs are online may contribute to flooded kernel
logs. Spinlock lockups due to the printing have also been seen to
result, compounding the problem due to additional prints.
Change-Id: I7440b2d77f03fd34f36816f549588fa89322ce5f
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
[abhimany: resolve trivial merge conflicts]
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
External modules may need to use caching APIs. Export the symbols
to allow their use.
Change-Id: I72a862608d37dedf0980ee2790ffb93a9de82221
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[stepanm@codeaurora.org: resolve minor conflicts]
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
When CPU idle is enabled, the idle call should also notifiy the
idle_notifier_call_chain of the change in status. Otherwise some
processes will think the CPU is always active.
CRs-Fixed: 677525
Change-Id: Iabd6f617d6835688cf8b482ac1321e5c1deafffd
Signed-off-by: Patrick Cain <pcain@codeaurora.org>
The change to refactor kernel/setup.c to use the common
of_flat_dt_get_machine_name() API has apparently removed
the line which prints the device tree model string during
boot. Having the model string in the kernel log is helpful,
so add it back in.
Change-Id: I7dccc3ab00f5b67753cdd256846a522596c5058f
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
[abhimany: resolve trivial merge conflicts]
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
The dma_mask for a device structure is a pointer. This pointer
needs to be set up before the dma mask can actually be set. Most
frameworks in the kernel take care of setting this up properly but
platform devices that don't follow a regular bus structure may not
ever have this set. As a result, checks such as dma_capable will
always return false on a raw platform device and dma_set_mask will
always return -EIO. Fix this by adding a dma_mask in the
platform_device archdata and setting it to be the dma_mask. Devices
used in other frameworks can change this as needed.
Change-Id: I5bfd2aa75798dfdf49d3af70fdd95dfaf2126e8c
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[abhimany: resolve trivial merge conflicts]
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
The commit f3b4a40bc637a25c01c5ec66c825b4ddfc30328a introduced changes
to store CPU registers for all CPUs that handle IPI_CPU_STOP. The
structure to save the registers was intended to be a per-cpu variable.
However, the patch did not allocate a per-cpu structure and instead only
ended up providing a compiler per-cpu directive. Fix this bug by actually
defining a static per-cpu variable.
Change-Id: Iea7e52e91819f6f2c7f8d2c638545c0a68d2ef76
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Based on the commit 8b775be35e41b9ffa764411a632b52015d1e3d69
Sending an IPI_RESCHEDULE to an offline CPU is incorrect and potentially
bad for both power and stability. On some sub-architectures such as MSM,
if a power-collapsed CPU is unexpectedly woken up by an IPI, it will be
begin executing without the preparations that would normally happen as
part of CPU_UP_PREPARE. If clocks, voltage regulators, or other hardware
configuration are not performed, the booting CPU may cause general
instability or (at best) poor power performance since the CPU would be
powered up but not utilized.
One common cause for such issues is misuse of add_timer_on() or APIs
such as queue_work_on() which call it. If proper precautions are not
taken to block hotplug while these APIs are called then a race may
result in IPIs being sent to CPUs that are already offline.
This same argument could be applied to other IPIs (with the exception
of IPI_WAKEUP), but the others are already restricted to only online
CPUs by existing mechanisms, so an explicit assertion is not useful.
Change-Id: I2607082719b4cb216e53fb354649ea4c5c875b1e
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
When a kernel panic occurs on one CPU, other CPUs are instructed to stop
execution via the IPI_CPU_STOP message. These other CPUs dump their stack,
which may not be good enough to reconstruct their context to perform
post-mortem analysis. Dump each CPU's context (before it started
procesing the IPI) into a globally accessible structure and print them on
the dmesg/console to allow for easier post-mortem debugging.
Change-Id: Ifd7589af4327992540196c87f8b640045d7eaf19
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
[abhimany: resolve trivial merge conflic]
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
Modify the kernel code section with fixmap to handle the case where
the kernel text section is readonly.
Change-Id: I3f81fcbfe917ef42783e55b107289ad97e1c02c3
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Lorenzo reported that we could not properly find v4mapped sockets
in inet_diag_find_one_icsk(). This patch fixes the issue.
[cherry-pick of fc439d9489479411fbf9bbbec2c768df89e85503]
Change-Id: I13515e83fb76d4729f00047f9eb142c929390fb2
Reported-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
When closing a listen socket, tcp_abort currently calls
tcp_done without clearing the request queue. If the socket has a
child socket that is established but not yet accepted, the child
socket is then left without a parent, causing a leak.
Fix this by setting the socket state to TCP_CLOSE and calling
inet_csk_listen_stop with the socket lock held, like tcp_close
does.
Tested using net_test. With this patch, calling SOCK_DESTROY on a
listen socket that has an established but not yet accepted child
socket results in the parent and the child being closed, such
that they no longer appear in sock_diag dumps.
[cherry-pick of net-next 2010b93e9317cc12acd20c4aed385af7f9d1681e]
Change-Id: I0555a142f11d8b36362ffd7c8ef4a5ecae8987c9
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Adding support for SYN_RECV request sockets to tcp_abort()
is quite easy after our tcp listener rewrite.
Note that we also need to better handle listeners, or we might
leak not yet accepted children, because of a missing
inet_csk_listen_stop() call.
[cherry-pick of net-next 07f6f4a31e5a8dee67960fc07bb0b37c5f879d4d]
Change-Id: I8ec6b2e6ec24f330a69595abf1d5469ace79b3fd
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Lorenzo Colitti <lorenzo@google.com>
Tested-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>