From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760587AbdCVP7p (ORCPT ); Wed, 22 Mar 2017 11:59:45 -0400 Received: from foss.arm.com ([217.140.101.70]:44896 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759879AbdCVP7Z (ORCPT ); Wed, 22 Mar 2017 11:59:25 -0400 From: Marc Zyngier Subject: Re: [PATCH v2 06/18] arm64: arch_timer: Add infrastructure for multiple erratum detection methods To: Daniel Lezcano References: <20170320174829.28182-1-marc.zyngier@arm.com> <20170320174829.28182-7-marc.zyngier@arm.com> <20170322154114.GE30499@mai> Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , Catalin Marinas , Will Deacon , Scott Wood , Hanjun Guo , Ding Tianhong , dann frazier Organization: ARM Ltd Message-ID: Date: Wed, 22 Mar 2017 15:59:21 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170322154114.GE30499@mai> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Sorry, sent too quickly] On 22/03/17 15:41, Daniel Lezcano wrote: > On Mon, Mar 20, 2017 at 05:48:17PM +0000, Marc Zyngier wrote: >> We're currently stuck with DT when it comes to handling errata, which >> is pretty restrictive. In order to make things more flexible, let's >> introduce an infrastructure that could support alternative discovery >> methods. No change in functionality. >> >> Reviewed-by: Hanjun Guo >> Signed-off-by: Marc Zyngier >> --- >> arch/arm64/include/asm/arch_timer.h | 7 +++- >> drivers/clocksource/arm_arch_timer.c | 80 +++++++++++++++++++++++++++++++----- >> 2 files changed, 75 insertions(+), 12 deletions(-) >> >> diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h >> index b4b34004a21e..5cd964e90d11 100644 >> --- a/arch/arm64/include/asm/arch_timer.h >> +++ b/arch/arm64/include/asm/arch_timer.h >> @@ -37,9 +37,14 @@ extern struct static_key_false arch_timer_read_ool_enabled; >> #define needs_unstable_timer_counter_workaround() false >> #endif >> >> +enum arch_timer_erratum_match_type { >> + ate_match_dt, >> +}; >> >> struct arch_timer_erratum_workaround { >> - const char *id; /* Indicate the Erratum ID */ >> + enum arch_timer_erratum_match_type match_type; > > Putting the match_fn instead will be much more simpler and the code won't > have to deal with ate_match_type, no ? I'm not sure about the "much simpler" aspect. Each function is not necessarily standalone (see patches 8 and 13 for example, dealing with CPU-local defects). Also, given that we have two architectures to cater for, as well as two firmware interfaces, it makes more sense (at least to me) to have something that doesn't require to define a bunch of empty stubs (we already have too many of them) depending on arm vs arm64, DT vs ACPI, errata handling enabled vs disabled. We're sidestepping this at the moment because it all lives under one single config option that cannot be enabled from 32bit, but I hope to change that. > > [ ... ] > >> +static void arch_timer_check_ool_workaround(enum arch_timer_erratum_match_type type, >> + void *arg) >> +{ >> + const struct arch_timer_erratum_workaround *wa; >> + ate_match_fn_t match_fn = NULL; >> + >> + if (static_branch_unlikely(&arch_timer_read_ool_enabled)) >> + return; >> + > > Why is this check necessary ? We don't allow cumulative workarounds at this stage. This restriction gets lifted (to some extent) later in the series. Thanks, M. -- Jazz is not dead. It just smells funny...