Files
kernel_arpi/include/linux/android_vendor.h
Jaskaran Singh e12dcc29cc ANDROID: Configure out the macros in android_kabi and android_vendor
Add configs to control removing the macros or not. On some platform,
configureing out the macros removes the associated members from the
structs, this reduces the object size of the slabs related with the
structs, therefore reduces the total slab memory consumption of system.

Besides, this also reduces vmlinux size a bit, therefore the total
kernel memory size increses a bit.

The macros are ANDROID_KABI_RESERVE, ANDROID_VENDOR_DATA,
ANDROID_VENDOR_DATA_ARRAY, ANDROID_OEM_DATA, ANDROID_OEM_DATA_ARRAY.

Bug: 206561931
(cherry picked from commit b7a6c15a6f)
Signed-off-by: Qingqing Zhou <quic_qqzhou@quicinc.com>
(cherry picked from commit 3c06a5ce5e5857a1dff88a784e58e32bbddaf759)
Signed-off-by: Jaskaran Singh <quic_jasksing@quicinc.com>
Change-Id: Iea4b962dff386a17c9bef20ae048be4e17bf43ab
2022-04-13 06:17:34 +00:00

51 lines
1.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* android_vendor.h - Android vendor data
*
* Copyright 2020 Google LLC
*
* These macros are to be used to reserve space in kernel data structures
* for use by vendor modules.
*
* These macros should be used before the kernel abi is "frozen".
* Fields can be added to various kernel structures that need space
* for functionality implemented in vendor modules. The use of
* these fields is vendor specific.
*/
#ifndef _ANDROID_VENDOR_H
#define _ANDROID_VENDOR_H
/*
* ANDROID_VENDOR_DATA
* Reserve some "padding" in a structure for potential future use.
* This normally placed at the end of a structure.
* number: the "number" of the padding variable in the structure. Start with
* 1 and go up.
*
* ANDROID_VENDOR_DATA_ARRAY
* Same as ANDROID_VENDOR_DATA but allocates an array of u64 with
* the specified size
*/
#ifdef CONFIG_ANDROID_VENDOR_OEM_DATA
#define ANDROID_VENDOR_DATA(n) u64 android_vendor_data##n
#define ANDROID_VENDOR_DATA_ARRAY(n, s) u64 android_vendor_data##n[s]
#define ANDROID_OEM_DATA(n) u64 android_oem_data##n
#define ANDROID_OEM_DATA_ARRAY(n, s) u64 android_oem_data##n[s]
#define android_init_vendor_data(p, n) \
memset(&p->android_vendor_data##n, 0, sizeof(p->android_vendor_data##n))
#define android_init_oem_data(p, n) \
memset(&p->android_oem_data##n, 0, sizeof(p->android_oem_data##n))
#else
#define ANDROID_VENDOR_DATA(n)
#define ANDROID_VENDOR_DATA_ARRAY(n, s)
#define ANDROID_OEM_DATA(n)
#define ANDROID_OEM_DATA_ARRAY(n, s)
#define android_init_vendor_data(p, n)
#define android_init_oem_data(p, n)
#endif
#endif /* _ANDROID_VENDOR_H */