010-mips_clocksource_init_war.patch 968 B

123456789101112131415161718192021222324252627282930313233
  1. --- a/arch/mips/kernel/cevt-r4k.c
  2. +++ b/arch/mips/kernel/cevt-r4k.c
  3. @@ -23,6 +23,22 @@
  4. #ifndef CONFIG_MIPS_MT_SMTC
  5. +/*
  6. + * Compare interrupt can be routed and latched outside the core,
  7. + * so a single execution hazard barrier may not be enough to give
  8. + * it time to clear as seen in the Cause register. 4 time the
  9. + * pipeline depth seems reasonably conservative, and empirically
  10. + * works better in configurations with high CPU/bus clock ratios.
  11. + */
  12. +
  13. +#define compare_change_hazard() \
  14. + do { \
  15. + irq_disable_hazard(); \
  16. + irq_disable_hazard(); \
  17. + irq_disable_hazard(); \
  18. + irq_disable_hazard(); \
  19. + } while (0)
  20. +
  21. static int mips_next_event(unsigned long delta,
  22. struct clock_event_device *evt)
  23. {
  24. @@ -32,6 +48,7 @@ static int mips_next_event(unsigned long
  25. cnt = read_c0_count();
  26. cnt += delta;
  27. write_c0_compare(cnt);
  28. + compare_change_hazard();
  29. res = ((int)(read_c0_count() - cnt) >= 0) ? -ETIME : 0;
  30. return res;
  31. }