summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/tlb.h1
-rw-r--r--include/asm-arm/tlb.h1
-rw-r--r--include/asm-generic/tlb.h113
-rw-r--r--include/asm-i386/tlb.h1
-rw-r--r--include/asm-ia64/tlb.h1
-rw-r--r--include/asm-m68k/tlb.h1
-rw-r--r--include/asm-s390/tlb.h1
-rw-r--r--include/asm-s390x/tlb.h1
-rw-r--r--include/asm-sh/tlb.h1
-rw-r--r--include/asm-sparc/fcntl.h2
-rw-r--r--include/asm-sparc/processor.h2
-rw-r--r--include/asm-sparc/tlb.h1
-rw-r--r--include/asm-sparc64/fcntl.h2
-rw-r--r--include/asm-sparc64/pgtable.h16
-rw-r--r--include/asm-sparc64/processor.h35
-rw-r--r--include/asm-sparc64/timex.h1
-rw-r--r--include/asm-sparc64/tlb.h1
-rw-r--r--include/linux/eeprom.h1
-rw-r--r--include/linux/lockd/xdr.h1
-rw-r--r--include/linux/mm.h2
-rw-r--r--include/linux/sonypi.h4
-rw-r--r--include/linux/sunrpc/xdr.h1
22 files changed, 172 insertions, 18 deletions
diff --git a/include/asm-alpha/tlb.h b/include/asm-alpha/tlb.h
new file mode 100644
index 000000000000..69c0faa93194
--- /dev/null
+++ b/include/asm-alpha/tlb.h
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff --git a/include/asm-arm/tlb.h b/include/asm-arm/tlb.h
new file mode 100644
index 000000000000..69c0faa93194
--- /dev/null
+++ b/include/asm-arm/tlb.h
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
new file mode 100644
index 000000000000..c427f7eeea67
--- /dev/null
+++ b/include/asm-generic/tlb.h
@@ -0,0 +1,113 @@
+/* asm-generic/tlb.h
+ *
+ * Generic TLB shootdown code
+ *
+ * Copyright 2001 Red Hat, Inc.
+ * Based on code from mm/memory.c Copyright Linus Torvalds and others.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#ifndef _ASM_GENERIC__TLB_H
+#define _ASM_GENERIC__TLB_H
+
+#include <linux/config.h>
+
+#ifdef CONFIG_SMP
+/* aim for something that fits in the L1 cache */
+#define FREE_PTE_NR 508
+
+/* mmu_gather_t is an opaque type used by the mm code for passing around any
+ * data needed by arch specific code for tlb_remove_page. This structure can
+ * be per-CPU or per-MM as the page table lock is held for the duration of TLB
+ * shootdown.
+ */
+typedef struct free_pte_ctx {
+ struct mm_struct *mm;
+ unsigned long nr; /* set to ~0UL means fast mode */
+ unsigned long start_addr, end_addr;
+ pte_t ptes[FREE_PTE_NR];
+} mmu_gather_t;
+
+/* Users of the generic TLB shootdown code must declare this storage space. */
+extern mmu_gather_t mmu_gathers[NR_CPUS];
+
+/* tlb_gather_mmu
+ * Return a pointer to an initialized mmu_gather_t.
+ */
+static inline mmu_gather_t *tlb_gather_mmu(struct mm_struct *mm)
+{
+ mmu_gather_t *tlb = &mmu_gathers[smp_processor_id()];
+
+ tlb->mm = mm;
+ /* Use fast mode if there is only one user of this mm (this process) */
+ tlb->nr = (atomic_read(&(mm)->mm_users) == 1) ? ~0UL : 0UL;
+ return tlb;
+}
+
+/* void tlb_remove_page(mmu_gather_t *tlb, pte_t *ptep, unsigned long addr)
+ * Must perform the equivalent to __free_pte(pte_get_and_clear(ptep)), while
+ * handling the additional races in SMP caused by other CPUs caching valid
+ * mappings in their TLBs.
+ */
+#define tlb_remove_page(ctxp, pte, addr) do {\
+ /* Handle the common case fast, first. */\
+ if ((ctxp)->nr == ~0UL) {\
+ __free_pte(*(pte));\
+ pte_clear((pte));\
+ break;\
+ }\
+ if (!(ctxp)->nr) \
+ (ctxp)->start_addr = (addr);\
+ (ctxp)->ptes[(ctxp)->nr++] = ptep_get_and_clear(pte);\
+ (ctxp)->end_addr = (addr) + PAGE_SIZE;\
+ if ((ctxp)->nr >= FREE_PTE_NR)\
+ tlb_finish_mmu((ctxp), 0, 0);\
+ } while (0)
+
+/* tlb_finish_mmu
+ * Called at the end of the shootdown operation to free up any resources
+ * that were required. The page talbe lock is still held at this point.
+ */
+static inline void tlb_finish_mmu(struct free_pte_ctx *ctx, unsigned long start, unsigned long end)
+{
+ unsigned long i, nr;
+
+ /* Handle the fast case first. */
+ if (ctx->nr == ~0UL) {
+ flush_tlb_range(ctx->mm, start, end);
+ return;
+ }
+ nr = ctx->nr;
+ ctx->nr = 0;
+ if (nr)
+ flush_tlb_range(ctx->mm, ctx->start_addr, ctx->end_addr);
+ for (i=0; i < nr; i++) {
+ pte_t pte = ctx->ptes[i];
+ __free_pte(pte);
+ }
+}
+
+#else
+
+/* The uniprocessor functions are quite simple and are inline macros in an
+ * attempt to get gcc to generate optimal code since this code is run on each
+ * page in a process at exit.
+ */
+typedef struct mm_struct mmu_gather_t;
+
+#define tlb_gather_mmu(mm) (mm)
+#define tlb_finish_mmu(tlb, start, end) flush_tlb_range(tlb, start, end)
+#define tlb_remove_page(tlb, ptep, addr) do {\
+ pte_t __pte = *(ptep);\
+ pte_clear(ptep);\
+ __free_pte(__pte);\
+ } while (0)
+
+#endif
+
+
+#endif /* _ASM_GENERIC__TLB_H */
+
diff --git a/include/asm-i386/tlb.h b/include/asm-i386/tlb.h
new file mode 100644
index 000000000000..69c0faa93194
--- /dev/null
+++ b/include/asm-i386/tlb.h
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff --git a/include/asm-ia64/tlb.h b/include/asm-ia64/tlb.h
new file mode 100644
index 000000000000..69c0faa93194
--- /dev/null
+++ b/include/asm-ia64/tlb.h
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff --git a/include/asm-m68k/tlb.h b/include/asm-m68k/tlb.h
new file mode 100644
index 000000000000..69c0faa93194
--- /dev/null
+++ b/include/asm-m68k/tlb.h
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff --git a/include/asm-s390/tlb.h b/include/asm-s390/tlb.h
new file mode 100644
index 000000000000..69c0faa93194
--- /dev/null
+++ b/include/asm-s390/tlb.h
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff --git a/include/asm-s390x/tlb.h b/include/asm-s390x/tlb.h
new file mode 100644
index 000000000000..69c0faa93194
--- /dev/null
+++ b/include/asm-s390x/tlb.h
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff --git a/include/asm-sh/tlb.h b/include/asm-sh/tlb.h
new file mode 100644
index 000000000000..69c0faa93194
--- /dev/null
+++ b/include/asm-sh/tlb.h
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff --git a/include/asm-sparc/fcntl.h b/include/asm-sparc/fcntl.h
index 465c6e05fb78..aa64cfc1df2e 100644
--- a/include/asm-sparc/fcntl.h
+++ b/include/asm-sparc/fcntl.h
@@ -1,4 +1,4 @@
-/* $Id: fcntl.h,v 1.15 2000/09/23 02:09:21 davem Exp $ */
+/* $Id: fcntl.h,v 1.16 2001/09/20 00:35:33 davem Exp $ */
#ifndef _SPARC_FCNTL_H
#define _SPARC_FCNTL_H
diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h
index deccc745a128..0b19b15ddcea 100644
--- a/include/asm-sparc/processor.h
+++ b/include/asm-sparc/processor.h
@@ -1,4 +1,4 @@
-/* $Id: processor.h,v 1.81 2001/03/27 02:36:37 davem Exp $
+/* $Id: processor.h,v 1.82 2001/09/20 00:35:34 davem Exp $
* include/asm-sparc/processor.h
*
* Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc/tlb.h b/include/asm-sparc/tlb.h
new file mode 100644
index 000000000000..69c0faa93194
--- /dev/null
+++ b/include/asm-sparc/tlb.h
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff --git a/include/asm-sparc64/fcntl.h b/include/asm-sparc64/fcntl.h
index 521efc96f44f..38ee2703ede9 100644
--- a/include/asm-sparc64/fcntl.h
+++ b/include/asm-sparc64/fcntl.h
@@ -1,4 +1,4 @@
-/* $Id: fcntl.h,v 1.11 2000/09/23 02:09:21 davem Exp $ */
+/* $Id: fcntl.h,v 1.12 2001/09/20 00:35:34 davem Exp $ */
#ifndef _SPARC64_FCNTL_H
#define _SPARC64_FCNTL_H
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index d2f008d7fd81..4c0d616dc51b 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -1,4 +1,4 @@
-/* $Id: pgtable.h,v 1.145 2001/08/30 03:22:00 kanoj Exp $
+/* $Id: pgtable.h,v 1.146 2001/09/11 02:20:23 kanoj Exp $
* pgtable.h: SpitFire page table operations.
*
* Copyright 1996,1997 David S. Miller (davem@caip.rutgers.edu)
@@ -17,6 +17,7 @@
#include <asm/mmu_context.h>
#include <asm/system.h>
#include <asm/page.h>
+#include <asm/processor.h>
/* XXX All of this needs to be rethought so we can take advantage
* XXX cheetah's full 64-bit virtual address space, ie. no more hole
@@ -32,8 +33,6 @@
* long). Finally, the higher few bits determine pgde#.
*/
-#define VA_BITS 44
-
/* PMD_SHIFT determines the size of the area a second-level page table can map */
#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT-3))
#define PMD_SIZE (1UL << PMD_SHIFT)
@@ -65,8 +64,15 @@
#define PTRS_PER_PMD ((const int)((current->thread.flags & SPARC_FLAG_32BIT) ? \
(1UL << (32 - (PAGE_SHIFT-3) - PAGE_SHIFT)) : (REAL_PTRS_PER_PMD)))
-/* We cannot use the top 16G because VPTE table lives there. */
-#define PTRS_PER_PGD ((1UL << (VA_BITS - PAGE_SHIFT - (PAGE_SHIFT-3) - PMD_BITS))-1)
+/*
+ * We cannot use the top address range because VPTE table lives there. This
+ * formula finds the total legal virtual space in the processor, subtracts the
+ * vpte size, then aligns it to the number of bytes mapped by one pgde, and
+ * thus calculates the number of pgdes needed.
+ */
+#define PTRS_PER_PGD (((1UL << VA_BITS) - VPTE_SIZE + (1UL << (PAGE_SHIFT + \
+ (PAGE_SHIFT-3) + PMD_BITS)) - 1) / (1UL << (PAGE_SHIFT + \
+ (PAGE_SHIFT-3) + PMD_BITS)))
/* Kernel has a separate 44bit address space. */
#define USER_PTRS_PER_PGD ((const int)((current->thread.flags & SPARC_FLAG_32BIT) ? \
diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h
index f6431ca84d9e..6c7a93f649f0 100644
--- a/include/asm-sparc64/processor.h
+++ b/include/asm-sparc64/processor.h
@@ -1,4 +1,4 @@
-/* $Id: processor.h,v 1.70 2001/03/27 02:36:38 davem Exp $
+/* $Id: processor.h,v 1.75 2001/09/20 00:35:34 davem Exp $
* include/asm-sparc64/processor.h
*
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -20,6 +20,7 @@
#include <asm/ptrace.h>
#include <asm/signal.h>
#include <asm/segment.h>
+#include <asm/page.h>
/* Bus types */
#define EISA_bus 0
@@ -31,12 +32,14 @@
#define wp_works_ok 1
#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
-/* User lives in his very own context, and cannot reference us. */
-#ifndef __ASSEMBLY__
-#define TASK_SIZE ((unsigned long)-PGDIR_SIZE)
-#else
-#define TASK_SIZE 0xfffffffc00000000
-#endif
+/*
+ * User lives in his very own context, and cannot reference us. Note
+ * that TASK_SIZE is a misnomer, it really gives maximum user virtual
+ * address that the kernel will allocate out.
+ */
+#define VA_BITS 44
+#define VPTE_SIZE (1UL << (VA_BITS - PAGE_SHIFT + 3))
+#define TASK_SIZE ((unsigned long)-VPTE_SIZE)
#ifndef __ASSEMBLY__
@@ -102,6 +105,16 @@ struct thread_struct {
0, 0, 0, 0, 0, \
}
+#ifdef __KERNEL__
+#if PAGE_SHIFT == 13
+#define THREAD_SIZE (2*PAGE_SIZE)
+#define THREAD_SHIFT (PAGE_SHIFT + 1)
+#else /* PAGE_SHIFT == 13 */
+#define THREAD_SIZE PAGE_SIZE
+#define THREAD_SHIFT PAGE_SHIFT
+#endif /* PAGE_SHIFT == 13 */
+#endif /* __KERNEL__ */
+
#ifndef __ASSEMBLY__
/* Return saved PC of a blocked thread. */
@@ -232,7 +245,7 @@ extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
do { \
/* Bogus frame pointer? */ \
if (fp < (task_base + sizeof(struct task_struct)) || \
- fp >= (task_base + (2 * PAGE_SIZE))) \
+ fp >= (task_base + THREAD_SIZE)) \
break; \
rw = (struct reg_window *) fp; \
pc = rw->ins[7]; \
@@ -250,10 +263,14 @@ __out: __ret; \
#define KSTK_ESP(tsk) ((tsk)->thread.kregs->u_regs[UREG_FP])
#ifdef __KERNEL__
-#define THREAD_SIZE (2*PAGE_SIZE)
/* Allocation and freeing of task_struct and kernel stack. */
+#if PAGE_SHIFT == 13
#define alloc_task_struct() ((struct task_struct *)__get_free_pages(GFP_KERNEL, 1))
#define free_task_struct(tsk) free_pages((unsigned long)(tsk),1)
+#else /* PAGE_SHIFT == 13 */
+#define alloc_task_struct() ((struct task_struct *)__get_free_pages(GFP_KERNEL, 0))
+#define free_task_struct(tsk) free_pages((unsigned long)(tsk),0)
+#endif /* PAGE_SHIFT == 13 */
#define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count)
#define init_task (init_task_union.task)
diff --git a/include/asm-sparc64/timex.h b/include/asm-sparc64/timex.h
index b8d586e4f060..2b9f1da1f470 100644
--- a/include/asm-sparc64/timex.h
+++ b/include/asm-sparc64/timex.h
@@ -14,7 +14,6 @@
/* Getting on the cycle counter on sparc64. */
typedef unsigned long cycles_t;
-extern cycles_t cacheflush_time;
#define get_cycles() \
({ cycles_t ret; \
__asm__("rd %%tick, %0" : "=r" (ret)); \
diff --git a/include/asm-sparc64/tlb.h b/include/asm-sparc64/tlb.h
new file mode 100644
index 000000000000..69c0faa93194
--- /dev/null
+++ b/include/asm-sparc64/tlb.h
@@ -0,0 +1 @@
+#include <asm-generic/tlb.h>
diff --git a/include/linux/eeprom.h b/include/linux/eeprom.h
index ef070e148042..0f0642271857 100644
--- a/include/linux/eeprom.h
+++ b/include/linux/eeprom.h
@@ -1,5 +1,6 @@
/* credit winbond-840.c
*/
+#include <asm/io.h>
struct eeprom_ops {
void (*set_cs)(void *ee);
void (*clear_cs)(void *ee);
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index 9354683a720f..51657ceffa2d 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -26,6 +26,7 @@
/* Lock info passed via NLM */
struct nlm_lock {
char * caller;
+ int len; /* length of "caller" */
struct nfs_fh fh;
struct xdr_netobj oh;
struct file_lock fl;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 48f0831d62f6..8f9e8bfbce88 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -487,6 +487,8 @@ static inline int exclusive_swap_page(struct page *page)
return count == 3; /* =3: total */
}
+extern void __free_pte(pte_t);
+
/* mmap.c */
extern void lock_vma_mappings(struct vm_area_struct *);
extern void unlock_vma_mappings(struct vm_area_struct *);
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h
index b563a2922275..29a0c691883c 100644
--- a/include/linux/sonypi.h
+++ b/include/linux/sonypi.h
@@ -67,6 +67,10 @@
#define SONYPI_EVENT_FNKEY_S 29
#define SONYPI_EVENT_FNKEY_B 30
#define SONYPI_EVENT_BLUETOOTH_PRESSED 31
+#define SONYPI_EVENT_PKEY_P1 32
+#define SONYPI_EVENT_PKEY_P2 33
+#define SONYPI_EVENT_PKEY_P3 34
+
/* brightness etc. ioctls */
#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index f0ec6e7b2e72..facaddcd50c8 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -62,6 +62,7 @@ typedef int (*kxdrproc_t)(void *rqstp, u32 *data, void *obj);
u32 * xdr_encode_array(u32 *p, const char *s, unsigned int len);
u32 * xdr_encode_string(u32 *p, const char *s);
u32 * xdr_decode_string(u32 *p, char **sp, int *lenp, int maxlen);
+u32 * xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen);
u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *);
u32 * xdr_decode_netobj(u32 *p, struct xdr_netobj *);
u32 * xdr_decode_netobj_fixed(u32 *p, void *obj, unsigned int len);