init_64.c (e82b3aec8d508d2a925a4c766e97f16b7c4dfb1b) init_64.c (87655ff26817993932b7d049c4df226fb2c0ac5f)
1/*
2 * PowerPC version
3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
4 *
5 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
6 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
7 * Copyright (C) 1996 Paul Mackerras
8 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).

--- 6 unchanged lines hidden (view full) ---

15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version.
20 *
21 */
22
1/*
2 * PowerPC version
3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
4 *
5 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
6 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
7 * Copyright (C) 1996 Paul Mackerras
8 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).

--- 6 unchanged lines hidden (view full) ---

15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version.
20 *
21 */
22
23#undef DEBUG
24
23#include <linux/config.h>
24#include <linux/signal.h>
25#include <linux/sched.h>
26#include <linux/kernel.h>
27#include <linux/errno.h>
28#include <linux/string.h>
29#include <linux/types.h>
30#include <linux/mman.h>

--- 28 unchanged lines hidden (view full) ---

59#include <asm/cputable.h>
60#include <asm/sections.h>
61#include <asm/system.h>
62#include <asm/iommu.h>
63#include <asm/abs_addr.h>
64#include <asm/vdso.h>
65#include <asm/imalloc.h>
66
25#include <linux/config.h>
26#include <linux/signal.h>
27#include <linux/sched.h>
28#include <linux/kernel.h>
29#include <linux/errno.h>
30#include <linux/string.h>
31#include <linux/types.h>
32#include <linux/mman.h>

--- 28 unchanged lines hidden (view full) ---

61#include <asm/cputable.h>
62#include <asm/sections.h>
63#include <asm/system.h>
64#include <asm/iommu.h>
65#include <asm/abs_addr.h>
66#include <asm/vdso.h>
67#include <asm/imalloc.h>
68
69#ifdef DEBUG
70#define DBG(fmt...) printk(fmt)
71#else
72#define DBG(fmt...)
73#endif
74
67#if PGTABLE_RANGE > USER_VSID_RANGE
68#warning Limited user VSID range means pagetable space is wasted
69#endif
70
71#if (TASK_SIZE_USER64 < PGTABLE_RANGE) && (TASK_SIZE_USER64 < USER_VSID_RANGE)
72#warning TASK_SIZE is smaller than it needs to be.
73#endif
74

--- 108 unchanged lines hidden (view full) ---

183module_init(setup_kcore);
184
185static void zero_ctor(void *addr, kmem_cache_t *cache, unsigned long flags)
186{
187 memset(addr, 0, kmem_cache_size(cache));
188}
189
190#ifdef CONFIG_PPC_64K_PAGES
75#if PGTABLE_RANGE > USER_VSID_RANGE
76#warning Limited user VSID range means pagetable space is wasted
77#endif
78
79#if (TASK_SIZE_USER64 < PGTABLE_RANGE) && (TASK_SIZE_USER64 < USER_VSID_RANGE)
80#warning TASK_SIZE is smaller than it needs to be.
81#endif
82

--- 108 unchanged lines hidden (view full) ---

191module_init(setup_kcore);
192
193static void zero_ctor(void *addr, kmem_cache_t *cache, unsigned long flags)
194{
195 memset(addr, 0, kmem_cache_size(cache));
196}
197
198#ifdef CONFIG_PPC_64K_PAGES
191static const int pgtable_cache_size[2] = {
192 PTE_TABLE_SIZE, PGD_TABLE_SIZE
199static const unsigned int pgtable_cache_size[3] = {
200 PTE_TABLE_SIZE, PMD_TABLE_SIZE, PGD_TABLE_SIZE
193};
194static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = {
201};
202static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = {
195 "pte_pmd_cache", "pgd_cache",
203 "pte_pmd_cache", "pmd_cache", "pgd_cache",
196};
197#else
204};
205#else
198static const int pgtable_cache_size[2] = {
206static const unsigned int pgtable_cache_size[2] = {
199 PTE_TABLE_SIZE, PMD_TABLE_SIZE
200};
201static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = {
202 "pgd_pte_cache", "pud_pmd_cache",
203};
204#endif /* CONFIG_PPC_64K_PAGES */
205
206kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)];
207
208void pgtable_cache_init(void)
209{
210 int i;
211
212 for (i = 0; i < ARRAY_SIZE(pgtable_cache_size); i++) {
213 int size = pgtable_cache_size[i];
214 const char *name = pgtable_cache_name[i];
215
207 PTE_TABLE_SIZE, PMD_TABLE_SIZE
208};
209static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = {
210 "pgd_pte_cache", "pud_pmd_cache",
211};
212#endif /* CONFIG_PPC_64K_PAGES */
213
214kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)];
215
216void pgtable_cache_init(void)
217{
218 int i;
219
220 for (i = 0; i < ARRAY_SIZE(pgtable_cache_size); i++) {
221 int size = pgtable_cache_size[i];
222 const char *name = pgtable_cache_name[i];
223
224 DBG("Allocating page table cache %s (#%d) "
225 "for size: %08x...\n", name, i, size);
216 pgtable_cache[i] = kmem_cache_create(name,
217 size, size,
218 SLAB_HWCACHE_ALIGN |
219 SLAB_MUST_HWCACHE_ALIGN,
220 zero_ctor,
221 NULL);
222 if (! pgtable_cache[i])
223 panic("pgtable_cache_init(): could not create %s!\n",
224 name);
225 }
226}
226 pgtable_cache[i] = kmem_cache_create(name,
227 size, size,
228 SLAB_HWCACHE_ALIGN |
229 SLAB_MUST_HWCACHE_ALIGN,
230 zero_ctor,
231 NULL);
232 if (! pgtable_cache[i])
233 panic("pgtable_cache_init(): could not create %s!\n",
234 name);
235 }
236}