1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2b020632eSMartin Schwidefsky #ifndef __S390_VDSO_H__ 3b020632eSMartin Schwidefsky #define __S390_VDSO_H__ 4b020632eSMartin Schwidefsky 5b020632eSMartin Schwidefsky /* Default link addresses for the vDSOs */ 6b020632eSMartin Schwidefsky #define VDSO32_LBASE 0 7b020632eSMartin Schwidefsky #define VDSO64_LBASE 0 8b020632eSMartin Schwidefsky 913c6680aSMartin Schwidefsky #define VDSO_VERSION_STRING LINUX_2.6.29 10b020632eSMartin Schwidefsky 11b020632eSMartin Schwidefsky #ifndef __ASSEMBLY__ 12b020632eSMartin Schwidefsky 13b020632eSMartin Schwidefsky /* 14c742b31cSMartin Schwidefsky * Note about the vdso_data and vdso_per_cpu_data structures: 15b020632eSMartin Schwidefsky * 16c742b31cSMartin Schwidefsky * NEVER USE THEM IN USERSPACE CODE DIRECTLY. The layout of the 17b020632eSMartin Schwidefsky * structure is supposed to be known only to the function in the vdso 18b020632eSMartin Schwidefsky * itself and may change without notice. 19b020632eSMartin Schwidefsky */ 20b020632eSMartin Schwidefsky 21b020632eSMartin Schwidefsky struct vdso_data { 22b020632eSMartin Schwidefsky __u64 tb_update_count; /* Timebase atomicity ctr 0x00 */ 23b020632eSMartin Schwidefsky __u64 xtime_tod_stamp; /* TOD clock for xtime 0x08 */ 24b020632eSMartin Schwidefsky __u64 xtime_clock_sec; /* Kernel time 0x10 */ 25b020632eSMartin Schwidefsky __u64 xtime_clock_nsec; /* 0x18 */ 26b7eacb59SMartin Schwidefsky __u64 xtime_coarse_sec; /* Coarse kernel time 0x20 */ 27b7eacb59SMartin Schwidefsky __u64 xtime_coarse_nsec; /* 0x28 */ 28b7eacb59SMartin Schwidefsky __u64 wtom_clock_sec; /* Wall to monotonic clock 0x30 */ 29b7eacb59SMartin Schwidefsky __u64 wtom_clock_nsec; /* 0x38 */ 30b7eacb59SMartin Schwidefsky __u64 wtom_coarse_sec; /* Coarse wall to monotonic 0x40 */ 31b7eacb59SMartin Schwidefsky __u64 wtom_coarse_nsec; /* 0x48 */ 32b7eacb59SMartin Schwidefsky __u32 tz_minuteswest; /* Minutes west of Greenwich 0x50 */ 33b7eacb59SMartin Schwidefsky __u32 tz_dsttime; /* Type of dst correction 0x54 */ 34b7eacb59SMartin Schwidefsky __u32 ectg_available; /* ECTG instruction present 0x58 */ 35b7eacb59SMartin Schwidefsky __u32 tk_mult; /* Mult. used for xtime_nsec 0x5c */ 36b7eacb59SMartin Schwidefsky __u32 tk_shift; /* Shift used for xtime_nsec 0x60 */ 3775c7b6f3SMartin Schwidefsky __u32 ts_dir; /* TOD steering direction 0x64 */ 3875c7b6f3SMartin Schwidefsky __u64 ts_end; /* TOD steering end 0x68 */ 39c742b31cSMartin Schwidefsky }; 40c742b31cSMartin Schwidefsky 41c742b31cSMartin Schwidefsky struct vdso_per_cpu_data { 42c742b31cSMartin Schwidefsky __u64 ectg_timer_base; 43c742b31cSMartin Schwidefsky __u64 ectg_user_time; 445a5525b0SHeiko Carstens /* 455a5525b0SHeiko Carstens * Note: node_id and cpu_nr must be at adjacent memory locations. 465a5525b0SHeiko Carstens * VDSO userspace must read both values with a single instruction. 475a5525b0SHeiko Carstens */ 485a5525b0SHeiko Carstens union { 495a5525b0SHeiko Carstens __u64 getcpu_val; 505a5525b0SHeiko Carstens struct { 51249c543bSMartin Schwidefsky __u32 node_id; 525a5525b0SHeiko Carstens __u32 cpu_nr; 535a5525b0SHeiko Carstens }; 545a5525b0SHeiko Carstens }; 55b020632eSMartin Schwidefsky }; 56b020632eSMartin Schwidefsky 57b020632eSMartin Schwidefsky extern struct vdso_data *vdso_data; 583c6153e8SHeiko Carstens extern struct vdso_data boot_vdso_data; 59b020632eSMartin Schwidefsky 60608796ffSMartin Schwidefsky void vdso_alloc_boot_cpu(struct lowcore *lowcore); 61c667aeacSHeiko Carstens int vdso_alloc_per_cpu(struct lowcore *lowcore); 62c667aeacSHeiko Carstens void vdso_free_per_cpu(struct lowcore *lowcore); 63c742b31cSMartin Schwidefsky 64b020632eSMartin Schwidefsky #endif /* __ASSEMBLY__ */ 65b020632eSMartin Schwidefsky #endif /* __S390_VDSO_H__ */ 66