Files
kernel_arpi/include/trace/hooks/psci.h
Jian Gong ace93ca5ef ANDROID: GKI: psci: add hook to check if cpu is allowed to power off
While TOS is running alongside with linux, cpu power off operation by linux
may need be denied by TOS in some scenarios.
This patch added two hooks in psci_tos_resident_on and psci_cpu_suspend
to hook cpu off operation.

The function psci_tos_resident_on originally is used to check if TOS is resident on
a specific cpu and that cpu is dedicated for running TOS exclusively. If so, that
cpu can not be power off. Actually if TOS supports SMP, TOS may need deny any
other cpu to power down in some cases, i.e. there are no-expired timers in TOS.
Thus the first hook for psci_tos_resident_on is used to determine if
the specific cpu is allowed to power off in the cpu hotplug path.

Besides cpu hotplug, a cpu also can power off by cpu_suspend.
The second hook for psci_cpu_suspend determines if cpu suspend should go through
or not. When the same conditions described above meets, cpu suspend will break up.

The hook is same as commit 88d88955ae0b8b1f1a555d7810beb6c8ca4ca0f1 from android12-5.4

Bug: 229067021
Change-Id: Ib329beeff20f0cfef263f6a7813280d33f6a5eaa
Signed-off-by: Jian Gong <Jian.Gong@unisoc.com>
2022-04-20 00:31:37 +00:00

26 lines
659 B
C

/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM psci
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_PSCI_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_PSCI_H
#include <trace/hooks/vendor_hooks.h>
DECLARE_HOOK(android_vh_psci_tos_resident_on,
TP_PROTO(int cpu, bool *resident),
TP_ARGS(cpu, resident));
DECLARE_HOOK(android_vh_psci_cpu_suspend,
TP_PROTO(u32 state, bool *deny),
TP_ARGS(state, deny));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_PSCI_H */
/* This part must be outside protection */
#include <trace/define_trace.h>