Files
Nikhil V 158c40e5ec ANDROID: vendor_hooks: Add hooks to support hibernation
In case of hibernation with compression enabled, 'n' number of pages
will be compressed to 'x' number of pages before being written to the
disk. Keep a note of these compressed block counts so that bootloader
can directly read 'x' pages and pass it on to the decompressor. An
array will be maintained which will hold the count of these compressed
blocks and later on written to the the disk as part of the hibernation
image save process.

The vendor hook '__tracepoint_android_vh_hibernated_do_mem_alloc' does
the required memory allocations, for example, the array which is
dynamically allocated based on the snapshot image size so as to hold
the compressed block counts etc. This memory is later freed as part of
PM_POST_HIBERNATION notifier call.

The vendor hook '__tracepoint_android_vh_hibernate_save_cmp_len' saves
the compressed block counts to the array which is later written to the
disk.

Bug: 335581841
Change-Id: I574b641e2d9f4cd503c7768a66a7be3142c2686b
Signed-off-by: Nikhil V <quic_nprakash@quicinc.com>
2025-04-17 11:30:49 -07:00

54 lines
1.4 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM bl_hib
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_S2D_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_S2D_H
#include <trace/hooks/vendor_hooks.h>
struct file;
DECLARE_HOOK(android_vh_check_hibernation_swap,
TP_PROTO(struct file *resume_block_file, bool *hib_swap),
TP_ARGS(resume_block_file, hib_swap));
DECLARE_HOOK(android_vh_save_cpu_resume,
TP_PROTO(u64 *addr, u64 phys_addr),
TP_ARGS(addr, phys_addr));
DECLARE_HOOK(android_vh_save_hib_resume_bdev,
TP_PROTO(struct file *hib_resume_bdev_file),
TP_ARGS(hib_resume_bdev_file));
DECLARE_HOOK(android_vh_encrypt_page,
TP_PROTO(void *buf),
TP_ARGS(buf));
DECLARE_HOOK(android_vh_init_aes_encrypt,
TP_PROTO(void *unused),
TP_ARGS(unused));
DECLARE_HOOK(android_vh_skip_swap_map_write,
TP_PROTO(bool *skip),
TP_ARGS(skip));
DECLARE_HOOK(android_vh_post_image_save,
TP_PROTO(unsigned short root_swap),
TP_ARGS(root_swap));
DECLARE_HOOK(android_vh_hibernated_do_mem_alloc,
TP_PROTO(unsigned long nr_pages, unsigned int swsusp_header_flags,
int *ret),
TP_ARGS(nr_pages, swsusp_header_flags, ret));
DECLARE_HOOK(android_vh_hibernate_save_cmp_len,
TP_PROTO(size_t cmp_len),
TP_ARGS(cmp_len));
#endif /* _TRACE_HOOK_S2D_H */
/* This part must be outside protection */
#include <trace/define_trace.h>