aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/arm/setup.c
diff options
context:
space:
mode:
authorTim Deegan <tim@xen.org>2012-11-23 11:06:14 +0000
committerTim Deegan <tim@xen.org>2012-11-23 11:06:14 +0000
commitb1f2c77ffda88e16665078e3cf5b8fd20647d1e5 (patch)
tree382e15698180d0310afc174d91f912e27f2329eb /xen/arch/arm/setup.c
parent18cd92eed4d68421ecaf55469b1d00b641582d0d (diff)
downloadxen-b1f2c77ffda88e16665078e3cf5b8fd20647d1e5.tar.gz
xen-b1f2c77ffda88e16665078e3cf5b8fd20647d1e5.tar.bz2
xen-b1f2c77ffda88e16665078e3cf5b8fd20647d1e5.zip
arm: Tidy up flush_xen_dcache().
- Use a compile-time-constant check for whether we can safely flush just one cacheline. This reduces the common case from 28 instructions to three. - Pass an object to the macro, not a pointer, so we can detect attempts to flush arrays. - Decode CCSIDR correctly to get cacheline size. - Remove some redundant DSBs at the call sites. Signed-off-by: Tim Deegan <tim@xen.org> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'xen/arch/arm/setup.c')
-rw-r--r--xen/arch/arm/setup.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index c52330ee84..20767246a5 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -175,6 +175,21 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
end_boot_allocator();
}
+size_t __read_mostly cacheline_bytes;
+
+/* Very early check of the CPU cache properties */
+void __init setup_cache(void)
+{
+ uint32_t ccsid;
+
+ /* Read the cache size ID register for the level-0 data cache */
+ WRITE_CP32(0, CSSELR);
+ ccsid = READ_CP32(CCSIDR);
+
+ /* Low 3 bits are log2(cacheline size in words) - 2. */
+ cacheline_bytes = 1U << (4 + (ccsid & 0x7));
+}
+
/* C entry point for boot CPU */
void __init start_xen(unsigned long boot_phys_offset,
unsigned long arm_type,
@@ -185,6 +200,8 @@ void __init start_xen(unsigned long boot_phys_offset,
size_t fdt_size;
int cpus, i;
+ setup_cache();
+
smp_clear_cpu_maps();
fdt = (void *)BOOT_MISC_VIRT_START