All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-19 13:35 ` Ding Tianhong
  0 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-19 13:35 UTC (permalink / raw)
  To: catalin.marinas-5wv7dgnIgG8, will.deacon-5wv7dgnIgG8,
	marc.zyngier-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	oss-fOR+EgIDQEHk1uMJSBkQmQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A, stuart.yoder-3arQi8VN3Tc,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linuxarm-hv44wF8Li93QT0dZR+AlfA
  Cc: Ding Tianhong

Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
potential to contain an erroneous value when the timer value changes".
Accesses to TVAL (both read and write) are also affected due to the implicit counter
read.  Accesses to CVAL are not affected.

The workaround is to reread the system count registers until the value of the second
read is larger than the first one by less than 32, the system counter can be guaranteed
not to return wrong value twice by back-to-back read and the error value is always larger
than the correct one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.

v2: Introducing a new generic erratum handling mechanism for fsl,a008585 and hisilicon,161601.
    Significant rework based on feedback, including seperate the fsl erratum a008585
    to another patch, update the erratum name and remove unwanted code.

v3: Introducing the erratum_workaround_set_sne generic function for fsl erratum a008585
    and make the #define __fsl_a008585_read_reg to be private to the .c file instead of
    being globally visible. After discussion with Marc and Will, a consensus decision was
    made to remove the commandline parameter for enabling fsl,erratum-a008585 erratum,
    and make some generic name more specific, export timer_unstable_counter_workaround
    for module access.
    
    Significant rework based on feedback, including fix some alignment problem, make the
    #define __hisi_161601_read_reg to be private to the .c file instead of being globally
    visible, add more accurate annotation and modify a bit of logical format to enable
    arch_timer_read_ool_enabled, remove the kernel commandline parameter
    clocksource.arm_arch_timer.hisilicon-161601.

    Introduce a generic aquick framework for erratum in ACPI mode.

v4: rename the quirk handler parameter to make it more generic, and
    avoid break loop when handling the quirk becasue it need to
    support multi quirks handler.

    update some data structures for acpi mode. 

v5: Adapt the new kernel-parameters.txt for latest kernel version.
    Set the retries of reread system counter to 50, because it is possible 
    that some interrupts may lead to more than twice read errors and break the loop,
    it will trigger the warning, so we set the number of retries far beyond the number of
    iterations the loop has been observed to take.

v6: The last 2 patches in the previous version about the ACPI mode will conflict witch Fuwei's
    GTDT patches, so remove the ACPI part and only support the DT base code for this patch set.

    We have trigger a bug when select the CONFIG_FUNCTION_GRAPH_TRACER and enable function_graph
    to /sys/kernel/debug/tracing/current_tracer, the system will stall into an endless loop, it looks
    like that the ftrace_graph_caller will be related to xxx.read_cntvct_el0 and read the system counter
    again, so mark the xxx.read_cntvct_el0 with notrace to fix the problem.

v7: Introduce a new general config symbol named CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND to enable the workaround
    for any chips which has similar arch timer erratum just like "fsl,erratum_a008585" and "hisilicon,erratum_161601",
    modify the struct arch_timer_erratum_workaround to be compatible different chip erratum more easily, and
    reconstruction some code base on the new config symbol and struct, thanks to Marc's suggestion. 

v8: The original erratum ID could not cover all modules, which only specified <Errata-Prefix><SerialNum>, so after
    discussion with the soc team, we decide to use the new ID "161010101" for this timer erratum which consist of
    <Errata-Prefix><SeriesFlag><ModuleID><SerialNum> and also update the hisilicon erratum official documents.

v9: Modify the workaround description and remove the message for CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND.

Ding Tianhong (4):
  arm64: arch_timer: Add device tree binding for hisilicon-161010101
    erratum
  arm64: arch_timer: Introduce a generic erratum handing mechanism for
    fsl-a008585
  arm64: arch_timer: Work around Erratum Hisilicon-161010101
  arm64: arch timer: Add timer erratum property for Hip05-d02 and
    Hip06-d03

 Documentation/admin-guide/kernel-parameters.txt    |   9 --
 Documentation/arm64/silicon-errata.txt             |  43 +++---
 .../devicetree/bindings/arm/arch_timer.txt         |   6 +
 arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
 arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
 arch/arm64/include/asm/arch_timer.h                |  38 ++----
 drivers/clocksource/Kconfig                        |  18 +++
 drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
 8 files changed, 171 insertions(+), 95 deletions(-)

-- 
1.9.0


--
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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-19 13:35 ` Ding Tianhong
  0 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-19 13:35 UTC (permalink / raw)
  To: linux-arm-kernel

Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
potential to contain an erroneous value when the timer value changes".
Accesses to TVAL (both read and write) are also affected due to the implicit counter
read.  Accesses to CVAL are not affected.

The workaround is to reread the system count registers until the value of the second
read is larger than the first one by less than 32, the system counter can be guaranteed
not to return wrong value twice by back-to-back read and the error value is always larger
than the correct one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.

v2: Introducing a new generic erratum handling mechanism for fsl,a008585 and hisilicon,161601.
    Significant rework based on feedback, including seperate the fsl erratum a008585
    to another patch, update the erratum name and remove unwanted code.

v3: Introducing the erratum_workaround_set_sne generic function for fsl erratum a008585
    and make the #define __fsl_a008585_read_reg to be private to the .c file instead of
    being globally visible. After discussion with Marc and Will, a consensus decision was
    made to remove the commandline parameter for enabling fsl,erratum-a008585 erratum,
    and make some generic name more specific, export timer_unstable_counter_workaround
    for module access.
    
    Significant rework based on feedback, including fix some alignment problem, make the
    #define __hisi_161601_read_reg to be private to the .c file instead of being globally
    visible, add more accurate annotation and modify a bit of logical format to enable
    arch_timer_read_ool_enabled, remove the kernel commandline parameter
    clocksource.arm_arch_timer.hisilicon-161601.

    Introduce a generic aquick framework for erratum in ACPI mode.

v4: rename the quirk handler parameter to make it more generic, and
    avoid break loop when handling the quirk becasue it need to
    support multi quirks handler.

    update some data structures for acpi mode. 

v5: Adapt the new kernel-parameters.txt for latest kernel version.
    Set the retries of reread system counter to 50, because it is possible 
    that some interrupts may lead to more than twice read errors and break the loop,
    it will trigger the warning, so we set the number of retries far beyond the number of
    iterations the loop has been observed to take.

v6: The last 2 patches in the previous version about the ACPI mode will conflict witch Fuwei's
    GTDT patches, so remove the ACPI part and only support the DT base code for this patch set.

    We have trigger a bug when select the CONFIG_FUNCTION_GRAPH_TRACER and enable function_graph
    to /sys/kernel/debug/tracing/current_tracer, the system will stall into an endless loop, it looks
    like that the ftrace_graph_caller will be related to xxx.read_cntvct_el0 and read the system counter
    again, so mark the xxx.read_cntvct_el0 with notrace to fix the problem.

v7: Introduce a new general config symbol named CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND to enable the workaround
    for any chips which has similar arch timer erratum just like "fsl,erratum_a008585" and "hisilicon,erratum_161601",
    modify the struct arch_timer_erratum_workaround to be compatible different chip erratum more easily, and
    reconstruction some code base on the new config symbol and struct, thanks to Marc's suggestion. 

v8: The original erratum ID could not cover all modules, which only specified <Errata-Prefix><SerialNum>, so after
    discussion with the soc team, we decide to use the new ID "161010101" for this timer erratum which consist of
    <Errata-Prefix><SeriesFlag><ModuleID><SerialNum> and also update the hisilicon erratum official documents.

v9: Modify the workaround description and remove the message for CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND.

Ding Tianhong (4):
  arm64: arch_timer: Add device tree binding for hisilicon-161010101
    erratum
  arm64: arch_timer: Introduce a generic erratum handing mechanism for
    fsl-a008585
  arm64: arch_timer: Work around Erratum Hisilicon-161010101
  arm64: arch timer: Add timer erratum property for Hip05-d02 and
    Hip06-d03

 Documentation/admin-guide/kernel-parameters.txt    |   9 --
 Documentation/arm64/silicon-errata.txt             |  43 +++---
 .../devicetree/bindings/arm/arch_timer.txt         |   6 +
 arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
 arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
 arch/arm64/include/asm/arch_timer.h                |  38 ++----
 drivers/clocksource/Kconfig                        |  18 +++
 drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
 8 files changed, 171 insertions(+), 95 deletions(-)

-- 
1.9.0

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 1/4] arm64: arch_timer: Add device tree binding for hisilicon-161010101 erratum
  2017-01-19 13:35 ` Ding Tianhong
@ 2017-01-19 13:35     ` Ding Tianhong
  -1 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-19 13:35 UTC (permalink / raw)
  To: catalin.marinas-5wv7dgnIgG8, will.deacon-5wv7dgnIgG8,
	marc.zyngier-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	oss-fOR+EgIDQEHk1uMJSBkQmQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A, stuart.yoder-3arQi8VN3Tc,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linuxarm-hv44wF8Li93QT0dZR+AlfA
  Cc: Ding Tianhong

This erratum describes a bug in logic outside the core, so MIDR can't be
used to identify its presence, and reading an SoC-specific revision
register from common arch timer code would be awkward.  So, describe it
in the device tree.

Signed-off-by: Ding Tianhong <dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 Documentation/devicetree/bindings/arm/arch_timer.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/arch_timer.txt b/Documentation/devicetree/bindings/arm/arch_timer.txt
index ad440a2..e926aea 100644
--- a/Documentation/devicetree/bindings/arm/arch_timer.txt
+++ b/Documentation/devicetree/bindings/arm/arch_timer.txt
@@ -31,6 +31,12 @@ to deliver its interrupts via SPIs.
   This also affects writes to the tval register, due to the implicit
   counter read.
 
+- hisilicon,erratum-161010101 : A boolean property. Indicates the
+  presence of Hisilicon erratum 161010101, which says that reading the
+  counters is unreliable in some cases, and reads may return a value 32
+  beyond the correct value. This also affects writes to the tval
+  registers, due to the implicit counter read.
+
 ** Optional properties:
 
 - arm,cpu-registers-not-fw-configured : Firmware does not initialize
-- 
1.9.0


--
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

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v9 1/4] arm64: arch_timer: Add device tree binding for hisilicon-161010101 erratum
@ 2017-01-19 13:35     ` Ding Tianhong
  0 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-19 13:35 UTC (permalink / raw)
  To: linux-arm-kernel

This erratum describes a bug in logic outside the core, so MIDR can't be
used to identify its presence, and reading an SoC-specific revision
register from common arch timer code would be awkward.  So, describe it
in the device tree.

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/arm/arch_timer.txt | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/arch_timer.txt b/Documentation/devicetree/bindings/arm/arch_timer.txt
index ad440a2..e926aea 100644
--- a/Documentation/devicetree/bindings/arm/arch_timer.txt
+++ b/Documentation/devicetree/bindings/arm/arch_timer.txt
@@ -31,6 +31,12 @@ to deliver its interrupts via SPIs.
   This also affects writes to the tval register, due to the implicit
   counter read.
 
+- hisilicon,erratum-161010101 : A boolean property. Indicates the
+  presence of Hisilicon erratum 161010101, which says that reading the
+  counters is unreliable in some cases, and reads may return a value 32
+  beyond the correct value. This also affects writes to the tval
+  registers, due to the implicit counter read.
+
 ** Optional properties:
 
 - arm,cpu-registers-not-fw-configured : Firmware does not initialize
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v9 2/4] arm64: arch_timer: Introduce a generic erratum handing mechanism for fsl-a008585
  2017-01-19 13:35 ` Ding Tianhong
@ 2017-01-19 13:35   ` Ding Tianhong
  -1 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-19 13:35 UTC (permalink / raw)
  To: catalin.marinas, will.deacon, marc.zyngier, mark.rutland, oss,
	devicetree, shawnguo, stuart.yoder, linux-arm-kernel, linuxarm
  Cc: Ding Tianhong

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
a new generic erratum handing mechanism for fsl-a008585 and rename some functions.

After discussion with Marc and Will, a consensus decision was made to remove the commandline
parameter for enabling fsl,erratum-a008585 erratum.

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
+	help
+	  This option would only be enabled by Freescale/NXP Erratum A-008585
+	  or something else chip has similar erratum.
+
 config FSL_ERRATUM_A008585
 	bool "Workaround for Freescale/NXP Erratum A-008585"
 	default y
 	depends on ARM_ARCH_TIMER && ARM64
+	select ARM_ARCH_TIMER_OOL_WORKAROUND
 	help
 	  This option enables a workaround for Freescale/NXP Erratum
 	  A-008585 ("ARM generic timer may contain an erroneous
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 02fef68..2487c66 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -96,41 +96,59 @@ static int __init early_evtstrm_cfg(char *buf)
  */
 
 #ifdef CONFIG_FSL_ERRATUM_A008585
-DEFINE_STATIC_KEY_FALSE(arch_timer_read_ool_enabled);
-EXPORT_SYMBOL_GPL(arch_timer_read_ool_enabled);
-
-static int fsl_a008585_enable = -1;
-
-static int __init early_fsl_a008585_cfg(char *buf)
-{
-	int ret;
-	bool val;
 
-	ret = strtobool(buf, &val);
-	if (ret)
-		return ret;
-
-	fsl_a008585_enable = val;
-	return 0;
-}
-early_param("clocksource.arm_arch_timer.fsl-a008585", early_fsl_a008585_cfg);
-
-u32 __fsl_a008585_read_cntp_tval_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;						\
+})
+
+static u32 notrace fsl_a008585_read_cntp_tval_el0(void)
 {
 	return __fsl_a008585_read_reg(cntp_tval_el0);
 }
 
-u32 __fsl_a008585_read_cntv_tval_el0(void)
+static u32 notrace fsl_a008585_read_cntv_tval_el0(void)
 {
 	return __fsl_a008585_read_reg(cntv_tval_el0);
 }
 
-u64 __fsl_a008585_read_cntvct_el0(void)
+static u64 notrace fsl_a008585_read_cntvct_el0(void)
 {
 	return __fsl_a008585_read_reg(cntvct_el0);
 }
-EXPORT_SYMBOL(__fsl_a008585_read_cntvct_el0);
-#endif /* CONFIG_FSL_ERRATUM_A008585 */
+#endif
+
+#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
+const struct arch_timer_erratum_workaround *timer_unstable_counter_workaround = NULL;
+EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
+
+DEFINE_STATIC_KEY_FALSE(arch_timer_read_ool_enabled);
+EXPORT_SYMBOL_GPL(arch_timer_read_ool_enabled);
+
+static const struct arch_timer_erratum_workaround ool_workarounds[] = {
+#ifdef CONFIG_FSL_ERRATUM_A008585
+	{
+		.id = "fsl,erratum-a008585",
+		.read_cntp_tval_el0 = fsl_a008585_read_cntp_tval_el0,
+		.read_cntv_tval_el0 = fsl_a008585_read_cntv_tval_el0,
+		.read_cntvct_el0 = fsl_a008585_read_cntvct_el0,
+	},
+#endif
+};
+#endif /* CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND */
 
 static __always_inline
 void arch_timer_reg_write(int access, enum arch_timer_reg reg, u32 val,
@@ -281,8 +299,8 @@ static __always_inline void set_next_event(const int access, unsigned long evt,
 	arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl, clk);
 }
 
-#ifdef CONFIG_FSL_ERRATUM_A008585
-static __always_inline void fsl_a008585_set_next_event(const int access,
+#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
+static __always_inline void erratum_set_next_event_generic(const int access,
 		unsigned long evt, struct clock_event_device *clk)
 {
 	unsigned long ctrl;
@@ -300,20 +318,20 @@ static __always_inline void fsl_a008585_set_next_event(const int access,
 	arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl, clk);
 }
 
-static int fsl_a008585_set_next_event_virt(unsigned long evt,
+static int erratum_set_next_event_virt(unsigned long evt,
 					   struct clock_event_device *clk)
 {
-	fsl_a008585_set_next_event(ARCH_TIMER_VIRT_ACCESS, evt, clk);
+	erratum_set_next_event_generic(ARCH_TIMER_VIRT_ACCESS, evt, clk);
 	return 0;
 }
 
-static int fsl_a008585_set_next_event_phys(unsigned long evt,
+static int erratum_set_next_event_phys(unsigned long evt,
 					   struct clock_event_device *clk)
 {
-	fsl_a008585_set_next_event(ARCH_TIMER_PHYS_ACCESS, evt, clk);
+	erratum_set_next_event_generic(ARCH_TIMER_PHYS_ACCESS, evt, clk);
 	return 0;
 }
-#endif /* CONFIG_FSL_ERRATUM_A008585 */
+#endif /* CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND */
 
 static int arch_timer_set_next_event_virt(unsigned long evt,
 					  struct clock_event_device *clk)
@@ -343,16 +361,16 @@ static int arch_timer_set_next_event_phys_mem(unsigned long evt,
 	return 0;
 }
 
-static void fsl_a008585_set_sne(struct clock_event_device *clk)
+static void erratum_workaround_set_sne(struct clock_event_device *clk)
 {
-#ifdef CONFIG_FSL_ERRATUM_A008585
+#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
 	if (!static_branch_unlikely(&arch_timer_read_ool_enabled))
 		return;
 
 	if (arch_timer_uses_ppi == VIRT_PPI)
-		clk->set_next_event = fsl_a008585_set_next_event_virt;
+		clk->set_next_event = erratum_set_next_event_virt;
 	else
-		clk->set_next_event = fsl_a008585_set_next_event_phys;
+		clk->set_next_event = erratum_set_next_event_phys;
 #endif
 }
 
@@ -385,7 +403,7 @@ static void __arch_timer_setup(unsigned type,
 			BUG();
 		}
 
-		fsl_a008585_set_sne(clk);
+		erratum_workaround_set_sne(clk);
 	} else {
 		clk->features |= CLOCK_EVT_FEAT_DYNIRQ;
 		clk->name = "arch_mem_timer";
@@ -605,7 +623,7 @@ static void __init arch_counter_register(unsigned type)
 
 		clocksource_counter.archdata.vdso_direct = true;
 
-#ifdef CONFIG_FSL_ERRATUM_A008585
+#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
 		/*
 		 * Don't use the vdso fastpath if errata require using
 		 * the out-of-line counter accessor.
@@ -893,12 +911,15 @@ static int __init arch_timer_of_init(struct device_node *np)
 
 	arch_timer_c3stop = !of_property_read_bool(np, "always-on");
 
-#ifdef CONFIG_FSL_ERRATUM_A008585
-	if (fsl_a008585_enable < 0)
-		fsl_a008585_enable = of_property_read_bool(np, "fsl,erratum-a008585");
-	if (fsl_a008585_enable) {
-		static_branch_enable(&arch_timer_read_ool_enabled);
-		pr_info("Enabling workaround for FSL erratum A-008585\n");
+#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
+	for (i = 0; i < ARRAY_SIZE(ool_workarounds); i++) {
+		if (of_property_read_bool(np, ool_workarounds[i].id)) {
+			timer_unstable_counter_workaround = &ool_workarounds[i];
+			static_branch_enable(&arch_timer_read_ool_enabled);
+			pr_info("arch_timer: Enabling workaround for %s\n",
+				timer_unstable_counter_workaround->id);
+			break;
+		}
 	}
 #endif
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v9 2/4] arm64: arch_timer: Introduce a generic erratum handing mechanism for fsl-a008585
@ 2017-01-19 13:35   ` Ding Tianhong
  0 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-19 13:35 UTC (permalink / raw)
  To: linux-arm-kernel

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
a new generic erratum handing mechanism for fsl-a008585 and rename some functions.

After discussion with Marc and Will, a consensus decision was made to remove the commandline
parameter for enabling fsl,erratum-a008585 erratum.

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
+	help
+	  This option would only be enabled by Freescale/NXP Erratum A-008585
+	  or something else chip has similar erratum.
+
 config FSL_ERRATUM_A008585
 	bool "Workaround for Freescale/NXP Erratum A-008585"
 	default y
 	depends on ARM_ARCH_TIMER && ARM64
+	select ARM_ARCH_TIMER_OOL_WORKAROUND
 	help
 	  This option enables a workaround for Freescale/NXP Erratum
 	  A-008585 ("ARM generic timer may contain an erroneous
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 02fef68..2487c66 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -96,41 +96,59 @@ static int __init early_evtstrm_cfg(char *buf)
  */
 
 #ifdef CONFIG_FSL_ERRATUM_A008585
-DEFINE_STATIC_KEY_FALSE(arch_timer_read_ool_enabled);
-EXPORT_SYMBOL_GPL(arch_timer_read_ool_enabled);
-
-static int fsl_a008585_enable = -1;
-
-static int __init early_fsl_a008585_cfg(char *buf)
-{
-	int ret;
-	bool val;
 
-	ret = strtobool(buf, &val);
-	if (ret)
-		return ret;
-
-	fsl_a008585_enable = val;
-	return 0;
-}
-early_param("clocksource.arm_arch_timer.fsl-a008585", early_fsl_a008585_cfg);
-
-u32 __fsl_a008585_read_cntp_tval_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;						\
+})
+
+static u32 notrace fsl_a008585_read_cntp_tval_el0(void)
 {
 	return __fsl_a008585_read_reg(cntp_tval_el0);
 }
 
-u32 __fsl_a008585_read_cntv_tval_el0(void)
+static u32 notrace fsl_a008585_read_cntv_tval_el0(void)
 {
 	return __fsl_a008585_read_reg(cntv_tval_el0);
 }
 
-u64 __fsl_a008585_read_cntvct_el0(void)
+static u64 notrace fsl_a008585_read_cntvct_el0(void)
 {
 	return __fsl_a008585_read_reg(cntvct_el0);
 }
-EXPORT_SYMBOL(__fsl_a008585_read_cntvct_el0);
-#endif /* CONFIG_FSL_ERRATUM_A008585 */
+#endif
+
+#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
+const struct arch_timer_erratum_workaround *timer_unstable_counter_workaround = NULL;
+EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
+
+DEFINE_STATIC_KEY_FALSE(arch_timer_read_ool_enabled);
+EXPORT_SYMBOL_GPL(arch_timer_read_ool_enabled);
+
+static const struct arch_timer_erratum_workaround ool_workarounds[] = {
+#ifdef CONFIG_FSL_ERRATUM_A008585
+	{
+		.id = "fsl,erratum-a008585",
+		.read_cntp_tval_el0 = fsl_a008585_read_cntp_tval_el0,
+		.read_cntv_tval_el0 = fsl_a008585_read_cntv_tval_el0,
+		.read_cntvct_el0 = fsl_a008585_read_cntvct_el0,
+	},
+#endif
+};
+#endif /* CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND */
 
 static __always_inline
 void arch_timer_reg_write(int access, enum arch_timer_reg reg, u32 val,
@@ -281,8 +299,8 @@ static __always_inline void set_next_event(const int access, unsigned long evt,
 	arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl, clk);
 }
 
-#ifdef CONFIG_FSL_ERRATUM_A008585
-static __always_inline void fsl_a008585_set_next_event(const int access,
+#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
+static __always_inline void erratum_set_next_event_generic(const int access,
 		unsigned long evt, struct clock_event_device *clk)
 {
 	unsigned long ctrl;
@@ -300,20 +318,20 @@ static __always_inline void fsl_a008585_set_next_event(const int access,
 	arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl, clk);
 }
 
-static int fsl_a008585_set_next_event_virt(unsigned long evt,
+static int erratum_set_next_event_virt(unsigned long evt,
 					   struct clock_event_device *clk)
 {
-	fsl_a008585_set_next_event(ARCH_TIMER_VIRT_ACCESS, evt, clk);
+	erratum_set_next_event_generic(ARCH_TIMER_VIRT_ACCESS, evt, clk);
 	return 0;
 }
 
-static int fsl_a008585_set_next_event_phys(unsigned long evt,
+static int erratum_set_next_event_phys(unsigned long evt,
 					   struct clock_event_device *clk)
 {
-	fsl_a008585_set_next_event(ARCH_TIMER_PHYS_ACCESS, evt, clk);
+	erratum_set_next_event_generic(ARCH_TIMER_PHYS_ACCESS, evt, clk);
 	return 0;
 }
-#endif /* CONFIG_FSL_ERRATUM_A008585 */
+#endif /* CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND */
 
 static int arch_timer_set_next_event_virt(unsigned long evt,
 					  struct clock_event_device *clk)
@@ -343,16 +361,16 @@ static int arch_timer_set_next_event_phys_mem(unsigned long evt,
 	return 0;
 }
 
-static void fsl_a008585_set_sne(struct clock_event_device *clk)
+static void erratum_workaround_set_sne(struct clock_event_device *clk)
 {
-#ifdef CONFIG_FSL_ERRATUM_A008585
+#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
 	if (!static_branch_unlikely(&arch_timer_read_ool_enabled))
 		return;
 
 	if (arch_timer_uses_ppi == VIRT_PPI)
-		clk->set_next_event = fsl_a008585_set_next_event_virt;
+		clk->set_next_event = erratum_set_next_event_virt;
 	else
-		clk->set_next_event = fsl_a008585_set_next_event_phys;
+		clk->set_next_event = erratum_set_next_event_phys;
 #endif
 }
 
@@ -385,7 +403,7 @@ static void __arch_timer_setup(unsigned type,
 			BUG();
 		}
 
-		fsl_a008585_set_sne(clk);
+		erratum_workaround_set_sne(clk);
 	} else {
 		clk->features |= CLOCK_EVT_FEAT_DYNIRQ;
 		clk->name = "arch_mem_timer";
@@ -605,7 +623,7 @@ static void __init arch_counter_register(unsigned type)
 
 		clocksource_counter.archdata.vdso_direct = true;
 
-#ifdef CONFIG_FSL_ERRATUM_A008585
+#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
 		/*
 		 * Don't use the vdso fastpath if errata require using
 		 * the out-of-line counter accessor.
@@ -893,12 +911,15 @@ static int __init arch_timer_of_init(struct device_node *np)
 
 	arch_timer_c3stop = !of_property_read_bool(np, "always-on");
 
-#ifdef CONFIG_FSL_ERRATUM_A008585
-	if (fsl_a008585_enable < 0)
-		fsl_a008585_enable = of_property_read_bool(np, "fsl,erratum-a008585");
-	if (fsl_a008585_enable) {
-		static_branch_enable(&arch_timer_read_ool_enabled);
-		pr_info("Enabling workaround for FSL erratum A-008585\n");
+#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
+	for (i = 0; i < ARRAY_SIZE(ool_workarounds); i++) {
+		if (of_property_read_bool(np, ool_workarounds[i].id)) {
+			timer_unstable_counter_workaround = &ool_workarounds[i];
+			static_branch_enable(&arch_timer_read_ool_enabled);
+			pr_info("arch_timer: Enabling workaround for %s\n",
+				timer_unstable_counter_workaround->id);
+			break;
+		}
 	}
 #endif
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v9 3/4] arm64: arch_timer: Work around Erratum Hisilicon-161010101
  2017-01-19 13:35 ` Ding Tianhong
@ 2017-01-19 13:35   ` Ding Tianhong
  -1 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-19 13:35 UTC (permalink / raw)
  To: catalin.marinas, will.deacon, marc.zyngier, mark.rutland, oss,
	devicetree, shawnguo, stuart.yoder, linux-arm-kernel, linuxarm
  Cc: Ding Tianhong

Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
potential to contain an erroneous value when the timer value changes".
Accesses to TVAL (both read and write) are also affected due to the implicit counter
read.  Accesses to CVAL are not affected.

The workaround is to reread the system count registers until the value of the second
read is larger than the first one by less than 32, the system counter can be guaranteed
not to return wrong value twice by back-to-back read and the error value is always larger
than the correct one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.

The hisilicon erratum CONFIG name is too long, breaking the line format in silicon-errata.txt,
so extended the character spacing to fit all the erratum config.

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 Documentation/arm64/silicon-errata.txt | 43 ++++++++++++++---------------
 drivers/clocksource/Kconfig            | 12 ++++++++-
 drivers/clocksource/arm_arch_timer.c   | 49 ++++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 22 deletions(-)

diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
index 405da11..0aaae35 100644
--- a/Documentation/arm64/silicon-errata.txt
+++ b/Documentation/arm64/silicon-errata.txt
@@ -42,24 +42,25 @@ file acts as a registry of software workarounds in the Linux Kernel and
 will be updated when new workarounds are committed and backported to
 stable kernels.
 
-| Implementor    | Component       | Erratum ID      | Kconfig                 |
-+----------------+-----------------+-----------------+-------------------------+
-| ARM            | Cortex-A53      | #826319         | ARM64_ERRATUM_826319    |
-| ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319    |
-| ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069    |
-| ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472    |
-| ARM            | Cortex-A53      | #845719         | ARM64_ERRATUM_845719    |
-| ARM            | Cortex-A53      | #843419         | ARM64_ERRATUM_843419    |
-| ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075    |
-| ARM            | Cortex-A57      | #852523         | N/A                     |
-| ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220    |
-| ARM            | Cortex-A72      | #853709         | N/A                     |
-| ARM            | MMU-500         | #841119,#826419 | N/A                     |
-|                |                 |                 |                         |
-| Cavium         | ThunderX ITS    | #22375, #24313  | CAVIUM_ERRATUM_22375    |
-| Cavium         | ThunderX ITS    | #23144          | CAVIUM_ERRATUM_23144    |
-| Cavium         | ThunderX GICv3  | #23154          | CAVIUM_ERRATUM_23154    |
-| Cavium         | ThunderX Core   | #27456          | CAVIUM_ERRATUM_27456    |
-| Cavium         | ThunderX SMMUv2 | #27704          | N/A		       |
-|                |                 |                 |                         |
-| Freescale/NXP  | LS2080A/LS1043A | A-008585        | FSL_ERRATUM_A008585     |
+| Implementor    | Component       | Erratum ID      | Kconfig                         |
++----------------+-----------------+-----------------+---------------------------------+
+| ARM            | Cortex-A53      | #826319         | ARM64_ERRATUM_826319            |
+| ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319            |
+| ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069            |
+| ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472            |
+| ARM            | Cortex-A53      | #845719         | ARM64_ERRATUM_845719            |
+| ARM            | Cortex-A53      | #843419         | ARM64_ERRATUM_843419            |
+| ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075            |
+| ARM            | Cortex-A57      | #852523         | N/A                             |
+| ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220            |
+| ARM            | Cortex-A72      | #853709         | N/A                             |
+| ARM            | MMU-500         | #841119,#826419 | N/A                             |
+|                |                 |                 |                                 |
+| Cavium         | ThunderX ITS    | #22375, #24313  | CAVIUM_ERRATUM_22375            |
+| Cavium         | ThunderX ITS    | #23144          | CAVIUM_ERRATUM_23144            |
+| Cavium         | ThunderX GICv3  | #23154          | CAVIUM_ERRATUM_23154            |
+| Cavium         | ThunderX Core   | #27456          | CAVIUM_ERRATUM_27456            |
+| Cavium         | ThunderX SMMUv2 | #27704          | N/A                             |
+|                |                 |                 |                                 |
+| Freescale/NXP  | LS2080A/LS1043A | A-008585        | FSL_ERRATUM_A008585             |
+| Hisilicon      | Hip0{5,6,7}     | #161010101      | HISILICON_ERRATUM_161010101     |
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 6693e07..b30f44f 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -327,7 +327,7 @@ config ARM_ARCH_TIMER_EVTSTREAM
 
 config ARM_ARCH_TIMER_OOL_WORKAROUND
 	bool
-	depends on FSL_ERRATUM_A008585
+	depends on FSL_ERRATUM_A008585 || HISILICON_ERRATUM_161010101
 	help
 	  This option would only be enabled by Freescale/NXP Erratum A-008585
 	  or something else chip has similar erratum.
@@ -343,6 +343,16 @@ config FSL_ERRATUM_A008585
 	  value").  The workaround will only be active if the
 	  fsl,erratum-a008585 property is found in the timer node.
 
+config HISILICON_ERRATUM_161010101
+	bool "Workaround for Hisilicon Erratum 161010101"
+	default y
+	select ARM_ARCH_TIMER_OOL_WORKAROUND
+	depends on ARM_ARCH_TIMER && ARM64
+	help
+	  This option enables a workaround for Hisilicon Erratum
+	  161010101. The workaround will be active if the hisilicon,erratum-161010101
+	  property is found in the timer node.
+
 config ARM_GLOBAL_TIMER
 	bool "Support for the ARM global timer" if COMPILE_TEST
 	select CLKSRC_OF if OF
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 2487c66..7451b62 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -131,6 +131,47 @@ static u64 notrace fsl_a008585_read_cntvct_el0(void)
 }
 #endif
 
+#ifdef CONFIG_HISILICON_ERRATUM_161010101
+/*
+ * Verify whether the value of the second read is larger than the first by
+ * less than 32 is the only way to confirm the value is correct, so clear the
+ * lower 5 bits to check whether the difference is greater than 32 or not.
+ * Theoretically the erratum should not occur more than twice in succession
+ * when reading the system counter, but it is possible that some interrupts
+ * may lead to more than twice read errors, triggering the warning, so setting
+ * the number of retries far beyond the number of iterations the loop has been
+ * observed to take.
+ */
+#define __hisi_161010101_read_reg(reg) ({				\
+	u64 _old, _new;						\
+	int _retries = 50;					\
+								\
+	do {							\
+		_old = read_sysreg(reg);			\
+		_new = read_sysreg(reg);			\
+		_retries--;					\
+	} while (unlikely((_new - _old) >> 5) && _retries);	\
+								\
+	WARN_ON_ONCE(!_retries);				\
+	_new;							\
+})
+
+static u32 notrace hisi_161010101_read_cntp_tval_el0(void)
+{
+	return __hisi_161010101_read_reg(cntp_tval_el0);
+}
+
+static u32 notrace hisi_161010101_read_cntv_tval_el0(void)
+{
+	return __hisi_161010101_read_reg(cntv_tval_el0);
+}
+
+static u64 notrace hisi_161010101_read_cntvct_el0(void)
+{
+	return __hisi_161010101_read_reg(cntvct_el0);
+}
+#endif
+
 #ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
 const struct arch_timer_erratum_workaround *timer_unstable_counter_workaround = NULL;
 EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
@@ -147,6 +188,14 @@ static u64 notrace fsl_a008585_read_cntvct_el0(void)
 		.read_cntvct_el0 = fsl_a008585_read_cntvct_el0,
 	},
 #endif
+#ifdef CONFIG_HISILICON_ERRATUM_161010101
+	{
+		.id = "hisilicon,erratum-161010101",
+		.read_cntp_tval_el0 = hisi_161010101_read_cntp_tval_el0,
+		.read_cntv_tval_el0 = hisi_161010101_read_cntv_tval_el0,
+		.read_cntvct_el0 = hisi_161010101_read_cntvct_el0,
+	},
+#endif
 };
 #endif /* CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND */
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v9 3/4] arm64: arch_timer: Work around Erratum Hisilicon-161010101
@ 2017-01-19 13:35   ` Ding Tianhong
  0 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-19 13:35 UTC (permalink / raw)
  To: linux-arm-kernel

Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
potential to contain an erroneous value when the timer value changes".
Accesses to TVAL (both read and write) are also affected due to the implicit counter
read.  Accesses to CVAL are not affected.

The workaround is to reread the system count registers until the value of the second
read is larger than the first one by less than 32, the system counter can be guaranteed
not to return wrong value twice by back-to-back read and the error value is always larger
than the correct one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.

The hisilicon erratum CONFIG name is too long, breaking the line format in silicon-errata.txt,
so extended the character spacing to fit all the erratum config.

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 Documentation/arm64/silicon-errata.txt | 43 ++++++++++++++---------------
 drivers/clocksource/Kconfig            | 12 ++++++++-
 drivers/clocksource/arm_arch_timer.c   | 49 ++++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 22 deletions(-)

diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
index 405da11..0aaae35 100644
--- a/Documentation/arm64/silicon-errata.txt
+++ b/Documentation/arm64/silicon-errata.txt
@@ -42,24 +42,25 @@ file acts as a registry of software workarounds in the Linux Kernel and
 will be updated when new workarounds are committed and backported to
 stable kernels.
 
-| Implementor    | Component       | Erratum ID      | Kconfig                 |
-+----------------+-----------------+-----------------+-------------------------+
-| ARM            | Cortex-A53      | #826319         | ARM64_ERRATUM_826319    |
-| ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319    |
-| ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069    |
-| ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472    |
-| ARM            | Cortex-A53      | #845719         | ARM64_ERRATUM_845719    |
-| ARM            | Cortex-A53      | #843419         | ARM64_ERRATUM_843419    |
-| ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075    |
-| ARM            | Cortex-A57      | #852523         | N/A                     |
-| ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220    |
-| ARM            | Cortex-A72      | #853709         | N/A                     |
-| ARM            | MMU-500         | #841119,#826419 | N/A                     |
-|                |                 |                 |                         |
-| Cavium         | ThunderX ITS    | #22375, #24313  | CAVIUM_ERRATUM_22375    |
-| Cavium         | ThunderX ITS    | #23144          | CAVIUM_ERRATUM_23144    |
-| Cavium         | ThunderX GICv3  | #23154          | CAVIUM_ERRATUM_23154    |
-| Cavium         | ThunderX Core   | #27456          | CAVIUM_ERRATUM_27456    |
-| Cavium         | ThunderX SMMUv2 | #27704          | N/A		       |
-|                |                 |                 |                         |
-| Freescale/NXP  | LS2080A/LS1043A | A-008585        | FSL_ERRATUM_A008585     |
+| Implementor    | Component       | Erratum ID      | Kconfig                         |
++----------------+-----------------+-----------------+---------------------------------+
+| ARM            | Cortex-A53      | #826319         | ARM64_ERRATUM_826319            |
+| ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319            |
+| ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069            |
+| ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472            |
+| ARM            | Cortex-A53      | #845719         | ARM64_ERRATUM_845719            |
+| ARM            | Cortex-A53      | #843419         | ARM64_ERRATUM_843419            |
+| ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075            |
+| ARM            | Cortex-A57      | #852523         | N/A                             |
+| ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220            |
+| ARM            | Cortex-A72      | #853709         | N/A                             |
+| ARM            | MMU-500         | #841119,#826419 | N/A                             |
+|                |                 |                 |                                 |
+| Cavium         | ThunderX ITS    | #22375, #24313  | CAVIUM_ERRATUM_22375            |
+| Cavium         | ThunderX ITS    | #23144          | CAVIUM_ERRATUM_23144            |
+| Cavium         | ThunderX GICv3  | #23154          | CAVIUM_ERRATUM_23154            |
+| Cavium         | ThunderX Core   | #27456          | CAVIUM_ERRATUM_27456            |
+| Cavium         | ThunderX SMMUv2 | #27704          | N/A                             |
+|                |                 |                 |                                 |
+| Freescale/NXP  | LS2080A/LS1043A | A-008585        | FSL_ERRATUM_A008585             |
+| Hisilicon      | Hip0{5,6,7}     | #161010101      | HISILICON_ERRATUM_161010101     |
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 6693e07..b30f44f 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -327,7 +327,7 @@ config ARM_ARCH_TIMER_EVTSTREAM
 
 config ARM_ARCH_TIMER_OOL_WORKAROUND
 	bool
-	depends on FSL_ERRATUM_A008585
+	depends on FSL_ERRATUM_A008585 || HISILICON_ERRATUM_161010101
 	help
 	  This option would only be enabled by Freescale/NXP Erratum A-008585
 	  or something else chip has similar erratum.
@@ -343,6 +343,16 @@ config FSL_ERRATUM_A008585
 	  value").  The workaround will only be active if the
 	  fsl,erratum-a008585 property is found in the timer node.
 
+config HISILICON_ERRATUM_161010101
+	bool "Workaround for Hisilicon Erratum 161010101"
+	default y
+	select ARM_ARCH_TIMER_OOL_WORKAROUND
+	depends on ARM_ARCH_TIMER && ARM64
+	help
+	  This option enables a workaround for Hisilicon Erratum
+	  161010101. The workaround will be active if the hisilicon,erratum-161010101
+	  property is found in the timer node.
+
 config ARM_GLOBAL_TIMER
 	bool "Support for the ARM global timer" if COMPILE_TEST
 	select CLKSRC_OF if OF
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 2487c66..7451b62 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -131,6 +131,47 @@ static u64 notrace fsl_a008585_read_cntvct_el0(void)
 }
 #endif
 
+#ifdef CONFIG_HISILICON_ERRATUM_161010101
+/*
+ * Verify whether the value of the second read is larger than the first by
+ * less than 32 is the only way to confirm the value is correct, so clear the
+ * lower 5 bits to check whether the difference is greater than 32 or not.
+ * Theoretically the erratum should not occur more than twice in succession
+ * when reading the system counter, but it is possible that some interrupts
+ * may lead to more than twice read errors, triggering the warning, so setting
+ * the number of retries far beyond the number of iterations the loop has been
+ * observed to take.
+ */
+#define __hisi_161010101_read_reg(reg) ({				\
+	u64 _old, _new;						\
+	int _retries = 50;					\
+								\
+	do {							\
+		_old = read_sysreg(reg);			\
+		_new = read_sysreg(reg);			\
+		_retries--;					\
+	} while (unlikely((_new - _old) >> 5) && _retries);	\
+								\
+	WARN_ON_ONCE(!_retries);				\
+	_new;							\
+})
+
+static u32 notrace hisi_161010101_read_cntp_tval_el0(void)
+{
+	return __hisi_161010101_read_reg(cntp_tval_el0);
+}
+
+static u32 notrace hisi_161010101_read_cntv_tval_el0(void)
+{
+	return __hisi_161010101_read_reg(cntv_tval_el0);
+}
+
+static u64 notrace hisi_161010101_read_cntvct_el0(void)
+{
+	return __hisi_161010101_read_reg(cntvct_el0);
+}
+#endif
+
 #ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
 const struct arch_timer_erratum_workaround *timer_unstable_counter_workaround = NULL;
 EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
@@ -147,6 +188,14 @@ static u64 notrace fsl_a008585_read_cntvct_el0(void)
 		.read_cntvct_el0 = fsl_a008585_read_cntvct_el0,
 	},
 #endif
+#ifdef CONFIG_HISILICON_ERRATUM_161010101
+	{
+		.id = "hisilicon,erratum-161010101",
+		.read_cntp_tval_el0 = hisi_161010101_read_cntp_tval_el0,
+		.read_cntv_tval_el0 = hisi_161010101_read_cntv_tval_el0,
+		.read_cntvct_el0 = hisi_161010101_read_cntvct_el0,
+	},
+#endif
 };
 #endif /* CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND */
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v9 4/4] arm64: arch timer: Add timer erratum property for Hip05-d02 and Hip06-d03
  2017-01-19 13:35 ` Ding Tianhong
@ 2017-01-19 13:35     ` Ding Tianhong
  -1 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-19 13:35 UTC (permalink / raw)
  To: catalin.marinas-5wv7dgnIgG8, will.deacon-5wv7dgnIgG8,
	marc.zyngier-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	oss-fOR+EgIDQEHk1uMJSBkQmQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A, stuart.yoder-3arQi8VN3Tc,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linuxarm-hv44wF8Li93QT0dZR+AlfA
  Cc: Ding Tianhong

Enable workaround for hisilicon erratum 161010101 on Hip05-d02 and Hip06-d03 board.

Signed-off-by: Ding Tianhong <dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
 arch/arm64/boot/dts/hisilicon/hip05.dtsi | 1 +
 arch/arm64/boot/dts/hisilicon/hip06.dtsi | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hip05.dtsi b/arch/arm64/boot/dts/hisilicon/hip05.dtsi
index 4b472a3..6b76f3a 100644
--- a/arch/arm64/boot/dts/hisilicon/hip05.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hip05.dtsi
@@ -281,6 +281,7 @@
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+		hisilicon,erratum-161010101;
 	};
 
 	pmu {
diff --git a/arch/arm64/boot/dts/hisilicon/hip06.dtsi b/arch/arm64/boot/dts/hisilicon/hip06.dtsi
index a049b64..cf8b9db 100644
--- a/arch/arm64/boot/dts/hisilicon/hip06.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hip06.dtsi
@@ -260,6 +260,7 @@
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+		hisilicon,erratum-161010101;
 	};
 
 	pmu {
-- 
1.9.0


--
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

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v9 4/4] arm64: arch timer: Add timer erratum property for Hip05-d02 and Hip06-d03
@ 2017-01-19 13:35     ` Ding Tianhong
  0 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-19 13:35 UTC (permalink / raw)
  To: linux-arm-kernel

Enable workaround for hisilicon erratum 161010101 on Hip05-d02 and Hip06-d03 board.

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 arch/arm64/boot/dts/hisilicon/hip05.dtsi | 1 +
 arch/arm64/boot/dts/hisilicon/hip06.dtsi | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hip05.dtsi b/arch/arm64/boot/dts/hisilicon/hip05.dtsi
index 4b472a3..6b76f3a 100644
--- a/arch/arm64/boot/dts/hisilicon/hip05.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hip05.dtsi
@@ -281,6 +281,7 @@
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+		hisilicon,erratum-161010101;
 	};
 
 	pmu {
diff --git a/arch/arm64/boot/dts/hisilicon/hip06.dtsi b/arch/arm64/boot/dts/hisilicon/hip06.dtsi
index a049b64..cf8b9db 100644
--- a/arch/arm64/boot/dts/hisilicon/hip06.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hip06.dtsi
@@ -260,6 +260,7 @@
 			     <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
 			     <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
+		hisilicon,erratum-161010101;
 	};
 
 	pmu {
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-19 13:35 ` Ding Tianhong
@ 2017-01-19 13:49     ` Marc Zyngier
  -1 siblings, 0 replies; 44+ messages in thread
From: Marc Zyngier @ 2017-01-19 13:49 UTC (permalink / raw)
  To: Ding Tianhong, catalin.marinas-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	oss-fOR+EgIDQEHk1uMJSBkQmQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A, stuart.yoder-3arQi8VN3Tc,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linuxarm-hv44wF8Li93QT0dZR+AlfA

On 19/01/17 13:35, Ding Tianhong wrote:
> Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
> potential to contain an erroneous value when the timer value changes".
> Accesses to TVAL (both read and write) are also affected due to the implicit counter
> read.  Accesses to CVAL are not affected.

Please. 3 series in 2 hours is not fun, and is not helping your case
either. Give us the time to properly review your patches, and wait until
we ask you to respin if we think that this is required.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...
--
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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-19 13:49     ` Marc Zyngier
  0 siblings, 0 replies; 44+ messages in thread
From: Marc Zyngier @ 2017-01-19 13:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 19/01/17 13:35, Ding Tianhong wrote:
> Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
> potential to contain an erroneous value when the timer value changes".
> Accesses to TVAL (both read and write) are also affected due to the implicit counter
> read.  Accesses to CVAL are not affected.

Please. 3 series in 2 hours is not fun, and is not helping your case
either. Give us the time to properly review your patches, and wait until
we ask you to respin if we think that this is required.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-19 13:49     ` Marc Zyngier
@ 2017-01-20  1:22       ` Ding Tianhong
  -1 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-20  1:22 UTC (permalink / raw)
  To: Marc Zyngier, catalin.marinas, will.deacon, mark.rutland, oss,
	devicetree, shawnguo, stuart.yoder, linux-arm-kernel, linuxarm


On 2017/1/19 21:49, Marc Zyngier wrote:
> On 19/01/17 13:35, Ding Tianhong wrote:
>> Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
>> potential to contain an erroneous value when the timer value changes".
>> Accesses to TVAL (both read and write) are also affected due to the implicit counter
>> read.  Accesses to CVAL are not affected.
> 
> Please. 3 series in 2 hours is not fun, and is not helping your case
> either. Give us the time to properly review your patches, and wait until
> we ask you to respin if we think that this is required.
> 
> Thanks,
> 

OKo<\fThank you for your correction.

Thanks
Ding

> 	M.
> 

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-20  1:22       ` Ding Tianhong
  0 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-20  1:22 UTC (permalink / raw)
  To: linux-arm-kernel


On 2017/1/19 21:49, Marc Zyngier wrote:
> On 19/01/17 13:35, Ding Tianhong wrote:
>> Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
>> potential to contain an erroneous value when the timer value changes".
>> Accesses to TVAL (both read and write) are also affected due to the implicit counter
>> read.  Accesses to CVAL are not affected.
> 
> Please. 3 series in 2 hours is not fun, and is not helping your case
> either. Give us the time to properly review your patches, and wait until
> we ask you to respin if we think that this is required.
> 
> Thanks,
> 

OKo<
Thank you for your correction.

Thanks
Ding

> 	M.
> 

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-19 13:35 ` Ding Tianhong
@ 2017-01-20 15:04     ` Mark Rutland
  -1 siblings, 0 replies; 44+ messages in thread
From: Mark Rutland @ 2017-01-20 15:04 UTC (permalink / raw)
  To: Ding Tianhong, catalin.marinas-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, Daniel Lezcano, Thomas Gleixner
  Cc: marc.zyngier-5wv7dgnIgG8, oss-fOR+EgIDQEHk1uMJSBkQmQ,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A, stuart.yoder-3arQi8VN3Tc,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linuxarm-hv44wF8Li93QT0dZR+AlfA

On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
> Ding Tianhong (4):
>   arm64: arch_timer: Add device tree binding for hisilicon-161010101
>     erratum
>   arm64: arch_timer: Introduce a generic erratum handing mechanism for
>     fsl-a008585
>   arm64: arch_timer: Work around Erratum Hisilicon-161010101
>   arm64: arch timer: Add timer erratum property for Hip05-d02 and
>     Hip06-d03
> 
>  Documentation/admin-guide/kernel-parameters.txt    |   9 --
>  Documentation/arm64/silicon-errata.txt             |  43 +++---
>  .../devicetree/bindings/arm/arch_timer.txt         |   6 +
>  arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
>  arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
>  arch/arm64/include/asm/arch_timer.h                |  38 ++----
>  drivers/clocksource/Kconfig                        |  18 +++
>  drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
>  8 files changed, 171 insertions(+), 95 deletions(-)

I've picked these up (with a few local cleanups), given that some local
testing, and pushed the result to a branch [1] on my git repo.

There are likely to be clashes with the arm64 tree (e.g. for
silicon-errata.txt), and we're also likely to have more arch timer
updates shortly for the GTDT stuff, so I think the best bet is for both
arm64 and the clocksource tree to pull that branch for v4.11.

Alternatively, we could take this all through the arm64 tree, if the
clocksource maintainers are happy with that.

Thoughts?

Thanks,
Mark.

[1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arch-timer/hisi-161010101
--
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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-20 15:04     ` Mark Rutland
  0 siblings, 0 replies; 44+ messages in thread
From: Mark Rutland @ 2017-01-20 15:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
> Ding Tianhong (4):
>   arm64: arch_timer: Add device tree binding for hisilicon-161010101
>     erratum
>   arm64: arch_timer: Introduce a generic erratum handing mechanism for
>     fsl-a008585
>   arm64: arch_timer: Work around Erratum Hisilicon-161010101
>   arm64: arch timer: Add timer erratum property for Hip05-d02 and
>     Hip06-d03
> 
>  Documentation/admin-guide/kernel-parameters.txt    |   9 --
>  Documentation/arm64/silicon-errata.txt             |  43 +++---
>  .../devicetree/bindings/arm/arch_timer.txt         |   6 +
>  arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
>  arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
>  arch/arm64/include/asm/arch_timer.h                |  38 ++----
>  drivers/clocksource/Kconfig                        |  18 +++
>  drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
>  8 files changed, 171 insertions(+), 95 deletions(-)

I've picked these up (with a few local cleanups), given that some local
testing, and pushed the result to a branch [1] on my git repo.

There are likely to be clashes with the arm64 tree (e.g. for
silicon-errata.txt), and we're also likely to have more arch timer
updates shortly for the GTDT stuff, so I think the best bet is for both
arm64 and the clocksource tree to pull that branch for v4.11.

Alternatively, we could take this all through the arm64 tree, if the
clocksource maintainers are happy with that.

Thoughts?

Thanks,
Mark.

[1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arch-timer/hisi-161010101

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-20 15:04     ` Mark Rutland
@ 2017-01-22  7:59       ` Hanjun Guo
  -1 siblings, 0 replies; 44+ messages in thread
From: Hanjun Guo @ 2017-01-22  7:59 UTC (permalink / raw)
  To: Mark Rutland, Ding Tianhong, catalin.marinas-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, Daniel Lezcano, Thomas Gleixner
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, marc.zyngier-5wv7dgnIgG8,
	stuart.yoder-3arQi8VN3Tc, linuxarm-hv44wF8Li93QT0dZR+AlfA,
	oss-fOR+EgIDQEHk1uMJSBkQmQ, shawnguo-DgEjT+Ai2ygdnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Fu Wei

On 2017/1/20 23:04, Mark Rutland wrote:
> On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
>> Ding Tianhong (4):
>>   arm64: arch_timer: Add device tree binding for hisilicon-161010101
>>     erratum
>>   arm64: arch_timer: Introduce a generic erratum handing mechanism for
>>     fsl-a008585
>>   arm64: arch_timer: Work around Erratum Hisilicon-161010101
>>   arm64: arch timer: Add timer erratum property for Hip05-d02 and
>>     Hip06-d03
>>
>>  Documentation/admin-guide/kernel-parameters.txt    |   9 --
>>  Documentation/arm64/silicon-errata.txt             |  43 +++---
>>  .../devicetree/bindings/arm/arch_timer.txt         |   6 +
>>  arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
>>  arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
>>  arch/arm64/include/asm/arch_timer.h                |  38 ++----
>>  drivers/clocksource/Kconfig                        |  18 +++
>>  drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
>>  8 files changed, 171 insertions(+), 95 deletions(-)
>
> I've picked these up (with a few local cleanups), given that some local
> testing, and pushed the result to a branch [1] on my git repo.
>
> There are likely to be clashes with the arm64 tree (e.g. for
> silicon-errata.txt), and we're also likely to have more arch timer
> updates shortly for the GTDT stuff,

Yes, GTDT patches conflict with this patch set but it's easy to
fix.

> so I think the best bet is for both
> arm64 and the clocksource tree to pull that branch for v4.11.
>
> Alternatively, we could take this all through the arm64 tree, if the
> clocksource maintainers are happy with that.
>
> Thoughts?

GTDT patch set is adding ACPI support for arch timer, and it's
only used for ARM64 now, in order to handler the conflict easily,
I think take them all through arm64 tree is better (I was working
with Fuwei for the GTDT patch set and I hope it's not blocked by
"who will merge the code"...)

Thanks
Hanjun
--
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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-22  7:59       ` Hanjun Guo
  0 siblings, 0 replies; 44+ messages in thread
From: Hanjun Guo @ 2017-01-22  7:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 2017/1/20 23:04, Mark Rutland wrote:
> On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
>> Ding Tianhong (4):
>>   arm64: arch_timer: Add device tree binding for hisilicon-161010101
>>     erratum
>>   arm64: arch_timer: Introduce a generic erratum handing mechanism for
>>     fsl-a008585
>>   arm64: arch_timer: Work around Erratum Hisilicon-161010101
>>   arm64: arch timer: Add timer erratum property for Hip05-d02 and
>>     Hip06-d03
>>
>>  Documentation/admin-guide/kernel-parameters.txt    |   9 --
>>  Documentation/arm64/silicon-errata.txt             |  43 +++---
>>  .../devicetree/bindings/arm/arch_timer.txt         |   6 +
>>  arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
>>  arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
>>  arch/arm64/include/asm/arch_timer.h                |  38 ++----
>>  drivers/clocksource/Kconfig                        |  18 +++
>>  drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
>>  8 files changed, 171 insertions(+), 95 deletions(-)
>
> I've picked these up (with a few local cleanups), given that some local
> testing, and pushed the result to a branch [1] on my git repo.
>
> There are likely to be clashes with the arm64 tree (e.g. for
> silicon-errata.txt), and we're also likely to have more arch timer
> updates shortly for the GTDT stuff,

Yes, GTDT patches conflict with this patch set but it's easy to
fix.

> so I think the best bet is for both
> arm64 and the clocksource tree to pull that branch for v4.11.
>
> Alternatively, we could take this all through the arm64 tree, if the
> clocksource maintainers are happy with that.
>
> Thoughts?

GTDT patch set is adding ACPI support for arch timer, and it's
only used for ARM64 now, in order to handler the conflict easily,
I think take them all through arm64 tree is better (I was working
with Fuwei for the GTDT patch set and I hope it's not blocked by
"who will merge the code"...)

Thanks
Hanjun

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-20 15:04     ` Mark Rutland
@ 2017-01-23  7:36       ` Ding Tianhong
  -1 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-23  7:36 UTC (permalink / raw)
  To: Mark Rutland, catalin.marinas-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, Daniel Lezcano, Thomas Gleixner
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, marc.zyngier-5wv7dgnIgG8,
	stuart.yoder-3arQi8VN3Tc, linuxarm-hv44wF8Li93QT0dZR+AlfA,
	oss-fOR+EgIDQEHk1uMJSBkQmQ, shawnguo-DgEjT+Ai2ygdnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r



On 2017/1/20 23:04, Mark Rutland wrote:
> On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
>> Ding Tianhong (4):
>>   arm64: arch_timer: Add device tree binding for hisilicon-161010101
>>     erratum
>>   arm64: arch_timer: Introduce a generic erratum handing mechanism for
>>     fsl-a008585
>>   arm64: arch_timer: Work around Erratum Hisilicon-161010101
>>   arm64: arch timer: Add timer erratum property for Hip05-d02 and
>>     Hip06-d03
>>
>>  Documentation/admin-guide/kernel-parameters.txt    |   9 --
>>  Documentation/arm64/silicon-errata.txt             |  43 +++---
>>  .../devicetree/bindings/arm/arch_timer.txt         |   6 +
>>  arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
>>  arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
>>  arch/arm64/include/asm/arch_timer.h                |  38 ++----
>>  drivers/clocksource/Kconfig                        |  18 +++
>>  drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
>>  8 files changed, 171 insertions(+), 95 deletions(-)
> 
> I've picked these up (with a few local cleanups), given that some local
> testing, and pushed the result to a branch [1] on my git repo.
> 
> There are likely to be clashes with the arm64 tree (e.g. for
> silicon-errata.txt), and we're also likely to have more arch timer
> updates shortly for the GTDT stuff, so I think the best bet is for both
> arm64 and the clocksource tree to pull that branch for v4.11.
> 
> Alternatively, we could take this all through the arm64 tree, if the
> clocksource maintainers are happy with that.
> 
> Thoughts?
> 

Hi Mark:

It is really a great milestone now, Thanks for the help, and I will still wait
for Marc's new opinion for this version, hoping no need to change anything else. :)

Thanks
Ding

> Thanks,
> Mark.
> 
> [1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arch-timer/hisi-161010101
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> .
> 

--
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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-23  7:36       ` Ding Tianhong
  0 siblings, 0 replies; 44+ messages in thread
From: Ding Tianhong @ 2017-01-23  7:36 UTC (permalink / raw)
  To: linux-arm-kernel



On 2017/1/20 23:04, Mark Rutland wrote:
> On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
>> Ding Tianhong (4):
>>   arm64: arch_timer: Add device tree binding for hisilicon-161010101
>>     erratum
>>   arm64: arch_timer: Introduce a generic erratum handing mechanism for
>>     fsl-a008585
>>   arm64: arch_timer: Work around Erratum Hisilicon-161010101
>>   arm64: arch timer: Add timer erratum property for Hip05-d02 and
>>     Hip06-d03
>>
>>  Documentation/admin-guide/kernel-parameters.txt    |   9 --
>>  Documentation/arm64/silicon-errata.txt             |  43 +++---
>>  .../devicetree/bindings/arm/arch_timer.txt         |   6 +
>>  arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
>>  arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
>>  arch/arm64/include/asm/arch_timer.h                |  38 ++----
>>  drivers/clocksource/Kconfig                        |  18 +++
>>  drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
>>  8 files changed, 171 insertions(+), 95 deletions(-)
> 
> I've picked these up (with a few local cleanups), given that some local
> testing, and pushed the result to a branch [1] on my git repo.
> 
> There are likely to be clashes with the arm64 tree (e.g. for
> silicon-errata.txt), and we're also likely to have more arch timer
> updates shortly for the GTDT stuff, so I think the best bet is for both
> arm64 and the clocksource tree to pull that branch for v4.11.
> 
> Alternatively, we could take this all through the arm64 tree, if the
> clocksource maintainers are happy with that.
> 
> Thoughts?
> 

Hi Mark:

It is really a great milestone now, Thanks for the help, and I will still wait
for Marc's new opinion for this version, hoping no need to change anything else. :)

Thanks
Ding

> Thanks,
> Mark.
> 
> [1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arch-timer/hisi-161010101
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> .
> 

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-23  7:36       ` Ding Tianhong
@ 2017-01-23  8:43           ` Marc Zyngier
  -1 siblings, 0 replies; 44+ messages in thread
From: Marc Zyngier @ 2017-01-23  8:43 UTC (permalink / raw)
  To: Ding Tianhong, Mark Rutland, catalin.marinas-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, Daniel Lezcano, Thomas Gleixner
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, stuart.yoder-3arQi8VN3Tc,
	linuxarm-hv44wF8Li93QT0dZR+AlfA, oss-fOR+EgIDQEHk1uMJSBkQmQ,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 23/01/17 07:36, Ding Tianhong wrote:
> 
> 
> On 2017/1/20 23:04, Mark Rutland wrote:
>> On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
>>> Ding Tianhong (4):
>>>   arm64: arch_timer: Add device tree binding for hisilicon-161010101
>>>     erratum
>>>   arm64: arch_timer: Introduce a generic erratum handing mechanism for
>>>     fsl-a008585
>>>   arm64: arch_timer: Work around Erratum Hisilicon-161010101
>>>   arm64: arch timer: Add timer erratum property for Hip05-d02 and
>>>     Hip06-d03
>>>
>>>  Documentation/admin-guide/kernel-parameters.txt    |   9 --
>>>  Documentation/arm64/silicon-errata.txt             |  43 +++---
>>>  .../devicetree/bindings/arm/arch_timer.txt         |   6 +
>>>  arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
>>>  arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
>>>  arch/arm64/include/asm/arch_timer.h                |  38 ++----
>>>  drivers/clocksource/Kconfig                        |  18 +++
>>>  drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
>>>  8 files changed, 171 insertions(+), 95 deletions(-)
>>
>> I've picked these up (with a few local cleanups), given that some local
>> testing, and pushed the result to a branch [1] on my git repo.
>>
>> There are likely to be clashes with the arm64 tree (e.g. for
>> silicon-errata.txt), and we're also likely to have more arch timer
>> updates shortly for the GTDT stuff, so I think the best bet is for both
>> arm64 and the clocksource tree to pull that branch for v4.11.
>>
>> Alternatively, we could take this all through the arm64 tree, if the
>> clocksource maintainers are happy with that.
>>
>> Thoughts?
>>
> 
> Hi Mark:
> > It is really a great milestone now, Thanks for the help, and I will
> still wait for Marc's new opinion for this version, hoping no need to
> change anything else. :)

I'm working directly with Mark, and any change I feel necessary will go
directly on top of Mark's branch (as far as I'm concerned, these patches
are now in a "frozen" state).

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...
--
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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-23  8:43           ` Marc Zyngier
  0 siblings, 0 replies; 44+ messages in thread
From: Marc Zyngier @ 2017-01-23  8:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 23/01/17 07:36, Ding Tianhong wrote:
> 
> 
> On 2017/1/20 23:04, Mark Rutland wrote:
>> On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
>>> Ding Tianhong (4):
>>>   arm64: arch_timer: Add device tree binding for hisilicon-161010101
>>>     erratum
>>>   arm64: arch_timer: Introduce a generic erratum handing mechanism for
>>>     fsl-a008585
>>>   arm64: arch_timer: Work around Erratum Hisilicon-161010101
>>>   arm64: arch timer: Add timer erratum property for Hip05-d02 and
>>>     Hip06-d03
>>>
>>>  Documentation/admin-guide/kernel-parameters.txt    |   9 --
>>>  Documentation/arm64/silicon-errata.txt             |  43 +++---
>>>  .../devicetree/bindings/arm/arch_timer.txt         |   6 +
>>>  arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
>>>  arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
>>>  arch/arm64/include/asm/arch_timer.h                |  38 ++----
>>>  drivers/clocksource/Kconfig                        |  18 +++
>>>  drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
>>>  8 files changed, 171 insertions(+), 95 deletions(-)
>>
>> I've picked these up (with a few local cleanups), given that some local
>> testing, and pushed the result to a branch [1] on my git repo.
>>
>> There are likely to be clashes with the arm64 tree (e.g. for
>> silicon-errata.txt), and we're also likely to have more arch timer
>> updates shortly for the GTDT stuff, so I think the best bet is for both
>> arm64 and the clocksource tree to pull that branch for v4.11.
>>
>> Alternatively, we could take this all through the arm64 tree, if the
>> clocksource maintainers are happy with that.
>>
>> Thoughts?
>>
> 
> Hi Mark:
> > It is really a great milestone now, Thanks for the help, and I will
> still wait for Marc's new opinion for this version, hoping no need to
> change anything else. :)

I'm working directly with Mark, and any change I feel necessary will go
directly on top of Mark's branch (as far as I'm concerned, these patches
are now in a "frozen" state).

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-22  7:59       ` Hanjun Guo
@ 2017-01-23 10:31           ` Mark Rutland
  -1 siblings, 0 replies; 44+ messages in thread
From: Mark Rutland @ 2017-01-23 10:31 UTC (permalink / raw)
  To: Hanjun Guo
  Cc: Ding Tianhong, catalin.marinas-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, Daniel Lezcano, Thomas Gleixner,
	devicetree-u79uwXL29TY76Z2rM5mHXA, marc.zyngier-5wv7dgnIgG8,
	stuart.yoder-3arQi8VN3Tc, linuxarm-hv44wF8Li93QT0dZR+AlfA,
	oss-fOR+EgIDQEHk1uMJSBkQmQ, shawnguo-DgEjT+Ai2ygdnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Fu Wei

On Sun, Jan 22, 2017 at 03:59:57PM +0800, Hanjun Guo wrote:
> On 2017/1/20 23:04, Mark Rutland wrote:
> >On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
> >>Ding Tianhong (4):
> >>  arm64: arch_timer: Add device tree binding for hisilicon-161010101
> >>    erratum
> >>  arm64: arch_timer: Introduce a generic erratum handing mechanism for
> >>    fsl-a008585
> >>  arm64: arch_timer: Work around Erratum Hisilicon-161010101
> >>  arm64: arch timer: Add timer erratum property for Hip05-d02 and
> >>    Hip06-d03
> >>
> >> Documentation/admin-guide/kernel-parameters.txt    |   9 --
> >> Documentation/arm64/silicon-errata.txt             |  43 +++---
> >> .../devicetree/bindings/arm/arch_timer.txt         |   6 +
> >> arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
> >> arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
> >> arch/arm64/include/asm/arch_timer.h                |  38 ++----
> >> drivers/clocksource/Kconfig                        |  18 +++
> >> drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
> >> 8 files changed, 171 insertions(+), 95 deletions(-)
> >
> >I've picked these up (with a few local cleanups), given that some local
> >testing, and pushed the result to a branch [1] on my git repo.
> >
> >There are likely to be clashes with the arm64 tree (e.g. for
> >silicon-errata.txt), and we're also likely to have more arch timer
> >updates shortly for the GTDT stuff,
> 
> Yes, GTDT patches conflict with this patch set but it's easy to
> fix.

Sure. What I meant is that I'd prefer to fix any such conflict myself
(i.e. by basing the GTDT patches atop of this), before passing this
upwards.

> >so I think the best bet is for both arm64 and the clocksource tree to
> >pull that branch for v4.11.
> >
> >Alternatively, we could take this all through the arm64 tree, if the
> >clocksource maintainers are happy with that.
> >
> >Thoughts?
> 
> GTDT patch set is adding ACPI support for arch timer, and it's
> only used for ARM64 now, in order to handler the conflict easily,
> I think take them all through arm64 tree is better

In either case I believe we should be able to handle the conflict. Going
through one tree (i.e. arm64) would simplify things substantially,
though.

This really comes down to what the clocksource maintainers prefer.

> (I was working with Fuwei for the GTDT patch set and I hope it's not
> blocked by "who will merge the code"...)

Hopefully this is just a formality. :)

Thanks,
Mark.
--
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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-23 10:31           ` Mark Rutland
  0 siblings, 0 replies; 44+ messages in thread
From: Mark Rutland @ 2017-01-23 10:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Jan 22, 2017 at 03:59:57PM +0800, Hanjun Guo wrote:
> On 2017/1/20 23:04, Mark Rutland wrote:
> >On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
> >>Ding Tianhong (4):
> >>  arm64: arch_timer: Add device tree binding for hisilicon-161010101
> >>    erratum
> >>  arm64: arch_timer: Introduce a generic erratum handing mechanism for
> >>    fsl-a008585
> >>  arm64: arch_timer: Work around Erratum Hisilicon-161010101
> >>  arm64: arch timer: Add timer erratum property for Hip05-d02 and
> >>    Hip06-d03
> >>
> >> Documentation/admin-guide/kernel-parameters.txt    |   9 --
> >> Documentation/arm64/silicon-errata.txt             |  43 +++---
> >> .../devicetree/bindings/arm/arch_timer.txt         |   6 +
> >> arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
> >> arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
> >> arch/arm64/include/asm/arch_timer.h                |  38 ++----
> >> drivers/clocksource/Kconfig                        |  18 +++
> >> drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
> >> 8 files changed, 171 insertions(+), 95 deletions(-)
> >
> >I've picked these up (with a few local cleanups), given that some local
> >testing, and pushed the result to a branch [1] on my git repo.
> >
> >There are likely to be clashes with the arm64 tree (e.g. for
> >silicon-errata.txt), and we're also likely to have more arch timer
> >updates shortly for the GTDT stuff,
> 
> Yes, GTDT patches conflict with this patch set but it's easy to
> fix.

Sure. What I meant is that I'd prefer to fix any such conflict myself
(i.e. by basing the GTDT patches atop of this), before passing this
upwards.

> >so I think the best bet is for both arm64 and the clocksource tree to
> >pull that branch for v4.11.
> >
> >Alternatively, we could take this all through the arm64 tree, if the
> >clocksource maintainers are happy with that.
> >
> >Thoughts?
> 
> GTDT patch set is adding ACPI support for arch timer, and it's
> only used for ARM64 now, in order to handler the conflict easily,
> I think take them all through arm64 tree is better

In either case I believe we should be able to handle the conflict. Going
through one tree (i.e. arm64) would simplify things substantially,
though.

This really comes down to what the clocksource maintainers prefer.

> (I was working with Fuwei for the GTDT patch set and I hope it's not
> blocked by "who will merge the code"...)

Hopefully this is just a formality. :)

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-20 15:04     ` Mark Rutland
@ 2017-01-23 10:39       ` Will Deacon
  -1 siblings, 0 replies; 44+ messages in thread
From: Will Deacon @ 2017-01-23 10:39 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Ding Tianhong, catalin.marinas-5wv7dgnIgG8, Daniel Lezcano,
	Thomas Gleixner, marc.zyngier-5wv7dgnIgG8,
	oss-fOR+EgIDQEHk1uMJSBkQmQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A, stuart.yoder-3arQi8VN3Tc,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linuxarm-hv44wF8Li93QT0dZR+AlfA

On Fri, Jan 20, 2017 at 03:04:28PM +0000, Mark Rutland wrote:
> On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
> > Ding Tianhong (4):
> >   arm64: arch_timer: Add device tree binding for hisilicon-161010101
> >     erratum
> >   arm64: arch_timer: Introduce a generic erratum handing mechanism for
> >     fsl-a008585
> >   arm64: arch_timer: Work around Erratum Hisilicon-161010101
> >   arm64: arch timer: Add timer erratum property for Hip05-d02 and
> >     Hip06-d03
> > 
> >  Documentation/admin-guide/kernel-parameters.txt    |   9 --
> >  Documentation/arm64/silicon-errata.txt             |  43 +++---
> >  .../devicetree/bindings/arm/arch_timer.txt         |   6 +
> >  arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
> >  arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
> >  arch/arm64/include/asm/arch_timer.h                |  38 ++----
> >  drivers/clocksource/Kconfig                        |  18 +++
> >  drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
> >  8 files changed, 171 insertions(+), 95 deletions(-)
> 
> I've picked these up (with a few local cleanups), given that some local
> testing, and pushed the result to a branch [1] on my git repo.
> 
> There are likely to be clashes with the arm64 tree (e.g. for
> silicon-errata.txt), and we're also likely to have more arch timer
> updates shortly for the GTDT stuff, so I think the best bet is for both
> arm64 and the clocksource tree to pull that branch for v4.11.
> 
> Alternatively, we could take this all through the arm64 tree, if the
> clocksource maintainers are happy with that.

Fine by me, but I'd need at least Daniel's ack before taking these.

Will
--
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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-23 10:39       ` Will Deacon
  0 siblings, 0 replies; 44+ messages in thread
From: Will Deacon @ 2017-01-23 10:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 20, 2017 at 03:04:28PM +0000, Mark Rutland wrote:
> On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
> > Ding Tianhong (4):
> >   arm64: arch_timer: Add device tree binding for hisilicon-161010101
> >     erratum
> >   arm64: arch_timer: Introduce a generic erratum handing mechanism for
> >     fsl-a008585
> >   arm64: arch_timer: Work around Erratum Hisilicon-161010101
> >   arm64: arch timer: Add timer erratum property for Hip05-d02 and
> >     Hip06-d03
> > 
> >  Documentation/admin-guide/kernel-parameters.txt    |   9 --
> >  Documentation/arm64/silicon-errata.txt             |  43 +++---
> >  .../devicetree/bindings/arm/arch_timer.txt         |   6 +
> >  arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
> >  arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
> >  arch/arm64/include/asm/arch_timer.h                |  38 ++----
> >  drivers/clocksource/Kconfig                        |  18 +++
> >  drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
> >  8 files changed, 171 insertions(+), 95 deletions(-)
> 
> I've picked these up (with a few local cleanups), given that some local
> testing, and pushed the result to a branch [1] on my git repo.
> 
> There are likely to be clashes with the arm64 tree (e.g. for
> silicon-errata.txt), and we're also likely to have more arch timer
> updates shortly for the GTDT stuff, so I think the best bet is for both
> arm64 and the clocksource tree to pull that branch for v4.11.
> 
> Alternatively, we could take this all through the arm64 tree, if the
> clocksource maintainers are happy with that.

Fine by me, but I'd need at least Daniel's ack before taking these.

Will

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-23 10:39       ` Will Deacon
@ 2017-01-23 22:40         ` Daniel Lezcano
  -1 siblings, 0 replies; 44+ messages in thread
From: Daniel Lezcano @ 2017-01-23 22:40 UTC (permalink / raw)
  To: Will Deacon, Mark Rutland
  Cc: devicetree, marc.zyngier, catalin.marinas, stuart.yoder,
	linuxarm, oss, Ding Tianhong, Thomas Gleixner, shawnguo,
	linux-arm-kernel

On 23/01/2017 11:39, Will Deacon wrote:
> On Fri, Jan 20, 2017 at 03:04:28PM +0000, Mark Rutland wrote:
>> On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
>>> Ding Tianhong (4):
>>>   arm64: arch_timer: Add device tree binding for hisilicon-161010101
>>>     erratum
>>>   arm64: arch_timer: Introduce a generic erratum handing mechanism for
>>>     fsl-a008585
>>>   arm64: arch_timer: Work around Erratum Hisilicon-161010101
>>>   arm64: arch timer: Add timer erratum property for Hip05-d02 and
>>>     Hip06-d03
>>>
>>>  Documentation/admin-guide/kernel-parameters.txt    |   9 --
>>>  Documentation/arm64/silicon-errata.txt             |  43 +++---
>>>  .../devicetree/bindings/arm/arch_timer.txt         |   6 +
>>>  arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
>>>  arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
>>>  arch/arm64/include/asm/arch_timer.h                |  38 ++----
>>>  drivers/clocksource/Kconfig                        |  18 +++
>>>  drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
>>>  8 files changed, 171 insertions(+), 95 deletions(-)
>>
>> I've picked these up (with a few local cleanups), given that some local
>> testing, and pushed the result to a branch [1] on my git repo.
>>
>> There are likely to be clashes with the arm64 tree (e.g. for
>> silicon-errata.txt), and we're also likely to have more arch timer
>> updates shortly for the GTDT stuff, so I think the best bet is for both
>> arm64 and the clocksource tree to pull that branch for v4.11.
>>
>> Alternatively, we could take this all through the arm64 tree, if the
>> clocksource maintainers are happy with that.
> 
> Fine by me, but I'd need at least Daniel's ack before taking these.

Ok, I will have a look at them tomorrow.

  -- Daniel

-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-23 22:40         ` Daniel Lezcano
  0 siblings, 0 replies; 44+ messages in thread
From: Daniel Lezcano @ 2017-01-23 22:40 UTC (permalink / raw)
  To: linux-arm-kernel

On 23/01/2017 11:39, Will Deacon wrote:
> On Fri, Jan 20, 2017 at 03:04:28PM +0000, Mark Rutland wrote:
>> On Thu, Jan 19, 2017 at 09:35:12PM +0800, Ding Tianhong wrote:
>>> Ding Tianhong (4):
>>>   arm64: arch_timer: Add device tree binding for hisilicon-161010101
>>>     erratum
>>>   arm64: arch_timer: Introduce a generic erratum handing mechanism for
>>>     fsl-a008585
>>>   arm64: arch_timer: Work around Erratum Hisilicon-161010101
>>>   arm64: arch timer: Add timer erratum property for Hip05-d02 and
>>>     Hip06-d03
>>>
>>>  Documentation/admin-guide/kernel-parameters.txt    |   9 --
>>>  Documentation/arm64/silicon-errata.txt             |  43 +++---
>>>  .../devicetree/bindings/arm/arch_timer.txt         |   6 +
>>>  arch/arm64/boot/dts/hisilicon/hip05.dtsi           |   1 +
>>>  arch/arm64/boot/dts/hisilicon/hip06.dtsi           |   1 +
>>>  arch/arm64/include/asm/arch_timer.h                |  38 ++----
>>>  drivers/clocksource/Kconfig                        |  18 +++
>>>  drivers/clocksource/arm_arch_timer.c               | 150 +++++++++++++++------
>>>  8 files changed, 171 insertions(+), 95 deletions(-)
>>
>> I've picked these up (with a few local cleanups), given that some local
>> testing, and pushed the result to a branch [1] on my git repo.
>>
>> There are likely to be clashes with the arm64 tree (e.g. for
>> silicon-errata.txt), and we're also likely to have more arch timer
>> updates shortly for the GTDT stuff, so I think the best bet is for both
>> arm64 and the clocksource tree to pull that branch for v4.11.
>>
>> Alternatively, we could take this all through the arm64 tree, if the
>> clocksource maintainers are happy with that.
> 
> Fine by me, but I'd need at least Daniel's ack before taking these.

Ok, I will have a look at them tomorrow.

  -- Daniel

-- 
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-19 13:35 ` Ding Tianhong
@ 2017-01-24 15:08   ` Daniel Lezcano
  -1 siblings, 0 replies; 44+ messages in thread
From: Daniel Lezcano @ 2017-01-24 15:08 UTC (permalink / raw)
  To: Ding Tianhong, catalin.marinas, will.deacon, marc.zyngier,
	mark.rutland, oss, devicetree, shawnguo, stuart.yoder,
	linux-arm-kernel, linuxarm

On 19/01/2017 14:35, Ding Tianhong wrote:
> Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
> potential to contain an erroneous value when the timer value changes".
> Accesses to TVAL (both read and write) are also affected due to the implicit counter
> read.  Accesses to CVAL are not affected.
> 
> The workaround is to reread the system count registers until the value of the second
> read is larger than the first one by less than 32, the system counter can be guaranteed
> not to return wrong value twice by back-to-back read and the error value is always larger
> than the correct one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.

Why not use another clocksource instead of adding a workaround with a
non negligible overhead and more complexity in the code ?


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-24 15:08   ` Daniel Lezcano
  0 siblings, 0 replies; 44+ messages in thread
From: Daniel Lezcano @ 2017-01-24 15:08 UTC (permalink / raw)
  To: linux-arm-kernel

On 19/01/2017 14:35, Ding Tianhong wrote:
> Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
> potential to contain an erroneous value when the timer value changes".
> Accesses to TVAL (both read and write) are also affected due to the implicit counter
> read.  Accesses to CVAL are not affected.
> 
> The workaround is to reread the system count registers until the value of the second
> read is larger than the first one by less than 32, the system counter can be guaranteed
> not to return wrong value twice by back-to-back read and the error value is always larger
> than the correct one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.

Why not use another clocksource instead of adding a workaround with a
non negligible overhead and more complexity in the code ?


-- 
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-24 15:08   ` Daniel Lezcano
@ 2017-01-24 15:27       ` Marc Zyngier
  -1 siblings, 0 replies; 44+ messages in thread
From: Marc Zyngier @ 2017-01-24 15:27 UTC (permalink / raw)
  To: Daniel Lezcano, Ding Tianhong, catalin.marinas-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	oss-fOR+EgIDQEHk1uMJSBkQmQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A, stuart.yoder-3arQi8VN3Tc,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linuxarm-hv44wF8Li93QT0dZR+AlfA

On 24/01/17 15:08, Daniel Lezcano wrote:
> On 19/01/2017 14:35, Ding Tianhong wrote:
>> Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
>> potential to contain an erroneous value when the timer value changes".
>> Accesses to TVAL (both read and write) are also affected due to the implicit counter
>> read.  Accesses to CVAL are not affected.
>>
>> The workaround is to reread the system count registers until the value of the second
>> read is larger than the first one by less than 32, the system counter can be guaranteed
>> not to return wrong value twice by back-to-back read and the error value is always larger
>> than the correct one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.
> 
> Why not use another clocksource instead of adding a workaround with a
> non negligible overhead and more complexity in the code ?

The overhead only affects the affected systems, since it is guarded by a
static key (the same static key that guards the FSL workaround that is
already in mainline).

As for creating a different clocksources, this would in turn make the
integration with the arch code more complex (arm64 relies on having
working architected timers, with or without workarounds) and the
integration with KVM (which relies on the same), and in the end create
quite a lot of duplication. Are we going to create a separate
clocksource for each potential erratum that people with screwed hardware
come up with?

I'd prefer to organise the mess rather than spread it everywhere.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...
--
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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-24 15:27       ` Marc Zyngier
  0 siblings, 0 replies; 44+ messages in thread
From: Marc Zyngier @ 2017-01-24 15:27 UTC (permalink / raw)
  To: linux-arm-kernel

On 24/01/17 15:08, Daniel Lezcano wrote:
> On 19/01/2017 14:35, Ding Tianhong wrote:
>> Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
>> potential to contain an erroneous value when the timer value changes".
>> Accesses to TVAL (both read and write) are also affected due to the implicit counter
>> read.  Accesses to CVAL are not affected.
>>
>> The workaround is to reread the system count registers until the value of the second
>> read is larger than the first one by less than 32, the system counter can be guaranteed
>> not to return wrong value twice by back-to-back read and the error value is always larger
>> than the correct one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.
> 
> Why not use another clocksource instead of adding a workaround with a
> non negligible overhead and more complexity in the code ?

The overhead only affects the affected systems, since it is guarded by a
static key (the same static key that guards the FSL workaround that is
already in mainline).

As for creating a different clocksources, this would in turn make the
integration with the arch code more complex (arm64 relies on having
working architected timers, with or without workarounds) and the
integration with KVM (which relies on the same), and in the end create
quite a lot of duplication. Are we going to create a separate
clocksource for each potential erratum that people with screwed hardware
come up with?

I'd prefer to organise the mess rather than spread it everywhere.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-24 15:27       ` Marc Zyngier
@ 2017-01-24 16:35           ` Daniel Lezcano
  -1 siblings, 0 replies; 44+ messages in thread
From: Daniel Lezcano @ 2017-01-24 16:35 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Ding Tianhong, catalin.marinas-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	oss-fOR+EgIDQEHk1uMJSBkQmQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A, stuart.yoder-3arQi8VN3Tc,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linuxarm-hv44wF8Li93QT0dZR+AlfA

On Tue, Jan 24, 2017 at 03:27:51PM +0000, Marc Zyngier wrote:
> On 24/01/17 15:08, Daniel Lezcano wrote:
> > On 19/01/2017 14:35, Ding Tianhong wrote:
> >> Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
> >> potential to contain an erroneous value when the timer value changes".
> >> Accesses to TVAL (both read and write) are also affected due to the implicit counter
> >> read.  Accesses to CVAL are not affected.
> >>
> >> The workaround is to reread the system count registers until the value of the second
> >> read is larger than the first one by less than 32, the system counter can be guaranteed
> >> not to return wrong value twice by back-to-back read and the error value is always larger
> >> than the correct one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.
> > 
> > Why not use another clocksource instead of adding a workaround with a
> > non negligible overhead and more complexity in the code ?
> 
> The overhead only affects the affected systems, since it is guarded by a
> static key (the same static key that guards the FSL workaround that is
> already in mainline).

Yes, that is what I understood so far.
 
> As for creating a different clocksources, this would in turn make the
> integration with the arch code more complex (arm64 relies on having
> working architected timers, with or without workarounds) and the
> integration with KVM (which relies on the same), and in the end create
> quite a lot of duplication. Are we going to create a separate
> clocksource for each potential erratum that people with screwed hardware
> come up with?

That wasn't my point. The way the errata are handled in this patchset is
elegant and I have nothing against it. I'm worried about the accumulation of
fixes, hacks, workarounds in this driver. So my naive question is about not
using an identified bogus clocksource and use another one available on the
board, which is I believe often the case, instead of trying to deal with bogus
hardware. Apparently, that is not possible because 1) of KVM, 2) of duplication
and 3) of integration with the ARM64 code.

Does it mean it is not possible to use another clocksource/clockevent than the
armv8-timer ?

Can you elaborate these three points ? 

> I'd prefer to organise the mess rather than spread it everywhere.

I will add this punchline to my fortune database :)

  -- Daniel

-- 

 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
--
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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-24 16:35           ` Daniel Lezcano
  0 siblings, 0 replies; 44+ messages in thread
From: Daniel Lezcano @ 2017-01-24 16:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 24, 2017 at 03:27:51PM +0000, Marc Zyngier wrote:
> On 24/01/17 15:08, Daniel Lezcano wrote:
> > On 19/01/2017 14:35, Ding Tianhong wrote:
> >> Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
> >> potential to contain an erroneous value when the timer value changes".
> >> Accesses to TVAL (both read and write) are also affected due to the implicit counter
> >> read.  Accesses to CVAL are not affected.
> >>
> >> The workaround is to reread the system count registers until the value of the second
> >> read is larger than the first one by less than 32, the system counter can be guaranteed
> >> not to return wrong value twice by back-to-back read and the error value is always larger
> >> than the correct one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.
> > 
> > Why not use another clocksource instead of adding a workaround with a
> > non negligible overhead and more complexity in the code ?
> 
> The overhead only affects the affected systems, since it is guarded by a
> static key (the same static key that guards the FSL workaround that is
> already in mainline).

Yes, that is what I understood so far.
 
> As for creating a different clocksources, this would in turn make the
> integration with the arch code more complex (arm64 relies on having
> working architected timers, with or without workarounds) and the
> integration with KVM (which relies on the same), and in the end create
> quite a lot of duplication. Are we going to create a separate
> clocksource for each potential erratum that people with screwed hardware
> come up with?

That wasn't my point. The way the errata are handled in this patchset is
elegant and I have nothing against it. I'm worried about the accumulation of
fixes, hacks, workarounds in this driver. So my naive question is about not
using an identified bogus clocksource and use another one available on the
board, which is I believe often the case, instead of trying to deal with bogus
hardware. Apparently, that is not possible because 1) of KVM, 2) of duplication
and 3) of integration with the ARM64 code.

Does it mean it is not possible to use another clocksource/clockevent than the
armv8-timer ?

Can you elaborate these three points ? 

> I'd prefer to organise the mess rather than spread it everywhere.

I will add this punchline to my fortune database :)

  -- Daniel

-- 

 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-24 16:35           ` Daniel Lezcano
@ 2017-01-30 15:52             ` Mark Rutland
  -1 siblings, 0 replies; 44+ messages in thread
From: Mark Rutland @ 2017-01-30 15:52 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: devicetree, Marc Zyngier, catalin.marinas, will.deacon,
	stuart.yoder, linuxarm, oss, Ding Tianhong, shawnguo,
	linux-arm-kernel

Hi Daniel,

On Tue, Jan 24, 2017 at 05:35:51PM +0100, Daniel Lezcano wrote:
> That wasn't my point. The way the errata are handled in this patchset is
> elegant and I have nothing against it. I'm worried about the accumulation of
> fixes, hacks, workarounds in this driver. So my naive question is about not
> using an identified bogus clocksource and use another one available on the
> board, which is I believe often the case, instead of trying to deal with bogus
> hardware. Apparently, that is not possible because 1) of KVM, 2) of duplication
> and 3) of integration with the ARM64 code.
> 
> Does it mean it is not possible to use another clocksource/clockevent than the
> armv8-timer ?
> 
> Can you elaborate these three points ? 

Practically speaking, these platforms have no other clocksource or
clockevent device that I am aware of, which can be enumerated in a
standard manner using ACPI.

For point 1, KVM is intimately familiar with the architected timer
(which is managed during VM context switch in hyp code, for example).
KVM knows nothing of other clocksource or clockevent devices, and it is
far from trivial to plumb these in either way. Since the architected
timer is a mandatory part of ARMv8, guests may attempt to use it
regardless.

For point 3, arm64 currently requires the architected timer as this is
mandatory per the ARMv8 architecture. It is non-trivial to add support
for other devices to the vDSO, the delay loop, etc.

Localising these quirks to the architected timer driver is by far the
least worst option available. Marc and I are perfectly happy to manage
that.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-30 15:52             ` Mark Rutland
  0 siblings, 0 replies; 44+ messages in thread
From: Mark Rutland @ 2017-01-30 15:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Daniel,

On Tue, Jan 24, 2017 at 05:35:51PM +0100, Daniel Lezcano wrote:
> That wasn't my point. The way the errata are handled in this patchset is
> elegant and I have nothing against it. I'm worried about the accumulation of
> fixes, hacks, workarounds in this driver. So my naive question is about not
> using an identified bogus clocksource and use another one available on the
> board, which is I believe often the case, instead of trying to deal with bogus
> hardware. Apparently, that is not possible because 1) of KVM, 2) of duplication
> and 3) of integration with the ARM64 code.
> 
> Does it mean it is not possible to use another clocksource/clockevent than the
> armv8-timer ?
> 
> Can you elaborate these three points ? 

Practically speaking, these platforms have no other clocksource or
clockevent device that I am aware of, which can be enumerated in a
standard manner using ACPI.

For point 1, KVM is intimately familiar with the architected timer
(which is managed during VM context switch in hyp code, for example).
KVM knows nothing of other clocksource or clockevent devices, and it is
far from trivial to plumb these in either way. Since the architected
timer is a mandatory part of ARMv8, guests may attempt to use it
regardless.

For point 3, arm64 currently requires the architected timer as this is
mandatory per the ARMv8 architecture. It is non-trivial to add support
for other devices to the vDSO, the delay loop, etc.

Localising these quirks to the architected timer driver is by far the
least worst option available. Marc and I are perfectly happy to manage
that.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-30 15:52             ` Mark Rutland
@ 2017-01-30 21:54               ` Daniel Lezcano
  -1 siblings, 0 replies; 44+ messages in thread
From: Daniel Lezcano @ 2017-01-30 21:54 UTC (permalink / raw)
  To: Mark Rutland
  Cc: devicetree, Marc Zyngier, catalin.marinas, will.deacon,
	stuart.yoder, linuxarm, oss, Ding Tianhong, shawnguo,
	linux-arm-kernel

On Mon, Jan 30, 2017 at 03:52:09PM +0000, Mark Rutland wrote:
> Hi Daniel,
> 
> On Tue, Jan 24, 2017 at 05:35:51PM +0100, Daniel Lezcano wrote:
> > That wasn't my point. The way the errata are handled in this patchset is
> > elegant and I have nothing against it. I'm worried about the accumulation of
> > fixes, hacks, workarounds in this driver. So my naive question is about not
> > using an identified bogus clocksource and use another one available on the
> > board, which is I believe often the case, instead of trying to deal with bogus
> > hardware. Apparently, that is not possible because 1) of KVM, 2) of duplication
> > and 3) of integration with the ARM64 code.
> > 
> > Does it mean it is not possible to use another clocksource/clockevent than the
> > armv8-timer ?
> > 
> > Can you elaborate these three points ? 
> 
> Practically speaking, these platforms have no other clocksource or
> clockevent device that I am aware of, which can be enumerated in a
> standard manner using ACPI.
> 
> For point 1, KVM is intimately familiar with the architected timer
> (which is managed during VM context switch in hyp code, for example).
> KVM knows nothing of other clocksource or clockevent devices, and it is
> far from trivial to plumb these in either way. Since the architected
> timer is a mandatory part of ARMv8, guests may attempt to use it
> regardless.
> 
> For point 3, arm64 currently requires the architected timer as this is
> mandatory per the ARMv8 architecture. It is non-trivial to add support
> for other devices to the vDSO, the delay loop, etc.

Ok, thanks for these clarifications.

> Localising these quirks to the architected timer driver is by far the
> least worst option available. Marc and I are perfectly happy to manage
> that.

It is up to me to ensure the clockevent/clocksource drivers in general are
following the right direction. And this driver looks more and more opaque. I
will spend some times to do a review of the driver as soon as I have time.

So we finish the reviews of this series, you take the patches when I ack them up,
but from this point, any submission for this driver will have to stick to the
standard submission rules, that is to say: Thomas Gleixner and I have to be
recipients of the patches and go through our tree. Dependency issues with
other patchset must be solved before applying them in another tree.

Thanks.

  -- Daniel

-- 

 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-30 21:54               ` Daniel Lezcano
  0 siblings, 0 replies; 44+ messages in thread
From: Daniel Lezcano @ 2017-01-30 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 30, 2017 at 03:52:09PM +0000, Mark Rutland wrote:
> Hi Daniel,
> 
> On Tue, Jan 24, 2017 at 05:35:51PM +0100, Daniel Lezcano wrote:
> > That wasn't my point. The way the errata are handled in this patchset is
> > elegant and I have nothing against it. I'm worried about the accumulation of
> > fixes, hacks, workarounds in this driver. So my naive question is about not
> > using an identified bogus clocksource and use another one available on the
> > board, which is I believe often the case, instead of trying to deal with bogus
> > hardware. Apparently, that is not possible because 1) of KVM, 2) of duplication
> > and 3) of integration with the ARM64 code.
> > 
> > Does it mean it is not possible to use another clocksource/clockevent than the
> > armv8-timer ?
> > 
> > Can you elaborate these three points ? 
> 
> Practically speaking, these platforms have no other clocksource or
> clockevent device that I am aware of, which can be enumerated in a
> standard manner using ACPI.
> 
> For point 1, KVM is intimately familiar with the architected timer
> (which is managed during VM context switch in hyp code, for example).
> KVM knows nothing of other clocksource or clockevent devices, and it is
> far from trivial to plumb these in either way. Since the architected
> timer is a mandatory part of ARMv8, guests may attempt to use it
> regardless.
> 
> For point 3, arm64 currently requires the architected timer as this is
> mandatory per the ARMv8 architecture. It is non-trivial to add support
> for other devices to the vDSO, the delay loop, etc.

Ok, thanks for these clarifications.

> Localising these quirks to the architected timer driver is by far the
> least worst option available. Marc and I are perfectly happy to manage
> that.

It is up to me to ensure the clockevent/clocksource drivers in general are
following the right direction. And this driver looks more and more opaque. I
will spend some times to do a review of the driver as soon as I have time.

So we finish the reviews of this series, you take the patches when I ack them up,
but from this point, any submission for this driver will have to stick to the
standard submission rules, that is to say: Thomas Gleixner and I have to be
recipients of the patches and go through our tree. Dependency issues with
other patchset must be solved before applying them in another tree.

Thanks.

  -- Daniel

-- 

 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 2/4] arm64: arch_timer: Introduce a generic erratum handing mechanism for fsl-a008585
  2017-01-19 13:35   ` Ding Tianhong
@ 2017-01-30 21:59       ` Daniel Lezcano
  -1 siblings, 0 replies; 44+ messages in thread
From: Daniel Lezcano @ 2017-01-30 21:59 UTC (permalink / raw)
  To: Ding Tianhong
  Cc: catalin.marinas-5wv7dgnIgG8, will.deacon-5wv7dgnIgG8,
	marc.zyngier-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	oss-fOR+EgIDQEHk1uMJSBkQmQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A, stuart.yoder-3arQi8VN3Tc,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linuxarm-hv44wF8Li93QT0dZR+AlfA

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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 2/4] arm64: arch_timer: Introduce a generic erratum handing mechanism for fsl-a008585
@ 2017-01-30 21:59       ` Daniel Lezcano
  0 siblings, 0 replies; 44+ messages in thread
From: Daniel Lezcano @ 2017-01-30 21:59 UTC (permalink / raw)
  To: linux-arm-kernel

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.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 3/4] arm64: arch_timer: Work around Erratum Hisilicon-161010101
  2017-01-19 13:35   ` Ding Tianhong
@ 2017-01-30 23:17     ` Daniel Lezcano
  -1 siblings, 0 replies; 44+ messages in thread
From: Daniel Lezcano @ 2017-01-30 23:17 UTC (permalink / raw)
  To: Ding Tianhong
  Cc: mark.rutland, devicetree, marc.zyngier, catalin.marinas,
	will.deacon, stuart.yoder, linuxarm, oss, shawnguo,
	linux-arm-kernel

On Thu, Jan 19, 2017 at 09:35:15PM +0800, Ding Tianhong wrote:
> Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
> potential to contain an erroneous value when the timer value changes".
> Accesses to TVAL (both read and write) are also affected due to the implicit counter
> read.  Accesses to CVAL are not affected.
> 
> The workaround is to reread the system count registers until the value of the second
> read is larger than the first one by less than 32, the system counter can be guaranteed
> not to return wrong value twice by back-to-back read and the error value is always larger
> than the correct one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.
> 
> The hisilicon erratum CONFIG name is too long, breaking the line format in silicon-errata.txt,
> so extended the character spacing to fit all the erratum config.

Line length.

> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
>  Documentation/arm64/silicon-errata.txt | 43 ++++++++++++++---------------
>  drivers/clocksource/Kconfig            | 12 ++++++++-
>  drivers/clocksource/arm_arch_timer.c   | 49 ++++++++++++++++++++++++++++++++++
>  3 files changed, 82 insertions(+), 22 deletions(-)
> 
> diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
> index 405da11..0aaae35 100644
> --- a/Documentation/arm64/silicon-errata.txt
> +++ b/Documentation/arm64/silicon-errata.txt
> @@ -42,24 +42,25 @@ file acts as a registry of software workarounds in the Linux Kernel and
>  will be updated when new workarounds are committed and backported to
>  stable kernels.
>  
> -| Implementor    | Component       | Erratum ID      | Kconfig                 |
> -+----------------+-----------------+-----------------+-------------------------+
> -| ARM            | Cortex-A53      | #826319         | ARM64_ERRATUM_826319    |
> -| ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319    |
> -| ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069    |
> -| ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472    |
> -| ARM            | Cortex-A53      | #845719         | ARM64_ERRATUM_845719    |
> -| ARM            | Cortex-A53      | #843419         | ARM64_ERRATUM_843419    |
> -| ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075    |
> -| ARM            | Cortex-A57      | #852523         | N/A                     |
> -| ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220    |
> -| ARM            | Cortex-A72      | #853709         | N/A                     |
> -| ARM            | MMU-500         | #841119,#826419 | N/A                     |
> -|                |                 |                 |                         |
> -| Cavium         | ThunderX ITS    | #22375, #24313  | CAVIUM_ERRATUM_22375    |
> -| Cavium         | ThunderX ITS    | #23144          | CAVIUM_ERRATUM_23144    |
> -| Cavium         | ThunderX GICv3  | #23154          | CAVIUM_ERRATUM_23154    |
> -| Cavium         | ThunderX Core   | #27456          | CAVIUM_ERRATUM_27456    |
> -| Cavium         | ThunderX SMMUv2 | #27704          | N/A		       |
> -|                |                 |                 |                         |
> -| Freescale/NXP  | LS2080A/LS1043A | A-008585        | FSL_ERRATUM_A008585     |
> +| Implementor    | Component       | Erratum ID      | Kconfig                         |
> ++----------------+-----------------+-----------------+---------------------------------+
> +| ARM            | Cortex-A53      | #826319         | ARM64_ERRATUM_826319            |
> +| ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319            |
> +| ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069            |
> +| ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472            |
> +| ARM            | Cortex-A53      | #845719         | ARM64_ERRATUM_845719            |
> +| ARM            | Cortex-A53      | #843419         | ARM64_ERRATUM_843419            |
> +| ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075            |
> +| ARM            | Cortex-A57      | #852523         | N/A                             |
> +| ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220            |
> +| ARM            | Cortex-A72      | #853709         | N/A                             |
> +| ARM            | MMU-500         | #841119,#826419 | N/A                             |
> +|                |                 |                 |                                 |
> +| Cavium         | ThunderX ITS    | #22375, #24313  | CAVIUM_ERRATUM_22375            |
> +| Cavium         | ThunderX ITS    | #23144          | CAVIUM_ERRATUM_23144            |
> +| Cavium         | ThunderX GICv3  | #23154          | CAVIUM_ERRATUM_23154            |
> +| Cavium         | ThunderX Core   | #27456          | CAVIUM_ERRATUM_27456            |
> +| Cavium         | ThunderX SMMUv2 | #27704          | N/A                             |
> +|                |                 |                 |                                 |
> +| Freescale/NXP  | LS2080A/LS1043A | A-008585        | FSL_ERRATUM_A008585             |
> +| Hisilicon      | Hip0{5,6,7}     | #161010101      | HISILICON_ERRATUM_161010101     |
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index 6693e07..b30f44f 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -327,7 +327,7 @@ config ARM_ARCH_TIMER_EVTSTREAM
>  
>  config ARM_ARCH_TIMER_OOL_WORKAROUND
>  	bool
> -	depends on FSL_ERRATUM_A008585
> +	depends on FSL_ERRATUM_A008585 || HISILICON_ERRATUM_161010101

Same comment as the previous patch, this dependency is pointless.

Isn't possible to rely on the __init data mechanism, instead of polluting the
Kconfig with more options ?

>  	help
>  	  This option would only be enabled by Freescale/NXP Erratum A-008585
>  	  or something else chip has similar erratum.
> @@ -343,6 +343,16 @@ config FSL_ERRATUM_A008585
>  	  value").  The workaround will only be active if the
>  	  fsl,erratum-a008585 property is found in the timer node.
>  
> +config HISILICON_ERRATUM_161010101
> +	bool "Workaround for Hisilicon Erratum 161010101"
> +	default y
> +	select ARM_ARCH_TIMER_OOL_WORKAROUND
> +	depends on ARM_ARCH_TIMER && ARM64
> +	help
> +	  This option enables a workaround for Hisilicon Erratum
> +	  161010101. The workaround will be active if the hisilicon,erratum-161010101
> +	  property is found in the timer node.
>  config ARM_GLOBAL_TIMER
>  	bool "Support for the ARM global timer" if COMPILE_TEST
>  	select CLKSRC_OF if OF
> diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
> index 2487c66..7451b62 100644
> --- a/drivers/clocksource/arm_arch_timer.c
> +++ b/drivers/clocksource/arm_arch_timer.c
> @@ -131,6 +131,47 @@ static u64 notrace fsl_a008585_read_cntvct_el0(void)
>  }
>  #endif
>  
> +#ifdef CONFIG_HISILICON_ERRATUM_161010101
> +/*
> + * Verify whether the value of the second read is larger than the first by
> + * less than 32 is the only way to confirm the value is correct, so clear the
> + * lower 5 bits to check whether the difference is greater than 32 or not.
> + * Theoretically the erratum should not occur more than twice in succession
> + * when reading the system counter, but it is possible that some interrupts
> + * may lead to more than twice read errors, triggering the warning, so setting
> + * the number of retries far beyond the number of iterations the loop has been
> + * observed to take.
> + */
> +#define __hisi_161010101_read_reg(reg) ({				\
> +	u64 _old, _new;						\
> +	int _retries = 50;					\
> +								\
> +	do {							\
> +		_old = read_sysreg(reg);			\
> +		_new = read_sysreg(reg);			\
> +		_retries--;					\
> +	} while (unlikely((_new - _old) >> 5) && _retries);	\
> +								\
> +	WARN_ON_ONCE(!_retries);				\
> +	_new;							\
> +})
> +
> +static u32 notrace hisi_161010101_read_cntp_tval_el0(void)
> +{
> +	return __hisi_161010101_read_reg(cntp_tval_el0);
> +}
> +
> +static u32 notrace hisi_161010101_read_cntv_tval_el0(void)
> +{
> +	return __hisi_161010101_read_reg(cntv_tval_el0);
> +}
> +
> +static u64 notrace hisi_161010101_read_cntvct_el0(void)
> +{
> +	return __hisi_161010101_read_reg(cntvct_el0);
> +}
> +#endif
> +
>  #ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
>  const struct arch_timer_erratum_workaround *timer_unstable_counter_workaround = NULL;
>  EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
> @@ -147,6 +188,14 @@ static u64 notrace fsl_a008585_read_cntvct_el0(void)
>  		.read_cntvct_el0 = fsl_a008585_read_cntvct_el0,
>  	},
>  #endif
> +#ifdef CONFIG_HISILICON_ERRATUM_161010101
> +	{
> +		.id = "hisilicon,erratum-161010101",
> +		.read_cntp_tval_el0 = hisi_161010101_read_cntp_tval_el0,
> +		.read_cntv_tval_el0 = hisi_161010101_read_cntv_tval_el0,
> +		.read_cntvct_el0 = hisi_161010101_read_cntvct_el0,
> +	},
> +#endif
>  };
>  #endif /* CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND */
>  
> -- 
> 1.9.0
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 

 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 3/4] arm64: arch_timer: Work around Erratum Hisilicon-161010101
@ 2017-01-30 23:17     ` Daniel Lezcano
  0 siblings, 0 replies; 44+ messages in thread
From: Daniel Lezcano @ 2017-01-30 23:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 19, 2017 at 09:35:15PM +0800, Ding Tianhong wrote:
> Erratum Hisilicon-161010101 says that the ARM generic timer counter "has the
> potential to contain an erroneous value when the timer value changes".
> Accesses to TVAL (both read and write) are also affected due to the implicit counter
> read.  Accesses to CVAL are not affected.
> 
> The workaround is to reread the system count registers until the value of the second
> read is larger than the first one by less than 32, the system counter can be guaranteed
> not to return wrong value twice by back-to-back read and the error value is always larger
> than the correct one by 32. Writes to TVAL are replaced with an equivalent write to CVAL.
> 
> The hisilicon erratum CONFIG name is too long, breaking the line format in silicon-errata.txt,
> so extended the character spacing to fit all the erratum config.

Line length.

> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
>  Documentation/arm64/silicon-errata.txt | 43 ++++++++++++++---------------
>  drivers/clocksource/Kconfig            | 12 ++++++++-
>  drivers/clocksource/arm_arch_timer.c   | 49 ++++++++++++++++++++++++++++++++++
>  3 files changed, 82 insertions(+), 22 deletions(-)
> 
> diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
> index 405da11..0aaae35 100644
> --- a/Documentation/arm64/silicon-errata.txt
> +++ b/Documentation/arm64/silicon-errata.txt
> @@ -42,24 +42,25 @@ file acts as a registry of software workarounds in the Linux Kernel and
>  will be updated when new workarounds are committed and backported to
>  stable kernels.
>  
> -| Implementor    | Component       | Erratum ID      | Kconfig                 |
> -+----------------+-----------------+-----------------+-------------------------+
> -| ARM            | Cortex-A53      | #826319         | ARM64_ERRATUM_826319    |
> -| ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319    |
> -| ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069    |
> -| ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472    |
> -| ARM            | Cortex-A53      | #845719         | ARM64_ERRATUM_845719    |
> -| ARM            | Cortex-A53      | #843419         | ARM64_ERRATUM_843419    |
> -| ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075    |
> -| ARM            | Cortex-A57      | #852523         | N/A                     |
> -| ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220    |
> -| ARM            | Cortex-A72      | #853709         | N/A                     |
> -| ARM            | MMU-500         | #841119,#826419 | N/A                     |
> -|                |                 |                 |                         |
> -| Cavium         | ThunderX ITS    | #22375, #24313  | CAVIUM_ERRATUM_22375    |
> -| Cavium         | ThunderX ITS    | #23144          | CAVIUM_ERRATUM_23144    |
> -| Cavium         | ThunderX GICv3  | #23154          | CAVIUM_ERRATUM_23154    |
> -| Cavium         | ThunderX Core   | #27456          | CAVIUM_ERRATUM_27456    |
> -| Cavium         | ThunderX SMMUv2 | #27704          | N/A		       |
> -|                |                 |                 |                         |
> -| Freescale/NXP  | LS2080A/LS1043A | A-008585        | FSL_ERRATUM_A008585     |
> +| Implementor    | Component       | Erratum ID      | Kconfig                         |
> ++----------------+-----------------+-----------------+---------------------------------+
> +| ARM            | Cortex-A53      | #826319         | ARM64_ERRATUM_826319            |
> +| ARM            | Cortex-A53      | #827319         | ARM64_ERRATUM_827319            |
> +| ARM            | Cortex-A53      | #824069         | ARM64_ERRATUM_824069            |
> +| ARM            | Cortex-A53      | #819472         | ARM64_ERRATUM_819472            |
> +| ARM            | Cortex-A53      | #845719         | ARM64_ERRATUM_845719            |
> +| ARM            | Cortex-A53      | #843419         | ARM64_ERRATUM_843419            |
> +| ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075            |
> +| ARM            | Cortex-A57      | #852523         | N/A                             |
> +| ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220            |
> +| ARM            | Cortex-A72      | #853709         | N/A                             |
> +| ARM            | MMU-500         | #841119,#826419 | N/A                             |
> +|                |                 |                 |                                 |
> +| Cavium         | ThunderX ITS    | #22375, #24313  | CAVIUM_ERRATUM_22375            |
> +| Cavium         | ThunderX ITS    | #23144          | CAVIUM_ERRATUM_23144            |
> +| Cavium         | ThunderX GICv3  | #23154          | CAVIUM_ERRATUM_23154            |
> +| Cavium         | ThunderX Core   | #27456          | CAVIUM_ERRATUM_27456            |
> +| Cavium         | ThunderX SMMUv2 | #27704          | N/A                             |
> +|                |                 |                 |                                 |
> +| Freescale/NXP  | LS2080A/LS1043A | A-008585        | FSL_ERRATUM_A008585             |
> +| Hisilicon      | Hip0{5,6,7}     | #161010101      | HISILICON_ERRATUM_161010101     |
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index 6693e07..b30f44f 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -327,7 +327,7 @@ config ARM_ARCH_TIMER_EVTSTREAM
>  
>  config ARM_ARCH_TIMER_OOL_WORKAROUND
>  	bool
> -	depends on FSL_ERRATUM_A008585
> +	depends on FSL_ERRATUM_A008585 || HISILICON_ERRATUM_161010101

Same comment as the previous patch, this dependency is pointless.

Isn't possible to rely on the __init data mechanism, instead of polluting the
Kconfig with more options ?

>  	help
>  	  This option would only be enabled by Freescale/NXP Erratum A-008585
>  	  or something else chip has similar erratum.
> @@ -343,6 +343,16 @@ config FSL_ERRATUM_A008585
>  	  value").  The workaround will only be active if the
>  	  fsl,erratum-a008585 property is found in the timer node.
>  
> +config HISILICON_ERRATUM_161010101
> +	bool "Workaround for Hisilicon Erratum 161010101"
> +	default y
> +	select ARM_ARCH_TIMER_OOL_WORKAROUND
> +	depends on ARM_ARCH_TIMER && ARM64
> +	help
> +	  This option enables a workaround for Hisilicon Erratum
> +	  161010101. The workaround will be active if the hisilicon,erratum-161010101
> +	  property is found in the timer node.
>  config ARM_GLOBAL_TIMER
>  	bool "Support for the ARM global timer" if COMPILE_TEST
>  	select CLKSRC_OF if OF
> diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
> index 2487c66..7451b62 100644
> --- a/drivers/clocksource/arm_arch_timer.c
> +++ b/drivers/clocksource/arm_arch_timer.c
> @@ -131,6 +131,47 @@ static u64 notrace fsl_a008585_read_cntvct_el0(void)
>  }
>  #endif
>  
> +#ifdef CONFIG_HISILICON_ERRATUM_161010101
> +/*
> + * Verify whether the value of the second read is larger than the first by
> + * less than 32 is the only way to confirm the value is correct, so clear the
> + * lower 5 bits to check whether the difference is greater than 32 or not.
> + * Theoretically the erratum should not occur more than twice in succession
> + * when reading the system counter, but it is possible that some interrupts
> + * may lead to more than twice read errors, triggering the warning, so setting
> + * the number of retries far beyond the number of iterations the loop has been
> + * observed to take.
> + */
> +#define __hisi_161010101_read_reg(reg) ({				\
> +	u64 _old, _new;						\
> +	int _retries = 50;					\
> +								\
> +	do {							\
> +		_old = read_sysreg(reg);			\
> +		_new = read_sysreg(reg);			\
> +		_retries--;					\
> +	} while (unlikely((_new - _old) >> 5) && _retries);	\
> +								\
> +	WARN_ON_ONCE(!_retries);				\
> +	_new;							\
> +})
> +
> +static u32 notrace hisi_161010101_read_cntp_tval_el0(void)
> +{
> +	return __hisi_161010101_read_reg(cntp_tval_el0);
> +}
> +
> +static u32 notrace hisi_161010101_read_cntv_tval_el0(void)
> +{
> +	return __hisi_161010101_read_reg(cntv_tval_el0);
> +}
> +
> +static u64 notrace hisi_161010101_read_cntvct_el0(void)
> +{
> +	return __hisi_161010101_read_reg(cntvct_el0);
> +}
> +#endif
> +
>  #ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
>  const struct arch_timer_erratum_workaround *timer_unstable_counter_workaround = NULL;
>  EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
> @@ -147,6 +188,14 @@ static u64 notrace fsl_a008585_read_cntvct_el0(void)
>  		.read_cntvct_el0 = fsl_a008585_read_cntvct_el0,
>  	},
>  #endif
> +#ifdef CONFIG_HISILICON_ERRATUM_161010101
> +	{
> +		.id = "hisilicon,erratum-161010101",
> +		.read_cntp_tval_el0 = hisi_161010101_read_cntp_tval_el0,
> +		.read_cntv_tval_el0 = hisi_161010101_read_cntv_tval_el0,
> +		.read_cntvct_el0 = hisi_161010101_read_cntvct_el0,
> +	},
> +#endif
>  };
>  #endif /* CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND */
>  
> -- 
> 1.9.0
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 

 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
  2017-01-30 21:54               ` Daniel Lezcano
@ 2017-01-31 12:14                 ` Mark Rutland
  -1 siblings, 0 replies; 44+ messages in thread
From: Mark Rutland @ 2017-01-31 12:14 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: devicetree, Marc Zyngier, catalin.marinas, will.deacon,
	stuart.yoder, linuxarm, oss, Ding Tianhong, shawnguo,
	linux-arm-kernel

On Mon, Jan 30, 2017 at 10:54:30PM +0100, Daniel Lezcano wrote:
> On Mon, Jan 30, 2017 at 03:52:09PM +0000, Mark Rutland wrote:
> > Hi Daniel,
> > 
> > On Tue, Jan 24, 2017 at 05:35:51PM +0100, Daniel Lezcano wrote:
 
> It is up to me to ensure the clockevent/clocksource drivers in general are
> following the right direction. And this driver looks more and more opaque. I
> will spend some times to do a review of the driver as soon as I have time.

FWIW, I'd locally fixed up the patches in the branch I previously
mentioned, so many issues in this series no longer exist.

I will post the cleaned up series momentarily. Hopefully that should be
less painful to review.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v9 0/4] arm64: arch_timer: Add workaround for hisilicon-161010101 erratum
@ 2017-01-31 12:14                 ` Mark Rutland
  0 siblings, 0 replies; 44+ messages in thread
From: Mark Rutland @ 2017-01-31 12:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 30, 2017 at 10:54:30PM +0100, Daniel Lezcano wrote:
> On Mon, Jan 30, 2017 at 03:52:09PM +0000, Mark Rutland wrote:
> > Hi Daniel,
> > 
> > On Tue, Jan 24, 2017 at 05:35:51PM +0100, Daniel Lezcano wrote:
 
> It is up to me to ensure the clockevent/clocksource drivers in general are
> following the right direction. And this driver looks more and more opaque. I
> will spend some times to do a review of the driver as soon as I have time.

FWIW, I'd locally fixed up the patches in the branch I previously
mentioned, so many issues in this series no longer exist.

I will post the cleaned up series momentarily. Hopefully that should be
less painful to review.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2017-01-31 12:14 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 2/4] arm64: arch_timer: Introduce a generic erratum handing mechanism for fsl-a008585 Ding Tianhong
2017-01-19 13:35   ` Ding Tianhong
     [not found]   ` <1484832916-7248-3-git-send-email-dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-01-30 21:59     ` Daniel Lezcano
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
     [not found] ` <1484832916-7248-1-git-send-email-dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-01-19 13:35   ` [PATCH v9 1/4] arm64: arch_timer: Add device tree binding for hisilicon-161010101 erratum Ding Tianhong
2017-01-19 13:35     ` Ding Tianhong
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
     [not found]       ` <8818973b-602b-e71f-a12b-3e894aa0e619-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
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
     [not found]       ` <56554f95-b51d-abc7-8ac0-7f561728375a-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
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
     [not found]   ` <765699aa-cbc6-67eb-9108-cbf335338e4c-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-01-24 15:27     ` Marc Zyngier
2017-01-24 15:27       ` Marc Zyngier
     [not found]       ` <35cf654f-3944-fc76-5120-25e33f71be4f-5wv7dgnIgG8@public.gmane.org>
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

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.