| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | *  linux/arch/arm/kernel/smp.c | 
|  | 3 | * | 
|  | 4 | *  Copyright (C) 2002 ARM Limited, All Rights Reserved. | 
|  | 5 | * | 
|  | 6 | * This program is free software; you can redistribute it and/or modify | 
|  | 7 | * it under the terms of the GNU General Public License version 2 as | 
|  | 8 | * published by the Free Software Foundation. | 
|  | 9 | */ | 
| Russell King | c97d486 | 2006-10-25 13:59:16 +0100 | [diff] [blame] | 10 | #include <linux/module.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <linux/delay.h> | 
|  | 12 | #include <linux/init.h> | 
|  | 13 | #include <linux/spinlock.h> | 
|  | 14 | #include <linux/sched.h> | 
|  | 15 | #include <linux/interrupt.h> | 
|  | 16 | #include <linux/cache.h> | 
|  | 17 | #include <linux/profile.h> | 
|  | 18 | #include <linux/errno.h> | 
|  | 19 | #include <linux/mm.h> | 
| Alexey Dobriyan | 4e950f6 | 2007-07-30 02:36:13 +0400 | [diff] [blame] | 20 | #include <linux/err.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #include <linux/cpu.h> | 
|  | 22 | #include <linux/smp.h> | 
|  | 23 | #include <linux/seq_file.h> | 
| Russell King | c97d486 | 2006-10-25 13:59:16 +0100 | [diff] [blame] | 24 | #include <linux/irq.h> | 
| Russell King | bc28248 | 2009-05-17 18:58:34 +0100 | [diff] [blame] | 25 | #include <linux/percpu.h> | 
|  | 26 | #include <linux/clockchips.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 |  | 
|  | 28 | #include <asm/atomic.h> | 
|  | 29 | #include <asm/cacheflush.h> | 
|  | 30 | #include <asm/cpu.h> | 
| Russell King | 42578c8 | 2009-06-11 15:35:00 +0100 | [diff] [blame] | 31 | #include <asm/cputype.h> | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 32 | #include <asm/mmu_context.h> | 
|  | 33 | #include <asm/pgtable.h> | 
|  | 34 | #include <asm/pgalloc.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | #include <asm/processor.h> | 
|  | 36 | #include <asm/tlbflush.h> | 
|  | 37 | #include <asm/ptrace.h> | 
| Russell King | bc28248 | 2009-05-17 18:58:34 +0100 | [diff] [blame] | 38 | #include <asm/localtimer.h> | 
| Russell King | e616c59 | 2009-09-27 20:55:43 +0100 | [diff] [blame] | 39 | #include <asm/smp_plat.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 |  | 
|  | 41 | /* | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 42 | * as from 2.5, kernels no longer have an init_tasks structure | 
|  | 43 | * so we need some other way of telling a new secondary core | 
|  | 44 | * where to place its SVC stack | 
|  | 45 | */ | 
|  | 46 | struct secondary_data secondary_data; | 
|  | 47 |  | 
|  | 48 | /* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | * structures for inter-processor calls | 
|  | 50 | * - A collection of single bit ipi messages. | 
|  | 51 | */ | 
|  | 52 | struct ipi_data { | 
|  | 53 | spinlock_t lock; | 
|  | 54 | unsigned long ipi_count; | 
|  | 55 | unsigned long bits; | 
|  | 56 | }; | 
|  | 57 |  | 
|  | 58 | static DEFINE_PER_CPU(struct ipi_data, ipi_data) = { | 
|  | 59 | .lock	= SPIN_LOCK_UNLOCKED, | 
|  | 60 | }; | 
|  | 61 |  | 
|  | 62 | enum ipi_msg_type { | 
|  | 63 | IPI_TIMER, | 
|  | 64 | IPI_RESCHEDULE, | 
|  | 65 | IPI_CALL_FUNC, | 
| Jens Axboe | f6dd9fa5 | 2008-06-10 20:48:30 +0200 | [diff] [blame] | 66 | IPI_CALL_FUNC_SINGLE, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | IPI_CPU_STOP, | 
|  | 68 | }; | 
|  | 69 |  | 
| Russell King | bd6f68a | 2005-07-17 21:35:41 +0100 | [diff] [blame] | 70 | int __cpuinit __cpu_up(unsigned int cpu) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | { | 
| Russell King | 71f512e | 2005-11-02 21:51:40 +0000 | [diff] [blame] | 72 | struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu); | 
|  | 73 | struct task_struct *idle = ci->idle; | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 74 | pgd_t *pgd; | 
|  | 75 | pmd_t *pmd; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | int ret; | 
|  | 77 |  | 
|  | 78 | /* | 
| Russell King | 71f512e | 2005-11-02 21:51:40 +0000 | [diff] [blame] | 79 | * Spawn a new process manually, if not already done. | 
|  | 80 | * Grab a pointer to its task struct so we can mess with it | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | */ | 
| Russell King | 71f512e | 2005-11-02 21:51:40 +0000 | [diff] [blame] | 82 | if (!idle) { | 
|  | 83 | idle = fork_idle(cpu); | 
|  | 84 | if (IS_ERR(idle)) { | 
|  | 85 | printk(KERN_ERR "CPU%u: fork() failed\n", cpu); | 
|  | 86 | return PTR_ERR(idle); | 
|  | 87 | } | 
|  | 88 | ci->idle = idle; | 
| Santosh Shilimkar | 13ea9cc | 2010-04-30 06:51:20 +0100 | [diff] [blame] | 89 | } else { | 
|  | 90 | /* | 
|  | 91 | * Since this idle thread is being re-used, call | 
|  | 92 | * init_idle() to reinitialize the thread structure. | 
|  | 93 | */ | 
|  | 94 | init_idle(idle, cpu); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | } | 
|  | 96 |  | 
|  | 97 | /* | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 98 | * Allocate initial page tables to allow the new CPU to | 
|  | 99 | * enable the MMU safely.  This essentially means a set | 
|  | 100 | * of our "standard" page tables, with the addition of | 
|  | 101 | * a 1:1 mapping for the physical address of the kernel. | 
|  | 102 | */ | 
|  | 103 | pgd = pgd_alloc(&init_mm); | 
| Russell King | 058ddee | 2008-08-07 22:36:59 +0100 | [diff] [blame] | 104 | pmd = pmd_offset(pgd + pgd_index(PHYS_OFFSET), PHYS_OFFSET); | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 105 | *pmd = __pmd((PHYS_OFFSET & PGDIR_MASK) | | 
|  | 106 | PMD_TYPE_SECT | PMD_SECT_AP_WRITE); | 
| Catalin Marinas | e9fc782 | 2009-02-11 13:14:57 +0100 | [diff] [blame] | 107 | flush_pmd_entry(pmd); | 
| Russell King | 1027247 | 2010-02-12 14:36:24 +0000 | [diff] [blame] | 108 | outer_clean_range(__pa(pmd), __pa(pmd + 1)); | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 109 |  | 
|  | 110 | /* | 
|  | 111 | * We need to tell the secondary core where to find | 
|  | 112 | * its stack and the page tables. | 
|  | 113 | */ | 
| Al Viro | 32d39a9 | 2006-01-12 01:05:58 -0800 | [diff] [blame] | 114 | secondary_data.stack = task_stack_page(idle) + THREAD_START_SP; | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 115 | secondary_data.pgdir = virt_to_phys(pgd); | 
| Russell King | 1027247 | 2010-02-12 14:36:24 +0000 | [diff] [blame] | 116 | __cpuc_flush_dcache_area(&secondary_data, sizeof(secondary_data)); | 
|  | 117 | outer_clean_range(__pa(&secondary_data), __pa(&secondary_data + 1)); | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 118 |  | 
|  | 119 | /* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | * Now bring the CPU into our world. | 
|  | 121 | */ | 
|  | 122 | ret = boot_secondary(cpu, idle); | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 123 | if (ret == 0) { | 
|  | 124 | unsigned long timeout; | 
|  | 125 |  | 
|  | 126 | /* | 
|  | 127 | * CPU was successfully started, wait for it | 
|  | 128 | * to come online or time out. | 
|  | 129 | */ | 
|  | 130 | timeout = jiffies + HZ; | 
|  | 131 | while (time_before(jiffies, timeout)) { | 
|  | 132 | if (cpu_online(cpu)) | 
|  | 133 | break; | 
|  | 134 |  | 
|  | 135 | udelay(10); | 
|  | 136 | barrier(); | 
|  | 137 | } | 
|  | 138 |  | 
|  | 139 | if (!cpu_online(cpu)) | 
|  | 140 | ret = -EIO; | 
|  | 141 | } | 
|  | 142 |  | 
| Russell King | 5d43045 | 2005-11-08 10:44:46 +0000 | [diff] [blame] | 143 | secondary_data.stack = NULL; | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 144 | secondary_data.pgdir = 0; | 
|  | 145 |  | 
| Russell King | 058ddee | 2008-08-07 22:36:59 +0100 | [diff] [blame] | 146 | *pmd = __pmd(0); | 
| Catalin Marinas | e9fc782 | 2009-02-11 13:14:57 +0100 | [diff] [blame] | 147 | clean_pmd_entry(pmd); | 
| Benjamin Herrenschmidt | 5e54197 | 2008-02-04 22:29:14 -0800 | [diff] [blame] | 148 | pgd_free(&init_mm, pgd); | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 149 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | if (ret) { | 
| Russell King | 0908db2 | 2005-06-19 19:48:16 +0100 | [diff] [blame] | 151 | printk(KERN_CRIT "CPU%u: processor failed to boot\n", cpu); | 
|  | 152 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | /* | 
|  | 154 | * FIXME: We need to clean up the new idle thread. --rmk | 
|  | 155 | */ | 
|  | 156 | } | 
|  | 157 |  | 
|  | 158 | return ret; | 
|  | 159 | } | 
|  | 160 |  | 
| Russell King | a054a81 | 2005-11-02 22:24:33 +0000 | [diff] [blame] | 161 | #ifdef CONFIG_HOTPLUG_CPU | 
|  | 162 | /* | 
|  | 163 | * __cpu_disable runs on the processor to be shutdown. | 
|  | 164 | */ | 
| Russell King | 90140c3 | 2009-09-27 21:04:48 +0100 | [diff] [blame] | 165 | int __cpu_disable(void) | 
| Russell King | a054a81 | 2005-11-02 22:24:33 +0000 | [diff] [blame] | 166 | { | 
|  | 167 | unsigned int cpu = smp_processor_id(); | 
|  | 168 | struct task_struct *p; | 
|  | 169 | int ret; | 
|  | 170 |  | 
| Russell King | 8e2a43f | 2010-05-15 10:18:05 +0100 | [diff] [blame] | 171 | ret = platform_cpu_disable(cpu); | 
| Russell King | a054a81 | 2005-11-02 22:24:33 +0000 | [diff] [blame] | 172 | if (ret) | 
|  | 173 | return ret; | 
|  | 174 |  | 
|  | 175 | /* | 
|  | 176 | * Take this CPU offline.  Once we clear this, we can't return, | 
|  | 177 | * and we must not schedule until we're ready to give up the cpu. | 
|  | 178 | */ | 
| Russell King | e03cdad | 2009-05-28 14:16:52 +0100 | [diff] [blame] | 179 | set_cpu_online(cpu, false); | 
| Russell King | a054a81 | 2005-11-02 22:24:33 +0000 | [diff] [blame] | 180 |  | 
|  | 181 | /* | 
|  | 182 | * OK - migrate IRQs away from this CPU | 
|  | 183 | */ | 
|  | 184 | migrate_irqs(); | 
|  | 185 |  | 
|  | 186 | /* | 
| Russell King | 37ee16a | 2005-11-08 19:08:05 +0000 | [diff] [blame] | 187 | * Stop the local timer for this CPU. | 
|  | 188 | */ | 
| Catalin Marinas | ebac654 | 2008-12-01 14:54:57 +0000 | [diff] [blame] | 189 | local_timer_stop(); | 
| Russell King | 37ee16a | 2005-11-08 19:08:05 +0000 | [diff] [blame] | 190 |  | 
|  | 191 | /* | 
| Russell King | a054a81 | 2005-11-02 22:24:33 +0000 | [diff] [blame] | 192 | * Flush user cache and TLB mappings, and then remove this CPU | 
|  | 193 | * from the vm mask set of all processes. | 
|  | 194 | */ | 
|  | 195 | flush_cache_all(); | 
|  | 196 | local_flush_tlb_all(); | 
|  | 197 |  | 
|  | 198 | read_lock(&tasklist_lock); | 
|  | 199 | for_each_process(p) { | 
|  | 200 | if (p->mm) | 
| Rusty Russell | 56f8ba8 | 2009-09-24 09:34:49 -0600 | [diff] [blame] | 201 | cpumask_clear_cpu(cpu, mm_cpumask(p->mm)); | 
| Russell King | a054a81 | 2005-11-02 22:24:33 +0000 | [diff] [blame] | 202 | } | 
|  | 203 | read_unlock(&tasklist_lock); | 
|  | 204 |  | 
|  | 205 | return 0; | 
|  | 206 | } | 
|  | 207 |  | 
|  | 208 | /* | 
|  | 209 | * called on the thread which is asking for a CPU to be shutdown - | 
|  | 210 | * waits until shutdown has completed, or it is timed out. | 
|  | 211 | */ | 
| Russell King | 90140c3 | 2009-09-27 21:04:48 +0100 | [diff] [blame] | 212 | void __cpu_die(unsigned int cpu) | 
| Russell King | a054a81 | 2005-11-02 22:24:33 +0000 | [diff] [blame] | 213 | { | 
|  | 214 | if (!platform_cpu_kill(cpu)) | 
|  | 215 | printk("CPU%u: unable to kill\n", cpu); | 
|  | 216 | } | 
|  | 217 |  | 
|  | 218 | /* | 
|  | 219 | * Called from the idle thread for the CPU which has been shutdown. | 
|  | 220 | * | 
|  | 221 | * Note that we disable IRQs here, but do not re-enable them | 
|  | 222 | * before returning to the caller. This is also the behaviour | 
|  | 223 | * of the other hotplug-cpu capable cores, so presumably coming | 
|  | 224 | * out of idle fixes this. | 
|  | 225 | */ | 
| Russell King | 90140c3 | 2009-09-27 21:04:48 +0100 | [diff] [blame] | 226 | void __ref cpu_die(void) | 
| Russell King | a054a81 | 2005-11-02 22:24:33 +0000 | [diff] [blame] | 227 | { | 
|  | 228 | unsigned int cpu = smp_processor_id(); | 
|  | 229 |  | 
|  | 230 | local_irq_disable(); | 
|  | 231 | idle_task_exit(); | 
|  | 232 |  | 
|  | 233 | /* | 
|  | 234 | * actual CPU shutdown procedure is at least platform (if not | 
|  | 235 | * CPU) specific | 
|  | 236 | */ | 
|  | 237 | platform_cpu_die(cpu); | 
|  | 238 |  | 
|  | 239 | /* | 
|  | 240 | * Do not return to the idle loop - jump back to the secondary | 
|  | 241 | * cpu initialisation.  There's some initialisation which needs | 
|  | 242 | * to be repeated to undo the effects of taking the CPU offline. | 
|  | 243 | */ | 
|  | 244 | __asm__("mov	sp, %0\n" | 
|  | 245 | "	b	secondary_start_kernel" | 
|  | 246 | : | 
| Al Viro | 32d39a9 | 2006-01-12 01:05:58 -0800 | [diff] [blame] | 247 | : "r" (task_stack_page(current) + THREAD_SIZE - 8)); | 
| Russell King | a054a81 | 2005-11-02 22:24:33 +0000 | [diff] [blame] | 248 | } | 
|  | 249 | #endif /* CONFIG_HOTPLUG_CPU */ | 
|  | 250 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | /* | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 252 | * This is the secondary CPU boot entry.  We're using this CPUs | 
|  | 253 | * idle thread stack, but a set of temporary page tables. | 
|  | 254 | */ | 
| Russell King | bd6f68a | 2005-07-17 21:35:41 +0100 | [diff] [blame] | 255 | asmlinkage void __cpuinit secondary_start_kernel(void) | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 256 | { | 
|  | 257 | struct mm_struct *mm = &init_mm; | 
| Russell King | da2660d | 2005-11-12 17:21:47 +0000 | [diff] [blame] | 258 | unsigned int cpu = smp_processor_id(); | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 259 |  | 
|  | 260 | printk("CPU%u: Booted secondary processor\n", cpu); | 
|  | 261 |  | 
|  | 262 | /* | 
|  | 263 | * All kernel threads share the same mm context; grab a | 
|  | 264 | * reference and switch to it. | 
|  | 265 | */ | 
|  | 266 | atomic_inc(&mm->mm_users); | 
|  | 267 | atomic_inc(&mm->mm_count); | 
|  | 268 | current->active_mm = mm; | 
| Rusty Russell | 56f8ba8 | 2009-09-24 09:34:49 -0600 | [diff] [blame] | 269 | cpumask_set_cpu(cpu, mm_cpumask(mm)); | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 270 | cpu_switch_mm(mm->pgd, mm); | 
|  | 271 | enter_lazy_tlb(mm, current); | 
| Russell King | 505d7b1 | 2005-07-28 20:32:47 +0100 | [diff] [blame] | 272 | local_flush_tlb_all(); | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 273 |  | 
|  | 274 | cpu_init(); | 
| Nick Piggin | 5bfb5d6 | 2005-11-08 21:39:01 -0800 | [diff] [blame] | 275 | preempt_disable(); | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 276 |  | 
|  | 277 | /* | 
|  | 278 | * Give the platform a chance to do its own initialisation. | 
|  | 279 | */ | 
|  | 280 | platform_secondary_init(cpu); | 
|  | 281 |  | 
|  | 282 | /* | 
|  | 283 | * Enable local interrupts. | 
|  | 284 | */ | 
| Manfred Spraul | e545a61 | 2008-09-07 16:57:22 +0200 | [diff] [blame] | 285 | notify_cpu_starting(cpu); | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 286 | local_irq_enable(); | 
|  | 287 | local_fiq_enable(); | 
|  | 288 |  | 
| Catalin Marinas | a8655e8 | 2008-02-04 17:30:57 +0100 | [diff] [blame] | 289 | /* | 
| Russell King | bc28248 | 2009-05-17 18:58:34 +0100 | [diff] [blame] | 290 | * Setup the percpu timer for this CPU. | 
| Catalin Marinas | a8655e8 | 2008-02-04 17:30:57 +0100 | [diff] [blame] | 291 | */ | 
| Russell King | bc28248 | 2009-05-17 18:58:34 +0100 | [diff] [blame] | 292 | percpu_timer_setup(); | 
| Catalin Marinas | a8655e8 | 2008-02-04 17:30:57 +0100 | [diff] [blame] | 293 |  | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 294 | calibrate_delay(); | 
|  | 295 |  | 
|  | 296 | smp_store_cpu_info(cpu); | 
|  | 297 |  | 
|  | 298 | /* | 
|  | 299 | * OK, now it's safe to let the boot CPU continue | 
|  | 300 | */ | 
| Russell King | e03cdad | 2009-05-28 14:16:52 +0100 | [diff] [blame] | 301 | set_cpu_online(cpu, true); | 
| Russell King | e65f38e | 2005-06-18 09:33:31 +0100 | [diff] [blame] | 302 |  | 
|  | 303 | /* | 
|  | 304 | * OK, it's off to the idle thread for us | 
|  | 305 | */ | 
|  | 306 | cpu_idle(); | 
|  | 307 | } | 
|  | 308 |  | 
|  | 309 | /* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | * Called by both boot and secondaries to move global data into | 
|  | 311 | * per-processor storage. | 
|  | 312 | */ | 
| Russell King | bd6f68a | 2005-07-17 21:35:41 +0100 | [diff] [blame] | 313 | void __cpuinit smp_store_cpu_info(unsigned int cpuid) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | { | 
|  | 315 | struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpuid); | 
|  | 316 |  | 
|  | 317 | cpu_info->loops_per_jiffy = loops_per_jiffy; | 
|  | 318 | } | 
|  | 319 |  | 
|  | 320 | void __init smp_cpus_done(unsigned int max_cpus) | 
|  | 321 | { | 
|  | 322 | int cpu; | 
|  | 323 | unsigned long bogosum = 0; | 
|  | 324 |  | 
|  | 325 | for_each_online_cpu(cpu) | 
|  | 326 | bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy; | 
|  | 327 |  | 
|  | 328 | printk(KERN_INFO "SMP: Total of %d processors activated " | 
|  | 329 | "(%lu.%02lu BogoMIPS).\n", | 
|  | 330 | num_online_cpus(), | 
|  | 331 | bogosum / (500000/HZ), | 
|  | 332 | (bogosum / (5000/HZ)) % 100); | 
|  | 333 | } | 
|  | 334 |  | 
|  | 335 | void __init smp_prepare_boot_cpu(void) | 
|  | 336 | { | 
|  | 337 | unsigned int cpu = smp_processor_id(); | 
|  | 338 |  | 
| Russell King | 71f512e | 2005-11-02 21:51:40 +0000 | [diff] [blame] | 339 | per_cpu(cpu_data, cpu).idle = current; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | } | 
|  | 341 |  | 
| Russell King | 8266810 | 2009-05-17 16:20:18 +0100 | [diff] [blame] | 342 | static void send_ipi_message(const struct cpumask *mask, enum ipi_msg_type msg) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | { | 
|  | 344 | unsigned long flags; | 
|  | 345 | unsigned int cpu; | 
|  | 346 |  | 
|  | 347 | local_irq_save(flags); | 
|  | 348 |  | 
| Russell King | 8266810 | 2009-05-17 16:20:18 +0100 | [diff] [blame] | 349 | for_each_cpu(cpu, mask) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | struct ipi_data *ipi = &per_cpu(ipi_data, cpu); | 
|  | 351 |  | 
|  | 352 | spin_lock(&ipi->lock); | 
|  | 353 | ipi->bits |= 1 << msg; | 
|  | 354 | spin_unlock(&ipi->lock); | 
|  | 355 | } | 
|  | 356 |  | 
|  | 357 | /* | 
|  | 358 | * Call the platform specific cross-CPU call function. | 
|  | 359 | */ | 
| Russell King | 8266810 | 2009-05-17 16:20:18 +0100 | [diff] [blame] | 360 | smp_cross_call(mask); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 |  | 
|  | 362 | local_irq_restore(flags); | 
|  | 363 | } | 
|  | 364 |  | 
| Russell King | 8266810 | 2009-05-17 16:20:18 +0100 | [diff] [blame] | 365 | void arch_send_call_function_ipi_mask(const struct cpumask *mask) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | { | 
| Jens Axboe | f6dd9fa5 | 2008-06-10 20:48:30 +0200 | [diff] [blame] | 367 | send_ipi_message(mask, IPI_CALL_FUNC); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | } | 
|  | 369 |  | 
| Jens Axboe | f6dd9fa5 | 2008-06-10 20:48:30 +0200 | [diff] [blame] | 370 | void arch_send_call_function_single_ipi(int cpu) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | { | 
| Russell King | 8266810 | 2009-05-17 16:20:18 +0100 | [diff] [blame] | 372 | send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | } | 
| Catalin Marinas | 3e45999 | 2008-02-04 17:28:56 +0100 | [diff] [blame] | 374 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | void show_ipi_list(struct seq_file *p) | 
|  | 376 | { | 
|  | 377 | unsigned int cpu; | 
|  | 378 |  | 
|  | 379 | seq_puts(p, "IPI:"); | 
|  | 380 |  | 
| Russell King | e11b223 | 2005-07-11 19:26:31 +0100 | [diff] [blame] | 381 | for_each_present_cpu(cpu) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 382 | seq_printf(p, " %10lu", per_cpu(ipi_data, cpu).ipi_count); | 
|  | 383 |  | 
|  | 384 | seq_putc(p, '\n'); | 
|  | 385 | } | 
|  | 386 |  | 
| Russell King | 37ee16a | 2005-11-08 19:08:05 +0000 | [diff] [blame] | 387 | void show_local_irqs(struct seq_file *p) | 
|  | 388 | { | 
|  | 389 | unsigned int cpu; | 
|  | 390 |  | 
|  | 391 | seq_printf(p, "LOC: "); | 
|  | 392 |  | 
|  | 393 | for_each_present_cpu(cpu) | 
|  | 394 | seq_printf(p, "%10u ", irq_stat[cpu].local_timer_irqs); | 
|  | 395 |  | 
|  | 396 | seq_putc(p, '\n'); | 
|  | 397 | } | 
|  | 398 |  | 
| Russell King | bc28248 | 2009-05-17 18:58:34 +0100 | [diff] [blame] | 399 | /* | 
|  | 400 | * Timer (local or broadcast) support | 
|  | 401 | */ | 
|  | 402 | static DEFINE_PER_CPU(struct clock_event_device, percpu_clockevent); | 
|  | 403 |  | 
| Russell King | c97d486 | 2006-10-25 13:59:16 +0100 | [diff] [blame] | 404 | static void ipi_timer(void) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 405 | { | 
| Russell King | bc28248 | 2009-05-17 18:58:34 +0100 | [diff] [blame] | 406 | struct clock_event_device *evt = &__get_cpu_var(percpu_clockevent); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | irq_enter(); | 
| Russell King | bc28248 | 2009-05-17 18:58:34 +0100 | [diff] [blame] | 408 | evt->event_handler(evt); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | irq_exit(); | 
|  | 410 | } | 
|  | 411 |  | 
| Russell King | 37ee16a | 2005-11-08 19:08:05 +0000 | [diff] [blame] | 412 | #ifdef CONFIG_LOCAL_TIMERS | 
| Russell King | b9811d7 | 2007-05-08 11:31:07 +0100 | [diff] [blame] | 413 | asmlinkage void __exception do_local_timer(struct pt_regs *regs) | 
| Russell King | 37ee16a | 2005-11-08 19:08:05 +0000 | [diff] [blame] | 414 | { | 
| Russell King | c97d486 | 2006-10-25 13:59:16 +0100 | [diff] [blame] | 415 | struct pt_regs *old_regs = set_irq_regs(regs); | 
| Russell King | 37ee16a | 2005-11-08 19:08:05 +0000 | [diff] [blame] | 416 | int cpu = smp_processor_id(); | 
|  | 417 |  | 
|  | 418 | if (local_timer_ack()) { | 
|  | 419 | irq_stat[cpu].local_timer_irqs++; | 
| Russell King | c97d486 | 2006-10-25 13:59:16 +0100 | [diff] [blame] | 420 | ipi_timer(); | 
| Russell King | 37ee16a | 2005-11-08 19:08:05 +0000 | [diff] [blame] | 421 | } | 
| Russell King | c97d486 | 2006-10-25 13:59:16 +0100 | [diff] [blame] | 422 |  | 
|  | 423 | set_irq_regs(old_regs); | 
| Russell King | 37ee16a | 2005-11-08 19:08:05 +0000 | [diff] [blame] | 424 | } | 
|  | 425 | #endif | 
|  | 426 |  | 
| Russell King | bc28248 | 2009-05-17 18:58:34 +0100 | [diff] [blame] | 427 | #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | 
|  | 428 | static void smp_timer_broadcast(const struct cpumask *mask) | 
|  | 429 | { | 
|  | 430 | send_ipi_message(mask, IPI_TIMER); | 
|  | 431 | } | 
|  | 432 |  | 
|  | 433 | static void broadcast_timer_set_mode(enum clock_event_mode mode, | 
|  | 434 | struct clock_event_device *evt) | 
|  | 435 | { | 
|  | 436 | } | 
|  | 437 |  | 
|  | 438 | static void local_timer_setup(struct clock_event_device *evt) | 
|  | 439 | { | 
|  | 440 | evt->name	= "dummy_timer"; | 
|  | 441 | evt->features	= CLOCK_EVT_FEAT_ONESHOT | | 
|  | 442 | CLOCK_EVT_FEAT_PERIODIC | | 
|  | 443 | CLOCK_EVT_FEAT_DUMMY; | 
|  | 444 | evt->rating	= 400; | 
|  | 445 | evt->mult	= 1; | 
|  | 446 | evt->set_mode	= broadcast_timer_set_mode; | 
|  | 447 | evt->broadcast	= smp_timer_broadcast; | 
|  | 448 |  | 
|  | 449 | clockevents_register_device(evt); | 
|  | 450 | } | 
|  | 451 | #endif | 
|  | 452 |  | 
|  | 453 | void __cpuinit percpu_timer_setup(void) | 
|  | 454 | { | 
|  | 455 | unsigned int cpu = smp_processor_id(); | 
|  | 456 | struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu); | 
|  | 457 |  | 
|  | 458 | evt->cpumask = cpumask_of(cpu); | 
|  | 459 |  | 
|  | 460 | local_timer_setup(evt); | 
|  | 461 | } | 
|  | 462 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | static DEFINE_SPINLOCK(stop_lock); | 
|  | 464 |  | 
|  | 465 | /* | 
|  | 466 | * ipi_cpu_stop - handle IPI from smp_send_stop() | 
|  | 467 | */ | 
|  | 468 | static void ipi_cpu_stop(unsigned int cpu) | 
|  | 469 | { | 
|  | 470 | spin_lock(&stop_lock); | 
|  | 471 | printk(KERN_CRIT "CPU%u: stopping\n", cpu); | 
|  | 472 | dump_stack(); | 
|  | 473 | spin_unlock(&stop_lock); | 
|  | 474 |  | 
| Russell King | e03cdad | 2009-05-28 14:16:52 +0100 | [diff] [blame] | 475 | set_cpu_online(cpu, false); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 476 |  | 
|  | 477 | local_fiq_disable(); | 
|  | 478 | local_irq_disable(); | 
|  | 479 |  | 
|  | 480 | while (1) | 
|  | 481 | cpu_relax(); | 
|  | 482 | } | 
|  | 483 |  | 
|  | 484 | /* | 
|  | 485 | * Main handler for inter-processor interrupts | 
|  | 486 | * | 
|  | 487 | * For ARM, the ipimask now only identifies a single | 
|  | 488 | * category of IPI (Bit 1 IPIs have been replaced by a | 
|  | 489 | * different mechanism): | 
|  | 490 | * | 
|  | 491 | *  Bit 0 - Inter-processor function call | 
|  | 492 | */ | 
| Russell King | b9811d7 | 2007-05-08 11:31:07 +0100 | [diff] [blame] | 493 | asmlinkage void __exception do_IPI(struct pt_regs *regs) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | { | 
|  | 495 | unsigned int cpu = smp_processor_id(); | 
|  | 496 | struct ipi_data *ipi = &per_cpu(ipi_data, cpu); | 
| Russell King | c97d486 | 2006-10-25 13:59:16 +0100 | [diff] [blame] | 497 | struct pt_regs *old_regs = set_irq_regs(regs); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 |  | 
|  | 499 | ipi->ipi_count++; | 
|  | 500 |  | 
|  | 501 | for (;;) { | 
|  | 502 | unsigned long msgs; | 
|  | 503 |  | 
|  | 504 | spin_lock(&ipi->lock); | 
|  | 505 | msgs = ipi->bits; | 
|  | 506 | ipi->bits = 0; | 
|  | 507 | spin_unlock(&ipi->lock); | 
|  | 508 |  | 
|  | 509 | if (!msgs) | 
|  | 510 | break; | 
|  | 511 |  | 
|  | 512 | do { | 
|  | 513 | unsigned nextmsg; | 
|  | 514 |  | 
|  | 515 | nextmsg = msgs & -msgs; | 
|  | 516 | msgs &= ~nextmsg; | 
|  | 517 | nextmsg = ffz(~nextmsg); | 
|  | 518 |  | 
|  | 519 | switch (nextmsg) { | 
|  | 520 | case IPI_TIMER: | 
| Russell King | c97d486 | 2006-10-25 13:59:16 +0100 | [diff] [blame] | 521 | ipi_timer(); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | break; | 
|  | 523 |  | 
|  | 524 | case IPI_RESCHEDULE: | 
|  | 525 | /* | 
|  | 526 | * nothing more to do - eveything is | 
|  | 527 | * done on the interrupt return path | 
|  | 528 | */ | 
|  | 529 | break; | 
|  | 530 |  | 
|  | 531 | case IPI_CALL_FUNC: | 
| Jens Axboe | f6dd9fa5 | 2008-06-10 20:48:30 +0200 | [diff] [blame] | 532 | generic_smp_call_function_interrupt(); | 
|  | 533 | break; | 
|  | 534 |  | 
|  | 535 | case IPI_CALL_FUNC_SINGLE: | 
|  | 536 | generic_smp_call_function_single_interrupt(); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | break; | 
|  | 538 |  | 
|  | 539 | case IPI_CPU_STOP: | 
|  | 540 | ipi_cpu_stop(cpu); | 
|  | 541 | break; | 
|  | 542 |  | 
|  | 543 | default: | 
|  | 544 | printk(KERN_CRIT "CPU%u: Unknown IPI message 0x%x\n", | 
|  | 545 | cpu, nextmsg); | 
|  | 546 | break; | 
|  | 547 | } | 
|  | 548 | } while (msgs); | 
|  | 549 | } | 
| Russell King | c97d486 | 2006-10-25 13:59:16 +0100 | [diff] [blame] | 550 |  | 
|  | 551 | set_irq_regs(old_regs); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | } | 
|  | 553 |  | 
|  | 554 | void smp_send_reschedule(int cpu) | 
|  | 555 | { | 
| Russell King | 8266810 | 2009-05-17 16:20:18 +0100 | [diff] [blame] | 556 | send_ipi_message(cpumask_of(cpu), IPI_RESCHEDULE); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | } | 
|  | 558 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 559 | void smp_send_stop(void) | 
|  | 560 | { | 
|  | 561 | cpumask_t mask = cpu_online_map; | 
|  | 562 | cpu_clear(smp_processor_id(), mask); | 
| Russell King | 8266810 | 2009-05-17 16:20:18 +0100 | [diff] [blame] | 563 | send_ipi_message(&mask, IPI_CPU_STOP); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 564 | } | 
|  | 565 |  | 
|  | 566 | /* | 
|  | 567 | * not supported here | 
|  | 568 | */ | 
| Russell King | 5048bcb | 2007-07-23 12:59:46 +0100 | [diff] [blame] | 569 | int setup_profiling_timer(unsigned int multiplier) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 570 | { | 
|  | 571 | return -EINVAL; | 
|  | 572 | } | 
| Russell King | 4b0ef3b | 2005-06-28 13:49:16 +0100 | [diff] [blame] | 573 |  | 
| Russell King | 8266810 | 2009-05-17 16:20:18 +0100 | [diff] [blame] | 574 | static void | 
|  | 575 | on_each_cpu_mask(void (*func)(void *), void *info, int wait, | 
|  | 576 | const struct cpumask *mask) | 
| Russell King | 4b0ef3b | 2005-06-28 13:49:16 +0100 | [diff] [blame] | 577 | { | 
| Russell King | 4b0ef3b | 2005-06-28 13:49:16 +0100 | [diff] [blame] | 578 | preempt_disable(); | 
|  | 579 |  | 
| Russell King | 8266810 | 2009-05-17 16:20:18 +0100 | [diff] [blame] | 580 | smp_call_function_many(mask, func, info, wait); | 
|  | 581 | if (cpumask_test_cpu(smp_processor_id(), mask)) | 
| Russell King | 4b0ef3b | 2005-06-28 13:49:16 +0100 | [diff] [blame] | 582 | func(info); | 
|  | 583 |  | 
|  | 584 | preempt_enable(); | 
| Russell King | 4b0ef3b | 2005-06-28 13:49:16 +0100 | [diff] [blame] | 585 | } | 
|  | 586 |  | 
|  | 587 | /**********************************************************************/ | 
|  | 588 |  | 
|  | 589 | /* | 
|  | 590 | * TLB operations | 
|  | 591 | */ | 
|  | 592 | struct tlb_args { | 
|  | 593 | struct vm_area_struct *ta_vma; | 
|  | 594 | unsigned long ta_start; | 
|  | 595 | unsigned long ta_end; | 
|  | 596 | }; | 
|  | 597 |  | 
|  | 598 | static inline void ipi_flush_tlb_all(void *ignored) | 
|  | 599 | { | 
|  | 600 | local_flush_tlb_all(); | 
|  | 601 | } | 
|  | 602 |  | 
|  | 603 | static inline void ipi_flush_tlb_mm(void *arg) | 
|  | 604 | { | 
|  | 605 | struct mm_struct *mm = (struct mm_struct *)arg; | 
|  | 606 |  | 
|  | 607 | local_flush_tlb_mm(mm); | 
|  | 608 | } | 
|  | 609 |  | 
|  | 610 | static inline void ipi_flush_tlb_page(void *arg) | 
|  | 611 | { | 
|  | 612 | struct tlb_args *ta = (struct tlb_args *)arg; | 
|  | 613 |  | 
|  | 614 | local_flush_tlb_page(ta->ta_vma, ta->ta_start); | 
|  | 615 | } | 
|  | 616 |  | 
|  | 617 | static inline void ipi_flush_tlb_kernel_page(void *arg) | 
|  | 618 | { | 
|  | 619 | struct tlb_args *ta = (struct tlb_args *)arg; | 
|  | 620 |  | 
|  | 621 | local_flush_tlb_kernel_page(ta->ta_start); | 
|  | 622 | } | 
|  | 623 |  | 
|  | 624 | static inline void ipi_flush_tlb_range(void *arg) | 
|  | 625 | { | 
|  | 626 | struct tlb_args *ta = (struct tlb_args *)arg; | 
|  | 627 |  | 
|  | 628 | local_flush_tlb_range(ta->ta_vma, ta->ta_start, ta->ta_end); | 
|  | 629 | } | 
|  | 630 |  | 
|  | 631 | static inline void ipi_flush_tlb_kernel_range(void *arg) | 
|  | 632 | { | 
|  | 633 | struct tlb_args *ta = (struct tlb_args *)arg; | 
|  | 634 |  | 
|  | 635 | local_flush_tlb_kernel_range(ta->ta_start, ta->ta_end); | 
|  | 636 | } | 
|  | 637 |  | 
|  | 638 | void flush_tlb_all(void) | 
|  | 639 | { | 
| Catalin Marinas | faa7bc5 | 2009-05-30 14:00:14 +0100 | [diff] [blame] | 640 | if (tlb_ops_need_broadcast()) | 
|  | 641 | on_each_cpu(ipi_flush_tlb_all, NULL, 1); | 
|  | 642 | else | 
|  | 643 | local_flush_tlb_all(); | 
| Russell King | 4b0ef3b | 2005-06-28 13:49:16 +0100 | [diff] [blame] | 644 | } | 
|  | 645 |  | 
|  | 646 | void flush_tlb_mm(struct mm_struct *mm) | 
|  | 647 | { | 
| Catalin Marinas | faa7bc5 | 2009-05-30 14:00:14 +0100 | [diff] [blame] | 648 | if (tlb_ops_need_broadcast()) | 
| Rusty Russell | 56f8ba8 | 2009-09-24 09:34:49 -0600 | [diff] [blame] | 649 | on_each_cpu_mask(ipi_flush_tlb_mm, mm, 1, mm_cpumask(mm)); | 
| Catalin Marinas | faa7bc5 | 2009-05-30 14:00:14 +0100 | [diff] [blame] | 650 | else | 
|  | 651 | local_flush_tlb_mm(mm); | 
| Russell King | 4b0ef3b | 2005-06-28 13:49:16 +0100 | [diff] [blame] | 652 | } | 
|  | 653 |  | 
|  | 654 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) | 
|  | 655 | { | 
| Catalin Marinas | faa7bc5 | 2009-05-30 14:00:14 +0100 | [diff] [blame] | 656 | if (tlb_ops_need_broadcast()) { | 
|  | 657 | struct tlb_args ta; | 
|  | 658 | ta.ta_vma = vma; | 
|  | 659 | ta.ta_start = uaddr; | 
| Rusty Russell | 56f8ba8 | 2009-09-24 09:34:49 -0600 | [diff] [blame] | 660 | on_each_cpu_mask(ipi_flush_tlb_page, &ta, 1, mm_cpumask(vma->vm_mm)); | 
| Catalin Marinas | faa7bc5 | 2009-05-30 14:00:14 +0100 | [diff] [blame] | 661 | } else | 
|  | 662 | local_flush_tlb_page(vma, uaddr); | 
| Russell King | 4b0ef3b | 2005-06-28 13:49:16 +0100 | [diff] [blame] | 663 | } | 
|  | 664 |  | 
|  | 665 | void flush_tlb_kernel_page(unsigned long kaddr) | 
|  | 666 | { | 
| Catalin Marinas | faa7bc5 | 2009-05-30 14:00:14 +0100 | [diff] [blame] | 667 | if (tlb_ops_need_broadcast()) { | 
|  | 668 | struct tlb_args ta; | 
|  | 669 | ta.ta_start = kaddr; | 
|  | 670 | on_each_cpu(ipi_flush_tlb_kernel_page, &ta, 1); | 
|  | 671 | } else | 
|  | 672 | local_flush_tlb_kernel_page(kaddr); | 
| Russell King | 4b0ef3b | 2005-06-28 13:49:16 +0100 | [diff] [blame] | 673 | } | 
|  | 674 |  | 
|  | 675 | void flush_tlb_range(struct vm_area_struct *vma, | 
|  | 676 | unsigned long start, unsigned long end) | 
|  | 677 | { | 
| Catalin Marinas | faa7bc5 | 2009-05-30 14:00:14 +0100 | [diff] [blame] | 678 | if (tlb_ops_need_broadcast()) { | 
|  | 679 | struct tlb_args ta; | 
|  | 680 | ta.ta_vma = vma; | 
|  | 681 | ta.ta_start = start; | 
|  | 682 | ta.ta_end = end; | 
| Rusty Russell | 56f8ba8 | 2009-09-24 09:34:49 -0600 | [diff] [blame] | 683 | on_each_cpu_mask(ipi_flush_tlb_range, &ta, 1, mm_cpumask(vma->vm_mm)); | 
| Catalin Marinas | faa7bc5 | 2009-05-30 14:00:14 +0100 | [diff] [blame] | 684 | } else | 
|  | 685 | local_flush_tlb_range(vma, start, end); | 
| Russell King | 4b0ef3b | 2005-06-28 13:49:16 +0100 | [diff] [blame] | 686 | } | 
|  | 687 |  | 
|  | 688 | void flush_tlb_kernel_range(unsigned long start, unsigned long end) | 
|  | 689 | { | 
| Catalin Marinas | faa7bc5 | 2009-05-30 14:00:14 +0100 | [diff] [blame] | 690 | if (tlb_ops_need_broadcast()) { | 
|  | 691 | struct tlb_args ta; | 
|  | 692 | ta.ta_start = start; | 
|  | 693 | ta.ta_end = end; | 
|  | 694 | on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1); | 
|  | 695 | } else | 
|  | 696 | local_flush_tlb_kernel_range(start, end); | 
| Russell King | 4b0ef3b | 2005-06-28 13:49:16 +0100 | [diff] [blame] | 697 | } |