diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2006-01-30 18:32:31 -0500 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2006-02-02 16:25:54 -0500 |
commit | a58786917ce23c2a26c3e099c3cdba32a35eeceb (patch) | |
tree | 4740de51febbe16934d24d94cb80432a7547cb26 | |
parent | af14aca90e0cdfccd71f9947c45b6ea2cf321dcb (diff) |
[IA64] avoid broken SAL_CACHE_FLUSH implementations
If SAL_CACHE_FLUSH drops interrupts, complain about it and fall back to
using PAL_CACHE_FLUSH instead.
This is to work around a defect in HP rx5670 firmware: when an interrupt
occurs during SAL_CACHE_FLUSH, SAL drops the interrupt but leaves it marked
"in-service", which leaves the interrupt (and others of equal or lower
priority) masked.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r-- | arch/ia64/kernel/sal.c | 75 | ||||
-rw-r--r-- | include/asm-ia64/processor.h | 17 | ||||
-rw-r--r-- | include/asm-ia64/sal.h | 10 |
3 files changed, 93 insertions, 9 deletions
diff --git a/arch/ia64/kernel/sal.c b/arch/ia64/kernel/sal.c index acc0f132f86c..056f7a6eedc7 100644 --- a/arch/ia64/kernel/sal.c +++ b/arch/ia64/kernel/sal.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
15 | #include <linux/string.h> | 15 | #include <linux/string.h> |
16 | 16 | ||
17 | #include <asm/delay.h> | ||
17 | #include <asm/page.h> | 18 | #include <asm/page.h> |
18 | #include <asm/sal.h> | 19 | #include <asm/sal.h> |
19 | #include <asm/pal.h> | 20 | #include <asm/pal.h> |
@@ -214,6 +215,78 @@ chk_nointroute_opt(void) | |||
214 | static void __init sal_desc_ap_wakeup(void *p) { } | 215 | static void __init sal_desc_ap_wakeup(void *p) { } |
215 | #endif | 216 | #endif |
216 | 217 | ||
218 | /* | ||
219 | * HP rx5670 firmware polls for interrupts during SAL_CACHE_FLUSH by reading | ||
220 | * cr.ivr, but it never writes cr.eoi. This leaves any interrupt marked as | ||
221 | * "in-service" and masks other interrupts of equal or lower priority. | ||
222 | * | ||
223 | * HP internal defect reports: F1859, F2775, F3031. | ||
224 | */ | ||
225 | static int sal_cache_flush_drops_interrupts; | ||
226 | |||
227 | static void __init | ||
228 | check_sal_cache_flush (void) | ||
229 | { | ||
230 | unsigned long flags, itv; | ||
231 | int cpu; | ||
232 | u64 vector; | ||
233 | |||
234 | cpu = get_cpu(); | ||
235 | local_irq_save(flags); | ||
236 | |||
237 | /* | ||
238 | * Schedule a timer interrupt, wait until it's reported, and see if | ||
239 | * SAL_CACHE_FLUSH drops it. | ||
240 | */ | ||
241 | itv = ia64_get_itv(); | ||
242 | BUG_ON((itv & (1 << 16)) == 0); | ||
243 | |||
244 | ia64_set_itv(IA64_TIMER_VECTOR); | ||
245 | ia64_set_itm(ia64_get_itc() + 1000); | ||
246 | |||
247 | while (!ia64_get_irr(IA64_TIMER_VECTOR)) | ||
248 | cpu_relax(); | ||
249 | |||
250 | ia64_sal_cache_flush(3); | ||
251 | |||
252 | if (ia64_get_irr(IA64_TIMER_VECTOR)) { | ||
253 | vector = ia64_get_ivr(); | ||
254 | ia64_eoi(); | ||
255 | WARN_ON(vector != IA64_TIMER_VECTOR); | ||
256 | } else { | ||
257 | sal_cache_flush_drops_interrupts = 1; | ||
258 | printk(KERN_ERR "SAL: SAL_CACHE_FLUSH drops interrupts; " | ||
259 | "PAL_CACHE_FLUSH will be used instead\n"); | ||
260 | ia64_eoi(); | ||
261 | } | ||
262 | |||
263 | ia64_set_itv(itv); | ||
264 | local_irq_restore(flags); | ||
265 | put_cpu(); | ||
266 | } | ||
267 | |||
268 | s64 | ||
269 | ia64_sal_cache_flush (u64 cache_type) | ||
270 | { | ||
271 | struct ia64_sal_retval isrv; | ||
272 | |||
273 | if (sal_cache_flush_drops_interrupts) { | ||
274 | unsigned long flags; | ||
275 | u64 progress; | ||
276 | s64 rc; | ||
277 | |||
278 | progress = 0; | ||
279 | local_irq_save(flags); | ||
280 | rc = ia64_pal_cache_flush(cache_type, | ||
281 | PAL_CACHE_FLUSH_INVALIDATE, &progress, NULL); | ||
282 | local_irq_restore(flags); | ||
283 | return rc; | ||
284 | } | ||
285 | |||
286 | SAL_CALL(isrv, SAL_CACHE_FLUSH, cache_type, 0, 0, 0, 0, 0, 0); | ||
287 | return isrv.status; | ||
288 | } | ||
289 | |||
217 | void __init | 290 | void __init |
218 | ia64_sal_init (struct ia64_sal_systab *systab) | 291 | ia64_sal_init (struct ia64_sal_systab *systab) |
219 | { | 292 | { |
@@ -262,6 +335,8 @@ ia64_sal_init (struct ia64_sal_systab *systab) | |||
262 | } | 335 | } |
263 | p += SAL_DESC_SIZE(*p); | 336 | p += SAL_DESC_SIZE(*p); |
264 | } | 337 | } |
338 | |||
339 | check_sal_cache_flush(); | ||
265 | } | 340 | } |
266 | 341 | ||
267 | int | 342 | int |
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h index 09b99029ac1a..23c8e1be1911 100644 --- a/include/asm-ia64/processor.h +++ b/include/asm-ia64/processor.h | |||
@@ -559,6 +559,23 @@ ia64_eoi (void) | |||
559 | 559 | ||
560 | #define cpu_relax() ia64_hint(ia64_hint_pause) | 560 | #define cpu_relax() ia64_hint(ia64_hint_pause) |
561 | 561 | ||
562 | static inline int | ||
563 | ia64_get_irr(unsigned int vector) | ||
564 | { | ||
565 | unsigned int reg = vector / 64; | ||
566 | unsigned int bit = vector % 64; | ||
567 | u64 irr; | ||
568 | |||
569 | switch (reg) { | ||
570 | case 0: irr = ia64_getreg(_IA64_REG_CR_IRR0); break; | ||
571 | case 1: irr = ia64_getreg(_IA64_REG_CR_IRR1); break; | ||
572 | case 2: irr = ia64_getreg(_IA64_REG_CR_IRR2); break; | ||
573 | case 3: irr = ia64_getreg(_IA64_REG_CR_IRR3); break; | ||
574 | } | ||
575 | |||
576 | return test_bit(bit, &irr); | ||
577 | } | ||
578 | |||
562 | static inline void | 579 | static inline void |
563 | ia64_set_lrr0 (unsigned long val) | 580 | ia64_set_lrr0 (unsigned long val) |
564 | { | 581 | { |
diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h index 313cad0628d0..0b210abbe003 100644 --- a/include/asm-ia64/sal.h +++ b/include/asm-ia64/sal.h | |||
@@ -658,15 +658,7 @@ ia64_sal_freq_base (unsigned long which, unsigned long *ticks_per_second, | |||
658 | return isrv.status; | 658 | return isrv.status; |
659 | } | 659 | } |
660 | 660 | ||
661 | /* Flush all the processor and platform level instruction and/or data caches */ | 661 | extern s64 ia64_sal_cache_flush (u64 cache_type); |
662 | static inline s64 | ||
663 | ia64_sal_cache_flush (u64 cache_type) | ||
664 | { | ||
665 | struct ia64_sal_retval isrv; | ||
666 | SAL_CALL(isrv, SAL_CACHE_FLUSH, cache_type, 0, 0, 0, 0, 0, 0); | ||
667 | return isrv.status; | ||
668 | } | ||
669 | |||
670 | 662 | ||
671 | /* Initialize all the processor and platform level instruction and data caches */ | 663 | /* Initialize all the processor and platform level instruction and data caches */ |
672 | static inline s64 | 664 | static inline s64 |