From: Scott Wood <oss-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
To: Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>,
Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>,
Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>
Cc: Shawn Guo <shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
stuart.yoder-3arQi8VN3Tc@public.gmane.org,
mike.caraman-3arQi8VN3Tc@public.gmane.org,
Ding Tianhong
<dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
Scott Wood <oss-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
Subject: [PATCH v5 4/5] arm/arm64: arch_timer: Use archdata to indicate vdso suitability
Date: Fri, 9 Sep 2016 20:03:32 -0500 [thread overview]
Message-ID: <1473469413-11019-4-git-send-email-oss@buserror.net> (raw)
In-Reply-To: <1473469413-11019-1-git-send-email-oss-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
Instead of comparing the name to a magic string, use archdata to
explicitly communicate whether the arch timer is suitable for
direct vdso access.
Signed-off-by: Scott Wood <oss-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
Acked-by: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
---
arch/arm/Kconfig | 1 +
arch/arm/include/asm/clocksource.h | 8 ++++++++
arch/arm/kernel/vdso.c | 2 +-
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/clocksource.h | 8 ++++++++
arch/arm64/kernel/vdso.c | 2 +-
drivers/clocksource/arm_arch_timer.c | 11 +++--------
7 files changed, 23 insertions(+), 10 deletions(-)
create mode 100644 arch/arm/include/asm/clocksource.h
create mode 100644 arch/arm64/include/asm/clocksource.h
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a9c4e48..b2113c2 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1,6 +1,7 @@
config ARM
bool
default y
+ select ARCH_CLOCKSOURCE_DATA
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_HAS_ELF_RANDOMIZE
diff --git a/arch/arm/include/asm/clocksource.h b/arch/arm/include/asm/clocksource.h
new file mode 100644
index 0000000..0b350a7
--- /dev/null
+++ b/arch/arm/include/asm/clocksource.h
@@ -0,0 +1,8 @@
+#ifndef _ASM_CLOCKSOURCE_H
+#define _ASM_CLOCKSOURCE_H
+
+struct arch_clocksource_data {
+ bool vdso_direct; /* Usable for direct VDSO access? */
+};
+
+#endif
diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c
index 994e971..a0affd1 100644
--- a/arch/arm/kernel/vdso.c
+++ b/arch/arm/kernel/vdso.c
@@ -270,7 +270,7 @@ static bool tk_is_cntvct(const struct timekeeper *tk)
if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
return false;
- if (strcmp(tk->tkr_mono.clock->name, "arch_sys_counter") != 0)
+ if (!tk->tkr_mono.clock->archdata.vdso_direct)
return false;
return true;
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index bc3f00f..c19a574 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -4,6 +4,7 @@ config ARM64
select ACPI_GENERIC_GSI if ACPI
select ACPI_REDUCED_HARDWARE_ONLY if ACPI
select ACPI_MCFG if ACPI
+ select ARCH_CLOCKSOURCE_DATA
select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
diff --git a/arch/arm64/include/asm/clocksource.h b/arch/arm64/include/asm/clocksource.h
new file mode 100644
index 0000000..0b350a7
--- /dev/null
+++ b/arch/arm64/include/asm/clocksource.h
@@ -0,0 +1,8 @@
+#ifndef _ASM_CLOCKSOURCE_H
+#define _ASM_CLOCKSOURCE_H
+
+struct arch_clocksource_data {
+ bool vdso_direct; /* Usable for direct VDSO access? */
+};
+
+#endif
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 076312b..2fa7cf5 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -201,7 +201,7 @@ up_fail:
*/
void update_vsyscall(struct timekeeper *tk)
{
- u32 use_syscall = strcmp(tk->tkr_mono.clock->name, "arch_sys_counter");
+ u32 use_syscall = !tk->tkr_mono.clock->archdata.vdso_direct;
++vdso_data->tb_seq_count;
smp_wmb();
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 2526543..36d4ee1 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -606,23 +606,18 @@ static void __init arch_counter_register(unsigned type)
else
arch_timer_read_counter = arch_counter_get_cntpct;
+ clocksource_counter.archdata.vdso_direct = true;
+
#ifdef CONFIG_FSL_ERRATUM_A008585
/*
* Don't use the vdso fastpath if errata require using
* the out-of-line counter accessor.
*/
if (static_branch_unlikely(&arch_timer_read_ool_enabled))
- clocksource_counter.name = "arch_sys_counter_ool";
+ clocksource_counter.archdata.vdso_direct = false;
#endif
} else {
arch_timer_read_counter = arch_counter_get_cntvct_mem;
-
- /* If the clocksource name is "arch_sys_counter" the
- * VDSO will attempt to read the CP15-based counter.
- * Ensure this does not happen when CP15-based
- * counter is not available.
- */
- clocksource_counter.name = "arch_mem_counter";
}
start_count = arch_timer_read_counter();
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-09-10 1:03 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-10 1:03 [PATCH v5 1/5] arm64: arch_timer: Add device tree binding for A-008585 erratum Scott Wood
[not found] ` <1473469413-11019-1-git-send-email-oss-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
2016-09-10 1:03 ` [PATCH v5 2/5] arm64: dts: Add timer erratum property for LS2080A and LS1043A Scott Wood
2016-09-10 1:03 ` [PATCH v5 3/5] arm64: arch_timer: Work around QorIQ Erratum A-008585 Scott Wood
[not found] ` <1473469413-11019-3-git-send-email-oss-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
2016-09-12 11:36 ` Mark Rutland
2016-09-12 11:44 ` Will Deacon
[not found] ` <20160912114406.GG23211-5wv7dgnIgG8@public.gmane.org>
2016-09-12 12:30 ` Mark Rutland
2016-09-12 12:59 ` Mark Rutland
2016-09-12 13:07 ` Marc Zyngier
[not found] ` <57D6A88D.7000002-5wv7dgnIgG8@public.gmane.org>
2016-09-19 4:31 ` Scott Wood
[not found] ` <1474259505.15220.8.camel-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
2016-09-19 16:55 ` Mark Rutland
2016-09-19 4:28 ` Scott Wood
[not found] ` <1474259324.15220.5.camel-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
2016-09-19 7:44 ` Arnd Bergmann
2016-09-20 12:52 ` Shawn Guo
2016-09-19 4:41 ` Scott Wood
[not found] ` <1474260085.15220.17.camel-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
2016-09-19 16:52 ` Mark Rutland
2016-09-19 17:01 ` Scott Wood
[not found] ` <1474304489.4283.6.camel-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
2016-09-19 17:07 ` Mark Rutland
2016-09-19 19:16 ` Scott Wood
[not found] ` <1474312560.4283.10.camel-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org>
2016-09-20 9:35 ` Mark Rutland
2016-09-22 8:34 ` Scott Wood
2016-09-10 1:03 ` Scott Wood [this message]
2016-09-10 1:03 ` [PATCH v5 5/5] arm64: arch_timer: Add command line parameter for A-008585 Scott Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1473469413-11019-4-git-send-email-oss@buserror.net \
--to=oss-for+egidqehk1umjsbkqmq@public.gmane.org \
--cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=marc.zyngier-5wv7dgnIgG8@public.gmane.org \
--cc=mike.caraman-3arQi8VN3Tc@public.gmane.org \
--cc=shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=stuart.yoder-3arQi8VN3Tc@public.gmane.org \
--cc=will.deacon-5wv7dgnIgG8@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).