vdso_datapage.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef _VDSO_DATAPAGE_H
  3. #define _VDSO_DATAPAGE_H
  4. #ifdef __KERNEL__
  5. /*
  6. * Copyright (C) 2002 Peter Bergner <[email protected]>, IBM
  7. * Copyright (C) 2005 Benjamin Herrenschmidy <[email protected]>,
  8. * IBM Corp.
  9. */
  10. /*
  11. * Note about this structure:
  12. *
  13. * This structure was historically called systemcfg and exposed to
  14. * userland via /proc/ppc64/systemcfg. Unfortunately, this became an
  15. * ABI issue as some proprietary software started relying on being able
  16. * to mmap() it, thus we have to keep the base layout at least for a
  17. * few kernel versions.
  18. *
  19. * However, since ppc32 doesn't suffer from this backward handicap,
  20. * a simpler version of the data structure is used there with only the
  21. * fields actually used by the vDSO.
  22. *
  23. */
  24. /*
  25. * If the major version changes we are incompatible.
  26. * Minor version changes are a hint.
  27. */
  28. #define SYSTEMCFG_MAJOR 1
  29. #define SYSTEMCFG_MINOR 1
  30. #ifndef __ASSEMBLY__
  31. #include <linux/unistd.h>
  32. #include <linux/time.h>
  33. #include <vdso/datapage.h>
  34. #define SYSCALL_MAP_SIZE ((NR_syscalls + 31) / 32)
  35. /*
  36. * So here is the ppc64 backward compatible version
  37. */
  38. #ifdef CONFIG_PPC64
  39. struct vdso_arch_data {
  40. __u8 eye_catcher[16]; /* Eyecatcher: SYSTEMCFG:PPC64 0x00 */
  41. struct { /* Systemcfg version numbers */
  42. __u32 major; /* Major number 0x10 */
  43. __u32 minor; /* Minor number 0x14 */
  44. } version;
  45. /* Note about the platform flags: it now only contains the lpar
  46. * bit. The actual platform number is dead and buried
  47. */
  48. __u32 platform; /* Platform flags 0x18 */
  49. __u32 processor; /* Processor type 0x1C */
  50. __u64 processorCount; /* # of physical processors 0x20 */
  51. __u64 physicalMemorySize; /* Size of real memory(B) 0x28 */
  52. __u64 tb_orig_stamp; /* (NU) Timebase at boot 0x30 */
  53. __u64 tb_ticks_per_sec; /* Timebase tics / sec 0x38 */
  54. __u64 tb_to_xs; /* (NU) Inverse of TB to 2^20 0x40 */
  55. __u64 stamp_xsec; /* (NU) 0x48 */
  56. __u64 tb_update_count; /* (NU) Timebase atomicity ctr 0x50 */
  57. __u32 tz_minuteswest; /* (NU) Min. west of Greenwich 0x58 */
  58. __u32 tz_dsttime; /* (NU) Type of dst correction 0x5C */
  59. __u32 dcache_size; /* L1 d-cache size 0x60 */
  60. __u32 dcache_line_size; /* L1 d-cache line size 0x64 */
  61. __u32 icache_size; /* L1 i-cache size 0x68 */
  62. __u32 icache_line_size; /* L1 i-cache line size 0x6C */
  63. /* those additional ones don't have to be located anywhere
  64. * special as they were not part of the original systemcfg
  65. */
  66. __u32 dcache_block_size; /* L1 d-cache block size */
  67. __u32 icache_block_size; /* L1 i-cache block size */
  68. __u32 dcache_log_block_size; /* L1 d-cache log block size */
  69. __u32 icache_log_block_size; /* L1 i-cache log block size */
  70. __u32 syscall_map[SYSCALL_MAP_SIZE]; /* Map of syscalls */
  71. __u32 compat_syscall_map[SYSCALL_MAP_SIZE]; /* Map of compat syscalls */
  72. struct vdso_data data[CS_BASES];
  73. };
  74. #else /* CONFIG_PPC64 */
  75. /*
  76. * And here is the simpler 32 bits version
  77. */
  78. struct vdso_arch_data {
  79. __u64 tb_ticks_per_sec; /* Timebase tics / sec 0x38 */
  80. __u32 syscall_map[SYSCALL_MAP_SIZE]; /* Map of syscalls */
  81. __u32 compat_syscall_map[0]; /* No compat syscalls on PPC32 */
  82. struct vdso_data data[CS_BASES];
  83. };
  84. #endif /* CONFIG_PPC64 */
  85. extern struct vdso_arch_data *vdso_data;
  86. #else /* __ASSEMBLY__ */
  87. .macro get_datapage ptr
  88. bcl 20, 31, .+4
  89. 999:
  90. mflr \ptr
  91. addis \ptr, \ptr, (_vdso_datapage - 999b)@ha
  92. addi \ptr, \ptr, (_vdso_datapage - 999b)@l
  93. .endm
  94. #endif /* __ASSEMBLY__ */
  95. #endif /* __KERNEL__ */
  96. #endif /* _SYSTEMCFG_H */