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/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_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_irq_entry 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_irq_entry 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. }