From 69588298188b40ed7f75c98a6fd328d82f23ca21 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 4 Sep 2006 21:53:14 -0700 Subject: [POWERPC] Implement PowerPC futex_atomic_cmpxchg_inatomic(). The sys_[gs]et_robust_list() syscalls were wired up on PowerPC but didn't work correctly because futex_atomic_cmpxchg_inatomic() wasn't implemented. Implement it, based on __cmpxchg_u32(). Signed-off-by: David Woodhouse Signed-off-by: Paul Mackerras --- include/asm-powerpc/futex.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-powerpc/futex.h b/include/asm-powerpc/futex.h index f1b3c00bc1ce..936422e54891 100644 --- a/include/asm-powerpc/futex.h +++ b/include/asm-powerpc/futex.h @@ -84,7 +84,33 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr) static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) { - return -ENOSYS; + int prev; + + if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) + return -EFAULT; + + __asm__ __volatile__ ( + LWSYNC_ON_SMP +"1: lwarx %0,0,%2 # futex_atomic_cmpxchg_inatomic\n\ + cmpw 0,%0,%3\n\ + bne- 3f\n" + PPC405_ERR77(0,%2) +"2: stwcx. %4,0,%2\n\ + bne- 1b\n" + ISYNC_ON_SMP +"3: .section .fixup,\"ax\"\n\ +4: li %0,%5\n\ + b 3b\n\ + .previous\n\ + .section __ex_table,\"a\"\n\ + .align 3\n\ + " PPC_LONG "1b,4b,2b,4b\n\ + .previous" \ + : "=&r" (prev), "+m" (*uaddr) + : "r" (uaddr), "r" (oldval), "r" (newval), "i" (-EFAULT) + : "cc", "memory"); + + return prev; } #endif /* __KERNEL__ */ -- cgit v1.2.3 From e269d269e0b53a7a6cb1d04290f8174bf0488cb4 Mon Sep 17 00:00:00 2001 From: "Sachin P. Sant" Date: Fri, 8 Sep 2006 07:59:52 +0530 Subject: [POWERPC] kdump: Support kernels having 64k page size. This is required to generate proper core files using kdump on ppc64. Create a backup region of 64K size irrespective of the PAGE SIZE. At present 32K was used as backup size. In the case of 64K page size, second PT_LOAD segments starts at 32K and the first one is not page aligned. __ioremap() (crash_dump.c) fails if pfn = 0 which is the case for the second PT_LOAD segment. This is not an issue for 4K page size because the the first page (32K backup) is copied to second kernel memory and thus referencing with the second kernel pfn. Signed-off-by: Sachin Sant Signed-off-by: Paul Mackerras --- include/asm-powerpc/kdump.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-powerpc/kdump.h b/include/asm-powerpc/kdump.h index dc1574c945f8..10e8eb1e6f4f 100644 --- a/include/asm-powerpc/kdump.h +++ b/include/asm-powerpc/kdump.h @@ -7,7 +7,7 @@ /* How many bytes to reserve at zero for kdump. The reserve limit should * be greater or equal to the trampoline's end address. * Reserve to the end of the FWNMI area, see head_64.S */ -#define KDUMP_RESERVE_LIMIT 0x8000 +#define KDUMP_RESERVE_LIMIT 0x10000 /* 64K */ #ifdef CONFIG_CRASH_DUMP -- cgit v1.2.3 From f007cacffc8870702a1473d83ba5e4922d54e17c Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Wed, 13 Sep 2006 22:08:26 +1000 Subject: [POWERPC] Fix MMIO ops to provide expected barrier behaviour This changes the writeX family of functions to have a sync instruction before the MMIO store rather than after, because the generally expected behaviour is that the device receiving the MMIO store can be guaranteed to see the effects of any preceding writes to normal memory. To preserve ordering between writeX and readX, and to preserve ordering between preceding stores and the readX, the readX family of functions have had an sync added before the load. Although writeX followed by spin_unlock is not officially guaranteed to keep the writeX inside the spin-locked region unless an mmiowb() is used, there are currently drivers that depend on the previous behaviour on powerpc, which was that the mmiowb wasn't actually required. Therefore we have a per-cpu flag that is set by writeX, cleared by __raw_spin_lock and mmiowb, and tested by __raw_spin_unlock. If it is set, __raw_spin_unlock does a sync and clears it. This changes both 32-bit and 64-bit readX/writeX. 32-bit already has a sync in __raw_spin_unlock (since lwsync doesn't exist on 32-bit), and thus doesn't need the per-cpu flag. Tested on G5 (PPC970) and POWER5. Signed-off-by: Paul Mackerras --- arch/powerpc/kernel/misc.S | 49 +++++++++++++++++++++--------------------- include/asm-powerpc/eeh.h | 3 +++ include/asm-powerpc/io.h | 43 +++++++++++++++++++++++------------- include/asm-powerpc/paca.h | 1 + include/asm-powerpc/spinlock.h | 17 +++++++++++++++ include/asm-ppc/io.h | 20 +++++++++-------- 6 files changed, 85 insertions(+), 48 deletions(-) (limited to 'include') diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S index fc23040d5a26..f770805f1215 100644 --- a/arch/powerpc/kernel/misc.S +++ b/arch/powerpc/kernel/misc.S @@ -17,15 +17,6 @@ .text -#ifdef CONFIG_PPC64 -#define IN_SYNC twi 0,r5,0; isync -#define EIEIO_32 -#define SYNC_64 sync -#else /* CONFIG_PPC32 */ -#define IN_SYNC -#define EIEIO_32 eieio -#define SYNC_64 -#endif /* * Returns (address we are running at) - (address we were linked at) * for use before the text and data are mapped to KERNELBASE. @@ -70,6 +61,7 @@ _GLOBAL(add_reloc_offset) * The *_ns versions don't do byte-swapping. */ _GLOBAL(_insb) + sync cmpwi 0,r5,0 mtctr r5 subi r4,r4,1 @@ -78,7 +70,8 @@ _GLOBAL(_insb) eieio stbu r5,1(r4) bdnz 00b - IN_SYNC + twi 0,r5,0 + isync blr _GLOBAL(_outsb) @@ -86,14 +79,15 @@ _GLOBAL(_outsb) mtctr r5 subi r4,r4,1 blelr- + sync 00: lbzu r5,1(r4) stb r5,0(r3) - EIEIO_32 bdnz 00b - SYNC_64 + sync blr _GLOBAL(_insw) + sync cmpwi 0,r5,0 mtctr r5 subi r4,r4,2 @@ -102,7 +96,8 @@ _GLOBAL(_insw) eieio sthu r5,2(r4) bdnz 00b - IN_SYNC + twi 0,r5,0 + isync blr _GLOBAL(_outsw) @@ -110,14 +105,15 @@ _GLOBAL(_outsw) mtctr r5 subi r4,r4,2 blelr- + sync 00: lhzu r5,2(r4) - EIEIO_32 sthbrx r5,0,r3 bdnz 00b - SYNC_64 + sync blr _GLOBAL(_insl) + sync cmpwi 0,r5,0 mtctr r5 subi r4,r4,4 @@ -126,7 +122,8 @@ _GLOBAL(_insl) eieio stwu r5,4(r4) bdnz 00b - IN_SYNC + twi 0,r5,0 + isync blr _GLOBAL(_outsl) @@ -134,17 +131,18 @@ _GLOBAL(_outsl) mtctr r5 subi r4,r4,4 blelr- + sync 00: lwzu r5,4(r4) stwbrx r5,0,r3 - EIEIO_32 bdnz 00b - SYNC_64 + sync blr #ifdef CONFIG_PPC32 _GLOBAL(__ide_mm_insw) #endif _GLOBAL(_insw_ns) + sync cmpwi 0,r5,0 mtctr r5 subi r4,r4,2 @@ -153,7 +151,8 @@ _GLOBAL(_insw_ns) eieio sthu r5,2(r4) bdnz 00b - IN_SYNC + twi 0,r5,0 + isync blr #ifdef CONFIG_PPC32 @@ -164,17 +163,18 @@ _GLOBAL(_outsw_ns) mtctr r5 subi r4,r4,2 blelr- + sync 00: lhzu r5,2(r4) sth r5,0(r3) - EIEIO_32 bdnz 00b - SYNC_64 + sync blr #ifdef CONFIG_PPC32 _GLOBAL(__ide_mm_insl) #endif _GLOBAL(_insl_ns) + sync cmpwi 0,r5,0 mtctr r5 subi r4,r4,4 @@ -183,7 +183,8 @@ _GLOBAL(_insl_ns) eieio stwu r5,4(r4) bdnz 00b - IN_SYNC + twi 0,r5,0 + isync blr #ifdef CONFIG_PPC32 @@ -194,10 +195,10 @@ _GLOBAL(_outsl_ns) mtctr r5 subi r4,r4,4 blelr- + sync 00: lwzu r5,4(r4) stw r5,0(r3) - EIEIO_32 bdnz 00b - SYNC_64 + sync blr diff --git a/include/asm-powerpc/eeh.h b/include/asm-powerpc/eeh.h index 4df3e80118f4..6a784396660b 100644 --- a/include/asm-powerpc/eeh.h +++ b/include/asm-powerpc/eeh.h @@ -205,6 +205,7 @@ static inline void eeh_memset_io(volatile void __iomem *addr, int c, lc |= lc << 8; lc |= lc << 16; + __asm__ __volatile__ ("sync" : : : "memory"); while(n && !EEH_CHECK_ALIGN(p, 4)) { *((volatile u8 *)p) = c; p++; @@ -229,6 +230,7 @@ static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *sr void *destsave = dest; unsigned long nsave = n; + __asm__ __volatile__ ("sync" : : : "memory"); while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) { *((u8 *)dest) = *((volatile u8 *)vsrc); __asm__ __volatile__ ("eieio" : : : "memory"); @@ -266,6 +268,7 @@ static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src, { void *vdest = (void __force *) dest; + __asm__ __volatile__ ("sync" : : : "memory"); while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) { *((volatile u8 *)vdest) = *((u8 *)src); src++; diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h index 36c4c34bf565..212428db0d8b 100644 --- a/include/asm-powerpc/io.h +++ b/include/asm-powerpc/io.h @@ -19,6 +19,7 @@ extern int check_legacy_ioport(unsigned long base_port); #include #include #include +#include #ifdef CONFIG_PPC_ISERIES #include #endif @@ -162,7 +163,11 @@ extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns); extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl); extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl); -#define mmiowb() +static inline void mmiowb(void) +{ + __asm__ __volatile__ ("sync" : : : "memory"); + get_paca()->io_sync = 0; +} /* * output pause versions need a delay at least for the @@ -278,22 +283,23 @@ static inline int in_8(const volatile unsigned char __iomem *addr) { int ret; - __asm__ __volatile__("lbz%U1%X1 %0,%1; twi 0,%0,0; isync" + __asm__ __volatile__("sync; lbz%U1%X1 %0,%1; twi 0,%0,0; isync" : "=r" (ret) : "m" (*addr)); return ret; } static inline void out_8(volatile unsigned char __iomem *addr, int val) { - __asm__ __volatile__("stb%U0%X0 %1,%0; sync" + __asm__ __volatile__("sync; stb%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); + get_paca()->io_sync = 1; } static inline int in_le16(const volatile unsigned short __iomem *addr) { int ret; - __asm__ __volatile__("lhbrx %0,0,%1; twi 0,%0,0; isync" + __asm__ __volatile__("sync; lhbrx %0,0,%1; twi 0,%0,0; isync" : "=r" (ret) : "r" (addr), "m" (*addr)); return ret; } @@ -302,28 +308,30 @@ static inline int in_be16(const volatile unsigned short __iomem *addr) { int ret; - __asm__ __volatile__("lhz%U1%X1 %0,%1; twi 0,%0,0; isync" + __asm__ __volatile__("sync; lhz%U1%X1 %0,%1; twi 0,%0,0; isync" : "=r" (ret) : "m" (*addr)); return ret; } static inline void out_le16(volatile unsigned short __iomem *addr, int val) { - __asm__ __volatile__("sthbrx %1,0,%2; sync" + __asm__ __volatile__("sync; sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); + get_paca()->io_sync = 1; } static inline void out_be16(volatile unsigned short __iomem *addr, int val) { - __asm__ __volatile__("sth%U0%X0 %1,%0; sync" + __asm__ __volatile__("sync; sth%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); + get_paca()->io_sync = 1; } static inline unsigned in_le32(const volatile unsigned __iomem *addr) { unsigned ret; - __asm__ __volatile__("lwbrx %0,0,%1; twi 0,%0,0; isync" + __asm__ __volatile__("sync; lwbrx %0,0,%1; twi 0,%0,0; isync" : "=r" (ret) : "r" (addr), "m" (*addr)); return ret; } @@ -332,21 +340,23 @@ static inline unsigned in_be32(const volatile unsigned __iomem *addr) { unsigned ret; - __asm__ __volatile__("lwz%U1%X1 %0,%1; twi 0,%0,0; isync" + __asm__ __volatile__("sync; lwz%U1%X1 %0,%1; twi 0,%0,0; isync" : "=r" (ret) : "m" (*addr)); return ret; } static inline void out_le32(volatile unsigned __iomem *addr, int val) { - __asm__ __volatile__("stwbrx %1,0,%2; sync" : "=m" (*addr) + __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); + get_paca()->io_sync = 1; } static inline void out_be32(volatile unsigned __iomem *addr, int val) { - __asm__ __volatile__("stw%U0%X0 %1,%0; sync" + __asm__ __volatile__("sync; stw%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); + get_paca()->io_sync = 1; } static inline unsigned long in_le64(const volatile unsigned long __iomem *addr) @@ -354,6 +364,7 @@ static inline unsigned long in_le64(const volatile unsigned long __iomem *addr) unsigned long tmp, ret; __asm__ __volatile__( + "sync\n" "ld %1,0(%2)\n" "twi 0,%1,0\n" "isync\n" @@ -372,7 +383,7 @@ static inline unsigned long in_be64(const volatile unsigned long __iomem *addr) { unsigned long ret; - __asm__ __volatile__("ld%U1%X1 %0,%1; twi 0,%0,0; isync" + __asm__ __volatile__("sync; ld%U1%X1 %0,%1; twi 0,%0,0; isync" : "=r" (ret) : "m" (*addr)); return ret; } @@ -389,14 +400,16 @@ static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long "rldicl %1,%1,32,0\n" "rlwimi %0,%1,8,8,31\n" "rlwimi %0,%1,24,16,23\n" - "std %0,0(%3)\n" - "sync" + "sync\n" + "std %0,0(%3)" : "=&r" (tmp) , "=&r" (val) : "1" (val) , "b" (addr) , "m" (*addr)); + get_paca()->io_sync = 1; } static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long val) { - __asm__ __volatile__("std%U0%X0 %1,%0; sync" : "=m" (*addr) : "r" (val)); + __asm__ __volatile__("sync; std%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); + get_paca()->io_sync = 1; } #ifndef CONFIG_PPC_ISERIES diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h index 2d4585f06209..3d5d590bc4b0 100644 --- a/include/asm-powerpc/paca.h +++ b/include/asm-powerpc/paca.h @@ -93,6 +93,7 @@ struct paca_struct { u64 saved_r1; /* r1 save for RTAS calls */ u64 saved_msr; /* MSR saved here by enter_rtas */ u8 proc_enabled; /* irq soft-enable flag */ + u8 io_sync; /* writel() needs spin_unlock sync */ /* Stuff for accurate time accounting */ u64 user_time; /* accumulated usermode TB ticks */ diff --git a/include/asm-powerpc/spinlock.h b/include/asm-powerpc/spinlock.h index 895cb6d3a42a..c31e4382a775 100644 --- a/include/asm-powerpc/spinlock.h +++ b/include/asm-powerpc/spinlock.h @@ -36,6 +36,19 @@ #define LOCK_TOKEN 1 #endif +#if defined(CONFIG_PPC64) && defined(CONFIG_SMP) +#define CLEAR_IO_SYNC (get_paca()->io_sync = 0) +#define SYNC_IO do { \ + if (unlikely(get_paca()->io_sync)) { \ + mb(); \ + get_paca()->io_sync = 0; \ + } \ + } while (0) +#else +#define CLEAR_IO_SYNC +#define SYNC_IO +#endif + /* * This returns the old value in the lock, so we succeeded * in getting the lock if the return value is 0. @@ -61,6 +74,7 @@ static __inline__ unsigned long __spin_trylock(raw_spinlock_t *lock) static int __inline__ __raw_spin_trylock(raw_spinlock_t *lock) { + CLEAR_IO_SYNC; return __spin_trylock(lock) == 0; } @@ -91,6 +105,7 @@ extern void __rw_yield(raw_rwlock_t *lock); static void __inline__ __raw_spin_lock(raw_spinlock_t *lock) { + CLEAR_IO_SYNC; while (1) { if (likely(__spin_trylock(lock) == 0)) break; @@ -107,6 +122,7 @@ static void __inline__ __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long { unsigned long flags_dis; + CLEAR_IO_SYNC; while (1) { if (likely(__spin_trylock(lock) == 0)) break; @@ -124,6 +140,7 @@ static void __inline__ __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long static __inline__ void __raw_spin_unlock(raw_spinlock_t *lock) { + SYNC_IO; __asm__ __volatile__("# __raw_spin_unlock\n\t" LWSYNC_ON_SMP: : :"memory"); lock->slock = 0; diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h index 89c6f1bc3aab..680555be22ec 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h @@ -63,7 +63,7 @@ extern inline int in_8(const volatile unsigned char __iomem *addr) int ret; __asm__ __volatile__( - "lbz%U1%X1 %0,%1;\n" + "sync; lbz%U1%X1 %0,%1;\n" "twi 0,%0,0;\n" "isync" : "=r" (ret) : "m" (*addr)); return ret; @@ -78,7 +78,7 @@ extern inline int in_le16(const volatile unsigned short __iomem *addr) { int ret; - __asm__ __volatile__("lhbrx %0,0,%1;\n" + __asm__ __volatile__("sync; lhbrx %0,0,%1;\n" "twi 0,%0,0;\n" "isync" : "=r" (ret) : "r" (addr), "m" (*addr)); @@ -89,7 +89,7 @@ extern inline int in_be16(const volatile unsigned short __iomem *addr) { int ret; - __asm__ __volatile__("lhz%U1%X1 %0,%1;\n" + __asm__ __volatile__("sync; lhz%U1%X1 %0,%1;\n" "twi 0,%0,0;\n" "isync" : "=r" (ret) : "m" (*addr)); return ret; @@ -97,20 +97,20 @@ extern inline int in_be16(const volatile unsigned short __iomem *addr) extern inline void out_le16(volatile unsigned short __iomem *addr, int val) { - __asm__ __volatile__("sthbrx %1,0,%2; eieio" : "=m" (*addr) : + __asm__ __volatile__("sync; sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); } extern inline void out_be16(volatile unsigned short __iomem *addr, int val) { - __asm__ __volatile__("sth%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); + __asm__ __volatile__("sync; sth%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); } extern inline unsigned in_le32(const volatile unsigned __iomem *addr) { unsigned ret; - __asm__ __volatile__("lwbrx %0,0,%1;\n" + __asm__ __volatile__("sync; lwbrx %0,0,%1;\n" "twi 0,%0,0;\n" "isync" : "=r" (ret) : "r" (addr), "m" (*addr)); @@ -121,7 +121,7 @@ extern inline unsigned in_be32(const volatile unsigned __iomem *addr) { unsigned ret; - __asm__ __volatile__("lwz%U1%X1 %0,%1;\n" + __asm__ __volatile__("sync; lwz%U1%X1 %0,%1;\n" "twi 0,%0,0;\n" "isync" : "=r" (ret) : "m" (*addr)); return ret; @@ -129,13 +129,13 @@ extern inline unsigned in_be32(const volatile unsigned __iomem *addr) extern inline void out_le32(volatile unsigned __iomem *addr, int val) { - __asm__ __volatile__("stwbrx %1,0,%2; eieio" : "=m" (*addr) : + __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); } extern inline void out_be32(volatile unsigned __iomem *addr, int val) { - __asm__ __volatile__("stw%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val)); + __asm__ __volatile__("sync; stw%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); } #if defined (CONFIG_8260_PCI9) #define readb(addr) in_8((volatile u8 *)(addr)) @@ -259,6 +259,7 @@ extern __inline__ unsigned int name(unsigned int port) \ { \ unsigned int x; \ __asm__ __volatile__( \ + "sync\n" \ "0:" op " %0,0,%1\n" \ "1: twi 0,%0,0\n" \ "2: isync\n" \ @@ -284,6 +285,7 @@ extern __inline__ unsigned int name(unsigned int port) \ extern __inline__ void name(unsigned int val, unsigned int port) \ { \ __asm__ __volatile__( \ + "sync\n" \ "0:" op " %0,0,%1\n" \ "1: sync\n" \ "2:\n" \ -- cgit v1.2.3 From 7f1cbe51ffc1273bcded36742ede4b6ebef1b640 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 12 Sep 2006 20:36:02 -0700 Subject: [PATCH] headers_check: reduce user-visible noise in We don't need any of this crap included from the user-visible part of nfs_fs.h -- remove it all. In fact, we probably don't need anything but NFS_SUPER_MAGIC to be defined; is there any need for anything else? And magic numbers should probably move to rather than being strewn across various fs-specific include files which exist in userspace for solely that purpose. With this patch, 'make header_check' works again at least on PowerPC. Signed-off-by: David Woodhouse Cc: Trond Myklebust Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/nfs_fs.h | 52 +++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'include') diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 530b1e6173b1..6c2066caeaab 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -9,27 +9,6 @@ #ifndef _LINUX_NFS_FS_H #define _LINUX_NFS_FS_H -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include - /* * Enable debugging support for nfs client. * Requires RPC_DEBUG. @@ -47,11 +26,6 @@ */ #define NFS_SUPER_MAGIC 0x6969 -/* - * These are the default flags for swap requests - */ -#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) - /* * When flushing a cluster of dirty pages, there can be different * strategies: @@ -65,6 +39,32 @@ #ifdef __KERNEL__ +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include + +/* + * These are the default flags for swap requests + */ +#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) + /* * NFSv3/v4 Access mode cache entry */ -- cgit v1.2.3 From ee6baf884b27739cca110e5167a2edfa061ca19f Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 12 Sep 2006 20:36:03 -0700 Subject: [PATCH] headers_check: remove from user export There's useful stuff in but has nothing for userspace. Stop exporting it, and include it only from within the existing #ifdef __KERNEL__ part of This fixes a 'make headers_check' failure on i386 because asm-i386/timex.h includes both asm-i386/tsc.h and asm-i386/processor.h, neither of which are exported to userspace. It's not entirely clear _why_ it includes either of these, but it does. Signed-off-by: David Woodhouse Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-generic/Kbuild.asm | 2 +- include/linux/timex.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm index 6b16dda18115..c00de6028fa8 100644 --- a/include/asm-generic/Kbuild.asm +++ b/include/asm-generic/Kbuild.asm @@ -2,7 +2,7 @@ unifdef-y += a.out.h auxvec.h byteorder.h errno.h fcntl.h ioctl.h \ ioctls.h ipcbuf.h mman.h msgbuf.h param.h poll.h \ posix_types.h ptrace.h resource.h sembuf.h shmbuf.h shmparam.h \ sigcontext.h siginfo.h signal.h socket.h sockios.h stat.h \ - statfs.h termbits.h termios.h timex.h types.h unistd.h user.h + statfs.h termbits.h termios.h types.h unistd.h user.h # These probably shouldn't be exported unifdef-y += elf.h page.h diff --git a/include/linux/timex.h b/include/linux/timex.h index 19bb6538b49e..d543d3871e38 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h @@ -57,7 +57,6 @@ #include #include -#include /* * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen @@ -191,6 +190,8 @@ struct timex { #define TIME_BAD TIME_ERROR /* bw compat */ #ifdef __KERNEL__ +#include + /* * kernel variables * Note: maximum error = NTP synch distance = dispersion + delay / 2; -- cgit v1.2.3 From b40c274a03f70d1f758753c56452bed506e47a09 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 12 Sep 2006 20:36:04 -0700 Subject: [PATCH] headers_check: move inclusion of in Because doesn't exist in userspace, it should be only included from within #ifdef __KERNEL__. Move the corresponding #include Signed-off-by: David Woodhouse Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-i386/signal.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-i386/signal.h b/include/asm-i386/signal.h index 3824a502351f..c3e8adec5918 100644 --- a/include/asm-i386/signal.h +++ b/include/asm-i386/signal.h @@ -2,7 +2,6 @@ #define _ASMi386_SIGNAL_H #include -#include #include #include @@ -10,6 +9,9 @@ struct siginfo; #ifdef __KERNEL__ + +#include + /* Most things should be clean enough to redefine this at will, if care is taken to make libc match. */ -- cgit v1.2.3 From 651c923a4446dc5aee385d81c2436d6edf8c9a0c Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 12 Sep 2006 20:36:04 -0700 Subject: [PATCH] headers_check: move kernel-only #includes within Some files which don't exist in userspace were being included unconditionally in asm-i386/elf.h. Move the offending #includes down a few lines so that they're protected by #ifdef __KERNEL__ In fact, we probably want to kill off all userspace use of asm/elf.h -- but we aren't there yet, so we should at least make it possible to include it for now. Signed-off-by: David Woodhouse Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-i386/elf.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h index 1eac92cb5b16..db4344d9f73f 100644 --- a/include/asm-i386/elf.h +++ b/include/asm-i386/elf.h @@ -7,10 +7,7 @@ #include #include -#include -#include /* for savesegment */ #include -#include #include @@ -48,6 +45,12 @@ typedef struct user_fxsr_struct elf_fpxregset_t; #define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_386 +#ifdef __KERNEL__ + +#include +#include /* for savesegment */ +#include + /* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx contains a pointer to a function which might be registered using `atexit'. This provides a mean for the dynamic linker to call DT_FINI functions for @@ -111,7 +114,6 @@ typedef struct user_fxsr_struct elf_fpxregset_t; #define ELF_PLATFORM (system_utsname.machine) -#ifdef __KERNEL__ #define SET_PERSONALITY(ex, ibcs2) do { } while (0) /* -- cgit v1.2.3 From f01f0f052d1255dcdcf11d4872c4bca95e46b36c Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 12 Sep 2006 20:36:05 -0700 Subject: [PATCH] headers_check: don't expose PFN stuff to userspace in The header file doesn't exist in userspace and probably shouldn't -- but it's used unconditionally in . Protect it with #ifdef __KERNEL__ and move setup.h from $(header-y) to $(unifdef-y) in Kbuild accordingly. Signed-off-by: David Woodhouse Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-i386/Kbuild | 4 ++-- include/asm-i386/setup.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/asm-i386/Kbuild b/include/asm-i386/Kbuild index 335b2fa4e066..2308190321da 100644 --- a/include/asm-i386/Kbuild +++ b/include/asm-i386/Kbuild @@ -1,5 +1,5 @@ include include/asm-generic/Kbuild.asm -header-y += boot.h debugreg.h ldt.h setup.h ucontext.h +header-y += boot.h debugreg.h ldt.h ucontext.h -unifdef-y += mtrr.h vm86.h +unifdef-y += mtrr.h setup.h vm86.h diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h index f737e423029e..2734909eff84 100644 --- a/include/asm-i386/setup.h +++ b/include/asm-i386/setup.h @@ -6,6 +6,7 @@ #ifndef _i386_SETUP_H #define _i386_SETUP_H +#ifdef __KERNEL__ #include /* @@ -13,6 +14,7 @@ */ #define MAXMEM_PFN PFN_DOWN(MAXMEM) #define MAX_NONPAE_PFN (1 << 20) +#endif #define PARAM_SIZE 4096 #define COMMAND_LINE_SIZE 256 -- cgit v1.2.3 From a2aa3e2304e21e2b8bf52b69ac9f1e0cb0320909 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 12 Sep 2006 20:36:06 -0700 Subject: [PATCH] headers_check: fix userspace build of asm-mips/page.h MIPS asm/page.h unconditionally includes , which doesn't exist in userspace. Move an #endif /* __KERNEL__ */ down a few lines to prevent that. Also, remove the broken definition of PAGE_SIZE which is never going to be correct -- in the absence of PAGE_SIZE, non-broken userspace will fall back to using sysconf() or getpagesize() instead. Signed-off-by: David Woodhouse Cc: Ralf Baechle Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-mips/page.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index 6ed1151a05a3..219d359861f3 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h @@ -14,8 +14,6 @@ #include -#endif - /* * PAGE_SHIFT determines the page size */ @@ -34,8 +32,6 @@ #define PAGE_SIZE (1UL << PAGE_SHIFT) #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) - -#ifdef __KERNEL__ #ifndef __ASSEMBLY__ extern void clear_page(void * page); @@ -168,8 +164,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE) #define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET) -#endif /* defined (__KERNEL__) */ - #ifdef CONFIG_LIMITED_DMA #define WANT_PAGE_VIRTUAL #endif @@ -177,4 +171,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; #include #include +#endif /* defined (__KERNEL__) */ + #endif /* _ASM_PAGE_H */ -- cgit v1.2.3 From c84cbb246e5a5235af30ddbe49d23bb1eaf64add Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Thu, 14 Sep 2006 13:29:15 +0100 Subject: [ARM] 3785/1: S3C2412: Fix idle code as default uses wrong clocks Patch from Ben Dooks Fix the idle code on the s3c2412 as the default code is using bits in the CLKCON register that are no-longer there. Provide an override for the idle code, and ensure that the power configuration is set to allow idle instead of stop or sleep. Signed-off-by: Ben Dooks Signed-off-by: Russell King --- arch/arm/mach-s3c2410/s3c2412.c | 29 ++++++++++++++++++++++++++ include/asm-arm/arch-s3c2410/regs-power.h | 34 +++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 include/asm-arm/arch-s3c2410/regs-power.h (limited to 'include') diff --git a/arch/arm/mach-s3c2410/s3c2412.c b/arch/arm/mach-s3c2410/s3c2412.c index e24ffd5e478b..2d163f7600be 100644 --- a/arch/arm/mach-s3c2410/s3c2412.c +++ b/arch/arm/mach-s3c2410/s3c2412.c @@ -35,11 +35,15 @@ #include #include +#include #include #include +#include + #include #include +#include #include #include #include @@ -75,6 +79,27 @@ void __init s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no) s3c_device_nand.name = "s3c2412-nand"; } +/* s3c2412_idle + * + * use the standard idle call by ensuring the idle mode + * in power config, then issuing the idle co-processor + * instruction +*/ + +static void s3c2412_idle(void) +{ + unsigned long tmp; + + /* ensure our idle mode is to go to idle */ + + tmp = __raw_readl(S3C2412_PWRCFG); + tmp &= ~S3C2412_PWRCFG_STANDBYWFI_MASK; + tmp |= S3C2412_PWRCFG_STANDBYWFI_IDLE; + __raw_writel(tmp, S3C2412_PWRCFG); + + cpu_do_idle(); +} + /* s3c2412_map_io * * register the standard cpu IO areas, and any passed in from the @@ -87,6 +112,10 @@ void __init s3c2412_map_io(struct map_desc *mach_desc, int mach_size) s3c24xx_va_gpio2 = S3C24XX_VA_GPIO + 0x10; + /* set our idle function */ + + s3c24xx_idle = s3c2412_idle; + /* register our io-tables */ iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc)); diff --git a/include/asm-arm/arch-s3c2410/regs-power.h b/include/asm-arm/arch-s3c2410/regs-power.h new file mode 100644 index 000000000000..6c319ea2afac --- /dev/null +++ b/include/asm-arm/arch-s3c2410/regs-power.h @@ -0,0 +1,34 @@ +/* linux/include/asm/arch-s3c2410/regs-power.h + * + * Copyright (c) 2003,2004,2005,2006 Simtec Electronics + * http://armlinux.simtec.co.uk/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * S3C24XX power control register definitions +*/ + +#ifndef __ASM_ARM_REGS_PWR +#define __ASM_ARM_REGS_PWR __FILE__ + +#define S3C24XX_PWRREG(x) ((x) + S3C24XX_VA_CLKPWR) + +#define S3C2412_PWRMODECON S3C24XX_PWRREG(0x20) +#define S3C2412_PWRCFG S3C24XX_PWRREG(0x24) + +#define S3C2412_PWRCFG_BATF_IGNORE (0<<0) +#define S3C2412_PWRCFG_BATF_SLEEP (3<<0) +#define S3C2412_PWRCFG_BATF_MASK (3<<0) + +#define S3C2412_PWRCFG_STANDBYWFI_IGNORE (0<<6) +#define S3C2412_PWRCFG_STANDBYWFI_IDLE (1<<6) +#define S3C2412_PWRCFG_STANDBYWFI_STOP (2<<6) +#define S3C2412_PWRCFG_STANDBYWFI_SLEEP (3<<6) +#define S3C2412_PWRCFG_STANDBYWFI_MASK (3<<6) + +#define S3C2412_PWRCFG_RTC_MASKIRQ (1<<8) +#define S3C2412_PWRCFG_NAND_NORST (1<<9) + +#endif /* __ASM_ARM_REGS_PWR */ -- cgit v1.2.3 From 124b51c7a8a2b47f1c4739905a28ab3ea5f17faa Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 16 Sep 2006 12:15:46 -0700 Subject: [PATCH] Fix 'make headers_check' on s390 On Tue, 2006-09-12 at 17:44 +0100, David Woodhouse wrote: > asm-s390/debug.h requires linux/string.h, which does not exist > asm-s390/elf.h requires asm/system.h, which does not exist Move things around slightly so the right things end up within #ifdef __KERNEL__ and thus don't pollute the exported headers. Signed-off-by: David Woodhouse Cc: Sam Ravnborg Acked-by: Martin Schwidefsky Cc: Heiko Carstens Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-s390/debug.h | 2 +- include/asm-s390/elf.h | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/asm-s390/debug.h b/include/asm-s390/debug.h index 7f1ef99fd1e1..c00dd2b3dc50 100644 --- a/include/asm-s390/debug.h +++ b/include/asm-s390/debug.h @@ -10,7 +10,6 @@ #define DEBUG_H #include -#include /* Note: * struct __debug_entry must be defined outside of #ifdef __KERNEL__ @@ -35,6 +34,7 @@ struct __debug_entry{ #define __DEBUG_FEATURE_VERSION 2 /* version of debug feature */ #ifdef __KERNEL__ +#include #include #include #include diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h index 710646e64f7d..c0d629d61d3e 100644 --- a/include/asm-s390/elf.h +++ b/include/asm-s390/elf.h @@ -92,19 +92,6 @@ /* Keep this the last entry. */ #define R_390_NUM 61 -/* - * ELF register definitions.. - */ - -#include /* for task_struct */ -#include -#include -#include /* for save_access_regs */ - - -typedef s390_fp_regs elf_fpregset_t; -typedef s390_regs elf_gregset_t; - /* * These are used to set parameters in the core dumps. */ @@ -116,6 +103,20 @@ typedef s390_regs elf_gregset_t; #define ELF_DATA ELFDATA2MSB #define ELF_ARCH EM_S390 +/* + * ELF register definitions.. + */ + +#include +#include + +typedef s390_fp_regs elf_fpregset_t; +typedef s390_regs elf_gregset_t; + +#ifdef __KERNEL__ +#include /* for task_struct */ +#include /* for save_access_regs */ + /* * This is used to ensure we don't load something for the wrong architecture. */ @@ -198,7 +199,6 @@ static inline int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs) #define ELF_PLATFORM (NULL) -#ifdef __KERNEL__ #ifndef __s390x__ #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #else /* __s390x__ */ -- cgit v1.2.3 From d5759641f5809b19bad4e2af6ca97b830545aaba Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 16 Sep 2006 12:15:47 -0700 Subject: [PATCH] Fix 'make headers_check' on ia64 On Tue, 2006-09-12 at 17:44 +0100, David Woodhouse wrote: > asm-ia64/ptrace.h requires asm/asm-offsets.h, which does not exist > asm-ia64/resource.h requires asm/ustack.h, which does not exist Hide parts which shouldn't be visible to userspace. Signed-off-by: David Woodhouse Cc: Sam Ravnborg Cc: "Luck, Tony" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-ia64/Kbuild | 2 +- include/asm-ia64/page.h | 4 ++-- include/asm-ia64/ptrace.h | 10 +++++++--- include/asm-ia64/ustack.h | 7 +++++-- 4 files changed, 15 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/asm-ia64/Kbuild b/include/asm-ia64/Kbuild index 85d6f8005eb4..f1cb00f39c22 100644 --- a/include/asm-ia64/Kbuild +++ b/include/asm-ia64/Kbuild @@ -4,4 +4,4 @@ header-y += break.h fpu.h fpswa.h gcc_intrin.h ia64regs.h \ intel_intrin.h intrinsics.h perfmon_default_smpl.h \ ptrace_offsets.h rse.h setup.h ucontext.h -unifdef-y += perfmon.h +unifdef-y += perfmon.h ustack.h diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h index f5a949ec6e1e..947cb72b520e 100644 --- a/include/asm-ia64/page.h +++ b/include/asm-ia64/page.h @@ -7,6 +7,7 @@ * David Mosberger-Tang */ +# ifdef __KERNEL__ #include #include @@ -64,7 +65,6 @@ # define __pa(x) ((x) - PAGE_OFFSET) # define __va(x) ((x) + PAGE_OFFSET) #else /* !__ASSEMBLY */ -# ifdef __KERNEL__ # define STRICT_MM_TYPECHECKS extern void clear_page (void *page); @@ -174,7 +174,6 @@ get_order (unsigned long size) return order; } -# endif /* __KERNEL__ */ #endif /* !__ASSEMBLY__ */ #ifdef STRICT_MM_TYPECHECKS @@ -228,4 +227,5 @@ get_order (unsigned long size) (((current->personality & READ_IMPLIES_EXEC) != 0) \ ? VM_EXEC : 0)) +# endif /* __KERNEL__ */ #endif /* _ASM_IA64_PAGE_H */ diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h index 415abb23b210..1414316efd40 100644 --- a/include/asm-ia64/ptrace.h +++ b/include/asm-ia64/ptrace.h @@ -56,6 +56,8 @@ #include + +#ifdef __KERNEL__ #ifndef ASM_OFFSETS_C #include #endif @@ -79,10 +81,9 @@ #define KERNEL_STACK_SIZE IA64_STK_OFFSET -#ifndef __ASSEMBLY__ +#endif /* __KERNEL__ */ -#include -#include +#ifndef __ASSEMBLY__ /* * This struct defines the way the registers are saved on system @@ -229,6 +230,9 @@ struct switch_stack { #ifdef __KERNEL__ +#include +#include + #define __ARCH_SYS_PTRACE 1 /* diff --git a/include/asm-ia64/ustack.h b/include/asm-ia64/ustack.h index da55c91246e3..a349467913ea 100644 --- a/include/asm-ia64/ustack.h +++ b/include/asm-ia64/ustack.h @@ -5,12 +5,15 @@ * Constants for the user stack size */ +#ifdef __KERNEL__ #include /* The absolute hard limit for stack size is 1/2 of the mappable space in the region */ #define MAX_USER_STACK_SIZE (RGN_MAP_LIMIT/2) -/* Make a default stack size of 2GB */ -#define DEFAULT_USER_STACK_SIZE (1UL << 31) #define STACK_TOP (0x6000000000000000UL + RGN_MAP_LIMIT) +#endif + +/* Make a default stack size of 2GiB */ +#define DEFAULT_USER_STACK_SIZE (1UL << 31) #endif /* _ASM_IA64_USTACK_H */ -- cgit v1.2.3 From e5fa6d70318e4a6a644edbb7d574059e5b326de1 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 16 Sep 2006 12:15:48 -0700 Subject: [PATCH] Fix 'make headers_check' on i386 This brings i386 asm/unistd.h into consistency with other architectures by not exporting functionality which is not necessary. Signed-off-by: David Woodhouse Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-i386/unistd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index d983b74e4d9f..fc1c8ddae149 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -324,6 +324,8 @@ #define __NR_vmsplice 316 #define __NR_move_pages 317 +#ifdef __KERNEL__ + #define NR_syscalls 318 /* @@ -423,8 +425,6 @@ __asm__ volatile ("push %%ebp ; push %%ebx ; movl 4(%2),%%ebp ; " \ __syscall_return(type,__res); \ } -#ifdef __KERNEL__ - #define __ARCH_WANT_IPC_PARSE_VERSION #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_OLD_STAT -- cgit v1.2.3 From 75da736fb3dc5cc8add98da0d02fe5103d7ce059 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 16 Sep 2006 12:15:48 -0700 Subject: [PATCH] Fix 'make headers_check' on x86_64 On Tue, 2006-09-12 at 17:44 +0100, David Woodhouse wrote: > asm-x86_64/elf.h requires asm/processor.h, which does not exist > asm-x86_64/signal.h requires linux/linkage.h, which does not exist > asm-x86_64/unistd.h requires linux/linkage.h, which does not exist > asm-x86_64/vsyscall.h requires linux/seqlock.h, which does not exist Again, move stuff which shouldn't be visible inside (mostly already existing) #ifdef __KERNEL__. This fixes a bunch of mislabelled and unlabelled #endifs in unistd.h and also cleans that up to conform with what's visible on other architectures, since the minimal fix for the error reported about would have involved a more intrusive patch, renesting other ifdefs. Signed-off-by: David Woodhouse Cc: Sam Ravnborg Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-x86_64/elf.h | 20 +++++++++++--------- include/asm-x86_64/signal.h | 2 +- include/asm-x86_64/unistd.h | 16 ++++++++-------- include/asm-x86_64/vsyscall.h | 3 +-- 4 files changed, 21 insertions(+), 20 deletions(-) (limited to 'include') diff --git a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h index b4f8f4a41a6e..a406fcb1e924 100644 --- a/include/asm-x86_64/elf.h +++ b/include/asm-x86_64/elf.h @@ -7,8 +7,6 @@ #include #include -#include -#include /* x86-64 relocation types */ #define R_X86_64_NONE 0 /* No reloc */ @@ -38,12 +36,6 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef struct user_i387_struct elf_fpregset_t; -/* - * This is used to ensure we don't load something for the wrong architecture. - */ -#define elf_check_arch(x) \ - ((x)->e_machine == EM_X86_64) - /* * These are used to set parameters in the core dumps. */ @@ -51,6 +43,17 @@ typedef struct user_i387_struct elf_fpregset_t; #define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_X86_64 +#ifdef __KERNEL__ +#include +#include + +/* + * This is used to ensure we don't load something for the wrong architecture. + */ +#define elf_check_arch(x) \ + ((x)->e_machine == EM_X86_64) + + /* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx contains a pointer to a function which might be registered using `atexit'. This provides a mean for the dynamic linker to call DT_FINI functions for @@ -141,7 +144,6 @@ typedef struct user_i387_struct elf_fpregset_t; /* I'm not sure if we can use '-' here */ #define ELF_PLATFORM ("x86_64") -#ifdef __KERNEL__ extern void set_personality_64bit(void); #define SET_PERSONALITY(ex, ibcs2) set_personality_64bit() /* diff --git a/include/asm-x86_64/signal.h b/include/asm-x86_64/signal.h index cef7a7d51b7e..3ede2a61973a 100644 --- a/include/asm-x86_64/signal.h +++ b/include/asm-x86_64/signal.h @@ -3,13 +3,13 @@ #ifndef __ASSEMBLY__ #include -#include #include /* Avoid too many header ordering problems. */ struct siginfo; #ifdef __KERNEL__ +#include /* Most things should be clean enough to redefine this at will, if care is taken to make libc match. */ diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h index 2d89d309a2a8..80fd48e84bbb 100644 --- a/include/asm-x86_64/unistd.h +++ b/include/asm-x86_64/unistd.h @@ -620,6 +620,8 @@ __SYSCALL(__NR_vmsplice, sys_vmsplice) #define __NR_move_pages 279 __SYSCALL(__NR_move_pages, sys_move_pages) +#ifdef __KERNEL__ + #define __NR_syscall_max __NR_move_pages #ifndef __NO_STUBS @@ -744,8 +746,6 @@ __syscall_return(type,__res); \ #else /* __KERNEL_SYSCALLS__ */ -#ifdef __KERNEL__ - #include #include @@ -821,8 +821,6 @@ asmlinkage long sys_fork(struct pt_regs regs); asmlinkage long sys_vfork(struct pt_regs regs); asmlinkage long sys_pipe(int *fildes); -#endif /* __KERNEL_SYSCALLS__ */ - #ifndef __ASSEMBLY__ #include @@ -838,9 +836,9 @@ asmlinkage long sys_rt_sigaction(int sig, struct sigaction __user *oact, size_t sigsetsize); -#endif +#endif /* __ASSEMBLY__ */ -#endif +#endif /* __KERNEL_SYSCALLS__ */ /* * "Conditional" syscalls @@ -850,6 +848,8 @@ asmlinkage long sys_rt_sigaction(int sig, */ #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") -#endif +#endif /* __NO_STUBS */ -#endif +#endif /* __KERNEL__ */ + +#endif /* _ASM_X86_64_UNISTD_H_ */ diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h index a85e16f56d73..146b24402a5f 100644 --- a/include/asm-x86_64/vsyscall.h +++ b/include/asm-x86_64/vsyscall.h @@ -1,8 +1,6 @@ #ifndef _ASM_X86_64_VSYSCALL_H_ #define _ASM_X86_64_VSYSCALL_H_ -#include - enum vsyscall_num { __NR_vgettimeofday, __NR_vtime, @@ -14,6 +12,7 @@ enum vsyscall_num { #define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr)) #ifdef __KERNEL__ +#include #define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16))) #define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16))) -- cgit v1.2.3 From 7f9d77d75895c0d7e326d75263af21d7e2759879 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 16 Sep 2006 12:15:49 -0700 Subject: [PATCH] Fix 'make headers_check' for Alpha Alpha currently fails 'make headers_check' in the 2.6.18-rc kernels. This patch fixes it, by moving the existing #ifdef __KERNEL__ in asm/page.h so that it covers everything that userspace shouldn't so, and by adding asm/compiler.h to the list of exported files so that its use within asm/byteorder.h is successful. [ Note that at least with GCC 4, doesn't do the forced inlining about which there are nasty comments (and a workaround) in , unless you set CONFIG_FORCED_INLINING. Rather than keep the mess you have in you could perhaps just make sure CONFIG_FORCED_INLINING=n is also honoured with GCC3, and make sure it cannot be set for Alpha? ] Signed-off-by: David Woodhouse Cc: Sam Ravnborg Cc: Ivan Kokshaysky Cc: Richard Henderson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-alpha/Kbuild | 2 +- include/asm-alpha/compiler.h | 3 +++ include/asm-alpha/page.h | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/asm-alpha/Kbuild b/include/asm-alpha/Kbuild index e57fd57538b8..2b06b3bad5ff 100644 --- a/include/asm-alpha/Kbuild +++ b/include/asm-alpha/Kbuild @@ -1,5 +1,5 @@ include include/asm-generic/Kbuild.asm -unifdef-y += console.h fpu.h sysinfo.h +unifdef-y += console.h fpu.h sysinfo.h compiler.h header-y += gentrap.h regdef.h pal.h reg.h diff --git a/include/asm-alpha/compiler.h b/include/asm-alpha/compiler.h index 00c6f57ad9a7..d2768cc3d7a4 100644 --- a/include/asm-alpha/compiler.h +++ b/include/asm-alpha/compiler.h @@ -90,6 +90,7 @@ __asm__("stw %1,%0" : "=m"(mem) : "r"(val)) #endif +#ifdef __KERNEL__ /* Some idiots over in thought inline should imply always_inline. This breaks stuff. We'll include this file whenever we run into such problems. */ @@ -101,4 +102,6 @@ #undef __always_inline #define __always_inline inline __attribute__((always_inline)) +#endif /* __KERNEL__ */ + #endif /* __ALPHA_COMPILER_H */ diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h index 8c7cd50d4eae..d2bed3cb33ff 100644 --- a/include/asm-alpha/page.h +++ b/include/asm-alpha/page.h @@ -1,6 +1,8 @@ #ifndef _ALPHA_PAGE_H #define _ALPHA_PAGE_H +#ifdef __KERNEL__ + #include /* PAGE_SHIFT determines the page size */ @@ -8,8 +10,6 @@ #define PAGE_SIZE (1UL << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) -#ifdef __KERNEL__ - #ifndef __ASSEMBLY__ #define STRICT_MM_TYPECHECKS @@ -92,9 +92,9 @@ typedef unsigned long pgprot_t; #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) -#endif /* __KERNEL__ */ #include #include +#endif /* __KERNEL__ */ #endif /* _ALPHA_PAGE_H */ -- cgit v1.2.3 From dc36251037ae4f69f2f764efd9b57136e3b9848d Mon Sep 17 00:00:00 2001 From: James Morris Date: Wed, 13 Sep 2006 21:04:55 -0700 Subject: [NETFILTER]: Add secmark headers to header-y This patch includes xt_SECMARK.h and xt_CONNSECMARK.h to the kernel headers which are exported via 'make headers_install'. This is needed to allow userland code to be built correctly with these features. Please apply, and consider for inclusion with 2.6.18 as a bugfix. Signed-off-by: James Morris Signed-off-by: David S. Miller --- include/linux/netfilter/Kbuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index d06311acd448..1d3a14e2da6e 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild @@ -5,7 +5,7 @@ header-y := nf_conntrack_sctp.h nf_conntrack_tuple_common.h \ xt_helper.h xt_length.h xt_limit.h xt_mac.h xt_mark.h \ xt_MARK.h xt_multiport.h xt_NFQUEUE.h xt_pkttype.h \ xt_policy.h xt_realm.h xt_sctp.h xt_state.h xt_string.h \ - xt_tcpmss.h xt_tcpudp.h + xt_tcpmss.h xt_tcpudp.h xt_SECMARK.h xt_CONNSECMARK.h unifdef-y := nf_conntrack_common.h nf_conntrack_ftp.h \ nf_conntrack_tcp.h nfnetlink.h x_tables.h xt_physdev.h -- cgit v1.2.3 From e40b1074af46d53740320f88dfffd9fb2f78bdf3 Mon Sep 17 00:00:00 2001 From: Ralph Siemsen Date: Mon, 18 Sep 2006 16:28:50 +0100 Subject: [ARM] 3815/1: headers_install support for ARM Move kernel-only #includes into #ifdef __KERNEL__, so that headers_install target can be used on ARM. Signed-off-by: Ralph Siemsen Signed-off-by: Russell King --- include/asm-arm/elf.h | 2 ++ include/asm-arm/page.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h index 71061ca5c5d0..ae7baa6c73f7 100644 --- a/include/asm-arm/elf.h +++ b/include/asm-arm/elf.h @@ -8,7 +8,9 @@ #include #include +#ifdef __KERNEL #include +#endif typedef unsigned long elf_greg_t; typedef unsigned long elf_freg_t[3]; diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h index 63d12f0244c5..b721270b9986 100644 --- a/include/asm-arm/page.h +++ b/include/asm-arm/page.h @@ -193,8 +193,8 @@ extern pmd_t *top_pmd; #define ARCH_SLAB_MINALIGN 8 #endif -#endif /* __KERNEL__ */ - #include +#endif /* __KERNEL__ */ + #endif -- cgit v1.2.3 From 47a5c6fa0e204a2b63309c648bb2fde36836c826 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Mon, 18 Sep 2006 16:20:40 -0700 Subject: x86: save/restore eflags in context switch (And reset it on new thread creation) It turns out that eflags is important to save and restore not just because of iopl, but due to the magic bits like the NT bit, which we don't want leaking between different threads. Tested-by: Mike Galbraith Signed-off-by: Linus Torvalds --- arch/i386/kernel/entry.S | 4 ++++ include/asm-i386/system.h | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S index 37a7d2eaf4a0..87f9f60b803b 100644 --- a/arch/i386/kernel/entry.S +++ b/arch/i386/kernel/entry.S @@ -209,6 +209,10 @@ ENTRY(ret_from_fork) GET_THREAD_INFO(%ebp) popl %eax CFI_ADJUST_CFA_OFFSET -4 + pushl $0x0202 # Reset kernel eflags + CFI_ADJUST_CFA_OFFSET 4 + popfl + CFI_ADJUST_CFA_OFFSET -4 jmp syscall_exit CFI_ENDPROC diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 49928eb33f8b..098bcee94e38 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -11,9 +11,14 @@ struct task_struct; /* one of the stranger aspects of C forward declarations.. */ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next)); +/* + * Saving eflags is important. It switches not only IOPL between tasks, + * it also protects other tasks from NT leaking through sysenter etc. + */ #define switch_to(prev,next,last) do { \ unsigned long esi,edi; \ - asm volatile("pushl %%ebp\n\t" \ + asm volatile("pushfl\n\t" /* Save flags */ \ + "pushl %%ebp\n\t" \ "movl %%esp,%0\n\t" /* save ESP */ \ "movl %5,%%esp\n\t" /* restore ESP */ \ "movl $1f,%1\n\t" /* save EIP */ \ @@ -21,6 +26,7 @@ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struc "jmp __switch_to\n" \ "1:\t" \ "popl %%ebp\n\t" \ + "popfl" \ :"=m" (prev->thread.esp),"=m" (prev->thread.eip), \ "=a" (last),"=S" (esi),"=D" (edi) \ :"m" (next->thread.esp),"m" (next->thread.eip), \ -- cgit v1.2.3