| .. | .. |
|---|
| 5 | 5 | #ifndef __ASSEMBLY__ |
|---|
| 6 | 6 | |
|---|
| 7 | 7 | #include <linux/compiler.h> |
|---|
| 8 | | -#include <linux/compat_time.h> |
|---|
| 9 | 8 | #include <uapi/linux/time.h> |
|---|
| 10 | 9 | #include <uapi/linux/types.h> |
|---|
| 11 | 10 | #include <uapi/asm-generic/errno-base.h> |
|---|
| .. | .. |
|---|
| 19 | 18 | #include <vdso/time.h> |
|---|
| 20 | 19 | #include <vdso/time32.h> |
|---|
| 21 | 20 | #include <vdso/time64.h> |
|---|
| 21 | + |
|---|
| 22 | +#ifdef CONFIG_ARCH_HAS_VDSO_DATA |
|---|
| 23 | +#include <asm/vdso/data.h> |
|---|
| 24 | +#else |
|---|
| 25 | +struct arch_vdso_data {}; |
|---|
| 26 | +#endif |
|---|
| 22 | 27 | |
|---|
| 23 | 28 | #define VDSO_BASES (CLOCK_TAI + 1) |
|---|
| 24 | 29 | #define VDSO_HRES (BIT(CLOCK_REALTIME) | \ |
|---|
| .. | .. |
|---|
| 60 | 65 | * @mult: clocksource multiplier |
|---|
| 61 | 66 | * @shift: clocksource shift |
|---|
| 62 | 67 | * @basetime[clock_id]: basetime per clock_id |
|---|
| 68 | + * @offset[clock_id]: time namespace offset per clock_id |
|---|
| 63 | 69 | * @tz_minuteswest: minutes west of Greenwich |
|---|
| 64 | 70 | * @tz_dsttime: type of DST correction |
|---|
| 65 | 71 | * @hrtimer_res: hrtimer resolution |
|---|
| 66 | 72 | * @__unused: unused |
|---|
| 73 | + * @arch_data: architecture specific data (optional, defaults |
|---|
| 74 | + * to an empty struct) |
|---|
| 67 | 75 | * |
|---|
| 68 | 76 | * vdso_data will be accessed by 64 bit and compat code at the same time |
|---|
| 69 | 77 | * so we should be careful before modifying this structure. |
|---|
| 78 | + * |
|---|
| 79 | + * @basetime is used to store the base time for the system wide time getter |
|---|
| 80 | + * VVAR page. |
|---|
| 81 | + * |
|---|
| 82 | + * @offset is used by the special time namespace VVAR pages which are |
|---|
| 83 | + * installed instead of the real VVAR page. These namespace pages must set |
|---|
| 84 | + * @seq to 1 and @clock_mode to VDSO_CLOCKMODE_TIMENS to force the code into |
|---|
| 85 | + * the time namespace slow path. The namespace aware functions retrieve the |
|---|
| 86 | + * real system wide VVAR page, read host time and add the per clock offset. |
|---|
| 87 | + * For clocks which are not affected by time namespace adjustment the |
|---|
| 88 | + * offset must be zero. |
|---|
| 70 | 89 | */ |
|---|
| 71 | 90 | struct vdso_data { |
|---|
| 72 | 91 | u32 seq; |
|---|
| .. | .. |
|---|
| 77 | 96 | u32 mult; |
|---|
| 78 | 97 | u32 shift; |
|---|
| 79 | 98 | |
|---|
| 80 | | - struct vdso_timestamp basetime[VDSO_BASES]; |
|---|
| 99 | + union { |
|---|
| 100 | + struct vdso_timestamp basetime[VDSO_BASES]; |
|---|
| 101 | + struct timens_offset offset[VDSO_BASES]; |
|---|
| 102 | + }; |
|---|
| 81 | 103 | |
|---|
| 82 | 104 | s32 tz_minuteswest; |
|---|
| 83 | 105 | s32 tz_dsttime; |
|---|
| 84 | 106 | u32 hrtimer_res; |
|---|
| 85 | 107 | u32 __unused; |
|---|
| 108 | + |
|---|
| 109 | + struct arch_vdso_data arch_data; |
|---|
| 86 | 110 | }; |
|---|
| 87 | 111 | |
|---|
| 88 | 112 | /* |
|---|
| .. | .. |
|---|
| 95 | 119 | * relocation, and this is what we need. |
|---|
| 96 | 120 | */ |
|---|
| 97 | 121 | extern struct vdso_data _vdso_data[CS_BASES] __attribute__((visibility("hidden"))); |
|---|
| 122 | +extern struct vdso_data _timens_data[CS_BASES] __attribute__((visibility("hidden"))); |
|---|
| 98 | 123 | |
|---|
| 99 | 124 | /* |
|---|
| 100 | 125 | * The generic vDSO implementation requires that gettimeofday.h |
|---|