Re: [PATCH v5 01/12] MIPS/Oprofile: extract PMU defines/helper functions for sharing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/27/2010 06:03 AM, Deng-Cheng Zhu wrote:
[...]

diff --git a/arch/mips/include/asm/pmu.h b/arch/mips/include/asm/pmu.h
[...]
+
+#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) || \
+    defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_SB1)
+

Why predicate the entire contents of the file?

In any event, if you keep it, it shold probably be something like:

    #if defined(CONFIG_CPU_MIPSR1) || defined(CONFIG_CPU_MIPSR2)


+#define M_CONFIG1_PC	(1<<  4)
+
+#define M_PERFCTL_EXL			(1UL<<   0)
+#define M_PERFCTL_KERNEL		(1UL<<   1)
+#define M_PERFCTL_SUPERVISOR		(1UL<<   2)
+#define M_PERFCTL_USER			(1UL<<   3)
+#define M_PERFCTL_INTERRUPT_ENABLE	(1UL<<   4)
+#define M_PERFCTL_EVENT(event)		(((event)&  0x3ff)<<  5)
+#define M_PERFCTL_VPEID(vpe)		((vpe)<<  16)
+#define M_PERFCTL_MT_EN(filter)		((filter)<<  20)
+#define    M_TC_EN_ALL			M_PERFCTL_MT_EN(0)
+#define    M_TC_EN_VPE			M_PERFCTL_MT_EN(1)
+#define    M_TC_EN_TC			M_PERFCTL_MT_EN(2)
+#define M_PERFCTL_TCID(tcid)		((tcid)<<  22)
+#define M_PERFCTL_WIDE			(1UL<<  30)
+#define M_PERFCTL_MORE			(1UL<<  31)
+
+#define M_COUNTER_OVERFLOW		(1UL<<  31)
+

Some or all of that should probably go in asm/mipsregs.h


[...]
+
+#define __define_perf_accessors(r, n, np)				\
+									\
+static inline unsigned int r_c0_ ## r ## n(void)			\
+{									\
+	unsigned int cpu = vpe_id();					\
+									\
+	switch (cpu) {							\
+	case 0:								\
+		return read_c0_ ## r ## n();				\
+	case 1:								\
+		return read_c0_ ## r ## np();				\
+	default:							\

Are 0 and 1 really the only conceivable values?


David Daney



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux