010-mips_clocksource_init_war.patch 1.1 KB

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