History

Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 and cross-arch updates from Catalin Marinas: "Here's a slightly wider-spread set of updates for 5.9. Going outside the usual arch/arm64/ area is the removal of read_barrier_depends() series from Will and the MSI/IOMMU ID translation series from Lorenzo. The notable arm64 updates include ARMv8.4 TLBI range operations and translation level hint, time namespace support, and perf. Summary: - Removal of the tremendously unpopular read_barrier_depends() barrier, which is a NOP on all architectures apart from Alpha, in favour of allowing architectures to override READ_ONCE() and do whatever dance they need to do to ensure address dependencies provide LOAD -> LOAD/STORE ordering. This work also offers a potential solution if compilers are shown to convert LOAD -> LOAD address dependencies into control dependencies (e.g. under LTO), as weakly ordered architectures will effectively be able to upgrade READ_ONCE() to smp_load_acquire(). The latter case is not used yet, but will be discussed further at LPC. - Make the MSI/IOMMU input/output ID translation PCI agnostic, augment the MSI/IOMMU ACPI/OF ID mapping APIs to accept an input ID bus-specific parameter and apply the resulting changes to the device ID space provided by the Freescale FSL bus. - arm64 support for TLBI range operations and translation table level hints (part of the ARMv8.4 architecture version). - Time namespace support for arm64. - Export the virtual and physical address sizes in vmcoreinfo for makedumpfile and crash utilities. - CPU feature handling cleanups and checks for programmer errors (overlapping bit-fields). - ACPI updates for arm64: disallow AML accesses to EFI code regions and kernel memory. - perf updates for arm64. - Miscellaneous fixes and cleanups, most notably PLT counting optimisation for module loading, recordmcount fix to ignore relocations other than R_AARCH64_CALL26, CMA areas reserved for gigantic pages on 16K and 64K configurations. - Trivial typos, duplicate words" Link: http://lkml.kernel.org/r/20200710165203.31284-1-will@kernel.org Link: http://lkml.kernel.org/r/20200619082013.13661-1-lorenzo.pieralisi@arm.com * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (82 commits) arm64: use IRQ_STACK_SIZE instead of THREAD_SIZE for irq stack arm64/mm: save memory access in check_and_switch_context() fast switch path arm64: sigcontext.h: delete duplicated word arm64: ptrace.h: delete duplicated word arm64: pgtable-hwdef.h: delete duplicated words bus: fsl-mc: Add ACPI support for fsl-mc bus/fsl-mc: Refactor the MSI domain creation in the DPRC driver of/irq: Make of_msi_map_rid() PCI bus agnostic of/irq: make of_msi_map_get_device_domain() bus agnostic dt-bindings: arm: fsl: Add msi-map device-tree binding for fsl-mc bus of/device: Add input id to of_dma_configure() of/iommu: Make of_map_rid() PCI agnostic ACPI/IORT: Add an input ID to acpi_dma_configure() ACPI/IORT: Remove useless PCI bus walk ACPI/IORT: Make iort_msi_map_rid() PCI agnostic ACPI/IORT: Make iort_get_device_domain IRQ domain agnostic ACPI/IORT: Make iort_match_node_callback walk the ACPI namespace for NC arm64: enable time namespace support arm64/vdso: Restrict splitting VVAR VMA arm64/vdso: Handle faults on timens page ...

Linus Torvalds committed 6 years ago

Commit 145ff1e2 parents 8c4e1c0 0e4cd9f98 files · +1892 −1091Browse files

Showing the changes to include/linux (13 of 98 files). Show all

Unified · Split

13 files
  1. include/linux/acpi.h +7 −0
  2. include/linux/acpi_iort.h +11 −9
  3. include/linux/arm-smccc.h +22 −22
  4. include/linux/compiler.h +2 −132
  5. include/linux/compiler_types.h +41 −0
  6. include/linux/nospec.h +2 −0
  7. include/linux/of.h +2 −2
  8. include/linux/of_device.h +14 −2
  9. include/linux/of_iommu.h +4 −2
  10. include/linux/of_irq.h +7 −6
  11. include/linux/percpu-refcount.h +1 −1
  12. include/linux/ptr_ring.h +1 −1
  13. include/linux/sched_clock.h +28 −0
include/linux/acpi.h+7−0
@@ -905,6 +905,13 @@ static inline int acpi_dma_configure(struct device *dev, · 904 unmodified lines
905905 return 0;
906906 }
907907
908+static inline int acpi_dma_configure_id(struct device *dev,
909+ enum dev_dma_attr attr,
910+ const u32 *input_id)
911+{
912+ return 0;
913+}
914+
908915 #define ACPI_PTR(_ptr) (NULL)
909916
910917 static inline void acpi_device_set_enumerated(struct acpi_device *adev)
include/linux/acpi_iort.h+11−9
@@ -28,27 +28,29 @@ void iort_deregister_domain_token(int trans_id); · 27 unmodified lines
2828 struct fwnode_handle *iort_find_domain_token(int trans_id);
2929 #ifdef CONFIG_ACPI_IORT
3030 void acpi_iort_init(void);
31−u32 iort_msi_map_rid(struct device *dev, u32 req_id);
32−struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id);
31+u32 iort_msi_map_id(struct device *dev, u32 id);
32+struct irq_domain *iort_get_device_domain(struct device *dev, u32 id,
33+ enum irq_domain_bus_token bus_token);
3334 void acpi_configure_pmsi_domain(struct device *dev);
3435 int iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id);
3536 /* IOMMU interface */
3637 void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *size);
37−const struct iommu_ops *iort_iommu_configure(struct device *dev);
38+const struct iommu_ops *iort_iommu_configure_id(struct device *dev,
39+ const u32 *id_in);
3840 int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head);
3941 #else
4042 static inline void acpi_iort_init(void) { }
41−static inline u32 iort_msi_map_rid(struct device *dev, u32 req_id)
42−{ return req_id; }
43−static inline struct irq_domain *iort_get_device_domain(struct device *dev,
44− u32 req_id)
43+static inline u32 iort_msi_map_id(struct device *dev, u32 id)
44+{ return id; }
45+static inline struct irq_domain *iort_get_device_domain(
46+ struct device *dev, u32 id, enum irq_domain_bus_token bus_token)
4547 { return NULL; }
4648 static inline void acpi_configure_pmsi_domain(struct device *dev) { }
4749 /* IOMMU interface */
4850 static inline void iort_dma_setup(struct device *dev, u64 *dma_addr,
4951 u64 *size) { }
50−static inline const struct iommu_ops *iort_iommu_configure(
51− struct device *dev)
52+static inline const struct iommu_ops *iort_iommu_configure_id(
53+ struct device *dev, const u32 *id_in)
5254 { return NULL; }
5355 static inline
5456 int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
include/linux/arm-smccc.h+22−22
@@ -81,6 +81,28 @@ · 80 unmodified lines
8181 ARM_SMCCC_SMC_32, \
8282 0, 0x7fff)
8383
84+/* Paravirtualised time calls (defined by ARM DEN0057A) */
85+#define ARM_SMCCC_HV_PV_TIME_FEATURES \
86+ ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
87+ ARM_SMCCC_SMC_64, \
88+ ARM_SMCCC_OWNER_STANDARD_HYP, \
89+ 0x20)
90+
91+#define ARM_SMCCC_HV_PV_TIME_ST \
92+ ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
93+ ARM_SMCCC_SMC_64, \
94+ ARM_SMCCC_OWNER_STANDARD_HYP, \
95+ 0x21)
96+
97+/*
98+ * Return codes defined in ARM DEN 0070A
99+ * ARM DEN 0070A is now merged/consolidated into ARM DEN 0028 C
100+ */
101+#define SMCCC_RET_SUCCESS 0
102+#define SMCCC_RET_NOT_SUPPORTED -1
103+#define SMCCC_RET_NOT_REQUIRED -2
104+#define SMCCC_RET_INVALID_PARAMETER -3
105+
84106 #ifndef __ASSEMBLY__
85107
86108 #include <linux/linkage.h>
@@ -331,15 +353,6 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1, · 244 unmodified lines
331353 */
332354 #define arm_smccc_1_1_hvc(...) __arm_smccc_1_1(SMCCC_HVC_INST, __VA_ARGS__)
333355
334−/*
335− * Return codes defined in ARM DEN 0070A
336− * ARM DEN 0070A is now merged/consolidated into ARM DEN 0028 C
337− */
338−#define SMCCC_RET_SUCCESS 0
339−#define SMCCC_RET_NOT_SUPPORTED -1
340−#define SMCCC_RET_NOT_REQUIRED -2
341−#define SMCCC_RET_INVALID_PARAMETER -3
342−
343356 /*
344357 * Like arm_smccc_1_1* but always returns SMCCC_RET_NOT_SUPPORTED.
345358 * Used when the SMCCC conduit is not defined. The empty asm statement
@@ -385,18 +398,5 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1, · 39 unmodified lines
385398 method; \
386399 })
387400
388−/* Paravirtualised time calls (defined by ARM DEN0057A) */
389−#define ARM_SMCCC_HV_PV_TIME_FEATURES \
390− ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
391− ARM_SMCCC_SMC_64, \
392− ARM_SMCCC_OWNER_STANDARD_HYP, \
393− 0x20)
394−
395−#define ARM_SMCCC_HV_PV_TIME_ST \
396− ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
397− ARM_SMCCC_SMC_64, \
398− ARM_SMCCC_OWNER_STANDARD_HYP, \
399− 0x21)
400−
401401 #endif /*__ASSEMBLY__*/
402402 #endif /*__LINUX_ARM_SMCCC_H*/
include/linux/compiler.h+2−132
@@ -230,28 +230,6 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 229 unmodified lines
230230 # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__)
231231 #endif
232232
233−/*
234− * Prevent the compiler from merging or refetching reads or writes. The
235− * compiler is also forbidden from reordering successive instances of
236− * READ_ONCE and WRITE_ONCE, but only when the compiler is aware of some
237− * particular ordering. One way to make the compiler aware of ordering is to
238− * put the two invocations of READ_ONCE or WRITE_ONCE in different C
239− * statements.
240− *
241− * These two macros will also work on aggregate data types like structs or
242− * unions.
243− *
244− * Their two major use cases are: (1) Mediating communication between
245− * process-level code and irq/NMI handlers, all running on the same CPU,
246− * and (2) Ensuring that the compiler does not fold, spindle, or otherwise
247− * mutilate accesses that either do not require ordering or that interact
248− * with an explicit memory barrier or atomic instruction that provides the
249− * required ordering.
250− */
251−#include <asm/barrier.h>
252−#include <linux/kasan-checks.h>
253−#include <linux/kcsan-checks.h>
254−
255233 /**
256234 * data_race - mark an expression as containing intentional data races
257235 *
@@ -272,65 +250,6 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 14 unmodified lines
272250 __v; \
273251 })
274252
275−/*
276− * Use __READ_ONCE() instead of READ_ONCE() if you do not require any
277− * atomicity or dependency ordering guarantees. Note that this may result
278− * in tears!
279− */
280−#define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
281−
282−#define __READ_ONCE_SCALAR(x) \
283−({ \
284− __unqual_scalar_typeof(x) __x = __READ_ONCE(x); \
285− smp_read_barrier_depends(); \
286− (typeof(x))__x; \
287−})
288−
289−#define READ_ONCE(x) \
290−({ \
291− compiletime_assert_rwonce_type(x); \
292− __READ_ONCE_SCALAR(x); \
293−})
294−
295−#define __WRITE_ONCE(x, val) \
296−do { \
297− *(volatile typeof(x) *)&(x) = (val); \
298−} while (0)
299−
300−#define WRITE_ONCE(x, val) \
301−do { \
302− compiletime_assert_rwonce_type(x); \
303− __WRITE_ONCE(x, val); \
304−} while (0)
305−
306−static __no_sanitize_or_inline
307−unsigned long __read_once_word_nocheck(const void *addr)
308−{
309− return __READ_ONCE(*(unsigned long *)addr);
310−}
311−
312−/*
313− * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need to load a
314− * word from memory atomically but without telling KASAN/KCSAN. This is
315− * usually used by unwinding code when walking the stack of a running process.
316− */
317−#define READ_ONCE_NOCHECK(x) \
318−({ \
319− unsigned long __x; \
320− compiletime_assert(sizeof(x) == sizeof(__x), \
321− "Unsupported access size for READ_ONCE_NOCHECK()."); \
322− __x = __read_once_word_nocheck(&(x)); \
323− smp_read_barrier_depends(); \
324− (typeof(x))__x; \
325−})
326−
327−static __no_kasan_or_inline
328−unsigned long read_word_at_a_time(const void *addr)
329−{
330− kasan_check_read(addr, 1);
331− return *(unsigned long *)addr;
332−}
333−
334253 #endif /* __KERNEL__ */
335254
336255 /*
@@ -354,57 +273,6 @@ static inline void *offset_to_ptr(const int *off) · 17 unmodified lines
354273
355274 #endif /* __ASSEMBLY__ */
356275
357−/* Compile time object size, -1 for unknown */
358−#ifndef __compiletime_object_size
359−# define __compiletime_object_size(obj) -1
360−#endif
361−#ifndef __compiletime_warning
362−# define __compiletime_warning(message)
363−#endif
364−#ifndef __compiletime_error
365−# define __compiletime_error(message)
366−#endif
367−
368−#ifdef __OPTIMIZE__
369−# define __compiletime_assert(condition, msg, prefix, suffix) \
370− do { \
371− extern void prefix ## suffix(void) __compiletime_error(msg); \
372− if (!(condition)) \
373− prefix ## suffix(); \
374− } while (0)
375−#else
376−# define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0)
377−#endif
378−
379−#define _compiletime_assert(condition, msg, prefix, suffix) \
380− __compiletime_assert(condition, msg, prefix, suffix)
381−
382−/**
383− * compiletime_assert - break build and emit msg if condition is false
384− * @condition: a compile-time constant condition to check
385− * @msg: a message to emit if condition is false
386− *
387− * In tradition of POSIX assert, this macro will break the build if the
388− * supplied condition is *false*, emitting the supplied error message if the
389− * compiler has support to do so.
390− */
391−#define compiletime_assert(condition, msg) \
392− _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
393−
394−#define compiletime_assert_atomic_type(t) \
395− compiletime_assert(__native_word(t), \
396− "Need native word sized stores/loads for atomicity.")
397−
398−/*
399− * Yes, this permits 64-bit accesses on 32-bit architectures. These will
400− * actually be atomic in some cases (namely Armv7 + LPAE), but for others we
401− * rely on the access being split into 2x32-bit accesses for a 32-bit quantity
402− * (e.g. a virtual address) and a strong prevailing wind.
403− */
404−#define compiletime_assert_rwonce_type(t) \
405− compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
406− "Unsupported access size for {READ,WRITE}_ONCE().")
407−
408276 /* &a[0] degrades to a pointer: a different type from an array */
409277 #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
410278
@@ -414,4 +282,6 @@ static inline void *offset_to_ptr(const int *off) · 3 unmodified lines
414282 */
415283 #define prevent_tail_call_optimization() mb()
416284
285+#include <asm/rwonce.h>
286+
417287 #endif /* __LINUX_COMPILER_H */
include/linux/compiler_types.h+41−0
@@ -275,6 +275,47 @@ struct ftrace_likely_data { · 274 unmodified lines
275275 (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
276276 sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
277277
278+/* Compile time object size, -1 for unknown */
279+#ifndef __compiletime_object_size
280+# define __compiletime_object_size(obj) -1
281+#endif
282+#ifndef __compiletime_warning
283+# define __compiletime_warning(message)
284+#endif
285+#ifndef __compiletime_error
286+# define __compiletime_error(message)
287+#endif
288+
289+#ifdef __OPTIMIZE__
290+# define __compiletime_assert(condition, msg, prefix, suffix) \
291+ do { \
292+ extern void prefix ## suffix(void) __compiletime_error(msg); \
293+ if (!(condition)) \
294+ prefix ## suffix(); \
295+ } while (0)
296+#else
297+# define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0)
298+#endif
299+
300+#define _compiletime_assert(condition, msg, prefix, suffix) \
301+ __compiletime_assert(condition, msg, prefix, suffix)
302+
303+/**
304+ * compiletime_assert - break build and emit msg if condition is false
305+ * @condition: a compile-time constant condition to check
306+ * @msg: a message to emit if condition is false
307+ *
308+ * In tradition of POSIX assert, this macro will break the build if the
309+ * supplied condition is *false*, emitting the supplied error message if the
310+ * compiler has support to do so.
311+ */
312+#define compiletime_assert(condition, msg) \
313+ _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
314+
315+#define compiletime_assert_atomic_type(t) \
316+ compiletime_assert(__native_word(t), \
317+ "Need native word sized stores/loads for atomicity.")
318+
278319 /* Helpers for emitting diagnostics in pragmas. */
279320 #ifndef __diag
280321 #define __diag(string)
include/linux/nospec.h+2−0
@@ -5,6 +5,8 @@ · 4 unmodified lines
55
66 #ifndef _LINUX_NOSPEC_H
77 #define _LINUX_NOSPEC_H
8+
9+#include <linux/compiler.h>
810 #include <asm/barrier.h>
911
1012 struct task_struct;
include/linux/of.h+2−2
@@ -554,7 +554,7 @@ bool of_console_check(struct device_node *dn, char *name, int index); · 553 unmodified lines
554554
555555 extern int of_cpu_node_to_id(struct device_node *np);
556556
557−int of_map_rid(struct device_node *np, u32 rid,
557+int of_map_id(struct device_node *np, u32 id,
558558 const char *map_name, const char *map_mask_name,
559559 struct device_node **target, u32 *id_out);
560560
@@ -978,7 +978,7 @@ static inline int of_cpu_node_to_id(struct device_node *np) · 417 unmodified lines
978978 return -ENODEV;
979979 }
980980
981−static inline int of_map_rid(struct device_node *np, u32 rid,
981+static inline int of_map_id(struct device_node *np, u32 id,
982982 const char *map_name, const char *map_mask_name,
983983 struct device_node **target, u32 *id_out)
984984 {
include/linux/of_device.h+14−2
@@ -55,9 +55,15 @@ static inline struct device_node *of_cpu_device_node_get(int cpu) · 54 unmodified lines
5555 return of_node_get(cpu_dev->of_node);
5656 }
5757
58−int of_dma_configure(struct device *dev,
58+int of_dma_configure_id(struct device *dev,
5959 struct device_node *np,
60− bool force_dma);
60+ bool force_dma, const u32 *id);
61+static inline int of_dma_configure(struct device *dev,
62+ struct device_node *np,
63+ bool force_dma)
64+{
65+ return of_dma_configure_id(dev, np, force_dma, NULL);
66+}
6167 #else /* CONFIG_OF */
6268
6369 static inline int of_driver_match_device(struct device *dev,
@@ -106,6 +112,12 @@ static inline struct device_node *of_cpu_device_node_get(int cpu) · 42 unmodified lines
106112 return NULL;
107113 }
108114
115+static inline int of_dma_configure_id(struct device *dev,
116+ struct device_node *np,
117+ bool force_dma)
118+{
119+ return 0;
120+}
109121 static inline int of_dma_configure(struct device *dev,
110122 struct device_node *np,
111123 bool force_dma)
include/linux/of_iommu.h+4−2
@@ -13,7 +13,8 @@ extern int of_get_dma_window(struct device_node *dn, const char *prefix, · 12 unmodified lines
1313 size_t *size);
1414
1515 extern const struct iommu_ops *of_iommu_configure(struct device *dev,
16− struct device_node *master_np);
16+ struct device_node *master_np,
17+ const u32 *id);
1718
1819 #else
1920
@@ -25,7 +26,8 @@ static inline int of_get_dma_window(struct device_node *dn, const char *prefix, · 5 unmodified lines
2526 }
2627
2728 static inline const struct iommu_ops *of_iommu_configure(struct device *dev,
28− struct device_node *master_np)
29+ struct device_node *master_np,
30+ const u32 *id)
2931 {
3032 return NULL;
3133 }
include/linux/of_irq.h+7−6
@@ -52,9 +52,10 @@ extern struct irq_domain *of_msi_get_domain(struct device *dev, · 51 unmodified lines
5252 struct device_node *np,
5353 enum irq_domain_bus_token token);
5454 extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
55− u32 rid);
55+ u32 id,
56+ u32 bus_token);
5657 extern void of_msi_configure(struct device *dev, struct device_node *np);
57−u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in);
58+u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in);
5859 #else
5960 static inline int of_irq_count(struct device_node *dev)
6061 {
@@ -85,17 +86,17 @@ static inline struct irq_domain *of_msi_get_domain(struct device *dev, · 24 unmodified lines
8586 return NULL;
8687 }
8788 static inline struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
88− u32 rid)
89+ u32 id, u32 bus_token)
8990 {
9091 return NULL;
9192 }
9293 static inline void of_msi_configure(struct device *dev, struct device_node *np)
9394 {
9495 }
95−static inline u32 of_msi_map_rid(struct device *dev,
96− struct device_node *msi_np, u32 rid_in)
96+static inline u32 of_msi_map_id(struct device *dev,
97+ struct device_node *msi_np, u32 id_in)
9798 {
98− return rid_in;
99+ return id_in;
99100 }
100101 #endif
101102
include/linux/percpu-refcount.h+1−1
@@ -155,7 +155,7 @@ static inline bool __ref_is_percpu(struct percpu_ref *ref, · 154 unmodified lines
155155 * between contaminating the pointer value, meaning that
156156 * READ_ONCE() is required when fetching it.
157157 *
158− * The smp_read_barrier_depends() implied by READ_ONCE() pairs
158+ * The dependency ordering from the READ_ONCE() pairs
159159 * with smp_store_release() in __percpu_ref_switch_to_percpu().
160160 */
161161 percpu_ptr = READ_ONCE(ref->percpu_count_ptr);
include/linux/ptr_ring.h+1−1
@@ -107,7 +107,7 @@ static inline int __ptr_ring_produce(struct ptr_ring *r, void *ptr) · 106 unmodified lines
107107 return -ENOSPC;
108108
109109 /* Make sure the pointer we are storing points to a valid data. */
110− /* Pairs with smp_read_barrier_depends in __ptr_ring_consume. */
110+ /* Pairs with the dependency ordering in __ptr_ring_consume. */
111111 smp_wmb();
112112
113113 WRITE_ONCE(r->queue[r->producer++], ptr);
include/linux/sched_clock.h+28−0
@@ -6,6 +6,34 @@ · 5 unmodified lines
66 #define LINUX_SCHED_CLOCK
77
88 #ifdef CONFIG_GENERIC_SCHED_CLOCK
9+/**
10+ * struct clock_read_data - data required to read from sched_clock()
11+ *
12+ * @epoch_ns: sched_clock() value at last update
13+ * @epoch_cyc: Clock cycle value at last update.
14+ * @sched_clock_mask: Bitmask for two's complement subtraction of non 64bit
15+ * clocks.
16+ * @read_sched_clock: Current clock source (or dummy source when suspended).
17+ * @mult: Multipler for scaled math conversion.
18+ * @shift: Shift value for scaled math conversion.
19+ *
20+ * Care must be taken when updating this structure; it is read by
21+ * some very hot code paths. It occupies <=40 bytes and, when combined
22+ * with the seqcount used to synchronize access, comfortably fits into
23+ * a 64 byte cache line.
24+ */
25+struct clock_read_data {
26+ u64 epoch_ns;
27+ u64 epoch_cyc;
28+ u64 sched_clock_mask;
29+ u64 (*read_sched_clock)(void);
30+ u32 mult;
31+ u32 shift;
32+};
33+
34+extern struct clock_read_data *sched_clock_read_begin(unsigned int *seq);
35+extern int sched_clock_read_retry(unsigned int seq);
36+
937 extern void generic_sched_clock_init(void);
1038
1139 extern void sched_clock_register(u64 (*read)(void), int bits,