diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-04-01 18:15:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-04-01 18:15:51 -0400 |
commit | 4fff5056600300402472dcc99cd814bfa012d8ee (patch) | |
tree | 7437fd0d8776cad26abcffeafac6e148fad1a170 | |
parent | 2708d17d07d2968a0fb0efa692b82cd544c3e9d4 (diff) | |
parent | 431597bb95560c975221c0394c442723d7a21f2d (diff) |
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Will Deacon:
- fix oops when patching in alternative sequences on big-endian CPUs
- reconcile asm/perf_event.h after merge window fallout with KVM ARM
- defconfig updates
* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
arm64: defconfig: updates for 4.6
arm64: perf: Move PMU register related defines to asm/perf_event.h
arm64: opcodes.h: Add arm big-endian config options before including arm header
-rw-r--r-- | arch/arm64/configs/defconfig | 28 | ||||
-rw-r--r-- | arch/arm64/include/asm/kvm_host.h | 1 | ||||
-rw-r--r-- | arch/arm64/include/asm/kvm_hyp.h | 1 | ||||
-rw-r--r-- | arch/arm64/include/asm/kvm_perf_event.h | 68 | ||||
-rw-r--r-- | arch/arm64/include/asm/opcodes.h | 4 | ||||
-rw-r--r-- | arch/arm64/include/asm/perf_event.h | 47 | ||||
-rw-r--r-- | arch/arm64/kernel/perf_event.c | 72 |
7 files changed, 90 insertions, 131 deletions
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index f70505186820..a44ef995d8ae 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig | |||
@@ -68,11 +68,13 @@ CONFIG_KSM=y | |||
68 | CONFIG_TRANSPARENT_HUGEPAGE=y | 68 | CONFIG_TRANSPARENT_HUGEPAGE=y |
69 | CONFIG_CMA=y | 69 | CONFIG_CMA=y |
70 | CONFIG_XEN=y | 70 | CONFIG_XEN=y |
71 | CONFIG_CMDLINE="console=ttyAMA0" | ||
72 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 71 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
73 | CONFIG_COMPAT=y | 72 | CONFIG_COMPAT=y |
74 | CONFIG_CPU_IDLE=y | 73 | CONFIG_CPU_IDLE=y |
75 | CONFIG_ARM_CPUIDLE=y | 74 | CONFIG_ARM_CPUIDLE=y |
75 | CONFIG_CPU_FREQ=y | ||
76 | CONFIG_ARM_BIG_LITTLE_CPUFREQ=y | ||
77 | CONFIG_ARM_SCPI_CPUFREQ=y | ||
76 | CONFIG_NET=y | 78 | CONFIG_NET=y |
77 | CONFIG_PACKET=y | 79 | CONFIG_PACKET=y |
78 | CONFIG_UNIX=y | 80 | CONFIG_UNIX=y |
@@ -80,7 +82,6 @@ CONFIG_INET=y | |||
80 | CONFIG_IP_PNP=y | 82 | CONFIG_IP_PNP=y |
81 | CONFIG_IP_PNP_DHCP=y | 83 | CONFIG_IP_PNP_DHCP=y |
82 | CONFIG_IP_PNP_BOOTP=y | 84 | CONFIG_IP_PNP_BOOTP=y |
83 | # CONFIG_INET_LRO is not set | ||
84 | # CONFIG_IPV6 is not set | 85 | # CONFIG_IPV6 is not set |
85 | CONFIG_BPF_JIT=y | 86 | CONFIG_BPF_JIT=y |
86 | # CONFIG_WIRELESS is not set | 87 | # CONFIG_WIRELESS is not set |
@@ -144,16 +145,18 @@ CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y | |||
144 | CONFIG_SERIAL_MVEBU_UART=y | 145 | CONFIG_SERIAL_MVEBU_UART=y |
145 | CONFIG_VIRTIO_CONSOLE=y | 146 | CONFIG_VIRTIO_CONSOLE=y |
146 | # CONFIG_HW_RANDOM is not set | 147 | # CONFIG_HW_RANDOM is not set |
147 | CONFIG_I2C=y | ||
148 | CONFIG_I2C_CHARDEV=y | 148 | CONFIG_I2C_CHARDEV=y |
149 | CONFIG_I2C_DESIGNWARE_PLATFORM=y | ||
149 | CONFIG_I2C_MV64XXX=y | 150 | CONFIG_I2C_MV64XXX=y |
150 | CONFIG_I2C_QUP=y | 151 | CONFIG_I2C_QUP=y |
152 | CONFIG_I2C_TEGRA=y | ||
151 | CONFIG_I2C_UNIPHIER_F=y | 153 | CONFIG_I2C_UNIPHIER_F=y |
152 | CONFIG_I2C_RCAR=y | 154 | CONFIG_I2C_RCAR=y |
153 | CONFIG_SPI=y | 155 | CONFIG_SPI=y |
154 | CONFIG_SPI_PL022=y | 156 | CONFIG_SPI_PL022=y |
155 | CONFIG_SPI_QUP=y | 157 | CONFIG_SPI_QUP=y |
156 | CONFIG_SPMI=y | 158 | CONFIG_SPMI=y |
159 | CONFIG_PINCTRL_SINGLE=y | ||
157 | CONFIG_PINCTRL_MSM8916=y | 160 | CONFIG_PINCTRL_MSM8916=y |
158 | CONFIG_PINCTRL_QCOM_SPMI_PMIC=y | 161 | CONFIG_PINCTRL_QCOM_SPMI_PMIC=y |
159 | CONFIG_GPIO_SYSFS=y | 162 | CONFIG_GPIO_SYSFS=y |
@@ -196,6 +199,7 @@ CONFIG_USB_EHCI_HCD_PLATFORM=y | |||
196 | CONFIG_USB_OHCI_HCD=y | 199 | CONFIG_USB_OHCI_HCD=y |
197 | CONFIG_USB_OHCI_HCD_PLATFORM=y | 200 | CONFIG_USB_OHCI_HCD_PLATFORM=y |
198 | CONFIG_USB_STORAGE=y | 201 | CONFIG_USB_STORAGE=y |
202 | CONFIG_USB_DWC2=y | ||
199 | CONFIG_USB_CHIPIDEA=y | 203 | CONFIG_USB_CHIPIDEA=y |
200 | CONFIG_USB_CHIPIDEA_UDC=y | 204 | CONFIG_USB_CHIPIDEA_UDC=y |
201 | CONFIG_USB_CHIPIDEA_HOST=y | 205 | CONFIG_USB_CHIPIDEA_HOST=y |
@@ -205,19 +209,20 @@ CONFIG_USB_MSM_OTG=y | |||
205 | CONFIG_USB_ULPI=y | 209 | CONFIG_USB_ULPI=y |
206 | CONFIG_USB_GADGET=y | 210 | CONFIG_USB_GADGET=y |
207 | CONFIG_MMC=y | 211 | CONFIG_MMC=y |
208 | CONFIG_MMC_BLOCK_MINORS=16 | 212 | CONFIG_MMC_BLOCK_MINORS=32 |
209 | CONFIG_MMC_ARMMMCI=y | 213 | CONFIG_MMC_ARMMMCI=y |
210 | CONFIG_MMC_SDHCI=y | 214 | CONFIG_MMC_SDHCI=y |
211 | CONFIG_MMC_SDHCI_PLTFM=y | 215 | CONFIG_MMC_SDHCI_PLTFM=y |
212 | CONFIG_MMC_SDHCI_TEGRA=y | 216 | CONFIG_MMC_SDHCI_TEGRA=y |
213 | CONFIG_MMC_SDHCI_MSM=y | 217 | CONFIG_MMC_SDHCI_MSM=y |
214 | CONFIG_MMC_SPI=y | 218 | CONFIG_MMC_SPI=y |
215 | CONFIG_MMC_SUNXI=y | ||
216 | CONFIG_MMC_DW=y | 219 | CONFIG_MMC_DW=y |
217 | CONFIG_MMC_DW_EXYNOS=y | 220 | CONFIG_MMC_DW_EXYNOS=y |
218 | CONFIG_MMC_BLOCK_MINORS=16 | 221 | CONFIG_MMC_DW_K3=y |
222 | CONFIG_MMC_SUNXI=y | ||
219 | CONFIG_NEW_LEDS=y | 223 | CONFIG_NEW_LEDS=y |
220 | CONFIG_LEDS_CLASS=y | 224 | CONFIG_LEDS_CLASS=y |
225 | CONFIG_LEDS_GPIO=y | ||
221 | CONFIG_LEDS_SYSCON=y | 226 | CONFIG_LEDS_SYSCON=y |
222 | CONFIG_LEDS_TRIGGERS=y | 227 | CONFIG_LEDS_TRIGGERS=y |
223 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | 228 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y |
@@ -229,8 +234,8 @@ CONFIG_RTC_DRV_PL031=y | |||
229 | CONFIG_RTC_DRV_SUN6I=y | 234 | CONFIG_RTC_DRV_SUN6I=y |
230 | CONFIG_RTC_DRV_XGENE=y | 235 | CONFIG_RTC_DRV_XGENE=y |
231 | CONFIG_DMADEVICES=y | 236 | CONFIG_DMADEVICES=y |
232 | CONFIG_QCOM_BAM_DMA=y | ||
233 | CONFIG_TEGRA20_APB_DMA=y | 237 | CONFIG_TEGRA20_APB_DMA=y |
238 | CONFIG_QCOM_BAM_DMA=y | ||
234 | CONFIG_RCAR_DMAC=y | 239 | CONFIG_RCAR_DMAC=y |
235 | CONFIG_VFIO=y | 240 | CONFIG_VFIO=y |
236 | CONFIG_VFIO_PCI=y | 241 | CONFIG_VFIO_PCI=y |
@@ -239,20 +244,26 @@ CONFIG_VIRTIO_BALLOON=y | |||
239 | CONFIG_VIRTIO_MMIO=y | 244 | CONFIG_VIRTIO_MMIO=y |
240 | CONFIG_XEN_GNTDEV=y | 245 | CONFIG_XEN_GNTDEV=y |
241 | CONFIG_XEN_GRANT_DEV_ALLOC=y | 246 | CONFIG_XEN_GRANT_DEV_ALLOC=y |
247 | CONFIG_COMMON_CLK_SCPI=y | ||
242 | CONFIG_COMMON_CLK_CS2000_CP=y | 248 | CONFIG_COMMON_CLK_CS2000_CP=y |
243 | CONFIG_COMMON_CLK_QCOM=y | 249 | CONFIG_COMMON_CLK_QCOM=y |
244 | CONFIG_MSM_GCC_8916=y | 250 | CONFIG_MSM_GCC_8916=y |
245 | CONFIG_HWSPINLOCK_QCOM=y | 251 | CONFIG_HWSPINLOCK_QCOM=y |
252 | CONFIG_MAILBOX=y | ||
253 | CONFIG_ARM_MHU=y | ||
254 | CONFIG_HI6220_MBOX=y | ||
246 | CONFIG_ARM_SMMU=y | 255 | CONFIG_ARM_SMMU=y |
247 | CONFIG_QCOM_SMEM=y | 256 | CONFIG_QCOM_SMEM=y |
248 | CONFIG_QCOM_SMD=y | 257 | CONFIG_QCOM_SMD=y |
249 | CONFIG_QCOM_SMD_RPM=y | 258 | CONFIG_QCOM_SMD_RPM=y |
250 | CONFIG_ARCH_TEGRA_132_SOC=y | 259 | CONFIG_ARCH_TEGRA_132_SOC=y |
251 | CONFIG_ARCH_TEGRA_210_SOC=y | 260 | CONFIG_ARCH_TEGRA_210_SOC=y |
252 | CONFIG_HISILICON_IRQ_MBIGEN=y | ||
253 | CONFIG_EXTCON_USB_GPIO=y | 261 | CONFIG_EXTCON_USB_GPIO=y |
262 | CONFIG_COMMON_RESET_HI6220=y | ||
254 | CONFIG_PHY_RCAR_GEN3_USB2=y | 263 | CONFIG_PHY_RCAR_GEN3_USB2=y |
264 | CONFIG_PHY_HI6220_USB=y | ||
255 | CONFIG_PHY_XGENE=y | 265 | CONFIG_PHY_XGENE=y |
266 | CONFIG_ARM_SCPI_PROTOCOL=y | ||
256 | CONFIG_EXT2_FS=y | 267 | CONFIG_EXT2_FS=y |
257 | CONFIG_EXT3_FS=y | 268 | CONFIG_EXT3_FS=y |
258 | CONFIG_FANOTIFY=y | 269 | CONFIG_FANOTIFY=y |
@@ -264,6 +275,7 @@ CONFIG_CUSE=y | |||
264 | CONFIG_VFAT_FS=y | 275 | CONFIG_VFAT_FS=y |
265 | CONFIG_TMPFS=y | 276 | CONFIG_TMPFS=y |
266 | CONFIG_HUGETLBFS=y | 277 | CONFIG_HUGETLBFS=y |
278 | CONFIG_CONFIGFS_FS=y | ||
267 | CONFIG_EFIVAR_FS=y | 279 | CONFIG_EFIVAR_FS=y |
268 | CONFIG_SQUASHFS=y | 280 | CONFIG_SQUASHFS=y |
269 | CONFIG_NFS_FS=y | 281 | CONFIG_NFS_FS=y |
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 227ed475dbd3..b7e82a795ac9 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <asm/kvm.h> | 27 | #include <asm/kvm.h> |
28 | #include <asm/kvm_asm.h> | 28 | #include <asm/kvm_asm.h> |
29 | #include <asm/kvm_mmio.h> | 29 | #include <asm/kvm_mmio.h> |
30 | #include <asm/kvm_perf_event.h> | ||
31 | 30 | ||
32 | #define __KVM_HAVE_ARCH_INTC_INITIALIZED | 31 | #define __KVM_HAVE_ARCH_INTC_INITIALIZED |
33 | 32 | ||
diff --git a/arch/arm64/include/asm/kvm_hyp.h b/arch/arm64/include/asm/kvm_hyp.h index a46b019ebcf5..44eaff70da6a 100644 --- a/arch/arm64/include/asm/kvm_hyp.h +++ b/arch/arm64/include/asm/kvm_hyp.h | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/compiler.h> | 21 | #include <linux/compiler.h> |
22 | #include <linux/kvm_host.h> | 22 | #include <linux/kvm_host.h> |
23 | #include <asm/kvm_mmu.h> | 23 | #include <asm/kvm_mmu.h> |
24 | #include <asm/kvm_perf_event.h> | ||
25 | #include <asm/sysreg.h> | 24 | #include <asm/sysreg.h> |
26 | 25 | ||
27 | #define __hyp_text __section(.hyp.text) notrace | 26 | #define __hyp_text __section(.hyp.text) notrace |
diff --git a/arch/arm64/include/asm/kvm_perf_event.h b/arch/arm64/include/asm/kvm_perf_event.h deleted file mode 100644 index c18fdebb8f66..000000000000 --- a/arch/arm64/include/asm/kvm_perf_event.h +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 ARM Ltd. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #ifndef __ASM_KVM_PERF_EVENT_H | ||
18 | #define __ASM_KVM_PERF_EVENT_H | ||
19 | |||
20 | #define ARMV8_PMU_MAX_COUNTERS 32 | ||
21 | #define ARMV8_PMU_COUNTER_MASK (ARMV8_PMU_MAX_COUNTERS - 1) | ||
22 | |||
23 | /* | ||
24 | * Per-CPU PMCR: config reg | ||
25 | */ | ||
26 | #define ARMV8_PMU_PMCR_E (1 << 0) /* Enable all counters */ | ||
27 | #define ARMV8_PMU_PMCR_P (1 << 1) /* Reset all counters */ | ||
28 | #define ARMV8_PMU_PMCR_C (1 << 2) /* Cycle counter reset */ | ||
29 | #define ARMV8_PMU_PMCR_D (1 << 3) /* CCNT counts every 64th cpu cycle */ | ||
30 | #define ARMV8_PMU_PMCR_X (1 << 4) /* Export to ETM */ | ||
31 | #define ARMV8_PMU_PMCR_DP (1 << 5) /* Disable CCNT if non-invasive debug*/ | ||
32 | /* Determines which bit of PMCCNTR_EL0 generates an overflow */ | ||
33 | #define ARMV8_PMU_PMCR_LC (1 << 6) | ||
34 | #define ARMV8_PMU_PMCR_N_SHIFT 11 /* Number of counters supported */ | ||
35 | #define ARMV8_PMU_PMCR_N_MASK 0x1f | ||
36 | #define ARMV8_PMU_PMCR_MASK 0x7f /* Mask for writable bits */ | ||
37 | |||
38 | /* | ||
39 | * PMOVSR: counters overflow flag status reg | ||
40 | */ | ||
41 | #define ARMV8_PMU_OVSR_MASK 0xffffffff /* Mask for writable bits */ | ||
42 | #define ARMV8_PMU_OVERFLOWED_MASK ARMV8_PMU_OVSR_MASK | ||
43 | |||
44 | /* | ||
45 | * PMXEVTYPER: Event selection reg | ||
46 | */ | ||
47 | #define ARMV8_PMU_EVTYPE_MASK 0xc80003ff /* Mask for writable bits */ | ||
48 | #define ARMV8_PMU_EVTYPE_EVENT 0x3ff /* Mask for EVENT bits */ | ||
49 | |||
50 | #define ARMV8_PMU_EVTYPE_EVENT_SW_INCR 0 /* Software increment event */ | ||
51 | |||
52 | /* | ||
53 | * Event filters for PMUv3 | ||
54 | */ | ||
55 | #define ARMV8_PMU_EXCLUDE_EL1 (1 << 31) | ||
56 | #define ARMV8_PMU_EXCLUDE_EL0 (1 << 30) | ||
57 | #define ARMV8_PMU_INCLUDE_EL2 (1 << 27) | ||
58 | |||
59 | /* | ||
60 | * PMUSERENR: user enable reg | ||
61 | */ | ||
62 | #define ARMV8_PMU_USERENR_MASK 0xf /* Mask for writable bits */ | ||
63 | #define ARMV8_PMU_USERENR_EN (1 << 0) /* PMU regs can be accessed at EL0 */ | ||
64 | #define ARMV8_PMU_USERENR_SW (1 << 1) /* PMSWINC can be written at EL0 */ | ||
65 | #define ARMV8_PMU_USERENR_CR (1 << 2) /* Cycle counter can be read at EL0 */ | ||
66 | #define ARMV8_PMU_USERENR_ER (1 << 3) /* Event counter can be read at EL0 */ | ||
67 | |||
68 | #endif | ||
diff --git a/arch/arm64/include/asm/opcodes.h b/arch/arm64/include/asm/opcodes.h index 4e603ea36ad3..123f45d92cd1 100644 --- a/arch/arm64/include/asm/opcodes.h +++ b/arch/arm64/include/asm/opcodes.h | |||
@@ -1 +1,5 @@ | |||
1 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
2 | #define CONFIG_CPU_ENDIAN_BE8 CONFIG_CPU_BIG_ENDIAN | ||
3 | #endif | ||
4 | |||
1 | #include <../../arm/include/asm/opcodes.h> | 5 | #include <../../arm/include/asm/opcodes.h> |
diff --git a/arch/arm64/include/asm/perf_event.h b/arch/arm64/include/asm/perf_event.h index 7bd3cdb533ea..2065f46fa740 100644 --- a/arch/arm64/include/asm/perf_event.h +++ b/arch/arm64/include/asm/perf_event.h | |||
@@ -17,6 +17,53 @@ | |||
17 | #ifndef __ASM_PERF_EVENT_H | 17 | #ifndef __ASM_PERF_EVENT_H |
18 | #define __ASM_PERF_EVENT_H | 18 | #define __ASM_PERF_EVENT_H |
19 | 19 | ||
20 | #define ARMV8_PMU_MAX_COUNTERS 32 | ||
21 | #define ARMV8_PMU_COUNTER_MASK (ARMV8_PMU_MAX_COUNTERS - 1) | ||
22 | |||
23 | /* | ||
24 | * Per-CPU PMCR: config reg | ||
25 | */ | ||
26 | #define ARMV8_PMU_PMCR_E (1 << 0) /* Enable all counters */ | ||
27 | #define ARMV8_PMU_PMCR_P (1 << 1) /* Reset all counters */ | ||
28 | #define ARMV8_PMU_PMCR_C (1 << 2) /* Cycle counter reset */ | ||
29 | #define ARMV8_PMU_PMCR_D (1 << 3) /* CCNT counts every 64th cpu cycle */ | ||
30 | #define ARMV8_PMU_PMCR_X (1 << 4) /* Export to ETM */ | ||
31 | #define ARMV8_PMU_PMCR_DP (1 << 5) /* Disable CCNT if non-invasive debug*/ | ||
32 | #define ARMV8_PMU_PMCR_LC (1 << 6) /* Overflow on 64 bit cycle counter */ | ||
33 | #define ARMV8_PMU_PMCR_N_SHIFT 11 /* Number of counters supported */ | ||
34 | #define ARMV8_PMU_PMCR_N_MASK 0x1f | ||
35 | #define ARMV8_PMU_PMCR_MASK 0x7f /* Mask for writable bits */ | ||
36 | |||
37 | /* | ||
38 | * PMOVSR: counters overflow flag status reg | ||
39 | */ | ||
40 | #define ARMV8_PMU_OVSR_MASK 0xffffffff /* Mask for writable bits */ | ||
41 | #define ARMV8_PMU_OVERFLOWED_MASK ARMV8_PMU_OVSR_MASK | ||
42 | |||
43 | /* | ||
44 | * PMXEVTYPER: Event selection reg | ||
45 | */ | ||
46 | #define ARMV8_PMU_EVTYPE_MASK 0xc800ffff /* Mask for writable bits */ | ||
47 | #define ARMV8_PMU_EVTYPE_EVENT 0xffff /* Mask for EVENT bits */ | ||
48 | |||
49 | #define ARMV8_PMU_EVTYPE_EVENT_SW_INCR 0 /* Software increment event */ | ||
50 | |||
51 | /* | ||
52 | * Event filters for PMUv3 | ||
53 | */ | ||
54 | #define ARMV8_PMU_EXCLUDE_EL1 (1 << 31) | ||
55 | #define ARMV8_PMU_EXCLUDE_EL0 (1 << 30) | ||
56 | #define ARMV8_PMU_INCLUDE_EL2 (1 << 27) | ||
57 | |||
58 | /* | ||
59 | * PMUSERENR: user enable reg | ||
60 | */ | ||
61 | #define ARMV8_PMU_USERENR_MASK 0xf /* Mask for writable bits */ | ||
62 | #define ARMV8_PMU_USERENR_EN (1 << 0) /* PMU regs can be accessed at EL0 */ | ||
63 | #define ARMV8_PMU_USERENR_SW (1 << 1) /* PMSWINC can be written at EL0 */ | ||
64 | #define ARMV8_PMU_USERENR_CR (1 << 2) /* Cycle counter can be read at EL0 */ | ||
65 | #define ARMV8_PMU_USERENR_ER (1 << 3) /* Event counter can be read at EL0 */ | ||
66 | |||
20 | #ifdef CONFIG_PERF_EVENTS | 67 | #ifdef CONFIG_PERF_EVENTS |
21 | struct pt_regs; | 68 | struct pt_regs; |
22 | extern unsigned long perf_instruction_pointer(struct pt_regs *regs); | 69 | extern unsigned long perf_instruction_pointer(struct pt_regs *regs); |
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 767c4f6e1f5b..f419a7c075a4 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <asm/irq_regs.h> | 22 | #include <asm/irq_regs.h> |
23 | #include <asm/perf_event.h> | ||
23 | #include <asm/virt.h> | 24 | #include <asm/virt.h> |
24 | 25 | ||
25 | #include <linux/of.h> | 26 | #include <linux/of.h> |
@@ -384,9 +385,6 @@ static const struct attribute_group *armv8_pmuv3_attr_groups[] = { | |||
384 | #define ARMV8_IDX_COUNTER_LAST(cpu_pmu) \ | 385 | #define ARMV8_IDX_COUNTER_LAST(cpu_pmu) \ |
385 | (ARMV8_IDX_CYCLE_COUNTER + cpu_pmu->num_events - 1) | 386 | (ARMV8_IDX_CYCLE_COUNTER + cpu_pmu->num_events - 1) |
386 | 387 | ||
387 | #define ARMV8_MAX_COUNTERS 32 | ||
388 | #define ARMV8_COUNTER_MASK (ARMV8_MAX_COUNTERS - 1) | ||
389 | |||
390 | /* | 388 | /* |
391 | * ARMv8 low level PMU access | 389 | * ARMv8 low level PMU access |
392 | */ | 390 | */ |
@@ -395,40 +393,7 @@ static const struct attribute_group *armv8_pmuv3_attr_groups[] = { | |||
395 | * Perf Event to low level counters mapping | 393 | * Perf Event to low level counters mapping |
396 | */ | 394 | */ |
397 | #define ARMV8_IDX_TO_COUNTER(x) \ | 395 | #define ARMV8_IDX_TO_COUNTER(x) \ |
398 | (((x) - ARMV8_IDX_COUNTER0) & ARMV8_COUNTER_MASK) | 396 | (((x) - ARMV8_IDX_COUNTER0) & ARMV8_PMU_COUNTER_MASK) |
399 | |||
400 | /* | ||
401 | * Per-CPU PMCR: config reg | ||
402 | */ | ||
403 | #define ARMV8_PMCR_E (1 << 0) /* Enable all counters */ | ||
404 | #define ARMV8_PMCR_P (1 << 1) /* Reset all counters */ | ||
405 | #define ARMV8_PMCR_C (1 << 2) /* Cycle counter reset */ | ||
406 | #define ARMV8_PMCR_D (1 << 3) /* CCNT counts every 64th cpu cycle */ | ||
407 | #define ARMV8_PMCR_X (1 << 4) /* Export to ETM */ | ||
408 | #define ARMV8_PMCR_DP (1 << 5) /* Disable CCNT if non-invasive debug*/ | ||
409 | #define ARMV8_PMCR_LC (1 << 6) /* Overflow on 64 bit cycle counter */ | ||
410 | #define ARMV8_PMCR_N_SHIFT 11 /* Number of counters supported */ | ||
411 | #define ARMV8_PMCR_N_MASK 0x1f | ||
412 | #define ARMV8_PMCR_MASK 0x7f /* Mask for writable bits */ | ||
413 | |||
414 | /* | ||
415 | * PMOVSR: counters overflow flag status reg | ||
416 | */ | ||
417 | #define ARMV8_OVSR_MASK 0xffffffff /* Mask for writable bits */ | ||
418 | #define ARMV8_OVERFLOWED_MASK ARMV8_OVSR_MASK | ||
419 | |||
420 | /* | ||
421 | * PMXEVTYPER: Event selection reg | ||
422 | */ | ||
423 | #define ARMV8_EVTYPE_MASK 0xc800ffff /* Mask for writable bits */ | ||
424 | #define ARMV8_EVTYPE_EVENT 0xffff /* Mask for EVENT bits */ | ||
425 | |||
426 | /* | ||
427 | * Event filters for PMUv3 | ||
428 | */ | ||
429 | #define ARMV8_EXCLUDE_EL1 (1 << 31) | ||
430 | #define ARMV8_EXCLUDE_EL0 (1 << 30) | ||
431 | #define ARMV8_INCLUDE_EL2 (1 << 27) | ||
432 | 397 | ||
433 | static inline u32 armv8pmu_pmcr_read(void) | 398 | static inline u32 armv8pmu_pmcr_read(void) |
434 | { | 399 | { |
@@ -439,14 +404,14 @@ static inline u32 armv8pmu_pmcr_read(void) | |||
439 | 404 | ||
440 | static inline void armv8pmu_pmcr_write(u32 val) | 405 | static inline void armv8pmu_pmcr_write(u32 val) |
441 | { | 406 | { |
442 | val &= ARMV8_PMCR_MASK; | 407 | val &= ARMV8_PMU_PMCR_MASK; |
443 | isb(); | 408 | isb(); |
444 | asm volatile("msr pmcr_el0, %0" :: "r" (val)); | 409 | asm volatile("msr pmcr_el0, %0" :: "r" (val)); |
445 | } | 410 | } |
446 | 411 | ||
447 | static inline int armv8pmu_has_overflowed(u32 pmovsr) | 412 | static inline int armv8pmu_has_overflowed(u32 pmovsr) |
448 | { | 413 | { |
449 | return pmovsr & ARMV8_OVERFLOWED_MASK; | 414 | return pmovsr & ARMV8_PMU_OVERFLOWED_MASK; |
450 | } | 415 | } |
451 | 416 | ||
452 | static inline int armv8pmu_counter_valid(struct arm_pmu *cpu_pmu, int idx) | 417 | static inline int armv8pmu_counter_valid(struct arm_pmu *cpu_pmu, int idx) |
@@ -512,7 +477,7 @@ static inline void armv8pmu_write_counter(struct perf_event *event, u32 value) | |||
512 | static inline void armv8pmu_write_evtype(int idx, u32 val) | 477 | static inline void armv8pmu_write_evtype(int idx, u32 val) |
513 | { | 478 | { |
514 | if (armv8pmu_select_counter(idx) == idx) { | 479 | if (armv8pmu_select_counter(idx) == idx) { |
515 | val &= ARMV8_EVTYPE_MASK; | 480 | val &= ARMV8_PMU_EVTYPE_MASK; |
516 | asm volatile("msr pmxevtyper_el0, %0" :: "r" (val)); | 481 | asm volatile("msr pmxevtyper_el0, %0" :: "r" (val)); |
517 | } | 482 | } |
518 | } | 483 | } |
@@ -558,7 +523,7 @@ static inline u32 armv8pmu_getreset_flags(void) | |||
558 | asm volatile("mrs %0, pmovsclr_el0" : "=r" (value)); | 523 | asm volatile("mrs %0, pmovsclr_el0" : "=r" (value)); |
559 | 524 | ||
560 | /* Write to clear flags */ | 525 | /* Write to clear flags */ |
561 | value &= ARMV8_OVSR_MASK; | 526 | value &= ARMV8_PMU_OVSR_MASK; |
562 | asm volatile("msr pmovsclr_el0, %0" :: "r" (value)); | 527 | asm volatile("msr pmovsclr_el0, %0" :: "r" (value)); |
563 | 528 | ||
564 | return value; | 529 | return value; |
@@ -696,7 +661,7 @@ static void armv8pmu_start(struct arm_pmu *cpu_pmu) | |||
696 | 661 | ||
697 | raw_spin_lock_irqsave(&events->pmu_lock, flags); | 662 | raw_spin_lock_irqsave(&events->pmu_lock, flags); |
698 | /* Enable all counters */ | 663 | /* Enable all counters */ |
699 | armv8pmu_pmcr_write(armv8pmu_pmcr_read() | ARMV8_PMCR_E); | 664 | armv8pmu_pmcr_write(armv8pmu_pmcr_read() | ARMV8_PMU_PMCR_E); |
700 | raw_spin_unlock_irqrestore(&events->pmu_lock, flags); | 665 | raw_spin_unlock_irqrestore(&events->pmu_lock, flags); |
701 | } | 666 | } |
702 | 667 | ||
@@ -707,7 +672,7 @@ static void armv8pmu_stop(struct arm_pmu *cpu_pmu) | |||
707 | 672 | ||
708 | raw_spin_lock_irqsave(&events->pmu_lock, flags); | 673 | raw_spin_lock_irqsave(&events->pmu_lock, flags); |
709 | /* Disable all counters */ | 674 | /* Disable all counters */ |
710 | armv8pmu_pmcr_write(armv8pmu_pmcr_read() & ~ARMV8_PMCR_E); | 675 | armv8pmu_pmcr_write(armv8pmu_pmcr_read() & ~ARMV8_PMU_PMCR_E); |
711 | raw_spin_unlock_irqrestore(&events->pmu_lock, flags); | 676 | raw_spin_unlock_irqrestore(&events->pmu_lock, flags); |
712 | } | 677 | } |
713 | 678 | ||
@@ -717,7 +682,7 @@ static int armv8pmu_get_event_idx(struct pmu_hw_events *cpuc, | |||
717 | int idx; | 682 | int idx; |
718 | struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); | 683 | struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); |
719 | struct hw_perf_event *hwc = &event->hw; | 684 | struct hw_perf_event *hwc = &event->hw; |
720 | unsigned long evtype = hwc->config_base & ARMV8_EVTYPE_EVENT; | 685 | unsigned long evtype = hwc->config_base & ARMV8_PMU_EVTYPE_EVENT; |
721 | 686 | ||
722 | /* Always place a cycle counter into the cycle counter. */ | 687 | /* Always place a cycle counter into the cycle counter. */ |
723 | if (evtype == ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES) { | 688 | if (evtype == ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES) { |
@@ -754,11 +719,11 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event, | |||
754 | attr->exclude_kernel != attr->exclude_hv) | 719 | attr->exclude_kernel != attr->exclude_hv) |
755 | return -EINVAL; | 720 | return -EINVAL; |
756 | if (attr->exclude_user) | 721 | if (attr->exclude_user) |
757 | config_base |= ARMV8_EXCLUDE_EL0; | 722 | config_base |= ARMV8_PMU_EXCLUDE_EL0; |
758 | if (!is_kernel_in_hyp_mode() && attr->exclude_kernel) | 723 | if (!is_kernel_in_hyp_mode() && attr->exclude_kernel) |
759 | config_base |= ARMV8_EXCLUDE_EL1; | 724 | config_base |= ARMV8_PMU_EXCLUDE_EL1; |
760 | if (!attr->exclude_hv) | 725 | if (!attr->exclude_hv) |
761 | config_base |= ARMV8_INCLUDE_EL2; | 726 | config_base |= ARMV8_PMU_INCLUDE_EL2; |
762 | 727 | ||
763 | /* | 728 | /* |
764 | * Install the filter into config_base as this is used to | 729 | * Install the filter into config_base as this is used to |
@@ -784,35 +749,36 @@ static void armv8pmu_reset(void *info) | |||
784 | * Initialize & Reset PMNC. Request overflow interrupt for | 749 | * Initialize & Reset PMNC. Request overflow interrupt for |
785 | * 64 bit cycle counter but cheat in armv8pmu_write_counter(). | 750 | * 64 bit cycle counter but cheat in armv8pmu_write_counter(). |
786 | */ | 751 | */ |
787 | armv8pmu_pmcr_write(ARMV8_PMCR_P | ARMV8_PMCR_C | ARMV8_PMCR_LC); | 752 | armv8pmu_pmcr_write(ARMV8_PMU_PMCR_P | ARMV8_PMU_PMCR_C | |
753 | ARMV8_PMU_PMCR_LC); | ||
788 | } | 754 | } |
789 | 755 | ||
790 | static int armv8_pmuv3_map_event(struct perf_event *event) | 756 | static int armv8_pmuv3_map_event(struct perf_event *event) |
791 | { | 757 | { |
792 | return armpmu_map_event(event, &armv8_pmuv3_perf_map, | 758 | return armpmu_map_event(event, &armv8_pmuv3_perf_map, |
793 | &armv8_pmuv3_perf_cache_map, | 759 | &armv8_pmuv3_perf_cache_map, |
794 | ARMV8_EVTYPE_EVENT); | 760 | ARMV8_PMU_EVTYPE_EVENT); |
795 | } | 761 | } |
796 | 762 | ||
797 | static int armv8_a53_map_event(struct perf_event *event) | 763 | static int armv8_a53_map_event(struct perf_event *event) |
798 | { | 764 | { |
799 | return armpmu_map_event(event, &armv8_a53_perf_map, | 765 | return armpmu_map_event(event, &armv8_a53_perf_map, |
800 | &armv8_a53_perf_cache_map, | 766 | &armv8_a53_perf_cache_map, |
801 | ARMV8_EVTYPE_EVENT); | 767 | ARMV8_PMU_EVTYPE_EVENT); |
802 | } | 768 | } |
803 | 769 | ||
804 | static int armv8_a57_map_event(struct perf_event *event) | 770 | static int armv8_a57_map_event(struct perf_event *event) |
805 | { | 771 | { |
806 | return armpmu_map_event(event, &armv8_a57_perf_map, | 772 | return armpmu_map_event(event, &armv8_a57_perf_map, |
807 | &armv8_a57_perf_cache_map, | 773 | &armv8_a57_perf_cache_map, |
808 | ARMV8_EVTYPE_EVENT); | 774 | ARMV8_PMU_EVTYPE_EVENT); |
809 | } | 775 | } |
810 | 776 | ||
811 | static int armv8_thunder_map_event(struct perf_event *event) | 777 | static int armv8_thunder_map_event(struct perf_event *event) |
812 | { | 778 | { |
813 | return armpmu_map_event(event, &armv8_thunder_perf_map, | 779 | return armpmu_map_event(event, &armv8_thunder_perf_map, |
814 | &armv8_thunder_perf_cache_map, | 780 | &armv8_thunder_perf_cache_map, |
815 | ARMV8_EVTYPE_EVENT); | 781 | ARMV8_PMU_EVTYPE_EVENT); |
816 | } | 782 | } |
817 | 783 | ||
818 | static void armv8pmu_read_num_pmnc_events(void *info) | 784 | static void armv8pmu_read_num_pmnc_events(void *info) |
@@ -820,7 +786,7 @@ static void armv8pmu_read_num_pmnc_events(void *info) | |||
820 | int *nb_cnt = info; | 786 | int *nb_cnt = info; |
821 | 787 | ||
822 | /* Read the nb of CNTx counters supported from PMNC */ | 788 | /* Read the nb of CNTx counters supported from PMNC */ |
823 | *nb_cnt = (armv8pmu_pmcr_read() >> ARMV8_PMCR_N_SHIFT) & ARMV8_PMCR_N_MASK; | 789 | *nb_cnt = (armv8pmu_pmcr_read() >> ARMV8_PMU_PMCR_N_SHIFT) & ARMV8_PMU_PMCR_N_MASK; |
824 | 790 | ||
825 | /* Add the CPU cycles counter */ | 791 | /* Add the CPU cycles counter */ |
826 | *nb_cnt += 1; | 792 | *nb_cnt += 1; |