Skip to contentSkip to conversation

csky: Add perf support for C-SKY

PATCH New [email protected] 1 participant 1 message Jan 2, 2019

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 csky: Add perf support for C-SKY

From: Guo Ren <[email protected]>

This adds basic perf support for all C-SKY CPUs. Hardware events are only supported by 807/810/860.

---
 arch/csky/Kconfig                  |   16 +-
 arch/csky/include/asm/perf_event.h |    7 +
 arch/csky/kernel/Makefile          |    1 +
 arch/csky/kernel/perf_event.c      | 1031 ++++++++++++++++++++++++++++++++++++
 4 files changed, 1054 insertions(+), 1 deletion(-)
 create mode 100644 arch/csky/include/asm/perf_event.h
 create mode 100644 arch/csky/kernel/perf_event.c
arch/csky/Kconfig +15 -1
index 6e81477..7689b54 100644
@@ -35,6 +35,7 @@ config CSKY
 	select HAVE_KERNEL_GZIP
 	select HAVE_KERNEL_LZO
 	select HAVE_KERNEL_LZMA
+	select HAVE_PERF_EVENTS
 	select HAVE_C_RECORDMCOUNT
 	select HAVE_DMA_API_DEBUG
 	select HAVE_DMA_CONTIGUOUS
@@ -43,7 +44,7 @@ config CSKY
 	select OF
 	select OF_EARLY_FLATTREE
 	select OF_RESERVED_MEM
-	select PERF_USE_VMALLOC
+	select PERF_USE_VMALLOC if CPU_CK610
 	select RTC_LIB
 	select TIMER_OF
 	select USB_ARCH_HAS_EHCI
@@ -151,6 +152,19 @@ config CPU_CK860
 endchoice
 
 choice
+	prompt "C-SKY PMU type"
+	depends on PERF_EVENTS
+	depends on CPU_CK807 || CPU_CK810 || CPU_CK860
+
+config CPU_PMU_NONE
+	bool "None"
+
+config CSKY_PMU_V1
+	bool "Performance Monitoring Unit Ver.1"
+
+endchoice
+
+choice
 	prompt "Power Manager Instruction (wait/doze/stop)"
 	default CPU_PM_NONE
 
arch/csky/include/asm/perf_event.h new file +7 -0
new file mode 100644
index 0000000..ea81931
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
+
+#ifndef __ASM_CSKY_PERF_EVENT_H
+#define __ASM_CSKY_PERF_EVENT_H
+
+#endif /* __ASM_PERF_EVENT_ELF_H */
arch/csky/kernel/Makefile +1 -0
index 3c0e2d1..484e6d3 100644
@@ -8,6 +8,7 @@ obj-$(CONFIG_MODULES)			+= module.o
 obj-$(CONFIG_SMP)			+= smp.o
 obj-$(CONFIG_FUNCTION_TRACER)		+= ftrace.o
 obj-$(CONFIG_STACKTRACE)		+= stacktrace.o
+obj-$(CONFIG_CSKY_PMU_V1)		+= perf_event.o
 
 ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE)
arch/csky/kernel/perf_event.c new file +1031 -0

1,031 lines not on this page · raw message

Signature · 1 line
2.7.4