smp.c 16 KB

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