tick-broadcast.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. /*
  2. * linux/kernel/time/tick-broadcast.c
  3. *
  4. * This file contains functions which emulate a local clock-event
  5. * device via a broadcast event source.
  6. *
  7. * Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de>
  8. * Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar
  9. * Copyright(C) 2006-2007, Timesys Corp., Thomas Gleixner
  10. *
  11. * This code is licenced under the GPL version 2. For details see
  12. * kernel-base/COPYING.
  13. */
  14. #include <linux/cpu.h>
  15. #include <linux/err.h>
  16. #include <linux/hrtimer.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/percpu.h>
  19. #include <linux/profile.h>
  20. #include <linux/sched.h>
  21. #include <linux/smp.h>
  22. #include "tick-internal.h"
  23. /*
  24. * Broadcast support for broken x86 hardware, where the local apic
  25. * timer stops in C3 state.
  26. */
  27. static struct tick_device tick_broadcast_device;
  28. /* FIXME: Use cpumask_var_t. */
  29. static DECLARE_BITMAP(tick_broadcast_mask, NR_CPUS);
  30. static DECLARE_BITMAP(tmpmask, NR_CPUS);
  31. static DEFINE_RAW_SPINLOCK(tick_broadcast_lock);
  32. static int tick_broadcast_force;
  33. #ifdef CONFIG_TICK_ONESHOT
  34. static void tick_broadcast_clear_oneshot(int cpu);
  35. #else
  36. static inline void tick_broadcast_clear_oneshot(int cpu) { }
  37. #endif
  38. /*
  39. * Debugging: see timer_list.c
  40. */
  41. struct tick_device *tick_get_broadcast_device(void)
  42. {
  43. return &tick_broadcast_device;
  44. }
  45. struct cpumask *tick_get_broadcast_mask(void)
  46. {
  47. return to_cpumask(tick_broadcast_mask);
  48. }
  49. /*
  50. * Start the device in periodic mode
  51. */
  52. static void tick_broadcast_start_periodic(struct clock_event_device *bc)
  53. {
  54. if (bc)
  55. tick_setup_periodic(bc, 1);
  56. }
  57. /*
  58. * Check, if the device can be utilized as broadcast device:
  59. */
  60. int tick_check_broadcast_device(struct clock_event_device *dev)
  61. {
  62. if ((tick_broadcast_device.evtdev &&
  63. tick_broadcast_device.evtdev->rating >= dev->rating) ||
  64. (dev->features & CLOCK_EVT_FEAT_C3STOP))
  65. return 0;
  66. clockevents_exchange_device(tick_broadcast_device.evtdev, dev);
  67. tick_broadcast_device.evtdev = dev;
  68. if (!cpumask_empty(tick_get_broadcast_mask()))
  69. tick_broadcast_start_periodic(dev);
  70. return 1;
  71. }
  72. /*
  73. * Check, if the device is the broadcast device
  74. */
  75. int tick_is_broadcast_device(struct clock_event_device *dev)
  76. {
  77. return (dev && tick_broadcast_device.evtdev == dev);
  78. }
  79. static void err_broadcast(const struct cpumask *mask)
  80. {
  81. pr_crit_once("Failed to broadcast timer tick. Some CPUs may be unresponsive.\n");
  82. }
  83. /*
  84. * Check, if the device is disfunctional and a place holder, which
  85. * needs to be handled by the broadcast device.
  86. */
  87. int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu)
  88. {
  89. unsigned long flags;
  90. int ret = 0;
  91. raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
  92. /*
  93. * Devices might be registered with both periodic and oneshot
  94. * mode disabled. This signals, that the device needs to be
  95. * operated from the broadcast device and is a placeholder for
  96. * the cpu local device.
  97. */
  98. if (!tick_device_is_functional(dev)) {
  99. dev->event_handler = tick_handle_periodic;
  100. if (!dev->broadcast)
  101. dev->broadcast = tick_broadcast;
  102. if (!dev->broadcast) {
  103. pr_warn_once("%s depends on broadcast, but no broadcast function available\n",
  104. dev->name);
  105. dev->broadcast = err_broadcast;
  106. }
  107. cpumask_set_cpu(cpu, tick_get_broadcast_mask());
  108. tick_broadcast_start_periodic(tick_broadcast_device.evtdev);
  109. ret = 1;
  110. } else {
  111. /*
  112. * When the new device is not affected by the stop
  113. * feature and the cpu is marked in the broadcast mask
  114. * then clear the broadcast bit.
  115. */
  116. if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) {
  117. int cpu = smp_processor_id();
  118. cpumask_clear_cpu(cpu, tick_get_broadcast_mask());
  119. tick_broadcast_clear_oneshot(cpu);
  120. }
  121. }
  122. raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
  123. return ret;
  124. }
  125. #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
  126. int tick_receive_broadcast(void)
  127. {
  128. struct tick_device *td = this_cpu_ptr(&tick_cpu_device);
  129. struct clock_event_device *evt = td->evtdev;
  130. if (!evt)
  131. return -ENODEV;
  132. if (!evt->event_handler)
  133. return -EINVAL;
  134. evt->event_handler(evt);
  135. return 0;
  136. }
  137. #endif
  138. /*
  139. * Broadcast the event to the cpus, which are set in the mask (mangled).
  140. */
  141. static void tick_do_broadcast(struct cpumask *mask)
  142. {
  143. int cpu = smp_processor_id();
  144. struct tick_device *td;
  145. /*
  146. * Check, if the current cpu is in the mask
  147. */
  148. if (cpumask_test_cpu(cpu, mask)) {
  149. cpumask_clear_cpu(cpu, mask);
  150. td = &per_cpu(tick_cpu_device, cpu);
  151. td->evtdev->event_handler(td->evtdev);
  152. }
  153. if (!cpumask_empty(mask)) {
  154. /*
  155. * It might be necessary to actually check whether the devices
  156. * have different broadcast functions. For now, just use the
  157. * one of the first device. This works as long as we have this
  158. * misfeature only on x86 (lapic)
  159. */
  160. td = &per_cpu(tick_cpu_device, cpumask_first(mask));
  161. td->evtdev->broadcast(mask);
  162. }
  163. }
  164. /*
  165. * Periodic broadcast:
  166. * - invoke the broadcast handlers
  167. */
  168. static void tick_do_periodic_broadcast(void)
  169. {
  170. raw_spin_lock(&tick_broadcast_lock);
  171. cpumask_and(to_cpumask(tmpmask),
  172. cpu_online_mask, tick_get_broadcast_mask());
  173. tick_do_broadcast(to_cpumask(tmpmask));
  174. raw_spin_unlock(&tick_broadcast_lock);
  175. }
  176. /*
  177. * Event handler for periodic broadcast ticks
  178. */
  179. static void tick_handle_periodic_broadcast(struct clock_event_device *dev)
  180. {
  181. ktime_t next;
  182. tick_do_periodic_broadcast();
  183. /*
  184. * The device is in periodic mode. No reprogramming necessary:
  185. */
  186. if (dev->mode == CLOCK_EVT_MODE_PERIODIC)
  187. return;
  188. /*
  189. * Setup the next period for devices, which do not have
  190. * periodic mode. We read dev->next_event first and add to it
  191. * when the event already expired. clockevents_program_event()
  192. * sets dev->next_event only when the event is really
  193. * programmed to the device.
  194. */
  195. for (next = dev->next_event; ;) {
  196. next = ktime_add(next, tick_period);
  197. if (!clockevents_program_event(dev, next, false))
  198. return;
  199. tick_do_periodic_broadcast();
  200. }
  201. }
  202. /*
  203. * Powerstate information: The system enters/leaves a state, where
  204. * affected devices might stop
  205. */
  206. static void tick_do_broadcast_on_off(unsigned long *reason)
  207. {
  208. struct clock_event_device *bc, *dev;
  209. struct tick_device *td;
  210. unsigned long flags;
  211. int cpu, bc_stopped;
  212. raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
  213. cpu = smp_processor_id();
  214. td = &per_cpu(tick_cpu_device, cpu);
  215. dev = td->evtdev;
  216. bc = tick_broadcast_device.evtdev;
  217. /*
  218. * Is the device not affected by the powerstate ?
  219. */
  220. if (!dev || !(dev->features & CLOCK_EVT_FEAT_C3STOP))
  221. goto out;
  222. if (!tick_device_is_functional(dev))
  223. goto out;
  224. bc_stopped = cpumask_empty(tick_get_broadcast_mask());
  225. switch (*reason) {
  226. case CLOCK_EVT_NOTIFY_BROADCAST_ON:
  227. case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
  228. if (!cpumask_test_cpu(cpu, tick_get_broadcast_mask())) {
  229. cpumask_set_cpu(cpu, tick_get_broadcast_mask());
  230. if (tick_broadcast_device.mode ==
  231. TICKDEV_MODE_PERIODIC)
  232. clockevents_shutdown(dev);
  233. }
  234. if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE)
  235. tick_broadcast_force = 1;
  236. break;
  237. case CLOCK_EVT_NOTIFY_BROADCAST_OFF:
  238. if (!tick_broadcast_force &&
  239. cpumask_test_cpu(cpu, tick_get_broadcast_mask())) {
  240. cpumask_clear_cpu(cpu, tick_get_broadcast_mask());
  241. if (tick_broadcast_device.mode ==
  242. TICKDEV_MODE_PERIODIC)
  243. tick_setup_periodic(dev, 0);
  244. }
  245. break;
  246. }
  247. if (cpumask_empty(tick_get_broadcast_mask())) {
  248. if (!bc_stopped)
  249. clockevents_shutdown(bc);
  250. } else if (bc_stopped) {
  251. if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
  252. tick_broadcast_start_periodic(bc);
  253. else
  254. tick_broadcast_setup_oneshot(bc);
  255. }
  256. out:
  257. raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
  258. }
  259. /*
  260. * Powerstate information: The system enters/leaves a state, where
  261. * affected devices might stop.
  262. */
  263. void tick_broadcast_on_off(unsigned long reason, int *oncpu)
  264. {
  265. if (!cpumask_test_cpu(*oncpu, cpu_online_mask))
  266. printk(KERN_ERR "tick-broadcast: ignoring broadcast for "
  267. "offline CPU #%d\n", *oncpu);
  268. else
  269. tick_do_broadcast_on_off(&reason);
  270. }
  271. /*
  272. * Set the periodic handler depending on broadcast on/off
  273. */
  274. void tick_set_periodic_handler(struct clock_event_device *dev, int broadcast)
  275. {
  276. if (!broadcast)
  277. dev->event_handler = tick_handle_periodic;
  278. else
  279. dev->event_handler = tick_handle_periodic_broadcast;
  280. }
  281. /*
  282. * Remove a CPU from broadcasting
  283. */
  284. void tick_shutdown_broadcast(unsigned int *cpup)
  285. {
  286. struct clock_event_device *bc;
  287. unsigned long flags;
  288. unsigned int cpu = *cpup;
  289. raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
  290. bc = tick_broadcast_device.evtdev;
  291. cpumask_clear_cpu(cpu, tick_get_broadcast_mask());
  292. if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) {
  293. if (bc && cpumask_empty(tick_get_broadcast_mask()))
  294. clockevents_shutdown(bc);
  295. }
  296. raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
  297. }
  298. void tick_suspend_broadcast(void)
  299. {
  300. struct clock_event_device *bc;
  301. unsigned long flags;
  302. raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
  303. bc = tick_broadcast_device.evtdev;
  304. if (bc)
  305. clockevents_shutdown(bc);
  306. raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
  307. }
  308. int tick_resume_broadcast(void)
  309. {
  310. struct clock_event_device *bc;
  311. unsigned long flags;
  312. int broadcast = 0;
  313. raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
  314. bc = tick_broadcast_device.evtdev;
  315. if (bc) {
  316. clockevents_set_mode(bc, CLOCK_EVT_MODE_RESUME);
  317. switch (tick_broadcast_device.mode) {
  318. case TICKDEV_MODE_PERIODIC:
  319. if (!cpumask_empty(tick_get_broadcast_mask()))
  320. tick_broadcast_start_periodic(bc);
  321. broadcast = cpumask_test_cpu(smp_processor_id(),
  322. tick_get_broadcast_mask());
  323. break;
  324. case TICKDEV_MODE_ONESHOT:
  325. if (!cpumask_empty(tick_get_broadcast_mask()))
  326. broadcast = tick_resume_broadcast_oneshot(bc);
  327. break;
  328. }
  329. }
  330. raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
  331. return broadcast;
  332. }
  333. #ifdef CONFIG_TICK_ONESHOT
  334. /* FIXME: use cpumask_var_t. */
  335. static DECLARE_BITMAP(tick_broadcast_oneshot_mask, NR_CPUS);
  336. /*
  337. * Exposed for debugging: see timer_list.c
  338. */
  339. struct cpumask *tick_get_broadcast_oneshot_mask(void)
  340. {
  341. return to_cpumask(tick_broadcast_oneshot_mask);
  342. }
  343. static int tick_broadcast_set_event(ktime_t expires, int force)
  344. {
  345. struct clock_event_device *bc = tick_broadcast_device.evtdev;
  346. if (bc->mode != CLOCK_EVT_MODE_ONESHOT)
  347. clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);
  348. return clockevents_program_event(bc, expires, force);
  349. }
  350. int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
  351. {
  352. clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);
  353. return 0;
  354. }
  355. /*
  356. * Called from irq_enter() when idle was interrupted to reenable the
  357. * per cpu device.
  358. */
  359. void tick_check_oneshot_broadcast(int cpu)
  360. {
  361. if (cpumask_test_cpu(cpu, to_cpumask(tick_broadcast_oneshot_mask))) {
  362. struct tick_device *td = &per_cpu(tick_cpu_device, cpu);
  363. clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_ONESHOT);
  364. }
  365. }
  366. /*
  367. * Handle oneshot mode broadcasting
  368. */
  369. static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
  370. {
  371. struct tick_device *td;
  372. ktime_t now, next_event;
  373. int cpu;
  374. raw_spin_lock(&tick_broadcast_lock);
  375. again:
  376. dev->next_event.tv64 = KTIME_MAX;
  377. next_event.tv64 = KTIME_MAX;
  378. cpumask_clear(to_cpumask(tmpmask));
  379. now = ktime_get();
  380. /* Find all expired events */
  381. for_each_cpu(cpu, tick_get_broadcast_oneshot_mask()) {
  382. td = &per_cpu(tick_cpu_device, cpu);
  383. if (td->evtdev->next_event.tv64 <= now.tv64)
  384. cpumask_set_cpu(cpu, to_cpumask(tmpmask));
  385. else if (td->evtdev->next_event.tv64 < next_event.tv64)
  386. next_event.tv64 = td->evtdev->next_event.tv64;
  387. }
  388. /*
  389. * Wakeup the cpus which have an expired event.
  390. */
  391. tick_do_broadcast(to_cpumask(tmpmask));
  392. /*
  393. * Two reasons for reprogram:
  394. *
  395. * - The global event did not expire any CPU local
  396. * events. This happens in dyntick mode, as the maximum PIT
  397. * delta is quite small.
  398. *
  399. * - There are pending events on sleeping CPUs which were not
  400. * in the event mask
  401. */
  402. if (next_event.tv64 != KTIME_MAX) {
  403. /*
  404. * Rearm the broadcast device. If event expired,
  405. * repeat the above
  406. */
  407. if (tick_broadcast_set_event(next_event, 0))
  408. goto again;
  409. }
  410. raw_spin_unlock(&tick_broadcast_lock);
  411. }
  412. /*
  413. * Powerstate information: The system enters/leaves a state, where
  414. * affected devices might stop
  415. */
  416. void tick_broadcast_oneshot_control(unsigned long reason)
  417. {
  418. struct clock_event_device *bc, *dev;
  419. struct tick_device *td;
  420. unsigned long flags;
  421. int cpu;
  422. /*
  423. * Periodic mode does not care about the enter/exit of power
  424. * states
  425. */
  426. if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
  427. return;
  428. /*
  429. * We are called with preemtion disabled from the depth of the
  430. * idle code, so we can't be moved away.
  431. */
  432. cpu = smp_processor_id();
  433. td = &per_cpu(tick_cpu_device, cpu);
  434. dev = td->evtdev;
  435. if (!(dev->features & CLOCK_EVT_FEAT_C3STOP))
  436. return;
  437. bc = tick_broadcast_device.evtdev;
  438. raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
  439. if (reason == CLOCK_EVT_NOTIFY_BROADCAST_ENTER) {
  440. if (!cpumask_test_cpu(cpu, tick_get_broadcast_oneshot_mask())) {
  441. cpumask_set_cpu(cpu, tick_get_broadcast_oneshot_mask());
  442. clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN);
  443. if (dev->next_event.tv64 < bc->next_event.tv64)
  444. tick_broadcast_set_event(dev->next_event, 1);
  445. }
  446. } else {
  447. if (cpumask_test_cpu(cpu, tick_get_broadcast_oneshot_mask())) {
  448. cpumask_clear_cpu(cpu,
  449. tick_get_broadcast_oneshot_mask());
  450. clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT);
  451. if (dev->next_event.tv64 != KTIME_MAX)
  452. tick_program_event(dev->next_event, 1);
  453. }
  454. }
  455. raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
  456. }
  457. /*
  458. * Reset the one shot broadcast for a cpu
  459. *
  460. * Called with tick_broadcast_lock held
  461. */
  462. static void tick_broadcast_clear_oneshot(int cpu)
  463. {
  464. cpumask_clear_cpu(cpu, tick_get_broadcast_oneshot_mask());
  465. }
  466. static void tick_broadcast_init_next_event(struct cpumask *mask,
  467. ktime_t expires)
  468. {
  469. struct tick_device *td;
  470. int cpu;
  471. for_each_cpu(cpu, mask) {
  472. td = &per_cpu(tick_cpu_device, cpu);
  473. if (td->evtdev)
  474. td->evtdev->next_event = expires;
  475. }
  476. }
  477. /**
  478. * tick_broadcast_setup_oneshot - setup the broadcast device
  479. */
  480. void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
  481. {
  482. int cpu = smp_processor_id();
  483. /* Set it up only once ! */
  484. if (bc->event_handler != tick_handle_oneshot_broadcast) {
  485. int was_periodic = bc->mode == CLOCK_EVT_MODE_PERIODIC;
  486. bc->event_handler = tick_handle_oneshot_broadcast;
  487. /* Take the do_timer update */
  488. tick_do_timer_cpu = cpu;
  489. /*
  490. * We must be careful here. There might be other CPUs
  491. * waiting for periodic broadcast. We need to set the
  492. * oneshot_mask bits for those and program the
  493. * broadcast device to fire.
  494. */
  495. cpumask_copy(to_cpumask(tmpmask), tick_get_broadcast_mask());
  496. cpumask_clear_cpu(cpu, to_cpumask(tmpmask));
  497. cpumask_or(tick_get_broadcast_oneshot_mask(),
  498. tick_get_broadcast_oneshot_mask(),
  499. to_cpumask(tmpmask));
  500. if (was_periodic && !cpumask_empty(to_cpumask(tmpmask))) {
  501. clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT);
  502. tick_broadcast_init_next_event(to_cpumask(tmpmask),
  503. tick_next_period);
  504. tick_broadcast_set_event(tick_next_period, 1);
  505. } else
  506. bc->next_event.tv64 = KTIME_MAX;
  507. } else {
  508. /*
  509. * The first cpu which switches to oneshot mode sets
  510. * the bit for all other cpus which are in the general
  511. * (periodic) broadcast mask. So the bit is set and
  512. * would prevent the first broadcast enter after this
  513. * to program the bc device.
  514. */
  515. tick_broadcast_clear_oneshot(cpu);
  516. }
  517. }
  518. /*
  519. * Select oneshot operating mode for the broadcast device
  520. */
  521. void tick_broadcast_switch_to_oneshot(void)
  522. {
  523. struct clock_event_device *bc;
  524. unsigned long flags;
  525. raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
  526. tick_broadcast_device.mode = TICKDEV_MODE_ONESHOT;
  527. bc = tick_broadcast_device.evtdev;
  528. if (bc)
  529. tick_broadcast_setup_oneshot(bc);
  530. raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
  531. }
  532. /*
  533. * Remove a dead CPU from broadcasting
  534. */
  535. void tick_shutdown_broadcast_oneshot(unsigned int *cpup)
  536. {
  537. unsigned long flags;
  538. unsigned int cpu = *cpup;
  539. raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
  540. /*
  541. * Clear the broadcast mask flag for the dead cpu, but do not
  542. * stop the broadcast device!
  543. */
  544. cpumask_clear_cpu(cpu, tick_get_broadcast_oneshot_mask());
  545. raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
  546. }
  547. /*
  548. * Check, whether the broadcast device is in one shot mode
  549. */
  550. int tick_broadcast_oneshot_active(void)
  551. {
  552. return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT;
  553. }
  554. /*
  555. * Check whether the broadcast device supports oneshot.
  556. */
  557. bool tick_broadcast_oneshot_available(void)
  558. {
  559. struct clock_event_device *bc = tick_broadcast_device.evtdev;
  560. return bc ? bc->features & CLOCK_EVT_FEAT_ONESHOT : false;
  561. }
  562. #endif