| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  *  arch/s390/kernel/irq.c | 
 | 3 |  * | 
 | 4 |  *  S390 version | 
 | 5 |  *    Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation | 
 | 6 |  *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), | 
 | 7 |  * | 
 | 8 |  * This file contains interrupt related functions. | 
 | 9 |  */ | 
 | 10 |  | 
 | 11 | #include <linux/module.h> | 
 | 12 | #include <linux/kernel.h> | 
 | 13 | #include <linux/kernel_stat.h> | 
 | 14 | #include <linux/interrupt.h> | 
 | 15 | #include <linux/seq_file.h> | 
 | 16 | #include <linux/cpu.h> | 
 | 17 |  | 
 | 18 | /* | 
 | 19 |  * show_interrupts is needed by /proc/interrupts. | 
 | 20 |  */ | 
 | 21 | int show_interrupts(struct seq_file *p, void *v) | 
 | 22 | { | 
 | 23 | 	static const char *intrclass_names[] = { "EXT", "I/O", }; | 
 | 24 | 	int i = *(loff_t *) v, j; | 
 | 25 |  | 
 | 26 | 	if (i == 0) { | 
 | 27 | 		seq_puts(p, "           "); | 
 | 28 | 		for_each_online_cpu(j) | 
 | 29 | 			seq_printf(p, "CPU%d       ",j); | 
 | 30 | 		seq_putc(p, '\n'); | 
 | 31 | 	} | 
 | 32 |  | 
 | 33 | 	if (i < NR_IRQS) { | 
 | 34 | 		seq_printf(p, "%s: ", intrclass_names[i]); | 
 | 35 | #ifndef CONFIG_SMP | 
 | 36 | 		seq_printf(p, "%10u ", kstat_irqs(i)); | 
 | 37 | #else | 
 | 38 | 		for_each_online_cpu(j) | 
 | 39 | 			seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); | 
 | 40 | #endif | 
 | 41 |                 seq_putc(p, '\n'); | 
 | 42 |  | 
 | 43 |         } | 
 | 44 |  | 
 | 45 |         return 0; | 
 | 46 | } | 
 | 47 |  | 
 | 48 | /* | 
 | 49 |  * For compatibilty only. S/390 specific setup of interrupts et al. is done | 
 | 50 |  * much later in init_channel_subsystem(). | 
 | 51 |  */ | 
 | 52 | void __init | 
 | 53 | init_IRQ(void) | 
 | 54 | { | 
 | 55 | 	/* nothing... */ | 
 | 56 | } | 
 | 57 |  | 
 | 58 | /* | 
 | 59 |  * Switch to the asynchronous interrupt stack for softirq execution. | 
 | 60 |  */ | 
 | 61 | extern void __do_softirq(void); | 
 | 62 |  | 
 | 63 | asmlinkage void do_softirq(void) | 
 | 64 | { | 
 | 65 | 	unsigned long flags, old, new; | 
 | 66 |  | 
 | 67 | 	if (in_interrupt()) | 
 | 68 | 		return; | 
 | 69 |  | 
 | 70 | 	local_irq_save(flags); | 
 | 71 |  | 
 | 72 | 	account_system_vtime(current); | 
 | 73 |  | 
 | 74 | 	local_bh_disable(); | 
 | 75 |  | 
 | 76 | 	if (local_softirq_pending()) { | 
 | 77 | 		/* Get current stack pointer. */ | 
 | 78 | 		asm volatile("la %0,0(15)" : "=a" (old)); | 
 | 79 | 		/* Check against async. stack address range. */ | 
 | 80 | 		new = S390_lowcore.async_stack; | 
 | 81 | 		if (((new - old) >> (PAGE_SHIFT + THREAD_ORDER)) != 0) { | 
 | 82 | 			/* Need to switch to the async. stack. */ | 
 | 83 | 			new -= STACK_FRAME_OVERHEAD; | 
 | 84 | 			((struct stack_frame *) new)->back_chain = old; | 
 | 85 |  | 
 | 86 | 			asm volatile("   la    15,0(%0)\n" | 
 | 87 | 				     "   basr  14,%2\n" | 
 | 88 | 				     "   la    15,0(%1)\n" | 
 | 89 | 				     : : "a" (new), "a" (old), | 
 | 90 | 				         "a" (__do_softirq) | 
 | 91 | 				     : "0", "1", "2", "3", "4", "5", "14", | 
 | 92 | 				       "cc", "memory" ); | 
 | 93 | 		} else | 
 | 94 | 			/* We are already on the async stack. */ | 
 | 95 | 			__do_softirq(); | 
 | 96 | 	} | 
 | 97 |  | 
 | 98 | 	account_system_vtime(current); | 
 | 99 |  | 
 | 100 | 	__local_bh_enable(); | 
 | 101 |  | 
 | 102 | 	local_irq_restore(flags); | 
 | 103 | } | 
 | 104 |  | 
 | 105 | EXPORT_SYMBOL(do_softirq); |