aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Kenna <cjk@cs.unc.edu>2012-10-05 14:24:18 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2012-10-05 20:49:52 -0400
commitb3b54764b5baa9bac7642bc559a42f1ee8bb656a (patch)
treea9586bc7df4ab36e172dc7a2f840e303eaf0a678
parentb1f5890e0aa8f0eb4ad9772ca50c1320a8af0a9c (diff)
Coloring on the ARM.
-rw-r--r--arch/arm/mm/cache-l2x0.c7
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c4
-rw-r--r--litmus/color.c25
-rw-r--r--litmus/color_dev.c2
4 files changed, 23 insertions, 15 deletions
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 44c086710d2b..83a9c076931b 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -23,6 +23,8 @@
23#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
24#include <asm/hardware/cache-l2x0.h> 24#include <asm/hardware/cache-l2x0.h>
25 25
26#include <litmus/color.h>
27
26#define CACHE_LINE_SIZE 32 28#define CACHE_LINE_SIZE 32
27 29
28static void __iomem *l2x0_base; 30static void __iomem *l2x0_base;
@@ -347,6 +349,11 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
347 outer_cache.disable = l2x0_disable; 349 outer_cache.disable = l2x0_disable;
348 outer_cache.set_debug = l2x0_set_debug; 350 outer_cache.set_debug = l2x0_set_debug;
349 351
352 color_cache_info.size = l2x0_size;
353 color_cache_info.line_size = CACHE_LINE_SIZE;
354 color_cache_info.ways = l2x0_ways;
355 color_cache_info.sets = l2x0_sets;
356
350 printk(KERN_INFO "%s cache controller enabled\n", type); 357 printk(KERN_INFO "%s cache controller enabled\n", type);
351 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", 358 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
352 ways, cache_id, aux, l2x0_size); 359 ways, cache_id, aux, l2x0_size);
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 95d5636720a6..76c5cc821632 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -20,6 +20,8 @@
20#include <asm/amd_nb.h> 20#include <asm/amd_nb.h>
21#include <asm/smp.h> 21#include <asm/smp.h>
22 22
23#include <litmus/color.h>
24
23#define LVL_1_INST 1 25#define LVL_1_INST 1
24#define LVL_1_DATA 2 26#define LVL_1_DATA 2
25#define LVL_2 3 27#define LVL_2 3
@@ -1215,8 +1217,6 @@ static struct notifier_block __cpuinitdata cacheinfo_cpu_notifier = {
1215 .notifier_call = cacheinfo_cpu_callback, 1217 .notifier_call = cacheinfo_cpu_callback,
1216}; 1218};
1217 1219
1218#include <litmus/color.h>
1219
1220static void set_color_vars(void) 1220static void set_color_vars(void)
1221{ 1221{
1222 struct _cpuid4_info *leaf = CPUID4_INFO_IDX( 1222 struct _cpuid4_info *leaf = CPUID4_INFO_IDX(
diff --git a/litmus/color.c b/litmus/color.c
index a68c30c0edb0..19767f41ee87 100644
--- a/litmus/color.c
+++ b/litmus/color.c
@@ -117,7 +117,7 @@ static int do_add_pages(void)
117#if defined(CONFIG_X86) 117#if defined(CONFIG_X86)
118 page = alloc_page(GFP_HIGHUSER | __GFP_ZERO | 118 page = alloc_page(GFP_HIGHUSER | __GFP_ZERO |
119 __GFP_MOVABLE); 119 __GFP_MOVABLE);
120#elif defined(CONFIG_SPARC) /* X86 */ 120#elif defined(CONFIG_SPARC) || defined(CONFIG_ARM)
121 page = alloc_page(GFP_HIGHUSER | __GFP_MOVABLE); 121 page = alloc_page(GFP_HIGHUSER | __GFP_MOVABLE);
122#else 122#else
123#error What architecture are you using? 123#error What architecture are you using?
@@ -253,7 +253,7 @@ out:
253 * Initialization 253 * Initialization
254***********************************************************/ 254***********************************************************/
255 255
256#if defined(CONFIG_X86) 256#if defined(CONFIG_X86) || defined(CONFIG_ARM)
257/* slowest possible way to find a log, but we only do this once on boot */ 257/* slowest possible way to find a log, but we only do this once on boot */
258static unsigned int __init slow_log(unsigned int v) 258static unsigned int __init slow_log(unsigned int v)
259{ 259{
@@ -268,10 +268,11 @@ static int __init init_mask(void)
268 unsigned int line_size_log = slow_log(color_cache_info.line_size); 268 unsigned int line_size_log = slow_log(color_cache_info.line_size);
269 int err = 0; 269 int err = 0;
270 270
271 BUG_ON(color_cache_info.size <= 1048576 || 271 WARN(color_cache_info.size < 1048576 ||
272 color_cache_info.ways < 15 || 272 color_cache_info.ways < 15 ||
273 color_cache_info.line_size != 64); 273 (color_cache_info.line_size != 64 &&
274 274 color_cache_info.line_size != 32),
275 "Potentially bad cache size, ways, or line size.\n");
275 printk("Cache size: %lu line-size: %lu ways: %lu sets: %lu\n", 276 printk("Cache size: %lu line-size: %lu ways: %lu sets: %lu\n",
276 color_cache_info.size, color_cache_info.line_size, 277 color_cache_info.size, color_cache_info.line_size,
277 color_cache_info.ways, color_cache_info.sets); 278 color_cache_info.ways, color_cache_info.sets);
@@ -282,16 +283,19 @@ static int __init init_mask(void)
282 } 283 }
283 284
284 285
285 BUG_ON(color_cache_info.size / color_cache_info.line_size / 286 WARN(color_cache_info.size / color_cache_info.line_size /
286 color_cache_info.ways != color_cache_info.sets); 287 color_cache_info.ways != color_cache_info.sets,
287 BUG_ON(PAGE_SIZE >= (color_cache_info.sets << line_size_log)); 288 "Cache size and set information do not agree.\n");
289 WARN(PAGE_SIZE >= (color_cache_info.sets << line_size_log),
290 "Cache set bits contained entirely within page bits.\n");
288 color_mask = ((color_cache_info.sets << line_size_log) - 1) ^ 291 color_mask = ((color_cache_info.sets << line_size_log) - 1) ^
289 (PAGE_SIZE - 1); 292 (PAGE_SIZE - 1);
290 color_cache_info.nr_colors = (color_mask >> PAGE_SHIFT) + 1; 293 color_cache_info.nr_colors = (color_mask >> PAGE_SHIFT) + 1;
294
291out: 295out:
292 return err; 296 return err;
293} 297}
294#elif defined(CONFIG_SPARC) /* X86 */ 298#elif defined(CONFIG_SPARC)
295static int __init init_mask(void) 299static int __init init_mask(void)
296{ 300{
297 /* 301 /*
@@ -307,8 +311,7 @@ static int __init init_mask(void)
307 color_cache_info.nr_colors = (1 << hweight_long(color_mask)); 311 color_cache_info.nr_colors = (1 << hweight_long(color_mask));
308 return 0; 312 return 0;
309} 313}
310#endif /* SPARC/X86 */ 314#endif
311
312 315
313 316
314static int __init init_color_groups(void) 317static int __init init_color_groups(void)
diff --git a/litmus/color_dev.c b/litmus/color_dev.c
index 677905a2a6b1..32ff0cb190f9 100644
--- a/litmus/color_dev.c
+++ b/litmus/color_dev.c
@@ -176,9 +176,7 @@ static int do_map_colored_page_set(struct vm_area_struct *vma,
176 goto out; 176 goto out;
177 } 177 }
178 178
179#ifdef CONFIG_SPARC
180 clear_user_highpage(page, addr); 179 clear_user_highpage(page, addr);
181#endif
182 180
183 TRACE_CUR("insert page (pa:0x%10llx, pfn:%8lu, color:%3lu) " 181 TRACE_CUR("insert page (pa:0x%10llx, pfn:%8lu, color:%3lu) "
184 "at 0x%lx vma:(flags:%16lx prot:%16lx)\n", 182 "at 0x%lx vma:(flags:%16lx prot:%16lx)\n",