From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v9 2/4] arm64: arch_timer: Introduce a generic erratum handing mechanism for fsl-a008585
Date: Mon, 30 Jan 2017 22:59:27 +0100 [thread overview]
Message-ID: <20170130215927.GK2206@mai> (raw)
In-Reply-To: <1484832916-7248-3-git-send-email-dingtianhong@huawei.com>
On Thu, Jan 19, 2017 at 09:35:14PM +0800, Ding Tianhong wrote:
> The workaround for hisilicon,161010101 will check the return value of the system counter
> by different way, in order to distinguish with the fsl-a008585 workaround, introduce
s/way/ways/
> a new generic erratum handing mechanism for fsl-a008585 and rename some functions.
s/handing/handling/
> After discussion with Marc and Will, a consensus decision was made to remove the commandline
> parameter for enabling fsl,erratum-a008585 erratum.
Lines are more than 78 char large.
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
> Documentation/admin-guide/kernel-parameters.txt | 9 --
> arch/arm64/include/asm/arch_timer.h | 38 +++------
> drivers/clocksource/Kconfig | 8 ++
> drivers/clocksource/arm_arch_timer.c | 105 ++++++++++++++----------
> 4 files changed, 84 insertions(+), 76 deletions(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 21e2d88..76437ad 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -539,15 +539,6 @@
> loops can be debugged more effectively on production
> systems.
>
> - clocksource.arm_arch_timer.fsl-a008585=
> - [ARM64]
> - Format: <bool>
> - Enable/disable the workaround of Freescale/NXP
> - erratum A-008585. This can be useful for KVM
> - guests, if the guest device tree doesn't show the
> - erratum. If unspecified, the workaround is
> - enabled based on the device tree.
> -
> clearcpuid=BITNUM [X86]
> Disable CPUID feature X for the kernel. See
> arch/x86/include/asm/cpufeatures.h for the valid bit
> diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
> index eaa5bbe..b4b3400 100644
> --- a/arch/arm64/include/asm/arch_timer.h
> +++ b/arch/arm64/include/asm/arch_timer.h
> @@ -29,41 +29,29 @@
>
> #include <clocksource/arm_arch_timer.h>
>
> -#if IS_ENABLED(CONFIG_FSL_ERRATUM_A008585)
> +#if IS_ENABLED(CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND)
> extern struct static_key_false arch_timer_read_ool_enabled;
> -#define needs_fsl_a008585_workaround() \
> +#define needs_unstable_timer_counter_workaround() \
> static_branch_unlikely(&arch_timer_read_ool_enabled)
> #else
> -#define needs_fsl_a008585_workaround() false
> +#define needs_unstable_timer_counter_workaround() false
> #endif
>
> -u32 __fsl_a008585_read_cntp_tval_el0(void);
> -u32 __fsl_a008585_read_cntv_tval_el0(void);
> -u64 __fsl_a008585_read_cntvct_el0(void);
>
> -/*
> - * The number of retries is an arbitrary value well beyond the highest number
> - * of iterations the loop has been observed to take.
> - */
> -#define __fsl_a008585_read_reg(reg) ({ \
> - u64 _old, _new; \
> - int _retries = 200; \
> - \
> - do { \
> - _old = read_sysreg(reg); \
> - _new = read_sysreg(reg); \
> - _retries--; \
> - } while (unlikely(_old != _new) && _retries); \
> - \
> - WARN_ON_ONCE(!_retries); \
> - _new; \
> -})
> +struct arch_timer_erratum_workaround {
> + const char *id; /* Indicate the Erratum ID */
> + u32 (*read_cntp_tval_el0)(void);
> + u32 (*read_cntv_tval_el0)(void);
> + u64 (*read_cntvct_el0)(void);
> +};
> +
> +extern const struct arch_timer_erratum_workaround *timer_unstable_counter_workaround;
>
> #define arch_timer_reg_read_stable(reg) \
> ({ \
> u64 _val; \
> - if (needs_fsl_a008585_workaround()) \
> - _val = __fsl_a008585_read_##reg(); \
> + if (needs_unstable_timer_counter_workaround()) \
> + _val = timer_unstable_counter_workaround->read_##reg();\
> else \
> _val = read_sysreg(reg); \
> _val; \
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index 4866f7a..6693e07 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -325,10 +325,18 @@ config ARM_ARCH_TIMER_EVTSTREAM
> This must be disabled for hardware validation purposes to detect any
> hardware anomalies of missing events.
>
> +config ARM_ARCH_TIMER_OOL_WORKAROUND
> + bool
> + depends on FSL_ERRATUM_A008585
This dependency is not needed as well as the help text below because it is a
silent option.
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Lezcano <daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Ding Tianhong <dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: catalin.marinas-5wv7dgnIgG8@public.gmane.org,
will.deacon-5wv7dgnIgG8@public.gmane.org,
marc.zyngier-5wv7dgnIgG8@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
oss-fOR+EgIDQEHk1uMJSBkQmQ@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
stuart.yoder-3arQi8VN3Tc@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linuxarm-hv44wF8Li93QT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH v9 2/4] arm64: arch_timer: Introduce a generic erratum handing mechanism for fsl-a008585
Date: Mon, 30 Jan 2017 22:59:27 +0100 [thread overview]
Message-ID: <20170130215927.GK2206@mai> (raw)
In-Reply-To: <1484832916-7248-3-git-send-email-dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
On Thu, Jan 19, 2017 at 09:35:14PM +0800, Ding Tianhong wrote:
> The workaround for hisilicon,161010101 will check the return value of the system counter
> by different way, in order to distinguish with the fsl-a008585 workaround, introduce
s/way/ways/
> a new generic erratum handing mechanism for fsl-a008585 and rename some functions.
s/handing/handling/
> After discussion with Marc and Will, a consensus decision was made to remove the commandline
> parameter for enabling fsl,erratum-a008585 erratum.
Lines are more than 78 char large.
> Signed-off-by: Ding Tianhong <dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
> Documentation/admin-guide/kernel-parameters.txt | 9 --
> arch/arm64/include/asm/arch_timer.h | 38 +++------
> drivers/clocksource/Kconfig | 8 ++
> drivers/clocksource/arm_arch_timer.c | 105 ++++++++++++++----------
> 4 files changed, 84 insertions(+), 76 deletions(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 21e2d88..76437ad 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -539,15 +539,6 @@
> loops can be debugged more effectively on production
> systems.
>
> - clocksource.arm_arch_timer.fsl-a008585=
> - [ARM64]
> - Format: <bool>
> - Enable/disable the workaround of Freescale/NXP
> - erratum A-008585. This can be useful for KVM
> - guests, if the guest device tree doesn't show the
> - erratum. If unspecified, the workaround is
> - enabled based on the device tree.
> -
> clearcpuid=BITNUM [X86]
> Disable CPUID feature X for the kernel. See
> arch/x86/include/asm/cpufeatures.h for the valid bit
> diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
> index eaa5bbe..b4b3400 100644
> --- a/arch/arm64/include/asm/arch_timer.h
> +++ b/arch/arm64/include/asm/arch_timer.h
> @@ -29,41 +29,29 @@
>
> #include <clocksource/arm_arch_timer.h>
>
> -#if IS_ENABLED(CONFIG_FSL_ERRATUM_A008585)
> +#if IS_ENABLED(CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND)
> extern struct static_key_false arch_timer_read_ool_enabled;
> -#define needs_fsl_a008585_workaround() \
> +#define needs_unstable_timer_counter_workaround() \
> static_branch_unlikely(&arch_timer_read_ool_enabled)
> #else
> -#define needs_fsl_a008585_workaround() false
> +#define needs_unstable_timer_counter_workaround() false
> #endif
>
> -u32 __fsl_a008585_read_cntp_tval_el0(void);
> -u32 __fsl_a008585_read_cntv_tval_el0(void);
> -u64 __fsl_a008585_read_cntvct_el0(void);
>
> -/*
> - * The number of retries is an arbitrary value well beyond the highest number
> - * of iterations the loop has been observed to take.
> - */
> -#define __fsl_a008585_read_reg(reg) ({ \
> - u64 _old, _new; \
> - int _retries = 200; \
> - \
> - do { \
> - _old = read_sysreg(reg); \
> - _new = read_sysreg(reg); \
> - _retries--; \
> - } while (unlikely(_old != _new) && _retries); \
> - \
> - WARN_ON_ONCE(!_retries); \
> - _new; \
> -})
> +struct arch_timer_erratum_workaround {
> + const char *id; /* Indicate the Erratum ID */
> + u32 (*read_cntp_tval_el0)(void);
> + u32 (*read_cntv_tval_el0)(void);
> + u64 (*read_cntvct_el0)(void);
> +};
> +
> +extern const struct arch_timer_erratum_workaround *timer_unstable_counter_workaround;
>
> #define arch_timer_reg_read_stable(reg) \
> ({ \
> u64 _val; \
> - if (needs_fsl_a008585_workaround()) \
> - _val = __fsl_a008585_read_##reg(); \
> + if (needs_unstable_timer_counter_workaround()) \
> + _val = timer_unstable_counter_workaround->read_##reg();\
> else \
> _val = read_sysreg(reg); \
> _val; \
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index 4866f7a..6693e07 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -325,10 +325,18 @@ config ARM_ARCH_TIMER_EVTSTREAM
> This must be disabled for hardware validation purposes to detect any
> hardware anomalies of missing events.
>
> +config ARM_ARCH_TIMER_OOL_WORKAROUND
> + bool
> + depends on FSL_ERRATUM_A008585
This dependency is not needed as well as the help text below because it is a
silent option.
--
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:[~2017-01-30 21:59 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-19 13:35 [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum Ding Tianhong
2017-01-19 13:35 ` Ding Tianhong
2017-01-19 13:35 ` [PATCH v9 1/4] arm64: arch_timer: Add device tree binding " Ding Tianhong
2017-01-19 13:35 ` Ding Tianhong
2017-01-19 13:35 ` [PATCH v9 2/4] arm64: arch_timer: Introduce a generic erratum handing mechanism for fsl-a008585 Ding Tianhong
2017-01-19 13:35 ` Ding Tianhong
2017-01-30 21:59 ` Daniel Lezcano [this message]
2017-01-30 21:59 ` Daniel Lezcano
2017-01-19 13:35 ` [PATCH v9 3/4] arm64: arch_timer: Work around Erratum Hisilicon-161010101 Ding Tianhong
2017-01-19 13:35 ` Ding Tianhong
2017-01-30 23:17 ` Daniel Lezcano
2017-01-30 23:17 ` Daniel Lezcano
2017-01-19 13:35 ` [PATCH v9 4/4] arm64: arch timer: Add timer erratum property for Hip05-d02 and Hip06-d03 Ding Tianhong
2017-01-19 13:35 ` Ding Tianhong
2017-01-19 13:49 ` [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum Marc Zyngier
2017-01-19 13:49 ` Marc Zyngier
2017-01-20 1:22 ` Ding Tianhong
2017-01-20 1:22 ` Ding Tianhong
2017-01-20 15:04 ` Mark Rutland
2017-01-20 15:04 ` Mark Rutland
2017-01-22 7:59 ` Hanjun Guo
2017-01-22 7:59 ` Hanjun Guo
2017-01-23 10:31 ` Mark Rutland
2017-01-23 10:31 ` Mark Rutland
2017-01-23 7:36 ` Ding Tianhong
2017-01-23 7:36 ` Ding Tianhong
2017-01-23 8:43 ` Marc Zyngier
2017-01-23 8:43 ` Marc Zyngier
2017-01-23 10:39 ` Will Deacon
2017-01-23 10:39 ` Will Deacon
2017-01-23 22:40 ` Daniel Lezcano
2017-01-23 22:40 ` Daniel Lezcano
2017-01-24 15:08 ` Daniel Lezcano
2017-01-24 15:08 ` Daniel Lezcano
2017-01-24 15:27 ` Marc Zyngier
2017-01-24 15:27 ` Marc Zyngier
2017-01-24 16:35 ` Daniel Lezcano
2017-01-24 16:35 ` Daniel Lezcano
2017-01-30 15:52 ` Mark Rutland
2017-01-30 15:52 ` Mark Rutland
2017-01-30 21:54 ` Daniel Lezcano
2017-01-30 21:54 ` Daniel Lezcano
2017-01-31 12:14 ` Mark Rutland
2017-01-31 12:14 ` Mark Rutland
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=20170130215927.GK2206@mai \
--to=daniel.lezcano@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.