smp.c 16 KB

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