From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754922AbdGURQW (ORCPT ); Fri, 21 Jul 2017 13:16:22 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:39066 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754808AbdGURQM (ORCPT ); Fri, 21 Jul 2017 13:16:12 -0400 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mark Rutland , Russell King , Catalin Marinas , Will Deacon , Daniel Lezcano , Thomas Gleixner Subject: [PATCH 15/16] clocksource/arm_arch_timer: Add helper to disable VDSO fastpath Date: Fri, 21 Jul 2017 18:15:41 +0100 Message-Id: <20170721171542.27639-16-marc.zyngier@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170721171542.27639-1-marc.zyngier@arm.com> References: <20170721171542.27639-1-marc.zyngier@arm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we are going to add more paths where we have to disable the counter access in the VDSO, let's add a helper that does exactly that. Acked-by: Mark Rutland Signed-off-by: Marc Zyngier --- drivers/clocksource/arm_arch_timer.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index aae87c4c546e..4f4633157978 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -188,6 +188,22 @@ struct ate_acpi_oem_info { u32 oem_revision; }; +static void __maybe_unused disable_vdso(void) +{ + /* + * Don't use the vdso fastpath if errata require using the + * out-of-line counter accessor and/or trap its access. We may + * change our mind pretty late in the game (with a per-CPU + * erratum, for example), so change both the default value and + * the vdso itself. + */ + if (vdso_default) { + pr_info("Disabling VDSO direct access\n"); + clocksource_counter.archdata.vdso_direct = false; + vdso_default = false; + } +} + #ifdef CONFIG_FSL_ERRATUM_A008585 /* * The number of retries is an arbitrary value well beyond the highest number @@ -457,16 +473,8 @@ void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa static_branch_enable(&arch_timer_read_ool_enabled); - /* - * Don't use the vdso fastpath if errata require using the - * out-of-line counter accessor. We may change our mind pretty - * late in the game (with a per-CPU erratum, for example), so - * change both the default value and the vdso itself. - */ - if (wa->read_cntvct_el0) { - clocksource_counter.archdata.vdso_direct = false; - vdso_default = false; - } + if (wa->read_cntvct_el0) + disable_vdso(); } static void arch_timer_check_ool_workaround(enum arch_timer_erratum_match_type type, -- 2.11.0