aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig12
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi8
-rw-r--r--arch/arm/include/asm/arch_timer.h36
-rw-r--r--arch/arm/include/uapi/asm/hwcap.h1
-rw-r--r--arch/arm/kernel/arch_timer.c14
-rw-r--r--arch/arm/kernel/setup.c1
-rw-r--r--arch/arm/mach-msm/timer.c1
-rw-r--r--arch/arm/mach-zynq/Kconfig1
-rw-r--r--arch/arm64/Kconfig1
-rw-r--r--arch/arm64/include/asm/arch_timer.h42
-rw-r--r--arch/arm64/include/asm/hwcap.h11
-rw-r--r--arch/arm64/include/uapi/asm/hwcap.h1
-rw-r--r--arch/arm64/kernel/setup.c11
-rw-r--r--arch/arm64/kernel/time.c10
-rw-r--r--arch/x86/kernel/rtc.c8
16 files changed, 118 insertions, 41 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index ad95133f8fae..ded747c7b74c 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -353,6 +353,18 @@ config HAVE_CONTEXT_TRACKING
353config HAVE_VIRT_CPU_ACCOUNTING 353config HAVE_VIRT_CPU_ACCOUNTING
354 bool 354 bool
355 355
356config HAVE_VIRT_CPU_ACCOUNTING_GEN
357 bool
358 default y if 64BIT
359 help
360 With VIRT_CPU_ACCOUNTING_GEN, cputime_t becomes 64-bit.
361 Before enabling this option, arch code must be audited
362 to ensure there are no races in concurrent read/write of
363 cputime_t. For example, reading/writing 64-bit cputime_t on
364 some 32-bit arches may require multiple accesses, so proper
365 locking is needed to protect against concurrent accesses.
366
367
356config HAVE_IRQ_TIME_ACCOUNTING 368config HAVE_IRQ_TIME_ACCOUNTING
357 bool 369 bool
358 help 370 help
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 04163fece49f..aa8300333bc5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -54,6 +54,7 @@ config ARM
54 select HAVE_REGS_AND_STACK_ACCESS_API 54 select HAVE_REGS_AND_STACK_ACCESS_API
55 select HAVE_SYSCALL_TRACEPOINTS 55 select HAVE_SYSCALL_TRACEPOINTS
56 select HAVE_UID16 56 select HAVE_UID16
57 select HAVE_VIRT_CPU_ACCOUNTING_GEN
57 select IRQ_FORCED_THREADING 58 select IRQ_FORCED_THREADING
58 select KTIME_SCALAR 59 select KTIME_SCALAR
59 select MODULES_USE_ELF_REL 60 select MODULES_USE_ELF_REL
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index e32b92b949d2..e7f73b2e4550 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -92,6 +92,14 @@
92 }; 92 };
93 }; 93 };
94 94
95 global_timer: timer@f8f00200 {
96 compatible = "arm,cortex-a9-global-timer";
97 reg = <0xf8f00200 0x20>;
98 interrupts = <1 11 0x301>;
99 interrupt-parent = <&intc>;
100 clocks = <&clkc 4>;
101 };
102
95 ttc0: ttc0@f8001000 { 103 ttc0: ttc0@f8001000 {
96 interrupt-parent = <&intc>; 104 interrupt-parent = <&intc>;
97 interrupts = < 0 10 4 0 11 4 0 12 4 >; 105 interrupts = < 0 10 4 0 11 4 0 12 4 >;
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
index 5665134bfa3e..0704e0cf5571 100644
--- a/arch/arm/include/asm/arch_timer.h
+++ b/arch/arm/include/asm/arch_timer.h
@@ -87,17 +87,43 @@ static inline u64 arch_counter_get_cntvct(void)
87 return cval; 87 return cval;
88} 88}
89 89
90static inline void arch_counter_set_user_access(void) 90static inline u32 arch_timer_get_cntkctl(void)
91{ 91{
92 u32 cntkctl; 92 u32 cntkctl;
93
94 asm volatile("mrc p15, 0, %0, c14, c1, 0" : "=r" (cntkctl)); 93 asm volatile("mrc p15, 0, %0, c14, c1, 0" : "=r" (cntkctl));
94 return cntkctl;
95}
95 96
96 /* disable user access to everything */ 97static inline void arch_timer_set_cntkctl(u32 cntkctl)
97 cntkctl &= ~((3 << 8) | (7 << 0)); 98{
98
99 asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl)); 99 asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl));
100} 100}
101
102static inline void arch_counter_set_user_access(void)
103{
104 u32 cntkctl = arch_timer_get_cntkctl();
105
106 /* Disable user access to both physical/virtual counters/timers */
107 /* Also disable virtual event stream */
108 cntkctl &= ~(ARCH_TIMER_USR_PT_ACCESS_EN
109 | ARCH_TIMER_USR_VT_ACCESS_EN
110 | ARCH_TIMER_VIRT_EVT_EN
111 | ARCH_TIMER_USR_VCT_ACCESS_EN
112 | ARCH_TIMER_USR_PCT_ACCESS_EN);
113 arch_timer_set_cntkctl(cntkctl);
114}
115
116static inline void arch_timer_evtstrm_enable(int divider)
117{
118 u32 cntkctl = arch_timer_get_cntkctl();
119 cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK;
120 /* Set the divider and enable virtual event stream */
121 cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT)
122 | ARCH_TIMER_VIRT_EVT_EN;
123 arch_timer_set_cntkctl(cntkctl);
124 elf_hwcap |= HWCAP_EVTSTRM;
125}
126
101#endif 127#endif
102 128
103#endif 129#endif
diff --git a/arch/arm/include/uapi/asm/hwcap.h b/arch/arm/include/uapi/asm/hwcap.h
index 6d34d080372a..7dcc10d67253 100644
--- a/arch/arm/include/uapi/asm/hwcap.h
+++ b/arch/arm/include/uapi/asm/hwcap.h
@@ -26,5 +26,6 @@
26#define HWCAP_VFPD32 (1 << 19) /* set if VFP has 32 regs (not 16) */ 26#define HWCAP_VFPD32 (1 << 19) /* set if VFP has 32 regs (not 16) */
27#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT) 27#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT)
28#define HWCAP_LPAE (1 << 20) 28#define HWCAP_LPAE (1 << 20)
29#define HWCAP_EVTSTRM (1 << 21)
29 30
30#endif /* _UAPI__ASMARM_HWCAP_H */ 31#endif /* _UAPI__ASMARM_HWCAP_H */
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index 221f07b11ccb..1791f12c180b 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -11,7 +11,6 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/sched_clock.h>
15 14
16#include <asm/delay.h> 15#include <asm/delay.h>
17 16
@@ -22,13 +21,6 @@ static unsigned long arch_timer_read_counter_long(void)
22 return arch_timer_read_counter(); 21 return arch_timer_read_counter();
23} 22}
24 23
25static u32 sched_clock_mult __read_mostly;
26
27static unsigned long long notrace arch_timer_sched_clock(void)
28{
29 return arch_timer_read_counter() * sched_clock_mult;
30}
31
32static struct delay_timer arch_delay_timer; 24static struct delay_timer arch_delay_timer;
33 25
34static void __init arch_timer_delay_timer_register(void) 26static void __init arch_timer_delay_timer_register(void)
@@ -48,11 +40,5 @@ int __init arch_timer_arch_init(void)
48 40
49 arch_timer_delay_timer_register(); 41 arch_timer_delay_timer_register();
50 42
51 /* Cache the sched_clock multiplier to save a divide in the hot path. */
52 sched_clock_mult = NSEC_PER_SEC / arch_timer_rate;
53 sched_clock_func = arch_timer_sched_clock;
54 pr_info("sched_clock: ARM arch timer >56 bits at %ukHz, resolution %uns\n",
55 arch_timer_rate / 1000, sched_clock_mult);
56
57 return 0; 43 return 0;
58} 44}
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 0e1e2b3afa45..5d65438685d8 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -975,6 +975,7 @@ static const char *hwcap_str[] = {
975 "idivt", 975 "idivt",
976 "vfpd32", 976 "vfpd32",
977 "lpae", 977 "lpae",
978 "evtstrm",
978 NULL 979 NULL
979}; 980};
980 981
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 696fb73296d0..1e9c3383daba 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -274,7 +274,6 @@ static void __init msm_dt_timer_init(struct device_node *np)
274 pr_err("Unknown frequency\n"); 274 pr_err("Unknown frequency\n");
275 return; 275 return;
276 } 276 }
277 of_node_put(np);
278 277
279 event_base = base + 0x4; 278 event_base = base + 0x4;
280 sts_base = base + 0x88; 279 sts_base = base + 0x88;
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
index 04f8a4a6e755..6b04260aa142 100644
--- a/arch/arm/mach-zynq/Kconfig
+++ b/arch/arm/mach-zynq/Kconfig
@@ -13,5 +13,6 @@ config ARCH_ZYNQ
13 select HAVE_SMP 13 select HAVE_SMP
14 select SPARSE_IRQ 14 select SPARSE_IRQ
15 select CADENCE_TTC_TIMER 15 select CADENCE_TTC_TIMER
16 select ARM_GLOBAL_TIMER
16 help 17 help
17 Support for Xilinx Zynq ARM Cortex A9 Platform 18 Support for Xilinx Zynq ARM Cortex A9 Platform
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index ce6ae9497492..bb0bf1bfc05d 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -15,6 +15,7 @@ config ARM64
15 select GENERIC_IOMAP 15 select GENERIC_IOMAP
16 select GENERIC_IRQ_PROBE 16 select GENERIC_IRQ_PROBE
17 select GENERIC_IRQ_SHOW 17 select GENERIC_IRQ_SHOW
18 select GENERIC_SCHED_CLOCK
18 select GENERIC_SMP_IDLE_THREAD 19 select GENERIC_SMP_IDLE_THREAD
19 select GENERIC_TIME_VSYSCALL 20 select GENERIC_TIME_VSYSCALL
20 select HARDIRQS_SW_RESEND 21 select HARDIRQS_SW_RESEND
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
index c9f1d2816c2b..9400596a0f39 100644
--- a/arch/arm64/include/asm/arch_timer.h
+++ b/arch/arm64/include/asm/arch_timer.h
@@ -92,19 +92,49 @@ static inline u32 arch_timer_get_cntfrq(void)
92 return val; 92 return val;
93} 93}
94 94
95static inline void arch_counter_set_user_access(void) 95static inline u32 arch_timer_get_cntkctl(void)
96{ 96{
97 u32 cntkctl; 97 u32 cntkctl;
98
99 /* Disable user access to the timers and the physical counter. */
100 asm volatile("mrs %0, cntkctl_el1" : "=r" (cntkctl)); 98 asm volatile("mrs %0, cntkctl_el1" : "=r" (cntkctl));
101 cntkctl &= ~((3 << 8) | (1 << 0)); 99 return cntkctl;
100}
102 101
103 /* Enable user access to the virtual counter and frequency. */ 102static inline void arch_timer_set_cntkctl(u32 cntkctl)
104 cntkctl |= (1 << 1); 103{
105 asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl)); 104 asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl));
106} 105}
107 106
107static inline void arch_counter_set_user_access(void)
108{
109 u32 cntkctl = arch_timer_get_cntkctl();
110
111 /* Disable user access to the timers and the physical counter */
112 /* Also disable virtual event stream */
113 cntkctl &= ~(ARCH_TIMER_USR_PT_ACCESS_EN
114 | ARCH_TIMER_USR_VT_ACCESS_EN
115 | ARCH_TIMER_VIRT_EVT_EN
116 | ARCH_TIMER_USR_PCT_ACCESS_EN);
117
118 /* Enable user access to the virtual counter */
119 cntkctl |= ARCH_TIMER_USR_VCT_ACCESS_EN;
120
121 arch_timer_set_cntkctl(cntkctl);
122}
123
124static inline void arch_timer_evtstrm_enable(int divider)
125{
126 u32 cntkctl = arch_timer_get_cntkctl();
127 cntkctl &= ~ARCH_TIMER_EVT_TRIGGER_MASK;
128 /* Set the divider and enable virtual event stream */
129 cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT)
130 | ARCH_TIMER_VIRT_EVT_EN;
131 arch_timer_set_cntkctl(cntkctl);
132 elf_hwcap |= HWCAP_EVTSTRM;
133#ifdef CONFIG_COMPAT
134 compat_elf_hwcap |= COMPAT_HWCAP_EVTSTRM;
135#endif
136}
137
108static inline u64 arch_counter_get_cntvct(void) 138static inline u64 arch_counter_get_cntvct(void)
109{ 139{
110 u64 cval; 140 u64 cval;
diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h
index e2950b098e76..6cddbb0c9f54 100644
--- a/arch/arm64/include/asm/hwcap.h
+++ b/arch/arm64/include/asm/hwcap.h
@@ -30,6 +30,7 @@
30#define COMPAT_HWCAP_IDIVA (1 << 17) 30#define COMPAT_HWCAP_IDIVA (1 << 17)
31#define COMPAT_HWCAP_IDIVT (1 << 18) 31#define COMPAT_HWCAP_IDIVT (1 << 18)
32#define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT) 32#define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT)
33#define COMPAT_HWCAP_EVTSTRM (1 << 21)
33 34
34#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
35/* 36/*
@@ -37,11 +38,11 @@
37 * instruction set this cpu supports. 38 * instruction set this cpu supports.
38 */ 39 */
39#define ELF_HWCAP (elf_hwcap) 40#define ELF_HWCAP (elf_hwcap)
40#define COMPAT_ELF_HWCAP (COMPAT_HWCAP_HALF|COMPAT_HWCAP_THUMB|\ 41
41 COMPAT_HWCAP_FAST_MULT|COMPAT_HWCAP_EDSP|\ 42#ifdef CONFIG_COMPAT
42 COMPAT_HWCAP_TLS|COMPAT_HWCAP_VFP|\ 43#define COMPAT_ELF_HWCAP (compat_elf_hwcap)
43 COMPAT_HWCAP_VFPv3|COMPAT_HWCAP_VFPv4|\ 44extern unsigned int compat_elf_hwcap;
44 COMPAT_HWCAP_NEON|COMPAT_HWCAP_IDIV) 45#endif
45 46
46extern unsigned long elf_hwcap; 47extern unsigned long elf_hwcap;
47#endif 48#endif
diff --git a/arch/arm64/include/uapi/asm/hwcap.h b/arch/arm64/include/uapi/asm/hwcap.h
index eea497578b87..9b12476e9c85 100644
--- a/arch/arm64/include/uapi/asm/hwcap.h
+++ b/arch/arm64/include/uapi/asm/hwcap.h
@@ -21,6 +21,7 @@
21 */ 21 */
22#define HWCAP_FP (1 << 0) 22#define HWCAP_FP (1 << 0)
23#define HWCAP_ASIMD (1 << 1) 23#define HWCAP_ASIMD (1 << 1)
24#define HWCAP_EVTSTRM (1 << 2)
24 25
25 26
26#endif /* _UAPI__ASM_HWCAP_H */ 27#endif /* _UAPI__ASM_HWCAP_H */
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 9cf30f49610d..47905598d790 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -61,6 +61,16 @@ EXPORT_SYMBOL(processor_id);
61unsigned long elf_hwcap __read_mostly; 61unsigned long elf_hwcap __read_mostly;
62EXPORT_SYMBOL_GPL(elf_hwcap); 62EXPORT_SYMBOL_GPL(elf_hwcap);
63 63
64#ifdef CONFIG_COMPAT
65#define COMPAT_ELF_HWCAP_DEFAULT \
66 (COMPAT_HWCAP_HALF|COMPAT_HWCAP_THUMB|\
67 COMPAT_HWCAP_FAST_MULT|COMPAT_HWCAP_EDSP|\
68 COMPAT_HWCAP_TLS|COMPAT_HWCAP_VFP|\
69 COMPAT_HWCAP_VFPv3|COMPAT_HWCAP_VFPv4|\
70 COMPAT_HWCAP_NEON|COMPAT_HWCAP_IDIV)
71unsigned int compat_elf_hwcap __read_mostly = COMPAT_ELF_HWCAP_DEFAULT;
72#endif
73
64static const char *cpu_name; 74static const char *cpu_name;
65static const char *machine_name; 75static const char *machine_name;
66phys_addr_t __fdt_pointer __initdata; 76phys_addr_t __fdt_pointer __initdata;
@@ -311,6 +321,7 @@ subsys_initcall(topology_init);
311static const char *hwcap_str[] = { 321static const char *hwcap_str[] = {
312 "fp", 322 "fp",
313 "asimd", 323 "asimd",
324 "evtstrm",
314 NULL 325 NULL
315}; 326};
316 327
diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
index 03dc3718eb13..29c39d5d77e3 100644
--- a/arch/arm64/kernel/time.c
+++ b/arch/arm64/kernel/time.c
@@ -61,13 +61,6 @@ unsigned long profile_pc(struct pt_regs *regs)
61EXPORT_SYMBOL(profile_pc); 61EXPORT_SYMBOL(profile_pc);
62#endif 62#endif
63 63
64static u64 sched_clock_mult __read_mostly;
65
66unsigned long long notrace sched_clock(void)
67{
68 return arch_timer_read_counter() * sched_clock_mult;
69}
70
71void __init time_init(void) 64void __init time_init(void)
72{ 65{
73 u32 arch_timer_rate; 66 u32 arch_timer_rate;
@@ -78,9 +71,6 @@ void __init time_init(void)
78 if (!arch_timer_rate) 71 if (!arch_timer_rate)
79 panic("Unable to initialise architected timer.\n"); 72 panic("Unable to initialise architected timer.\n");
80 73
81 /* Cache the sched_clock multiplier to save a divide in the hot path. */
82 sched_clock_mult = NSEC_PER_SEC / arch_timer_rate;
83
84 /* Calibrate the delay loop directly */ 74 /* Calibrate the delay loop directly */
85 lpj_fine = arch_timer_rate / HZ; 75 lpj_fine = arch_timer_rate / HZ;
86} 76}
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 0aa29394ed6f..5b9dd445eb89 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -192,6 +192,14 @@ static __init int add_rtc_cmos(void)
192 if (mrst_identify_cpu()) 192 if (mrst_identify_cpu())
193 return -ENODEV; 193 return -ENODEV;
194 194
195#ifdef CONFIG_ACPI
196 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC) {
197 /* This warning can likely go away again in a year or two. */
198 pr_info("ACPI: not registering RTC platform device\n");
199 return -ENODEV;
200 }
201#endif
202
195 platform_device_register(&rtc_device); 203 platform_device_register(&rtc_device);
196 dev_info(&rtc_device.dev, 204 dev_info(&rtc_device.dev,
197 "registered platform RTC device (no PNP device found)\n"); 205 "registered platform RTC device (no PNP device found)\n");