1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */ 2*4882a593Smuzhiyun #ifndef _VDSO_DATAPAGE_H 3*4882a593Smuzhiyun #define _VDSO_DATAPAGE_H 4*4882a593Smuzhiyun #ifdef __KERNEL__ 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun /* 7*4882a593Smuzhiyun * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM 8*4882a593Smuzhiyun * Copyright (C) 2005 Benjamin Herrenschmidy <benh@kernel.crashing.org>, 9*4882a593Smuzhiyun * IBM Corp. 10*4882a593Smuzhiyun */ 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun /* 14*4882a593Smuzhiyun * Note about this structure: 15*4882a593Smuzhiyun * 16*4882a593Smuzhiyun * This structure was historically called systemcfg and exposed to 17*4882a593Smuzhiyun * userland via /proc/ppc64/systemcfg. Unfortunately, this became an 18*4882a593Smuzhiyun * ABI issue as some proprietary software started relying on being able 19*4882a593Smuzhiyun * to mmap() it, thus we have to keep the base layout at least for a 20*4882a593Smuzhiyun * few kernel versions. 21*4882a593Smuzhiyun * 22*4882a593Smuzhiyun * However, since ppc32 doesn't suffer from this backward handicap, 23*4882a593Smuzhiyun * a simpler version of the data structure is used there with only the 24*4882a593Smuzhiyun * fields actually used by the vDSO. 25*4882a593Smuzhiyun * 26*4882a593Smuzhiyun */ 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun /* 29*4882a593Smuzhiyun * If the major version changes we are incompatible. 30*4882a593Smuzhiyun * Minor version changes are a hint. 31*4882a593Smuzhiyun */ 32*4882a593Smuzhiyun #define SYSTEMCFG_MAJOR 1 33*4882a593Smuzhiyun #define SYSTEMCFG_MINOR 1 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun #ifndef __ASSEMBLY__ 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun #include <linux/unistd.h> 38*4882a593Smuzhiyun #include <linux/time.h> 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun #define SYSCALL_MAP_SIZE ((NR_syscalls + 31) / 32) 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun /* 43*4882a593Smuzhiyun * So here is the ppc64 backward compatible version 44*4882a593Smuzhiyun */ 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun #ifdef CONFIG_PPC64 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun struct vdso_data { 49*4882a593Smuzhiyun __u8 eye_catcher[16]; /* Eyecatcher: SYSTEMCFG:PPC64 0x00 */ 50*4882a593Smuzhiyun struct { /* Systemcfg version numbers */ 51*4882a593Smuzhiyun __u32 major; /* Major number 0x10 */ 52*4882a593Smuzhiyun __u32 minor; /* Minor number 0x14 */ 53*4882a593Smuzhiyun } version; 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun /* Note about the platform flags: it now only contains the lpar 56*4882a593Smuzhiyun * bit. The actual platform number is dead and buried 57*4882a593Smuzhiyun */ 58*4882a593Smuzhiyun __u32 platform; /* Platform flags 0x18 */ 59*4882a593Smuzhiyun __u32 processor; /* Processor type 0x1C */ 60*4882a593Smuzhiyun __u64 processorCount; /* # of physical processors 0x20 */ 61*4882a593Smuzhiyun __u64 physicalMemorySize; /* Size of real memory(B) 0x28 */ 62*4882a593Smuzhiyun __u64 tb_orig_stamp; /* Timebase at boot 0x30 */ 63*4882a593Smuzhiyun __u64 tb_ticks_per_sec; /* Timebase tics / sec 0x38 */ 64*4882a593Smuzhiyun __u64 tb_to_xs; /* Inverse of TB to 2^20 0x40 */ 65*4882a593Smuzhiyun __u64 stamp_xsec; /* 0x48 */ 66*4882a593Smuzhiyun __u64 tb_update_count; /* Timebase atomicity ctr 0x50 */ 67*4882a593Smuzhiyun __u32 tz_minuteswest; /* Minutes west of Greenwich 0x58 */ 68*4882a593Smuzhiyun __u32 tz_dsttime; /* Type of dst correction 0x5C */ 69*4882a593Smuzhiyun __u32 dcache_size; /* L1 d-cache size 0x60 */ 70*4882a593Smuzhiyun __u32 dcache_line_size; /* L1 d-cache line size 0x64 */ 71*4882a593Smuzhiyun __u32 icache_size; /* L1 i-cache size 0x68 */ 72*4882a593Smuzhiyun __u32 icache_line_size; /* L1 i-cache line size 0x6C */ 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun /* those additional ones don't have to be located anywhere 75*4882a593Smuzhiyun * special as they were not part of the original systemcfg 76*4882a593Smuzhiyun */ 77*4882a593Smuzhiyun __u32 dcache_block_size; /* L1 d-cache block size */ 78*4882a593Smuzhiyun __u32 icache_block_size; /* L1 i-cache block size */ 79*4882a593Smuzhiyun __u32 dcache_log_block_size; /* L1 d-cache log block size */ 80*4882a593Smuzhiyun __u32 icache_log_block_size; /* L1 i-cache log block size */ 81*4882a593Smuzhiyun __u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */ 82*4882a593Smuzhiyun __s32 wtom_clock_nsec; /* Wall to monotonic clock nsec */ 83*4882a593Smuzhiyun __s64 wtom_clock_sec; /* Wall to monotonic clock sec */ 84*4882a593Smuzhiyun __s64 stamp_xtime_sec; /* xtime secs as at tb_orig_stamp */ 85*4882a593Smuzhiyun __s64 stamp_xtime_nsec; /* xtime nsecs as at tb_orig_stamp */ 86*4882a593Smuzhiyun __u32 hrtimer_res; /* hrtimer resolution */ 87*4882a593Smuzhiyun __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */ 88*4882a593Smuzhiyun __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ 89*4882a593Smuzhiyun }; 90*4882a593Smuzhiyun 91*4882a593Smuzhiyun #else /* CONFIG_PPC64 */ 92*4882a593Smuzhiyun 93*4882a593Smuzhiyun /* 94*4882a593Smuzhiyun * And here is the simpler 32 bits version 95*4882a593Smuzhiyun */ 96*4882a593Smuzhiyun struct vdso_data { 97*4882a593Smuzhiyun __u64 tb_orig_stamp; /* Timebase at boot 0x30 */ 98*4882a593Smuzhiyun __u64 tb_ticks_per_sec; /* Timebase tics / sec 0x38 */ 99*4882a593Smuzhiyun __u64 tb_to_xs; /* Inverse of TB to 2^20 0x40 */ 100*4882a593Smuzhiyun __u64 stamp_xsec; /* 0x48 */ 101*4882a593Smuzhiyun __u32 tb_update_count; /* Timebase atomicity ctr 0x50 */ 102*4882a593Smuzhiyun __u32 tz_minuteswest; /* Minutes west of Greenwich 0x58 */ 103*4882a593Smuzhiyun __u32 tz_dsttime; /* Type of dst correction 0x5C */ 104*4882a593Smuzhiyun __s32 wtom_clock_sec; /* Wall to monotonic clock */ 105*4882a593Smuzhiyun __s32 wtom_clock_nsec; 106*4882a593Smuzhiyun __s32 stamp_xtime_sec; /* xtime seconds as at tb_orig_stamp */ 107*4882a593Smuzhiyun __s32 stamp_xtime_nsec; /* xtime nsecs as at tb_orig_stamp */ 108*4882a593Smuzhiyun __u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */ 109*4882a593Smuzhiyun __u32 hrtimer_res; /* hrtimer resolution */ 110*4882a593Smuzhiyun __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ 111*4882a593Smuzhiyun }; 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun #endif /* CONFIG_PPC64 */ 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun extern struct vdso_data *vdso_data; 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun #else /* __ASSEMBLY__ */ 118*4882a593Smuzhiyun 119*4882a593Smuzhiyun .macro get_datapage ptr, tmp 120*4882a593Smuzhiyun bcl 20, 31, .+4 121*4882a593Smuzhiyun mflr \ptr 122*4882a593Smuzhiyun addi \ptr, \ptr, (__kernel_datapage_offset - (.-4))@l 123*4882a593Smuzhiyun lwz \tmp, 0(\ptr) 124*4882a593Smuzhiyun add \ptr, \tmp, \ptr 125*4882a593Smuzhiyun .endm 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun #endif /* __ASSEMBLY__ */ 128*4882a593Smuzhiyun 129*4882a593Smuzhiyun #endif /* __KERNEL__ */ 130*4882a593Smuzhiyun #endif /* _SYSTEMCFG_H */ 131