Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef _VDSO_DATAPAGE_H
0003 #define _VDSO_DATAPAGE_H
0004 #ifdef __KERNEL__
0005 
0006 /*
0007  * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM
0008  * Copyright (C) 2005 Benjamin Herrenschmidy <benh@kernel.crashing.org>,
0009  *            IBM Corp.
0010  */
0011 
0012 
0013 /*
0014  * Note about this structure:
0015  *
0016  * This structure was historically called systemcfg and exposed to
0017  * userland via /proc/ppc64/systemcfg. Unfortunately, this became an
0018  * ABI issue as some proprietary software started relying on being able
0019  * to mmap() it, thus we have to keep the base layout at least for a
0020  * few kernel versions.
0021  *
0022  * However, since ppc32 doesn't suffer from this backward handicap,
0023  * a simpler version of the data structure is used there with only the
0024  * fields actually used by the vDSO.
0025  *
0026  */
0027 
0028 /*
0029  * If the major version changes we are incompatible.
0030  * Minor version changes are a hint.
0031  */
0032 #define SYSTEMCFG_MAJOR 1
0033 #define SYSTEMCFG_MINOR 1
0034 
0035 #ifndef __ASSEMBLY__
0036 
0037 #include <linux/unistd.h>
0038 #include <linux/time.h>
0039 #include <vdso/datapage.h>
0040 
0041 #define SYSCALL_MAP_SIZE      ((NR_syscalls + 31) / 32)
0042 
0043 /*
0044  * So here is the ppc64 backward compatible version
0045  */
0046 
0047 #ifdef CONFIG_PPC64
0048 
0049 struct vdso_arch_data {
0050     __u8  eye_catcher[16];      /* Eyecatcher: SYSTEMCFG:PPC64  0x00 */
0051     struct {            /* Systemcfg version numbers         */
0052         __u32 major;        /* Major number         0x10 */
0053         __u32 minor;        /* Minor number         0x14 */
0054     } version;
0055 
0056     /* Note about the platform flags: it now only contains the lpar
0057      * bit. The actual platform number is dead and buried
0058      */
0059     __u32 platform;         /* Platform flags       0x18 */
0060     __u32 processor;        /* Processor type       0x1C */
0061     __u64 processorCount;       /* # of physical processors 0x20 */
0062     __u64 physicalMemorySize;   /* Size of real memory(B)   0x28 */
0063     __u64 tb_orig_stamp;        /* (NU) Timebase at boot    0x30 */
0064     __u64 tb_ticks_per_sec;     /* Timebase tics / sec      0x38 */
0065     __u64 tb_to_xs;         /* (NU) Inverse of TB to 2^20   0x40 */
0066     __u64 stamp_xsec;       /* (NU)             0x48 */
0067     __u64 tb_update_count;      /* (NU) Timebase atomicity ctr  0x50 */
0068     __u32 tz_minuteswest;       /* (NU) Min. west of Greenwich  0x58 */
0069     __u32 tz_dsttime;       /* (NU) Type of dst correction  0x5C */
0070     __u32 dcache_size;      /* L1 d-cache size      0x60 */
0071     __u32 dcache_line_size;     /* L1 d-cache line size     0x64 */
0072     __u32 icache_size;      /* L1 i-cache size      0x68 */
0073     __u32 icache_line_size;     /* L1 i-cache line size     0x6C */
0074 
0075     /* those additional ones don't have to be located anywhere
0076      * special as they were not part of the original systemcfg
0077      */
0078     __u32 dcache_block_size;        /* L1 d-cache block size     */
0079     __u32 icache_block_size;        /* L1 i-cache block size     */
0080     __u32 dcache_log_block_size;        /* L1 d-cache log block size */
0081     __u32 icache_log_block_size;        /* L1 i-cache log block size */
0082     __u32 syscall_map[SYSCALL_MAP_SIZE];    /* Map of syscalls  */
0083     __u32 compat_syscall_map[SYSCALL_MAP_SIZE]; /* Map of compat syscalls */
0084 
0085     struct vdso_data data[CS_BASES];
0086 };
0087 
0088 #else /* CONFIG_PPC64 */
0089 
0090 /*
0091  * And here is the simpler 32 bits version
0092  */
0093 struct vdso_arch_data {
0094     __u64 tb_ticks_per_sec;     /* Timebase tics / sec      0x38 */
0095     __u32 syscall_map[SYSCALL_MAP_SIZE]; /* Map of syscalls */
0096     __u32 compat_syscall_map[0];    /* No compat syscalls on PPC32 */
0097     struct vdso_data data[CS_BASES];
0098 };
0099 
0100 #endif /* CONFIG_PPC64 */
0101 
0102 extern struct vdso_arch_data *vdso_data;
0103 
0104 #else /* __ASSEMBLY__ */
0105 
0106 .macro get_datapage ptr
0107     bcl 20, 31, .+4
0108 999:
0109     mflr    \ptr
0110     addis   \ptr, \ptr, (_vdso_datapage - 999b)@ha
0111     addi    \ptr, \ptr, (_vdso_datapage - 999b)@l
0112 .endm
0113 
0114 #endif /* __ASSEMBLY__ */
0115 
0116 #endif /* __KERNEL__ */
0117 #endif /* _SYSTEMCFG_H */