18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __S390_VDSO_H__
38c2ecf20Sopenharmony_ci#define __S390_VDSO_H__
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <vdso/datapage.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/* Default link addresses for the vDSOs */
88c2ecf20Sopenharmony_ci#define VDSO32_LBASE	0
98c2ecf20Sopenharmony_ci#define VDSO64_LBASE	0
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define VDSO_VERSION_STRING	LINUX_2.6.29
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/*
168c2ecf20Sopenharmony_ci * Note about the vdso_data and vdso_per_cpu_data structures:
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci * NEVER USE THEM IN USERSPACE CODE DIRECTLY. The layout of the
198c2ecf20Sopenharmony_ci * structure is supposed to be known only to the function in the vdso
208c2ecf20Sopenharmony_ci * itself and may change without notice.
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistruct vdso_per_cpu_data {
248c2ecf20Sopenharmony_ci	/*
258c2ecf20Sopenharmony_ci	 * Note: node_id and cpu_nr must be at adjacent memory locations.
268c2ecf20Sopenharmony_ci	 * VDSO userspace must read both values with a single instruction.
278c2ecf20Sopenharmony_ci	 */
288c2ecf20Sopenharmony_ci	union {
298c2ecf20Sopenharmony_ci		__u64 getcpu_val;
308c2ecf20Sopenharmony_ci		struct {
318c2ecf20Sopenharmony_ci			__u32 node_id;
328c2ecf20Sopenharmony_ci			__u32 cpu_nr;
338c2ecf20Sopenharmony_ci		};
348c2ecf20Sopenharmony_ci	};
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciextern struct vdso_data *vdso_data;
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciint vdso_alloc_per_cpu(struct lowcore *lowcore);
408c2ecf20Sopenharmony_civoid vdso_free_per_cpu(struct lowcore *lowcore);
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
438c2ecf20Sopenharmony_ci#endif /* __S390_VDSO_H__ */
44