/[linux-patches]/genpatches-2.6/tags/2.6.16-7/1710_sparc-sparsemem.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.16-7/1710_sparc-sparsemem.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 451 - (show annotations) (download)
Mon May 1 23:04:47 2006 UTC (12 years, 2 months ago) by dsd
File size: 11171 byte(s)
2.6.16-7 release
1 diff -Nura linux-2.6.16-rc6-git4/arch/sparc64/Kconfig linux-2.6.16-rc6-git4-sparse/arch/sparc64/Kconfig
2 --- linux-2.6.16-rc6-git4/arch/sparc64/Kconfig 2006-03-11 16:12:55.000000000 -0600
3 +++ linux-2.6.16-rc6-git4-sparse/arch/sparc64/Kconfig 2006-03-15 07:13:12.000000000 -0600
4 @@ -186,6 +186,12 @@
5
6 endmenu
7
8 +config ARCH_SPARSEMEM_ENABLE
9 + def_bool y
10 +
11 +config ARCH_SPARSEMEM_DEFAULT
12 + def_bool y
13 +
14 source "mm/Kconfig"
15
16 config GENERIC_ISA_DMA
17 diff -Nura linux-2.6.16-rc6-git4/arch/sparc64/kernel/sparc64_ksyms.c linux-2.6.16-rc6-git4-sparse/arch/sparc64/kernel/sparc64_ksyms.c
18 --- linux-2.6.16-rc6-git4/arch/sparc64/kernel/sparc64_ksyms.c 2006-03-11 16:12:55.000000000 -0600
19 +++ linux-2.6.16-rc6-git4-sparse/arch/sparc64/kernel/sparc64_ksyms.c 2006-03-15 07:13:12.000000000 -0600
20 @@ -95,9 +95,6 @@
21
22 extern int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs);
23
24 -extern unsigned long phys_base;
25 -extern unsigned long pfn_base;
26 -
27 extern unsigned int sys_call_table[];
28
29 extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *);
30 @@ -342,11 +339,7 @@
31 EXPORT_SYMBOL(__bzero_noasi);
32
33 /* Various address conversion macros use this. */
34 -EXPORT_SYMBOL(phys_base);
35 -EXPORT_SYMBOL(pfn_base);
36 EXPORT_SYMBOL(sparc64_valid_addr_bitmap);
37 -EXPORT_SYMBOL(page_to_pfn);
38 -EXPORT_SYMBOL(pfn_to_page);
39
40 /* No version information on this, heavily used in inline asm,
41 * and will always be 'void __ret_efault(void)'.
42 diff -Nura linux-2.6.16-rc6-git4/arch/sparc64/mm/init.c linux-2.6.16-rc6-git4-sparse/arch/sparc64/mm/init.c
43 --- linux-2.6.16-rc6-git4/arch/sparc64/mm/init.c 2006-03-11 16:12:55.000000000 -0600
44 +++ linux-2.6.16-rc6-git4-sparse/arch/sparc64/mm/init.c 2006-03-15 07:13:27.000000000 -0600
45 @@ -111,11 +111,9 @@
46
47 unsigned long *sparc64_valid_addr_bitmap __read_mostly;
48
49 -/* Ugly, but necessary... -DaveM */
50 -unsigned long phys_base __read_mostly;
51 +/* Kernel physical address base and size in bytes. */
52 unsigned long kern_base __read_mostly;
53 unsigned long kern_size __read_mostly;
54 -unsigned long pfn_base __read_mostly;
55
56 /* get_new_mmu_context() uses "cache + 1". */
57 DEFINE_SPINLOCK(ctx_alloc_lock);
58 @@ -186,8 +184,8 @@
59 }
60
61 #define PG_dcache_dirty PG_arch_1
62 -#define PG_dcache_cpu_shift 24
63 -#define PG_dcache_cpu_mask (256 - 1)
64 +#define PG_dcache_cpu_shift 24UL
65 +#define PG_dcache_cpu_mask (256UL - 1UL)
66
67 #if NR_CPUS > 256
68 #error D-cache dirty tracking and thread_info->cpu need fixing for > 256 cpus
69 @@ -320,16 +318,6 @@
70 }
71 }
72
73 -unsigned long page_to_pfn(struct page *page)
74 -{
75 - return (unsigned long) ((page - mem_map) + pfn_base);
76 -}
77 -
78 -struct page *pfn_to_page(unsigned long pfn)
79 -{
80 - return (mem_map + (pfn - pfn_base));
81 -}
82 -
83 void show_mem(void)
84 {
85 printk("Mem-info:\n");
86 @@ -1196,9 +1184,78 @@
87
88 extern unsigned long cmdline_memory_size;
89
90 -unsigned long __init bootmem_init(unsigned long *pages_avail)
91 +/* Find a free area for the bootmem map, avoiding the kernel image
92 + * and the initial ramdisk.
93 + */
94 +static unsigned long __init choose_bootmap_pfn(unsigned long start_pfn,
95 + unsigned long end_pfn)
96 {
97 - unsigned long bootmap_size, start_pfn, end_pfn;
98 + unsigned long avoid_start, avoid_end, bootmap_size;
99 + int i;
100 +
101 + bootmap_size = ((end_pfn - start_pfn) + 7) / 8;
102 + bootmap_size = ALIGN(bootmap_size, sizeof(long));
103 +
104 + avoid_start = avoid_end = 0;
105 +#ifdef CONFIG_BLK_DEV_INITRD
106 + avoid_start = initrd_start;
107 + avoid_end = PAGE_ALIGN(initrd_end);
108 +#endif
109 +
110 +#ifdef CONFIG_DEBUG_BOOTMEM
111 + prom_printf("choose_bootmap_pfn: kern[%lx:%lx] avoid[%lx:%lx]\n",
112 + kern_base, PAGE_ALIGN(kern_base + kern_size),
113 + avoid_start, avoid_end);
114 +#endif
115 + for (i = 0; i < pavail_ents; i++) {
116 + unsigned long start, end;
117 +
118 + start = pavail[i].phys_addr;
119 + end = start + pavail[i].reg_size;
120 +
121 + while (start < end) {
122 + if (start >= kern_base &&
123 + start < PAGE_ALIGN(kern_base + kern_size)) {
124 + start = PAGE_ALIGN(kern_base + kern_size);
125 + continue;
126 + }
127 + if (start >= avoid_start && start < avoid_end) {
128 + start = avoid_end;
129 + continue;
130 + }
131 +
132 + if ((end - start) < bootmap_size)
133 + break;
134 +
135 + if (start < kern_base &&
136 + (start + bootmap_size) > kern_base) {
137 + start = PAGE_ALIGN(kern_base + kern_size);
138 + continue;
139 + }
140 +
141 + if (start < avoid_start &&
142 + (start + bootmap_size) > avoid_start) {
143 + start = avoid_end;
144 + continue;
145 + }
146 +
147 + /* OK, it doesn't overlap anything, use it. */
148 +#ifdef CONFIG_DEBUG_BOOTMEM
149 + prom_printf("choose_bootmap_pfn: Using %lx [%lx]\n",
150 + start >> PAGE_SHIFT, start);
151 +#endif
152 + return start >> PAGE_SHIFT;
153 + }
154 + }
155 +
156 + prom_printf("Cannot find free area for bootmap, aborting.\n");
157 + prom_halt();
158 +}
159 +
160 +static unsigned long __init bootmem_init(unsigned long *pages_avail,
161 + unsigned long phys_base)
162 +{
163 + unsigned long bootmap_size, end_pfn;
164 unsigned long end_of_phys_memory = 0UL;
165 unsigned long bootmap_pfn, bytes_avail, size;
166 int i;
167 @@ -1236,14 +1293,6 @@
168
169 *pages_avail = bytes_avail >> PAGE_SHIFT;
170
171 - /* Start with page aligned address of last symbol in kernel
172 - * image. The kernel is hard mapped below PAGE_OFFSET in a
173 - * 4MB locked TLB translation.
174 - */
175 - start_pfn = PAGE_ALIGN(kern_base + kern_size) >> PAGE_SHIFT;
176 -
177 - bootmap_pfn = start_pfn;
178 -
179 end_pfn = end_of_phys_memory >> PAGE_SHIFT;
180
181 #ifdef CONFIG_BLK_DEV_INITRD
182 @@ -1260,23 +1309,22 @@
183 "(0x%016lx > 0x%016lx)\ndisabling initrd\n",
184 initrd_end, end_of_phys_memory);
185 initrd_start = 0;
186 - }
187 - if (initrd_start) {
188 - if (initrd_start >= (start_pfn << PAGE_SHIFT) &&
189 - initrd_start < (start_pfn << PAGE_SHIFT) + 2 * PAGE_SIZE)
190 - bootmap_pfn = PAGE_ALIGN (initrd_end) >> PAGE_SHIFT;
191 + initrd_end = 0;
192 }
193 }
194 #endif
195 /* Initialize the boot-time allocator. */
196 max_pfn = max_low_pfn = end_pfn;
197 - min_low_pfn = pfn_base;
198 + min_low_pfn = (phys_base >> PAGE_SHIFT);
199 +
200 + bootmap_pfn = choose_bootmap_pfn(min_low_pfn, end_pfn);
201
202 #ifdef CONFIG_DEBUG_BOOTMEM
203 prom_printf("init_bootmem(min[%lx], bootmap[%lx], max[%lx])\n",
204 min_low_pfn, bootmap_pfn, max_low_pfn);
205 #endif
206 - bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap_pfn, pfn_base, end_pfn);
207 + bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap_pfn,
208 + min_low_pfn, end_pfn);
209
210 /* Now register the available physical memory with the
211 * allocator.
212 @@ -1324,6 +1372,20 @@
213 reserve_bootmem((bootmap_pfn << PAGE_SHIFT), size);
214 *pages_avail -= PAGE_ALIGN(size) >> PAGE_SHIFT;
215
216 + for (i = 0; i < pavail_ents; i++) {
217 + unsigned long start_pfn, end_pfn;
218 +
219 + start_pfn = pavail[i].phys_addr >> PAGE_SHIFT;
220 + end_pfn = (start_pfn + (pavail[i].reg_size >> PAGE_SHIFT));
221 +#ifdef CONFIG_DEBUG_BOOTMEM
222 + prom_printf("memory_present(0, %lx, %lx)\n",
223 + start_pfn, end_pfn);
224 +#endif
225 + memory_present(0, start_pfn, end_pfn);
226 + }
227 +
228 + sparse_init();
229 +
230 return end_pfn;
231 }
232
233 @@ -1448,7 +1510,7 @@
234
235 void __init paging_init(void)
236 {
237 - unsigned long end_pfn, pages_avail, shift;
238 + unsigned long end_pfn, pages_avail, shift, phys_base;
239 unsigned long real_end, i;
240
241 /* Find available physical memory... */
242 @@ -1458,8 +1520,6 @@
243 for (i = 0; i < pavail_ents; i++)
244 phys_base = min(phys_base, pavail[i].phys_addr);
245
246 - pfn_base = phys_base >> PAGE_SHIFT;
247 -
248 kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL;
249 kern_size = (unsigned long)&_end - (unsigned long)KERNBASE;
250
251 @@ -1506,7 +1566,9 @@
252
253 /* Setup bootmem... */
254 pages_avail = 0;
255 - last_valid_pfn = end_pfn = bootmem_init(&pages_avail);
256 + last_valid_pfn = end_pfn = bootmem_init(&pages_avail, phys_base);
257 +
258 + max_mapnr = last_valid_pfn;
259
260 #ifdef CONFIG_DEBUG_PAGEALLOC
261 kernel_physical_mapping_init();
262 @@ -1515,18 +1577,17 @@
263 {
264 unsigned long zones_size[MAX_NR_ZONES];
265 unsigned long zholes_size[MAX_NR_ZONES];
266 - unsigned long npages;
267 int znum;
268
269 for (znum = 0; znum < MAX_NR_ZONES; znum++)
270 zones_size[znum] = zholes_size[znum] = 0;
271
272 - npages = end_pfn - pfn_base;
273 - zones_size[ZONE_DMA] = npages;
274 - zholes_size[ZONE_DMA] = npages - pages_avail;
275 + zones_size[ZONE_DMA] = end_pfn;
276 + zholes_size[ZONE_DMA] = end_pfn - pages_avail;
277
278 free_area_init_node(0, &contig_page_data, zones_size,
279 - phys_base >> PAGE_SHIFT, zholes_size);
280 + __pa(PAGE_OFFSET) >> PAGE_SHIFT,
281 + zholes_size);
282 }
283
284 device_scan();
285 @@ -1596,7 +1657,6 @@
286
287 taint_real_pages();
288
289 - max_mapnr = last_valid_pfn - pfn_base;
290 high_memory = __va(last_valid_pfn << PAGE_SHIFT);
291
292 #ifdef CONFIG_DEBUG_BOOTMEM
293 diff -Nura linux-2.6.16-rc6-git4/include/asm-sparc64/numnodes.h linux-2.6.16-rc6-git4-sparse/include/asm-sparc64/numnodes.h
294 --- linux-2.6.16-rc6-git4/include/asm-sparc64/numnodes.h 1969-12-31 18:00:00.000000000 -0600
295 +++ linux-2.6.16-rc6-git4-sparse/include/asm-sparc64/numnodes.h 2006-03-15 07:13:12.000000000 -0600
296 @@ -0,0 +1,6 @@
297 +#ifndef _SPARC64_NUMNODES_H
298 +#define _SPARC64_NUMNODES_H
299 +
300 +#define NODES_SHIFT 0
301 +
302 +#endif /* !(_SPARC64_NUMNODES_H) */
303 diff -Nura linux-2.6.16-rc6-git4/include/asm-sparc64/page.h linux-2.6.16-rc6-git4-sparse/include/asm-sparc64/page.h
304 --- linux-2.6.16-rc6-git4/include/asm-sparc64/page.h 2006-03-11 16:12:55.000000000 -0600
305 +++ linux-2.6.16-rc6-git4-sparse/include/asm-sparc64/page.h 2006-03-15 07:13:12.000000000 -0600
306 @@ -124,17 +124,10 @@
307 #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
308 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
309
310 -/* PFNs are real physical page numbers. However, mem_map only begins to record
311 - * per-page information starting at pfn_base. This is to handle systems where
312 - * the first physical page in the machine is at some huge physical address,
313 - * such as 4GB. This is common on a partitioned E10000, for example.
314 - */
315 -extern struct page *pfn_to_page(unsigned long pfn);
316 -extern unsigned long page_to_pfn(struct page *);
317 +#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
318
319 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr)>>PAGE_SHIFT)
320
321 -#define pfn_valid(pfn) (((pfn)-(pfn_base)) < max_mapnr)
322 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
323
324 #define virt_to_phys __pa
325 diff -Nura linux-2.6.16-rc6-git4/include/asm-sparc64/pgtable.h linux-2.6.16-rc6-git4-sparse/include/asm-sparc64/pgtable.h
326 --- linux-2.6.16-rc6-git4/include/asm-sparc64/pgtable.h 2006-03-11 16:12:55.000000000 -0600
327 +++ linux-2.6.16-rc6-git4-sparse/include/asm-sparc64/pgtable.h 2006-03-15 07:13:12.000000000 -0600
328 @@ -212,9 +212,6 @@
329
330 #ifndef __ASSEMBLY__
331
332 -extern unsigned long phys_base;
333 -extern unsigned long pfn_base;
334 -
335 extern struct page *mem_map_zero;
336 #define ZERO_PAGE(vaddr) (mem_map_zero)
337
338 diff -Nura linux-2.6.16-rc6-git4/include/asm-sparc64/sparsemem.h linux-2.6.16-rc6-git4-sparse/include/asm-sparc64/sparsemem.h
339 --- linux-2.6.16-rc6-git4/include/asm-sparc64/sparsemem.h 1969-12-31 18:00:00.000000000 -0600
340 +++ linux-2.6.16-rc6-git4-sparse/include/asm-sparc64/sparsemem.h 2006-03-15 07:13:12.000000000 -0600
341 @@ -0,0 +1,12 @@
342 +#ifndef _SPARC64_SPARSEMEM_H
343 +#define _SPARC64_SPARSEMEM_H
344 +
345 +#ifdef __KERNEL__
346 +
347 +#define SECTION_SIZE_BITS 26
348 +#define MAX_PHYSADDR_BITS 42
349 +#define MAX_PHYSMEM_BITS 42
350 +
351 +#endif /* !(__KERNEL__) */
352 +
353 +#endif /* !(_SPARC64_SPARSEMEM_H) */

  ViewVC Help
Powered by ViewVC 1.1.20