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 (20 of 98 files). Show all

Unified · Split

20 files
  1. include/acpi/acpi_bus.h +7 −2
  2. include/asm-generic/Kbuild +1 −0
  3. include/asm-generic/barrier.h +1 −18
  4. include/asm-generic/rwonce.h +90 −0
  5. include/asm-generic/tlb.h +40 −15
  6. include/linux/acpi.h +7 −0
  7. include/linux/acpi_iort.h +11 −9
  8. include/linux/arm-smccc.h +22 −22
  9. include/linux/compiler.h +2 −132
  10. include/linux/compiler_types.h +41 −0
  11. include/linux/nospec.h +2 −0
  12. include/linux/of.h +2 −2
  13. include/linux/of_device.h +14 −2
  14. include/linux/of_iommu.h +4 −2
  15. include/linux/of_irq.h +7 −6
  16. include/linux/percpu-refcount.h +1 −1
  17. include/linux/ptr_ring.h +1 −1
  18. include/linux/sched_clock.h +28 −0
  19. include/uapi/linux/perf_event.h +20 −3
  20. include/vdso/datapage.h +1 −0
include/acpi/acpi_bus.h+7−2
@@ -588,8 +588,13 @@ bool acpi_dma_supported(struct acpi_device *adev); · 587 unmodified lines
588enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev);588enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev);
589int acpi_dma_get_range(struct device *dev, u64 *dma_addr, u64 *offset,589int acpi_dma_get_range(struct device *dev, u64 *dma_addr, u64 *offset,
590 u64 *size);590 u64 *size);
591int acpi_dma_configure(struct device *dev, enum dev_dma_attr attr);591int acpi_dma_configure_id(struct device *dev, enum dev_dma_attr attr,
592 592 const u32 *input_id);
593static inline int acpi_dma_configure(struct device *dev,
594 enum dev_dma_attr attr)
595{
596 return acpi_dma_configure_id(dev, attr, NULL);
597}
593struct acpi_device *acpi_find_child_device(struct acpi_device *parent,598struct acpi_device *acpi_find_child_device(struct acpi_device *parent,
594 u64 address, bool check_children);599 u64 address, bool check_children);
595int acpi_is_root_bridge(acpi_handle);600int acpi_is_root_bridge(acpi_handle);
include/asm-generic/Kbuild+1−0
@@ -45,6 +45,7 @@ mandatory-y += pci.h · 44 unmodified lines
45mandatory-y += percpu.h45mandatory-y += percpu.h
46mandatory-y += pgalloc.h46mandatory-y += pgalloc.h
47mandatory-y += preempt.h47mandatory-y += preempt.h
48mandatory-y += rwonce.h
48mandatory-y += sections.h49mandatory-y += sections.h
49mandatory-y += serial.h50mandatory-y += serial.h
50mandatory-y += shmparam.h51mandatory-y += shmparam.h
include/asm-generic/barrier.h+1−18
@@ -13,7 +13,7 @@ · 12 unmodified lines
13 13
14#ifndef __ASSEMBLY__14#ifndef __ASSEMBLY__
15 15
16#include <linux/compiler.h>16#include <asm/rwonce.h>
17 17
18#ifndef nop18#ifndef nop
19#define nop() asm volatile ("nop")19#define nop() asm volatile ("nop")
@@ -46,10 +46,6 @@ · 26 unmodified lines
46#define dma_wmb() wmb()46#define dma_wmb() wmb()
47#endif47#endif
48 48
49#ifndef read_barrier_depends
50#define read_barrier_depends() do { } while (0)
51#endif
52
53#ifndef __smp_mb49#ifndef __smp_mb
54#define __smp_mb() mb()50#define __smp_mb() mb()
55#endif51#endif
@@ -62,10 +58,6 @@ · 6 unmodified lines
62#define __smp_wmb() wmb()58#define __smp_wmb() wmb()
63#endif59#endif
64 60
65#ifndef __smp_read_barrier_depends
66#define __smp_read_barrier_depends() read_barrier_depends()
67#endif
68
69#ifdef CONFIG_SMP61#ifdef CONFIG_SMP
70 62
71#ifndef smp_mb63#ifndef smp_mb
@@ -80,10 +72,6 @@ · 8 unmodified lines
80#define smp_wmb() __smp_wmb()72#define smp_wmb() __smp_wmb()
81#endif73#endif
82 74
83#ifndef smp_read_barrier_depends
84#define smp_read_barrier_depends() __smp_read_barrier_depends()
85#endif
86
87#else /* !CONFIG_SMP */75#else /* !CONFIG_SMP */
88 76
89#ifndef smp_mb77#ifndef smp_mb
@@ -98,10 +86,6 @@ · 8 unmodified lines
98#define smp_wmb() barrier()86#define smp_wmb() barrier()
99#endif87#endif
100 88
101#ifndef smp_read_barrier_depends
102#define smp_read_barrier_depends() do { } while (0)
103#endif
104
105#endif /* CONFIG_SMP */89#endif /* CONFIG_SMP */
106 90
107#ifndef __smp_store_mb91#ifndef __smp_store_mb
@@ -196,7 +180,6 @@ do { \ · 88 unmodified lines
196#define virt_mb() __smp_mb()180#define virt_mb() __smp_mb()
197#define virt_rmb() __smp_rmb()181#define virt_rmb() __smp_rmb()
198#define virt_wmb() __smp_wmb()182#define virt_wmb() __smp_wmb()
199#define virt_read_barrier_depends() __smp_read_barrier_depends()
200#define virt_store_mb(var, value) __smp_store_mb(var, value)183#define virt_store_mb(var, value) __smp_store_mb(var, value)
201#define virt_mb__before_atomic() __smp_mb__before_atomic()184#define virt_mb__before_atomic() __smp_mb__before_atomic()
202#define virt_mb__after_atomic() __smp_mb__after_atomic()185#define virt_mb__after_atomic() __smp_mb__after_atomic()
include/asm-generic/rwonce.h+90−0
@@ -0,0 +1,90 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Prevent the compiler from merging or refetching reads or writes. The
4 * compiler is also forbidden from reordering successive instances of
5 * READ_ONCE and WRITE_ONCE, but only when the compiler is aware of some
6 * particular ordering. One way to make the compiler aware of ordering is to
7 * put the two invocations of READ_ONCE or WRITE_ONCE in different C
8 * statements.
9 *
10 * These two macros will also work on aggregate data types like structs or
11 * unions.
12 *
13 * Their two major use cases are: (1) Mediating communication between
14 * process-level code and irq/NMI handlers, all running on the same CPU,
15 * and (2) Ensuring that the compiler does not fold, spindle, or otherwise
16 * mutilate accesses that either do not require ordering or that interact
17 * with an explicit memory barrier or atomic instruction that provides the
18 * required ordering.
19 */
20#ifndef __ASM_GENERIC_RWONCE_H
21#define __ASM_GENERIC_RWONCE_H
22
23#ifndef __ASSEMBLY__
24
25#include <linux/compiler_types.h>
26#include <linux/kasan-checks.h>
27#include <linux/kcsan-checks.h>
28
29/*
30 * Yes, this permits 64-bit accesses on 32-bit architectures. These will
31 * actually be atomic in some cases (namely Armv7 + LPAE), but for others we
32 * rely on the access being split into 2x32-bit accesses for a 32-bit quantity
33 * (e.g. a virtual address) and a strong prevailing wind.
34 */
35#define compiletime_assert_rwonce_type(t) \
36 compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
37 "Unsupported access size for {READ,WRITE}_ONCE().")
38
39/*
40 * Use __READ_ONCE() instead of READ_ONCE() if you do not require any
41 * atomicity. Note that this may result in tears!
42 */
43#ifndef __READ_ONCE
44#define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
45#endif
46
47#define READ_ONCE(x) \
48({ \
49 compiletime_assert_rwonce_type(x); \
50 __READ_ONCE(x); \
51})
52
53#define __WRITE_ONCE(x, val) \
54do { \
55 *(volatile typeof(x) *)&(x) = (val); \
56} while (0)
57
58#define WRITE_ONCE(x, val) \
59do { \
60 compiletime_assert_rwonce_type(x); \
61 __WRITE_ONCE(x, val); \
62} while (0)
63
64static __no_sanitize_or_inline
65unsigned long __read_once_word_nocheck(const void *addr)
66{
67 return __READ_ONCE(*(unsigned long *)addr);
68}
69
70/*
71 * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need to load a
72 * word from memory atomically but without telling KASAN/KCSAN. This is
73 * usually used by unwinding code when walking the stack of a running process.
74 */
75#define READ_ONCE_NOCHECK(x) \
76({ \
77 compiletime_assert(sizeof(x) == sizeof(unsigned long), \
78 "Unsupported access size for READ_ONCE_NOCHECK()."); \
79 (typeof(x))__read_once_word_nocheck(&(x)); \
80})
81
82static __no_kasan_or_inline
83unsigned long read_word_at_a_time(const void *addr)
84{
85 kasan_check_read(addr, 1);
86 return *(unsigned long *)addr;
87}
88
89#endif /* __ASSEMBLY__ */
90#endif /* __ASM_GENERIC_RWONCE_H */
include/asm-generic/tlb.h+40−15
@@ -512,6 +512,38 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm · 511 unmodified lines
512}512}
513#endif513#endif
514 514
515/*
516 * tlb_flush_{pte|pmd|pud|p4d}_range() adjust the tlb->start and tlb->end,
517 * and set corresponding cleared_*.
518 */
519static inline void tlb_flush_pte_range(struct mmu_gather *tlb,
520 unsigned long address, unsigned long size)
521{
522 __tlb_adjust_range(tlb, address, size);
523 tlb->cleared_ptes = 1;
524}
525
526static inline void tlb_flush_pmd_range(struct mmu_gather *tlb,
527 unsigned long address, unsigned long size)
528{
529 __tlb_adjust_range(tlb, address, size);
530 tlb->cleared_pmds = 1;
531}
532
533static inline void tlb_flush_pud_range(struct mmu_gather *tlb,
534 unsigned long address, unsigned long size)
535{
536 __tlb_adjust_range(tlb, address, size);
537 tlb->cleared_puds = 1;
538}
539
540static inline void tlb_flush_p4d_range(struct mmu_gather *tlb,
541 unsigned long address, unsigned long size)
542{
543 __tlb_adjust_range(tlb, address, size);
544 tlb->cleared_p4ds = 1;
545}
546
515#ifndef __tlb_remove_tlb_entry547#ifndef __tlb_remove_tlb_entry
516#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)548#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
517#endif549#endif
@@ -525,19 +557,17 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm · 7 unmodified lines
525 */557 */
526#define tlb_remove_tlb_entry(tlb, ptep, address) \558#define tlb_remove_tlb_entry(tlb, ptep, address) \
527 do { \559 do { \
528 __tlb_adjust_range(tlb, address, PAGE_SIZE); \560 tlb_flush_pte_range(tlb, address, PAGE_SIZE); \
529 tlb->cleared_ptes = 1; \
530 __tlb_remove_tlb_entry(tlb, ptep, address); \561 __tlb_remove_tlb_entry(tlb, ptep, address); \
531 } while (0)562 } while (0)
532 563
533#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address) \564#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address) \
534 do { \565 do { \
535 unsigned long _sz = huge_page_size(h); \566 unsigned long _sz = huge_page_size(h); \
536 __tlb_adjust_range(tlb, address, _sz); \
537 if (_sz == PMD_SIZE) \567 if (_sz == PMD_SIZE) \
538 tlb->cleared_pmds = 1; \568 tlb_flush_pmd_range(tlb, address, _sz); \
539 else if (_sz == PUD_SIZE) \569 else if (_sz == PUD_SIZE) \
540 tlb->cleared_puds = 1; \570 tlb_flush_pud_range(tlb, address, _sz); \
541 __tlb_remove_tlb_entry(tlb, ptep, address); \571 __tlb_remove_tlb_entry(tlb, ptep, address); \
542 } while (0)572 } while (0)
543 573
@@ -551,8 +581,7 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm · 7 unmodified lines
551 581
552#define tlb_remove_pmd_tlb_entry(tlb, pmdp, address) \582#define tlb_remove_pmd_tlb_entry(tlb, pmdp, address) \
553 do { \583 do { \
554 __tlb_adjust_range(tlb, address, HPAGE_PMD_SIZE); \584 tlb_flush_pmd_range(tlb, address, HPAGE_PMD_SIZE); \
555 tlb->cleared_pmds = 1; \
556 __tlb_remove_pmd_tlb_entry(tlb, pmdp, address); \585 __tlb_remove_pmd_tlb_entry(tlb, pmdp, address); \
557 } while (0)586 } while (0)
558 587
@@ -566,8 +595,7 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm · 7 unmodified lines
566 595
567#define tlb_remove_pud_tlb_entry(tlb, pudp, address) \596#define tlb_remove_pud_tlb_entry(tlb, pudp, address) \
568 do { \597 do { \
569 __tlb_adjust_range(tlb, address, HPAGE_PUD_SIZE); \598 tlb_flush_pud_range(tlb, address, HPAGE_PUD_SIZE); \
570 tlb->cleared_puds = 1; \
571 __tlb_remove_pud_tlb_entry(tlb, pudp, address); \599 __tlb_remove_pud_tlb_entry(tlb, pudp, address); \
572 } while (0)600 } while (0)
573 601
@@ -592,9 +620,8 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm · 18 unmodified lines
592#ifndef pte_free_tlb620#ifndef pte_free_tlb
593#define pte_free_tlb(tlb, ptep, address) \621#define pte_free_tlb(tlb, ptep, address) \
594 do { \622 do { \
595 __tlb_adjust_range(tlb, address, PAGE_SIZE); \623 tlb_flush_pmd_range(tlb, address, PAGE_SIZE); \
596 tlb->freed_tables = 1; \624 tlb->freed_tables = 1; \
597 tlb->cleared_pmds = 1; \
598 __pte_free_tlb(tlb, ptep, address); \625 __pte_free_tlb(tlb, ptep, address); \
599 } while (0)626 } while (0)
600#endif627#endif
@@ -602,9 +629,8 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm · 1 unmodified line
602#ifndef pmd_free_tlb629#ifndef pmd_free_tlb
603#define pmd_free_tlb(tlb, pmdp, address) \630#define pmd_free_tlb(tlb, pmdp, address) \
604 do { \631 do { \
605 __tlb_adjust_range(tlb, address, PAGE_SIZE); \632 tlb_flush_pud_range(tlb, address, PAGE_SIZE); \
606 tlb->freed_tables = 1; \633 tlb->freed_tables = 1; \
607 tlb->cleared_puds = 1; \
608 __pmd_free_tlb(tlb, pmdp, address); \634 __pmd_free_tlb(tlb, pmdp, address); \
609 } while (0)635 } while (0)
610#endif636#endif
@@ -612,9 +638,8 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm · 1 unmodified line
612#ifndef pud_free_tlb638#ifndef pud_free_tlb
613#define pud_free_tlb(tlb, pudp, address) \639#define pud_free_tlb(tlb, pudp, address) \
614 do { \640 do { \
615 __tlb_adjust_range(tlb, address, PAGE_SIZE); \641 tlb_flush_p4d_range(tlb, address, PAGE_SIZE); \
616 tlb->freed_tables = 1; \642 tlb->freed_tables = 1; \
617 tlb->cleared_p4ds = 1; \
618 __pud_free_tlb(tlb, pudp, address); \643 __pud_free_tlb(tlb, pudp, address); \
619 } while (0)644 } while (0)
620#endif645#endif
include/linux/acpi.h+7−0
@@ -905,6 +905,13 @@ static inline int acpi_dma_configure(struct device *dev, · 904 unmodified lines
905 return 0;905 return 0;
906}906}
907 907
908static 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
908#define ACPI_PTR(_ptr) (NULL)915#define ACPI_PTR(_ptr) (NULL)
909 916
910static inline void acpi_device_set_enumerated(struct acpi_device *adev)917static 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
28struct fwnode_handle *iort_find_domain_token(int trans_id);28struct fwnode_handle *iort_find_domain_token(int trans_id);
29#ifdef CONFIG_ACPI_IORT29#ifdef CONFIG_ACPI_IORT
30void acpi_iort_init(void);30void acpi_iort_init(void);
31u32 iort_msi_map_rid(struct device *dev, u32 req_id);31u32 iort_msi_map_id(struct device *dev, u32 id);
32struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id);32struct irq_domain *iort_get_device_domain(struct device *dev, u32 id,
33 enum irq_domain_bus_token bus_token);
33void acpi_configure_pmsi_domain(struct device *dev);34void acpi_configure_pmsi_domain(struct device *dev);
34int iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id);35int iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id);
35/* IOMMU interface */36/* IOMMU interface */
36void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *size);37void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *size);
37const struct iommu_ops *iort_iommu_configure(struct device *dev);38const struct iommu_ops *iort_iommu_configure_id(struct device *dev,
39 const u32 *id_in);
38int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head);40int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head);
39#else41#else
40static inline void acpi_iort_init(void) { }42static inline void acpi_iort_init(void) { }
41static inline u32 iort_msi_map_rid(struct device *dev, u32 req_id)43static inline u32 iort_msi_map_id(struct device *dev, u32 id)
42{ return req_id; }44{ return id; }
43static inline struct irq_domain *iort_get_device_domain(struct device *dev,45static inline struct irq_domain *iort_get_device_domain(
44 u32 req_id)46 struct device *dev, u32 id, enum irq_domain_bus_token bus_token)
45{ return NULL; }47{ return NULL; }
46static inline void acpi_configure_pmsi_domain(struct device *dev) { }48static inline void acpi_configure_pmsi_domain(struct device *dev) { }
47/* IOMMU interface */49/* IOMMU interface */
48static inline void iort_dma_setup(struct device *dev, u64 *dma_addr,50static inline void iort_dma_setup(struct device *dev, u64 *dma_addr,
49 u64 *size) { }51 u64 *size) { }
50static inline const struct iommu_ops *iort_iommu_configure(52static inline const struct iommu_ops *iort_iommu_configure_id(
51 struct device *dev)53 struct device *dev, const u32 *id_in)
52{ return NULL; }54{ return NULL; }
53static inline55static inline
54int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)56int 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
81 ARM_SMCCC_SMC_32, \81 ARM_SMCCC_SMC_32, \
82 0, 0x7fff)82 0, 0x7fff)
83 83
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
84#ifndef __ASSEMBLY__106#ifndef __ASSEMBLY__
85 107
86#include <linux/linkage.h>108#include <linux/linkage.h>
@@ -331,15 +353,6 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1, · 244 unmodified lines
331 */353 */
332#define arm_smccc_1_1_hvc(...) __arm_smccc_1_1(SMCCC_HVC_INST, __VA_ARGS__)354#define arm_smccc_1_1_hvc(...) __arm_smccc_1_1(SMCCC_HVC_INST, __VA_ARGS__)
333 355
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
343/*356/*
344 * Like arm_smccc_1_1* but always returns SMCCC_RET_NOT_SUPPORTED.357 * Like arm_smccc_1_1* but always returns SMCCC_RET_NOT_SUPPORTED.
345 * Used when the SMCCC conduit is not defined. The empty asm statement358 * 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
385 method; \398 method; \
386 })399 })
387 400
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
401#endif /*__ASSEMBLY__*/401#endif /*__ASSEMBLY__*/
402#endif /*__LINUX_ARM_SMCCC_H*/402#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
230# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__)230# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__)
231#endif231#endif
232 232
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
255/**233/**
256 * data_race - mark an expression as containing intentional data races234 * data_race - mark an expression as containing intentional data races
257 *235 *
@@ -272,65 +250,6 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 14 unmodified lines
272 __v; \250 __v; \
273})251})
274 252
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) \
296do { \
297 *(volatile typeof(x) *)&(x) = (val); \
298} while (0)
299
300#define WRITE_ONCE(x, val) \
301do { \
302 compiletime_assert_rwonce_type(x); \
303 __WRITE_ONCE(x, val); \
304} while (0)
305
306static __no_sanitize_or_inline
307unsigned 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
327static __no_kasan_or_inline
328unsigned long read_word_at_a_time(const void *addr)
329{
330 kasan_check_read(addr, 1);
331 return *(unsigned long *)addr;
332}
333
334#endif /* __KERNEL__ */253#endif /* __KERNEL__ */
335 254
336/*255/*
@@ -354,57 +273,6 @@ static inline void *offset_to_ptr(const int *off) · 17 unmodified lines
354 273
355#endif /* __ASSEMBLY__ */274#endif /* __ASSEMBLY__ */
356 275
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
408/* &a[0] degrades to a pointer: a different type from an array */276/* &a[0] degrades to a pointer: a different type from an array */
409#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))277#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
410 278
@@ -414,4 +282,6 @@ static inline void *offset_to_ptr(const int *off) · 3 unmodified lines
414 */282 */
415#define prevent_tail_call_optimization() mb()283#define prevent_tail_call_optimization() mb()
416 284
285#include <asm/rwonce.h>
286
417#endif /* __LINUX_COMPILER_H */287#endif /* __LINUX_COMPILER_H */
include/linux/compiler_types.h+41−0
@@ -275,6 +275,47 @@ struct ftrace_likely_data { · 274 unmodified lines
275 (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \275 (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
276 sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))276 sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
277 277
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
278/* Helpers for emitting diagnostics in pragmas. */319/* Helpers for emitting diagnostics in pragmas. */
279#ifndef __diag320#ifndef __diag
280#define __diag(string)321#define __diag(string)
include/linux/nospec.h+2−0
@@ -5,6 +5,8 @@ · 4 unmodified lines
5 5
6#ifndef _LINUX_NOSPEC_H6#ifndef _LINUX_NOSPEC_H
7#define _LINUX_NOSPEC_H7#define _LINUX_NOSPEC_H
8
9#include <linux/compiler.h>
8#include <asm/barrier.h>10#include <asm/barrier.h>
9 11
10struct task_struct;12struct 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
554 554
555extern int of_cpu_node_to_id(struct device_node *np);555extern int of_cpu_node_to_id(struct device_node *np);
556 556
557int of_map_rid(struct device_node *np, u32 rid,557int of_map_id(struct device_node *np, u32 id,
558 const char *map_name, const char *map_mask_name,558 const char *map_name, const char *map_mask_name,
559 struct device_node **target, u32 *id_out);559 struct device_node **target, u32 *id_out);
560 560
@@ -978,7 +978,7 @@ static inline int of_cpu_node_to_id(struct device_node *np) · 417 unmodified lines
978 return -ENODEV;978 return -ENODEV;
979}979}
980 980
981static inline int of_map_rid(struct device_node *np, u32 rid,981static inline int of_map_id(struct device_node *np, u32 id,
982 const char *map_name, const char *map_mask_name,982 const char *map_name, const char *map_mask_name,
983 struct device_node **target, u32 *id_out)983 struct device_node **target, u32 *id_out)
984{984{
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
55 return of_node_get(cpu_dev->of_node);55 return of_node_get(cpu_dev->of_node);
56}56}
57 57
58int of_dma_configure(struct device *dev,58int of_dma_configure_id(struct device *dev,
59 struct device_node *np,59 struct device_node *np,
60 bool force_dma);60 bool force_dma, const u32 *id);
61static 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}
61#else /* CONFIG_OF */67#else /* CONFIG_OF */
62 68
63static inline int of_driver_match_device(struct device *dev,69static 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
106 return NULL;112 return NULL;
107}113}
108 114
115static inline int of_dma_configure_id(struct device *dev,
116 struct device_node *np,
117 bool force_dma)
118{
119 return 0;
120}
109static inline int of_dma_configure(struct device *dev,121static inline int of_dma_configure(struct device *dev,
110 struct device_node *np,122 struct device_node *np,
111 bool force_dma)123 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
13 size_t *size);13 size_t *size);
14 14
15extern const struct iommu_ops *of_iommu_configure(struct device *dev,15extern 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);
17 18
18#else19#else
19 20
@@ -25,7 +26,8 @@ static inline int of_get_dma_window(struct device_node *dn, const char *prefix, · 5 unmodified lines
25}26}
26 27
27static inline const struct iommu_ops *of_iommu_configure(struct device *dev,28static 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)
29{31{
30 return NULL;32 return NULL;
31}33}
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
52 struct device_node *np,52 struct device_node *np,
53 enum irq_domain_bus_token token);53 enum irq_domain_bus_token token);
54extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev,54extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
55 u32 rid);55 u32 id,
56 u32 bus_token);
56extern void of_msi_configure(struct device *dev, struct device_node *np);57extern void of_msi_configure(struct device *dev, struct device_node *np);
57u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in);58u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in);
58#else59#else
59static inline int of_irq_count(struct device_node *dev)60static inline int of_irq_count(struct device_node *dev)
60{61{
@@ -85,17 +86,17 @@ static inline struct irq_domain *of_msi_get_domain(struct device *dev, · 24 unmodified lines
85 return NULL;86 return NULL;
86}87}
87static inline struct irq_domain *of_msi_map_get_device_domain(struct device *dev,88static inline struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
88 u32 rid)89 u32 id, u32 bus_token)
89{90{
90 return NULL;91 return NULL;
91}92}
92static inline void of_msi_configure(struct device *dev, struct device_node *np)93static inline void of_msi_configure(struct device *dev, struct device_node *np)
93{94{
94}95}
95static inline u32 of_msi_map_rid(struct device *dev,96static inline u32 of_msi_map_id(struct device *dev,
96 struct device_node *msi_np, u32 rid_in)97 struct device_node *msi_np, u32 id_in)
97{98{
98 return rid_in;99 return id_in;
99}100}
100#endif101#endif
101 102
include/linux/percpu-refcount.h+1−1
@@ -155,7 +155,7 @@ static inline bool __ref_is_percpu(struct percpu_ref *ref, · 154 unmodified lines
155 * between contaminating the pointer value, meaning that155 * between contaminating the pointer value, meaning that
156 * READ_ONCE() is required when fetching it.156 * READ_ONCE() is required when fetching it.
157 *157 *
158 * The smp_read_barrier_depends() implied by READ_ONCE() pairs158 * The dependency ordering from the READ_ONCE() pairs
159 * with smp_store_release() in __percpu_ref_switch_to_percpu().159 * with smp_store_release() in __percpu_ref_switch_to_percpu().
160 */160 */
161 percpu_ptr = READ_ONCE(ref->percpu_count_ptr);161 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
107 return -ENOSPC;107 return -ENOSPC;
108 108
109 /* Make sure the pointer we are storing points to a valid data. */109 /* 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. */
111 smp_wmb();111 smp_wmb();
112 112
113 WRITE_ONCE(r->queue[r->producer++], ptr);113 WRITE_ONCE(r->queue[r->producer++], ptr);
include/linux/sched_clock.h+28−0
@@ -6,6 +6,34 @@ · 5 unmodified lines
6#define LINUX_SCHED_CLOCK6#define LINUX_SCHED_CLOCK
7 7
8#ifdef CONFIG_GENERIC_SCHED_CLOCK8#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 */
25struct 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
34extern struct clock_read_data *sched_clock_read_begin(unsigned int *seq);
35extern int sched_clock_read_retry(unsigned int seq);
36
9extern void generic_sched_clock_init(void);37extern void generic_sched_clock_init(void);
10 38
11extern void sched_clock_register(u64 (*read)(void), int bits,39extern void sched_clock_register(u64 (*read)(void), int bits,
include/uapi/linux/perf_event.h+20−3
@@ -532,9 +532,10 @@ struct perf_event_mmap_page { · 531 unmodified lines
532 cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */532 cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */
533 533
534 cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */534 cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */
535 cap_user_time : 1, /* The time_* fields are used */535 cap_user_time : 1, /* The time_{shift,mult,offset} fields are used */
536 cap_user_time_zero : 1, /* The time_zero field is used */536 cap_user_time_zero : 1, /* The time_zero field is used */
537 cap_____res : 59;537 cap_user_time_short : 1, /* the time_{cycle,mask} fields are used */
538 cap_____res : 58;
538 };539 };
539 };540 };
540 541
@@ -593,13 +594,29 @@ struct perf_event_mmap_page { · 52 unmodified lines
593 * ((rem * time_mult) >> time_shift);594 * ((rem * time_mult) >> time_shift);
594 */595 */
595 __u64 time_zero;596 __u64 time_zero;
597
596 __u32 size; /* Header size up to __reserved[] fields. */598 __u32 size; /* Header size up to __reserved[] fields. */
599 __u32 __reserved_1;
600
601 /*
602 * If cap_usr_time_short, the hardware clock is less than 64bit wide
603 * and we must compute the 'cyc' value, as used by cap_usr_time, as:
604 *
605 * cyc = time_cycles + ((cyc - time_cycles) & time_mask)
606 *
607 * NOTE: this form is explicitly chosen such that cap_usr_time_short
608 * is a correction on top of cap_usr_time, and code that doesn't
609 * know about cap_usr_time_short still works under the assumption
610 * the counter doesn't wrap.
611 */
612 __u64 time_cycles;
613 __u64 time_mask;
597 614
598 /*615 /*
599 * Hole for extension of the self monitor capabilities616 * Hole for extension of the self monitor capabilities
600 */617 */
601 618
602 __u8 __reserved[118*8+4]; /* align to 1k. */619 __u8 __reserved[116*8]; /* align to 1k. */
603 620
604 /*621 /*
605 * Control data for the mmap() data buffer.622 * Control data for the mmap() data buffer.
include/vdso/datapage.h+1−0
@@ -109,6 +109,7 @@ struct vdso_data { · 108 unmodified lines
109 * relocation, and this is what we need.109 * relocation, and this is what we need.
110 */110 */
111extern struct vdso_data _vdso_data[CS_BASES] __attribute__((visibility("hidden")));111extern struct vdso_data _vdso_data[CS_BASES] __attribute__((visibility("hidden")));
112extern struct vdso_data _timens_data[CS_BASES] __attribute__((visibility("hidden")));
112 113
113/*114/*
114 * The generic vDSO implementation requires that gettimeofday.h115 * The generic vDSO implementation requires that gettimeofday.h

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t