perf tools: Move sh barrier.h stuff to tools/arch/sh/include/asm/barrier.h
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 7 May 2015 20:09:48 +0000 (17:09 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 8 May 2015 19:05:05 +0000 (16:05 -0300)
We will need it for atomic.h, so move it from the ad-hoc tools/perf/
place to a tools/ subset of the kernel arch/ hierarchy.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-6xqb97k782wqp1r3v6jqayki@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/arch/sh/include/asm/barrier.h [new file with mode: 0644]
tools/include/asm/barrier.h
tools/perf/MANIFEST
tools/perf/perf-sys.h

diff --git a/tools/arch/sh/include/asm/barrier.h b/tools/arch/sh/include/asm/barrier.h
new file mode 100644 (file)
index 0000000..c18fd75
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copied from the kernel sources:
+ *
+ * Copyright (C) 1999, 2000  Niibe Yutaka  &  Kaz Kojima
+ * Copyright (C) 2002 Paul Mundt
+ */
+#ifndef __TOOLS_LINUX_ASM_SH_BARRIER_H
+#define __TOOLS_LINUX_ASM_SH_BARRIER_H
+
+/*
+ * A brief note on ctrl_barrier(), the control register write barrier.
+ *
+ * Legacy SH cores typically require a sequence of 8 nops after
+ * modification of a control register in order for the changes to take
+ * effect. On newer cores (like the sh4a and sh5) this is accomplished
+ * with icbi.
+ *
+ * Also note that on sh4a in the icbi case we can forego a synco for the
+ * write barrier, as it's not necessary for control registers.
+ *
+ * Historically we have only done this type of barrier for the MMUCR, but
+ * it's also necessary for the CCR, so we make it generic here instead.
+ */
+#if defined(__SH4A__) || defined(__SH5__)
+#define mb()           __asm__ __volatile__ ("synco": : :"memory")
+#define rmb()          mb()
+#define wmb()          mb()
+#endif
+
+#include <asm-generic/barrier.h>
+
+#endif /* __TOOLS_LINUX_ASM_SH_BARRIER_H */
index 7eb88946e0726aced24a8b478e783bc8f351e1c0..1338c8a404ef724f3c35d290c23f654ae8ae2223 100644 (file)
@@ -4,4 +4,6 @@
 #include "../../arch/powerpc/include/asm/barrier.h"
 #elif defined(__s390__)
 #include "../../arch/s390/include/asm/barrier.h"
+#elif defined(__sh__)
+#include "../../arch/sh/include/asm/barrier.h"
 #endif
index ac62cafa62ecc6495850a6891a1e9ae1750b1f64..2ceb1b262729f2e96ad058c5f48b85fc200963fa 100644 (file)
@@ -1,6 +1,7 @@
 tools/perf
 tools/arch/powerpc/include/asm/barrier.h
 tools/arch/s390/include/asm/barrier.h
+tools/arch/sh/include/asm/barrier.h
 tools/arch/x86/include/asm/barrier.h
 tools/scripts
 tools/build
index f44e53efd9a45038ce6984ae0a103e6925edb1a8..7ef5e821d41888614b6b10f3499cdfda5aa9d183 100644 (file)
 #endif
 
 #ifdef __sh__
-#if defined(__SH4A__) || defined(__SH5__)
-# define mb()          asm volatile("synco" ::: "memory")
-# define wmb()         asm volatile("synco" ::: "memory")
-# define rmb()         asm volatile("synco" ::: "memory")
-#else
-# define mb()          asm volatile("" ::: "memory")
-# define wmb()         asm volatile("" ::: "memory")
-# define rmb()         asm volatile("" ::: "memory")
-#endif
 #define CPUINFO_PROC   {"cpu type"}
 #endif