diff options
| author | Paul Mackerras <paulus@samba.org> | 2002-07-27 13:04:39 +1000 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2002-07-27 13:04:39 +1000 |
| commit | 8e70b6f7f899dc4fa10a1c80aa946712447785f4 (patch) | |
| tree | 690cf3ca09e38e16b59240aa87434133dcdaba05 /include | |
| parent | b0ab8396bab3f08959ebd903c55409475975f0aa (diff) | |
| parent | 889d64d50160568ce19ab361433fa69fc66fafa4 (diff) | |
Merge samba.org:/home/paulus/kernel/linux-2.5
into samba.org:/home/paulus/kernel/for-linus-ppc
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-ppc/hardirq.h | 85 | ||||
| -rw-r--r-- | include/asm-ppc/pgtable.h | 17 | ||||
| -rw-r--r-- | include/asm-ppc/smplock.h | 2 | ||||
| -rw-r--r-- | include/asm-ppc/softirq.h | 36 | ||||
| -rw-r--r-- | include/asm-ppc/system.h | 14 |
5 files changed, 47 insertions, 107 deletions
diff --git a/include/asm-ppc/hardirq.h b/include/asm-ppc/hardirq.h index bbe5bfb1cc54..764295d411ea 100644 --- a/include/asm-ppc/hardirq.h +++ b/include/asm-ppc/hardirq.h @@ -15,8 +15,6 @@ */ typedef struct { unsigned long __softirq_pending; /* set_bit is used on this */ - unsigned int __local_irq_count; - unsigned int __local_bh_count; unsigned int __syscall_count; struct task_struct * __ksoftirqd_task; unsigned int __last_jiffy_stamp; @@ -25,89 +23,24 @@ typedef struct { #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ #define last_jiffy_stamp(cpu) __IRQ_STAT((cpu), __last_jiffy_stamp) + +#define IRQ_OFFSET 64 + /* * Are we in an interrupt context? Either doing bottom half * or hardware interrupt processing? */ -#define in_interrupt() ({ int __cpu = smp_processor_id(); \ - (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); }) +#define in_interrupt() ((preempt_count() & ~PREEMPT_ACTIVE) >= IRQ_OFFSET) +#define in_irq in_interrupt -#define in_irq() (local_irq_count(smp_processor_id()) != 0) +#define irq_enter() (preempt_count() += IRQ_OFFSET) +#define irq_exit() (preempt_count() -= IRQ_OFFSET) #ifndef CONFIG_SMP - -#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0) -#define hardirq_endlock(cpu) do { } while (0) - -#define hardirq_enter(cpu) do { preempt_disable(); local_irq_count(cpu)++; } while (0) -#define hardirq_exit(cpu) do { local_irq_count(cpu)--; preempt_enable(); } while (0) - -#define synchronize_irq() do { } while (0) -#define release_irqlock(cpu) do { } while (0) +#define synchronize_irq(irq) barrier() #else /* CONFIG_SMP */ - -#include <asm/atomic.h> - -extern unsigned char global_irq_holder; -extern unsigned volatile long global_irq_lock; - -static inline int irqs_running (void) -{ - int i; - - for (i = 0; i < NR_CPUS; i++) - if (local_irq_count(i)) - return 1; - return 0; -} - -static inline void release_irqlock(int cpu) -{ - /* if we didn't own the irq lock, just ignore.. */ - if (global_irq_holder == (unsigned char) cpu) { - global_irq_holder = NO_PROC_ID; - clear_bit(0,&global_irq_lock); - } -} - -static inline void hardirq_enter(int cpu) -{ - unsigned int loops = 10000000; - - preempt_disable(); - ++local_irq_count(cpu); - while (test_bit(0,&global_irq_lock)) { - if (cpu == global_irq_holder) { - printk("uh oh, interrupt while we hold global irq lock! (CPU %d)\n", cpu); -#ifdef CONFIG_XMON - xmon(0); -#endif - break; - } - if (loops-- == 0) { - printk("do_IRQ waiting for irq lock (holder=%d)\n", global_irq_holder); -#ifdef CONFIG_XMON - xmon(0); -#endif - } - } -} - -static inline void hardirq_exit(int cpu) -{ - --local_irq_count(cpu); - preempt_enable(); -} - -static inline int hardirq_trylock(int cpu) -{ - return !test_bit(0,&global_irq_lock); -} - -#define hardirq_endlock(cpu) do { } while (0) - -extern void synchronize_irq(void); +extern void synchronize_irq(unsigned int irq); #endif /* CONFIG_SMP */ diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index c5bfc1332e5f..a5ee2c62decc 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h @@ -246,6 +246,23 @@ extern unsigned long ioremap_bot, ioremap_base; #define _PAGE_KERNEL _PAGE_BASE | _PAGE_WRENABLE | _PAGE_SHARED | _PAGE_HWEXEC #define _PAGE_IO _PAGE_KERNEL | _PAGE_NO_CACHE | _PAGE_GUARDED +#define _PAGE_RAM _PAGE_KERNEL + +#if defined(CONFIG_KGDB) || defined(CONFIG_XMON) +/* We want the debuggers to be able to set breakpoints anywhere, so + * don't write protect the kernel text */ +#define _PAGE_RAM_TEXT _PAGE_RAM +#else +#ifdef CONFIG_PPC_STD_MMU +/* On standard PPC MMU, no user access implies kernel read/write + * access, so to write-protect the kernel text we must turn on user + * access */ +#define _PAGE_RAM_TEXT (_PAGE_RAM & ~_PAGE_WRENABLE) | _PAGE_USER +#else +#define _PAGE_RAM_TEXT (_PAGE_RAM & ~_PAGE_WRENABLE) +#endif +#endif + #define PAGE_NONE __pgprot(_PAGE_BASE) #define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_USER) #define PAGE_READONLY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC) diff --git a/include/asm-ppc/smplock.h b/include/asm-ppc/smplock.h index 469d3db3f651..e9a3e6487a4f 100644 --- a/include/asm-ppc/smplock.h +++ b/include/asm-ppc/smplock.h @@ -18,7 +18,7 @@ extern spinlock_t kernel_flag; #ifdef CONFIG_SMP #define kernel_locked() spin_is_locked(&kernel_flag) #elif defined(CONFIG_PREEMPT) -#define kernel_locked() preempt_get_count() +#define kernel_locked() preempt_count() #endif /* diff --git a/include/asm-ppc/softirq.h b/include/asm-ppc/softirq.h index d78ec6f37d2e..8c06761f6aad 100644 --- a/include/asm-ppc/softirq.h +++ b/include/asm-ppc/softirq.h @@ -8,31 +8,29 @@ #include <asm/atomic.h> #include <asm/hardirq.h> -#define local_bh_disable() \ -do { \ - preempt_disable(); \ - local_bh_count(smp_processor_id())++; \ - barrier(); \ +#define local_bh_disable() \ +do { \ + preempt_count() += IRQ_OFFSET; \ + barrier(); \ } while (0) -#define __local_bh_enable() \ -do { \ - barrier(); \ - local_bh_count(smp_processor_id())--; \ - preempt_enable(); \ +#define __local_bh_enable() \ +do { \ + barrier(); \ + preempt_count() -= IRQ_OFFSET; \ } while (0) -#define local_bh_enable() \ -do { \ - barrier(); \ - if (!--local_bh_count(smp_processor_id()) \ - && softirq_pending(smp_processor_id())) { \ - do_softirq(); \ - } \ - preempt_enable(); \ +#define local_bh_enable() \ +do { \ + barrier(); \ + if ((preempt_count() -= IRQ_OFFSET) < IRQ_OFFSET \ + && softirq_pending(smp_processor_id())) \ + do_softirq(); \ + if (preempt_count() == 0) \ + preempt_check_resched(); \ } while (0) -#define in_softirq() (local_bh_count(smp_processor_id()) != 0) +#define in_softirq() in_interrupt() #endif /* __ASM_SOFTIRQ_H */ #endif /* __KERNEL__ */ diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index 00fafc7226c1..6829e9df11ca 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h @@ -98,23 +98,15 @@ extern void dump_regs(struct pt_regs *); #ifndef CONFIG_SMP +/* + * Compatibility macros, to be removed in future... + */ #define cli() local_irq_disable() #define sti() local_irq_enable() #define save_flags(flags) local_save_flags(flags) #define restore_flags(flags) local_irq_restore(flags) #define save_and_cli(flags) local_irq_save(flags) -#else /* CONFIG_SMP */ - -extern void __global_cli(void); -extern void __global_sti(void); -extern unsigned long __global_save_flags(void); -extern void __global_restore_flags(unsigned long); -#define cli() __global_cli() -#define sti() __global_sti() -#define save_flags(x) ((x)=__global_save_flags()) -#define restore_flags(x) __global_restore_flags(x) - #endif /* !CONFIG_SMP */ static __inline__ unsigned long |
