fix a kmap leak in virtio_console
[linux/fpc-iii.git] / arch / mn10300 / mm / cache-smp-inv.c
blobff1787358c8e6d3c6d65ae40bbc275e2fce35e94
1 /* Functions for global i/dcache invalidation when caching in SMP
3 * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
11 #include <linux/mm.h>
12 #include <asm/cacheflush.h>
13 #include "cache-smp.h"
15 /**
16 * mn10300_icache_inv - Globally invalidate instruction cache
18 * Invalidate the instruction cache on all CPUs.
20 void mn10300_icache_inv(void)
22 unsigned long flags;
24 flags = smp_lock_cache();
25 mn10300_local_icache_inv();
26 smp_cache_call(SMP_ICACHE_INV, 0, 0);
27 smp_unlock_cache(flags);
30 /**
31 * mn10300_icache_inv_page - Globally invalidate a page of instruction cache
32 * @start: The address of the page of memory to be invalidated.
34 * Invalidate a range of addresses in the instruction cache on all CPUs
35 * covering the page that includes the given address.
37 void mn10300_icache_inv_page(unsigned long start)
39 unsigned long flags;
41 start &= ~(PAGE_SIZE-1);
43 flags = smp_lock_cache();
44 mn10300_local_icache_inv_page(start);
45 smp_cache_call(SMP_ICACHE_INV_RANGE, start, start + PAGE_SIZE);
46 smp_unlock_cache(flags);
49 /**
50 * mn10300_icache_inv_range - Globally invalidate range of instruction cache
51 * @start: The start address of the region to be invalidated.
52 * @end: The end address of the region to be invalidated.
54 * Invalidate a range of addresses in the instruction cache on all CPUs,
55 * between start and end-1 inclusive.
57 void mn10300_icache_inv_range(unsigned long start, unsigned long end)
59 unsigned long flags;
61 flags = smp_lock_cache();
62 mn10300_local_icache_inv_range(start, end);
63 smp_cache_call(SMP_ICACHE_INV_RANGE, start, end);
64 smp_unlock_cache(flags);
67 /**
68 * mn10300_icache_inv_range2 - Globally invalidate range of instruction cache
69 * @start: The start address of the region to be invalidated.
70 * @size: The size of the region to be invalidated.
72 * Invalidate a range of addresses in the instruction cache on all CPUs,
73 * between start and start+size-1 inclusive.
75 void mn10300_icache_inv_range2(unsigned long start, unsigned long size)
77 unsigned long flags;
79 flags = smp_lock_cache();
80 mn10300_local_icache_inv_range2(start, size);
81 smp_cache_call(SMP_ICACHE_INV_RANGE, start, start + size);
82 smp_unlock_cache(flags);
85 /**
86 * mn10300_dcache_inv - Globally invalidate data cache
88 * Invalidate the data cache on all CPUs.
90 void mn10300_dcache_inv(void)
92 unsigned long flags;
94 flags = smp_lock_cache();
95 mn10300_local_dcache_inv();
96 smp_cache_call(SMP_DCACHE_INV, 0, 0);
97 smp_unlock_cache(flags);
101 * mn10300_dcache_inv_page - Globally invalidate a page of data cache
102 * @start: The address of the page of memory to be invalidated.
104 * Invalidate a range of addresses in the data cache on all CPUs covering the
105 * page that includes the given address.
107 void mn10300_dcache_inv_page(unsigned long start)
109 unsigned long flags;
111 start &= ~(PAGE_SIZE-1);
113 flags = smp_lock_cache();
114 mn10300_local_dcache_inv_page(start);
115 smp_cache_call(SMP_DCACHE_INV_RANGE, start, start + PAGE_SIZE);
116 smp_unlock_cache(flags);
120 * mn10300_dcache_inv_range - Globally invalidate range of data cache
121 * @start: The start address of the region to be invalidated.
122 * @end: The end address of the region to be invalidated.
124 * Invalidate a range of addresses in the data cache on all CPUs, between start
125 * and end-1 inclusive.
127 void mn10300_dcache_inv_range(unsigned long start, unsigned long end)
129 unsigned long flags;
131 flags = smp_lock_cache();
132 mn10300_local_dcache_inv_range(start, end);
133 smp_cache_call(SMP_DCACHE_INV_RANGE, start, end);
134 smp_unlock_cache(flags);
138 * mn10300_dcache_inv_range2 - Globally invalidate range of data cache
139 * @start: The start address of the region to be invalidated.
140 * @size: The size of the region to be invalidated.
142 * Invalidate a range of addresses in the data cache on all CPUs, between start
143 * and start+size-1 inclusive.
145 void mn10300_dcache_inv_range2(unsigned long start, unsigned long size)
147 unsigned long flags;
149 flags = smp_lock_cache();
150 mn10300_local_dcache_inv_range2(start, size);
151 smp_cache_call(SMP_DCACHE_INV_RANGE, start, start + size);
152 smp_unlock_cache(flags);