Skip to contentSkip to conversation

arm: vdso: move vgettimeofday.c to lib/vdso/

PATCH New Mark Salyzyn 1 participant 1 message Nov 6, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v5 9/12 arm: vdso: move vgettimeofday.c to lib/vdso/

Take an effort to recode the arm64 vdso code from assembler to C previously submitted by Andrew Pinski <[email protected]>, rework it for use in both arm and arm64, overlapping any optimizations for each architecture. But instead of landing it in arm64, land the result into lib/vdso and unify both implementations to simplify future maintenance.

Declare arch/arm/vdso/vgettimeofday.c to be a candidate for a global implementation of the vdso timer calls. The hope is that new architectures can take advantage of the current unification of arm and arm64 implementations.

We urge future efforts to merge their implementations into the global vgettimeofday.c file and thus provide functional parity.

Cc James Morse <[email protected]>
Cc Russell King <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dmitry Safonov <[email protected]>
Cc John Stultz <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Laura Abbott <[email protected]>
Cc Kees Cook <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Andy Gross <[email protected]>
Cc Kevin Brodsky <[email protected]>
Cc Andrew Pinski <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc linux-kernel at vger.kernel.org
Cc linux-arm-kernel at lists.infradead.org

v3:
- added this change
- move arch/arm/vdso/vgettimeofday.c to lib/vdso/vgettimeofday.c
- adjust vgettimeofday.c to be a better global candidate, switch to using ARCH_PROVIDES_TIMER and __arch_counter_get() as more generic.

v4:
- update commit message to reflect overall reasoning
- adjust to reflect dropping of any forced inline

v5:
- rebase due to changes in series.

---
 arch/arm/vdso/compiler.h      |   4 +
 arch/arm/vdso/vgettimeofday.c | 343 +----------------------------------------
 lib/vdso/compiler.h           |  24 +++
 lib/vdso/datapage.h           |  24 +++
 lib/vdso/vgettimeofday.c      | 344 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 397 insertions(+), 342 deletions(-)
 create mode 100644 lib/vdso/compiler.h
 create mode 100644 lib/vdso/datapage.h
 create mode 100644 lib/vdso/vgettimeofday.c
arch/arm/vdso/compiler.h +4 -0
index c7751019246a..6fd88be2ff0e 100644
@@ -34,6 +34,10 @@
 #error This code depends on AEABI system call conventions
 #endif
 
+#ifdef CONFIG_ARM_ARCH_TIMER
+#define ARCH_PROVIDES_TIMER
+#endif
+
 #define DEFINE_FALLBACK(name, type_arg1, name_arg1, type_arg2, name_arg2) \
 static notrace long name##_fallback(type_arg1 _##name_arg1,		  \
 				    type_arg2 _##name_arg2)		  \
arch/arm/vdso/vgettimeofday.c +1 -342

345 lines not on this page · raw message

lib/vdso/compiler.h new file +24 -0
new file mode 100644
index 000000000000..0e618b73e064
@@ -0,0 +1,24 @@
+/*
+ * Userspace implementations of fallback calls
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __VDSO_COMPILER_H
+#define __VDSO_COMPILER_H
+
+#error	"vdso: Provide architectural overrides such as ARCH_PROVIDES_TIMER,"
+#error	"      DEFINE_FALLBACK and __arch_counter_get or any overrides. eg:"
+#error	"      vdso entry points or compilation time helpers."
+
+#endif /* __VDSO_COMPILER_H */
lib/vdso/datapage.h new file +24 -0
new file mode 100644
index 000000000000..df4427e42d51
@@ -0,0 +1,24 @@
+/*
+ * Userspace implementations of __get_datapage
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __VDSO_DATAPAGE_H
+#define __VDSO_DATAPAGE_H
+
+#error	"vdso: Provide a user space architecture specific definition or"
+#error	"prototype for struct vdso_data *__get_datapage(void).  Also define"
+#error	"ARCH_CLOCK_FIXED_MASK if not provided by cs_mask."
+
+#endif /* __VDSO_DATAPAGE_H */
lib/vdso/vgettimeofday.c new file +344 -0

344 lines not on this page · raw message

Signature · 1 line
2.15.0.403.gc27cc4dac6-goog