* [PATCH 1/2] ARM: add diagnostic register access helpers
@ 2013-04-16 14:30 Shawn Guo
2013-04-16 14:30 ` [PATCH 2/2] ARM: imx: replicate the diagnostic register of boot cpu into secondary cores Shawn Guo
2013-04-16 14:48 ` [PATCH 1/2] ARM: add diagnostic register access helpers Will Deacon
0 siblings, 2 replies; 4+ messages in thread
From: Shawn Guo @ 2013-04-16 14:30 UTC (permalink / raw)
To: linux-arm-kernel
The CP15 diagnostic register holds many ARM errata bits. Add a pair of
access helpers for it.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/include/asm/cp15.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/arm/include/asm/cp15.h b/arch/arm/include/asm/cp15.h
index 5ef4d80..0b14dfb 100644
--- a/arch/arm/include/asm/cp15.h
+++ b/arch/arm/include/asm/cp15.h
@@ -82,6 +82,19 @@ static inline void set_copro_access(unsigned int val)
isb();
}
+static inline unsigned int get_diag_reg(void)
+{
+ unsigned int val;
+ asm("mrc p15, 0, %0, c15, c0, 1" : "=r" (val) : : "cc");
+ return val;
+}
+
+static inline void set_diag_reg(unsigned int val)
+{
+ asm volatile("mcr p15, 0, %0, c15, c0, 1" : : "r" (val) : "cc");
+ isb();
+}
+
#endif
#endif
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ARM: imx: replicate the diagnostic register of boot cpu into secondary cores
2013-04-16 14:30 [PATCH 1/2] ARM: add diagnostic register access helpers Shawn Guo
@ 2013-04-16 14:30 ` Shawn Guo
2013-04-16 14:48 ` [PATCH 1/2] ARM: add diagnostic register access helpers Will Deacon
1 sibling, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2013-04-16 14:30 UTC (permalink / raw)
To: linux-arm-kernel
The diagnostic register holds the errata bits. Mostly bootloader
does not bring up secondary cores, so that when errata bits are set
in bootloader, they are set only for boot cpu. But on a SMP
configuration, it should be equally done on every single core.
Set up the diagnostic register for secondary cores by replicating
the register from boot cpu.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/mach-imx/platsmp.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index 7c0b03f..93854f9 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -13,6 +13,7 @@
#include <linux/init.h>
#include <linux/smp.h>
#include <linux/irqchip/arm-gic.h>
+#include <asm/cp15.h>
#include <asm/page.h>
#include <asm/smp_scu.h>
#include <asm/mach/map.h>
@@ -23,6 +24,7 @@
#define SCU_STANDBY_ENABLE (1 << 5)
static void __iomem *scu_base;
+static u32 diag_reg;
static struct map_desc scu_io_desc __initdata = {
/* .virtual and .pfn are run-time assigned */
@@ -60,6 +62,9 @@ static void __cpuinit imx_secondary_init(unsigned int cpu)
* for us: do so
*/
gic_secondary_init(0);
+
+ /* Replicate the diagnostic register of boot cpu */
+ set_diag_reg(diag_reg);
}
static int __cpuinit imx_boot_secondary(unsigned int cpu, struct task_struct *idle)
@@ -91,6 +96,16 @@ void imx_smp_prepare(void)
static void __init imx_smp_prepare_cpus(unsigned int max_cpus)
{
imx_smp_prepare();
+
+ /*
+ * The diagnostic register holds the errata bits. Mostly bootloader
+ * does not bring up secondary cores, so that when errata bits are set
+ * in bootloader, they are set only for boot cpu. But on a SMP
+ * configuration, it should be equally done on every single core.
+ * Read the register from boot cpu here, and will replicate it into
+ * secondary cores when booting them.
+ */
+ diag_reg = get_diag_reg();
}
struct smp_operations imx_smp_ops __initdata = {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 1/2] ARM: add diagnostic register access helpers
2013-04-16 14:30 [PATCH 1/2] ARM: add diagnostic register access helpers Shawn Guo
2013-04-16 14:30 ` [PATCH 2/2] ARM: imx: replicate the diagnostic register of boot cpu into secondary cores Shawn Guo
@ 2013-04-16 14:48 ` Will Deacon
2013-04-16 15:11 ` Shawn Guo
1 sibling, 1 reply; 4+ messages in thread
From: Will Deacon @ 2013-04-16 14:48 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 16, 2013 at 03:30:42PM +0100, Shawn Guo wrote:
> The CP15 diagnostic register holds many ARM errata bits. Add a pair of
> access helpers for it.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
> arch/arm/include/asm/cp15.h | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/arch/arm/include/asm/cp15.h b/arch/arm/include/asm/cp15.h
> index 5ef4d80..0b14dfb 100644
> --- a/arch/arm/include/asm/cp15.h
> +++ b/arch/arm/include/asm/cp15.h
> @@ -82,6 +82,19 @@ static inline void set_copro_access(unsigned int val)
> isb();
> }
>
> +static inline unsigned int get_diag_reg(void)
> +{
> + unsigned int val;
> + asm("mrc p15, 0, %0, c15, c0, 1" : "=r" (val) : : "cc");
> + return val;
> +}
> +
> +static inline void set_diag_reg(unsigned int val)
> +{
> + asm volatile("mcr p15, 0, %0, c15, c0, 1" : : "r" (val) : "cc");
> + isb();
> +}
> +
You don't want to poke this register with the MMU on, so I don't think this
patch is a very good idea.
Will
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] ARM: add diagnostic register access helpers
2013-04-16 14:48 ` [PATCH 1/2] ARM: add diagnostic register access helpers Will Deacon
@ 2013-04-16 15:11 ` Shawn Guo
0 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2013-04-16 15:11 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 16, 2013 at 03:48:53PM +0100, Will Deacon wrote:
> > +static inline unsigned int get_diag_reg(void)
> > +{
> > + unsigned int val;
> > + asm("mrc p15, 0, %0, c15, c0, 1" : "=r" (val) : : "cc");
> > + return val;
> > +}
> > +
> > +static inline void set_diag_reg(unsigned int val)
> > +{
> > + asm volatile("mcr p15, 0, %0, c15, c0, 1" : : "r" (val) : "cc");
> > + isb();
> > +}
> > +
>
> You don't want to poke this register with the MMU on, so I don't think this
> patch is a very good idea.
If you are worrying about that the helpers could be abused by people, I
can certainly make them local in arch/arm/mach-imx/platsmp.c. But I do
not understand why diagnostic register shouldn't be accessed when MMU is
on. I'm doing that in patch #2 to get my problem fixed, and not seeing
anything broken there.
Shawn
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-16 15:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-16 14:30 [PATCH 1/2] ARM: add diagnostic register access helpers Shawn Guo
2013-04-16 14:30 ` [PATCH 2/2] ARM: imx: replicate the diagnostic register of boot cpu into secondary cores Shawn Guo
2013-04-16 14:48 ` [PATCH 1/2] ARM: add diagnostic register access helpers Will Deacon
2013-04-16 15:11 ` Shawn Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).