diff options
author | Paul Mackerras <paulus@samba.org> | 2005-10-10 07:52:43 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-10-10 07:52:43 -0400 |
commit | 70d64ceaa1a84d2502405422a4dfd3f87786a347 (patch) | |
tree | 23e38168021988d34b11c6f41cfff82f8095092e | |
parent | a432403a89646614252c3bb6dfbe897c8312ab35 (diff) |
powerpc: Rename files to have consistent _32/_64 suffixes
This doesn't change any code, just renames things so we consistently
have foo_32.c and foo_64.c where we have separate 32- and 64-bit
versions.
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/Makefile | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/Makefile | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_32.S (renamed from arch/powerpc/kernel/head.S) | 0 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_32.c (renamed from arch/powerpc/kernel/setup.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/lib/Makefile | 6 | ||||
-rw-r--r-- | arch/powerpc/lib/checksum_32.S (renamed from arch/powerpc/lib/checksum.S) | 0 | ||||
-rw-r--r-- | arch/powerpc/lib/checksum_64.S (renamed from arch/powerpc/lib/checksum64.S) | 0 | ||||
-rw-r--r-- | arch/powerpc/lib/copy_32.S (renamed from arch/powerpc/lib/copy32.S) | 0 | ||||
-rw-r--r-- | arch/powerpc/lib/copypage_64.S (renamed from arch/powerpc/lib/copypage.S) | 0 | ||||
-rw-r--r-- | arch/powerpc/lib/copyuser_64.S (renamed from arch/powerpc/lib/copyuser.S) | 0 | ||||
-rw-r--r-- | arch/powerpc/lib/mem_64.S | 119 | ||||
-rw-r--r-- | arch/powerpc/lib/memcpy_64.S (renamed from arch/powerpc/lib/memcpy.S) | 0 | ||||
-rw-r--r-- | arch/powerpc/lib/usercopy_64.c (renamed from arch/powerpc/lib/usercopy.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/mm/Makefile | 8 | ||||
-rw-r--r-- | arch/powerpc/mm/hash_low_32.S (renamed from arch/powerpc/mm/hash_32.S) | 0 | ||||
-rw-r--r-- | arch/powerpc/mm/init_32.c (renamed from arch/powerpc/mm/init.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/mm/init_64.c (renamed from arch/powerpc/mm/init64.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/mm/mem64.c | 259 | ||||
-rw-r--r-- | arch/powerpc/mm/mmu_context_32.c (renamed from arch/powerpc/mm/mmu_context.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/mm/mmu_context_64.c (renamed from arch/powerpc/mm/mmu_context64.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/mm/pgtable_32.c (renamed from arch/powerpc/mm/pgtable.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/mm/pgtable_64.c (renamed from arch/powerpc/mm/pgtable64.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/mm/ppc_mmu_32.c (renamed from arch/powerpc/mm/ppc_mmu.c) | 0 | ||||
-rw-r--r-- | arch/powerpc/mm/tlb_32.c (renamed from arch/powerpc/mm/tlb.c) | 0 |
24 files changed, 129 insertions, 269 deletions
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index eb1224c24e3e..064864065753 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile | |||
@@ -112,7 +112,7 @@ CFLAGS += $(cpu-as-y) | |||
112 | # Default to the common case. | 112 | # Default to the common case. |
113 | KBUILD_DEFCONFIG := common_defconfig | 113 | KBUILD_DEFCONFIG := common_defconfig |
114 | 114 | ||
115 | head-y := arch/powerpc/kernel/head.o | 115 | head-y := arch/powerpc/kernel/head_32.o |
116 | head-$(CONFIG_PPC64) := arch/powerpc/kernel/head_64.o | 116 | head-$(CONFIG_PPC64) := arch/powerpc/kernel/head_64.o |
117 | head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o | 117 | head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o |
118 | head-$(CONFIG_4xx) := arch/powerpc/kernel/head_4xx.o | 118 | head-$(CONFIG_4xx) := arch/powerpc/kernel/head_4xx.o |
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 06d618e52f8e..344cab678c6a 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -10,7 +10,7 @@ CFLAGS_prom_init.o += -fPIC | |||
10 | CFLAGS_btext.o += -fPIC | 10 | CFLAGS_btext.o += -fPIC |
11 | endif | 11 | endif |
12 | 12 | ||
13 | extra-$(CONFIG_PPC_STD_MMU) := head.o | 13 | extra-$(CONFIG_PPC_STD_MMU) := head_32.o |
14 | extra-$(CONFIG_PPC64) := head_64.o | 14 | extra-$(CONFIG_PPC64) := head_64.o |
15 | extra-$(CONFIG_40x) := head_4xx.o | 15 | extra-$(CONFIG_40x) := head_4xx.o |
16 | extra-$(CONFIG_44x) := head_44x.o | 16 | extra-$(CONFIG_44x) := head_44x.o |
@@ -21,7 +21,7 @@ extra-$(CONFIG_PPC_FPU) += fpu.o | |||
21 | extra-y += vmlinux.lds | 21 | extra-y += vmlinux.lds |
22 | 22 | ||
23 | obj-y := traps.o prom.o semaphore.o | 23 | obj-y := traps.o prom.o semaphore.o |
24 | obj-$(CONFIG_PPC32) += setup.o process.o | 24 | obj-$(CONFIG_PPC32) += setup_32.o process.o |
25 | obj-$(CONFIG_PPC64) += idle_power4.o | 25 | obj-$(CONFIG_PPC64) += idle_power4.o |
26 | ifeq ($(CONFIG_PPC32),y) | 26 | ifeq ($(CONFIG_PPC32),y) |
27 | obj-$(CONFIG_PPC_OF) += prom_init.o of_device.o | 27 | obj-$(CONFIG_PPC_OF) += prom_init.o of_device.o |
diff --git a/arch/powerpc/kernel/head.S b/arch/powerpc/kernel/head_32.S index d9dbbd426744..d9dbbd426744 100644 --- a/arch/powerpc/kernel/head.S +++ b/arch/powerpc/kernel/head_32.S | |||
diff --git a/arch/powerpc/kernel/setup.c b/arch/powerpc/kernel/setup_32.c index 27d7f828212b..27d7f828212b 100644 --- a/arch/powerpc/kernel/setup.c +++ b/arch/powerpc/kernel/setup_32.c | |||
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index 347f9798e433..a8cedb96de5f 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := strcase.o string.o | 5 | obj-y := strcase.o string.o |
6 | obj-$(CONFIG_PPC32) += div64.o copy32.o checksum.o | 6 | obj-$(CONFIG_PPC32) += div64.o copy_32.o checksum_32.o |
7 | obj-$(CONFIG_PPC64) += copypage.o copyuser.o memcpy.o usercopy.o \ | 7 | obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o memcpy_64.o \ |
8 | sstep.o checksum64.o | 8 | usercopy_64.o sstep.o checksum_64.o mem_64.o |
9 | obj-$(CONFIG_PPC_ISERIES) += e2a.o | 9 | obj-$(CONFIG_PPC_ISERIES) += e2a.o |
diff --git a/arch/powerpc/lib/checksum.S b/arch/powerpc/lib/checksum_32.S index 7874e8a80455..7874e8a80455 100644 --- a/arch/powerpc/lib/checksum.S +++ b/arch/powerpc/lib/checksum_32.S | |||
diff --git a/arch/powerpc/lib/checksum64.S b/arch/powerpc/lib/checksum_64.S index ef96c6c58efc..ef96c6c58efc 100644 --- a/arch/powerpc/lib/checksum64.S +++ b/arch/powerpc/lib/checksum_64.S | |||
diff --git a/arch/powerpc/lib/copy32.S b/arch/powerpc/lib/copy_32.S index 420a912198a2..420a912198a2 100644 --- a/arch/powerpc/lib/copy32.S +++ b/arch/powerpc/lib/copy_32.S | |||
diff --git a/arch/powerpc/lib/copypage.S b/arch/powerpc/lib/copypage_64.S index 733d61618bbf..733d61618bbf 100644 --- a/arch/powerpc/lib/copypage.S +++ b/arch/powerpc/lib/copypage_64.S | |||
diff --git a/arch/powerpc/lib/copyuser.S b/arch/powerpc/lib/copyuser_64.S index a0b3fbbd6fb1..a0b3fbbd6fb1 100644 --- a/arch/powerpc/lib/copyuser.S +++ b/arch/powerpc/lib/copyuser_64.S | |||
diff --git a/arch/powerpc/lib/mem_64.S b/arch/powerpc/lib/mem_64.S new file mode 100644 index 000000000000..68df20283ff5 --- /dev/null +++ b/arch/powerpc/lib/mem_64.S | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | * String handling functions for PowerPC. | ||
3 | * | ||
4 | * Copyright (C) 1996 Paul Mackerras. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | #include <asm/processor.h> | ||
12 | #include <asm/errno.h> | ||
13 | #include <asm/ppc_asm.h> | ||
14 | |||
15 | _GLOBAL(memset) | ||
16 | neg r0,r3 | ||
17 | rlwimi r4,r4,8,16,23 | ||
18 | andi. r0,r0,7 /* # bytes to be 8-byte aligned */ | ||
19 | rlwimi r4,r4,16,0,15 | ||
20 | cmplw cr1,r5,r0 /* do we get that far? */ | ||
21 | rldimi r4,r4,32,0 | ||
22 | mtcrf 1,r0 | ||
23 | mr r6,r3 | ||
24 | blt cr1,8f | ||
25 | beq+ 3f /* if already 8-byte aligned */ | ||
26 | subf r5,r0,r5 | ||
27 | bf 31,1f | ||
28 | stb r4,0(r6) | ||
29 | addi r6,r6,1 | ||
30 | 1: bf 30,2f | ||
31 | sth r4,0(r6) | ||
32 | addi r6,r6,2 | ||
33 | 2: bf 29,3f | ||
34 | stw r4,0(r6) | ||
35 | addi r6,r6,4 | ||
36 | 3: srdi. r0,r5,6 | ||
37 | clrldi r5,r5,58 | ||
38 | mtctr r0 | ||
39 | beq 5f | ||
40 | 4: std r4,0(r6) | ||
41 | std r4,8(r6) | ||
42 | std r4,16(r6) | ||
43 | std r4,24(r6) | ||
44 | std r4,32(r6) | ||
45 | std r4,40(r6) | ||
46 | std r4,48(r6) | ||
47 | std r4,56(r6) | ||
48 | addi r6,r6,64 | ||
49 | bdnz 4b | ||
50 | 5: srwi. r0,r5,3 | ||
51 | clrlwi r5,r5,29 | ||
52 | mtcrf 1,r0 | ||
53 | beq 8f | ||
54 | bf 29,6f | ||
55 | std r4,0(r6) | ||
56 | std r4,8(r6) | ||
57 | std r4,16(r6) | ||
58 | std r4,24(r6) | ||
59 | addi r6,r6,32 | ||
60 | 6: bf 30,7f | ||
61 | std r4,0(r6) | ||
62 | std r4,8(r6) | ||
63 | addi r6,r6,16 | ||
64 | 7: bf 31,8f | ||
65 | std r4,0(r6) | ||
66 | addi r6,r6,8 | ||
67 | 8: cmpwi r5,0 | ||
68 | mtcrf 1,r5 | ||
69 | beqlr+ | ||
70 | bf 29,9f | ||
71 | stw r4,0(r6) | ||
72 | addi r6,r6,4 | ||
73 | 9: bf 30,10f | ||
74 | sth r4,0(r6) | ||
75 | addi r6,r6,2 | ||
76 | 10: bflr 31 | ||
77 | stb r4,0(r6) | ||
78 | blr | ||
79 | |||
80 | _GLOBAL(memmove) | ||
81 | cmplw 0,r3,r4 | ||
82 | bgt .backwards_memcpy | ||
83 | b .memcpy | ||
84 | |||
85 | _GLOBAL(backwards_memcpy) | ||
86 | rlwinm. r7,r5,32-3,3,31 /* r0 = r5 >> 3 */ | ||
87 | add r6,r3,r5 | ||
88 | add r4,r4,r5 | ||
89 | beq 2f | ||
90 | andi. r0,r6,3 | ||
91 | mtctr r7 | ||
92 | bne 5f | ||
93 | 1: lwz r7,-4(r4) | ||
94 | lwzu r8,-8(r4) | ||
95 | stw r7,-4(r6) | ||
96 | stwu r8,-8(r6) | ||
97 | bdnz 1b | ||
98 | andi. r5,r5,7 | ||
99 | 2: cmplwi 0,r5,4 | ||
100 | blt 3f | ||
101 | lwzu r0,-4(r4) | ||
102 | subi r5,r5,4 | ||
103 | stwu r0,-4(r6) | ||
104 | 3: cmpwi 0,r5,0 | ||
105 | beqlr | ||
106 | mtctr r5 | ||
107 | 4: lbzu r0,-1(r4) | ||
108 | stbu r0,-1(r6) | ||
109 | bdnz 4b | ||
110 | blr | ||
111 | 5: mtctr r0 | ||
112 | 6: lbzu r7,-1(r4) | ||
113 | stbu r7,-1(r6) | ||
114 | bdnz 6b | ||
115 | subf r5,r0,r5 | ||
116 | rlwinm. r7,r5,32-3,3,31 | ||
117 | beq 2b | ||
118 | mtctr r7 | ||
119 | b 1b | ||
diff --git a/arch/powerpc/lib/memcpy.S b/arch/powerpc/lib/memcpy_64.S index 9ccacdf5bcb9..9ccacdf5bcb9 100644 --- a/arch/powerpc/lib/memcpy.S +++ b/arch/powerpc/lib/memcpy_64.S | |||
diff --git a/arch/powerpc/lib/usercopy.c b/arch/powerpc/lib/usercopy_64.c index 5eea6f3c1e03..5eea6f3c1e03 100644 --- a/arch/powerpc/lib/usercopy.c +++ b/arch/powerpc/lib/usercopy_64.c | |||
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile index afd3be112b79..35497deeb4b2 100644 --- a/arch/powerpc/mm/Makefile +++ b/arch/powerpc/mm/Makefile | |||
@@ -3,10 +3,10 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := fault.o mem.o lmb.o | 5 | obj-y := fault.o mem.o lmb.o |
6 | obj-$(CONFIG_PPC32) += init.o pgtable.o mmu_context.o \ | 6 | obj-$(CONFIG_PPC32) += init_32.o pgtable_32.o mmu_context_32.o \ |
7 | tlb.o | 7 | tlb_32.o |
8 | obj-$(CONFIG_PPC64) += init64.o pgtable64.o mmu_context64.o | 8 | obj-$(CONFIG_PPC64) += init_64.o pgtable_64.o mmu_context_64.o |
9 | obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu.o hash_32.o | 9 | obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o hash_low_32.o |
10 | obj-$(CONFIG_40x) += 4xx_mmu.o | 10 | obj-$(CONFIG_40x) += 4xx_mmu.o |
11 | obj-$(CONFIG_44x) += 44x_mmu.o | 11 | obj-$(CONFIG_44x) += 44x_mmu.o |
12 | obj-$(CONFIG_FSL_BOOKE) += fsl_booke_mmu.o | 12 | obj-$(CONFIG_FSL_BOOKE) += fsl_booke_mmu.o |
diff --git a/arch/powerpc/mm/hash_32.S b/arch/powerpc/mm/hash_low_32.S index 57278a8dd132..57278a8dd132 100644 --- a/arch/powerpc/mm/hash_32.S +++ b/arch/powerpc/mm/hash_low_32.S | |||
diff --git a/arch/powerpc/mm/init.c b/arch/powerpc/mm/init_32.c index bf13c14e66b3..bf13c14e66b3 100644 --- a/arch/powerpc/mm/init.c +++ b/arch/powerpc/mm/init_32.c | |||
diff --git a/arch/powerpc/mm/init64.c b/arch/powerpc/mm/init_64.c index c0ce6a7af3c7..c0ce6a7af3c7 100644 --- a/arch/powerpc/mm/init64.c +++ b/arch/powerpc/mm/init_64.c | |||
diff --git a/arch/powerpc/mm/mem64.c b/arch/powerpc/mm/mem64.c deleted file mode 100644 index ef765a84433f..000000000000 --- a/arch/powerpc/mm/mem64.c +++ /dev/null | |||
@@ -1,259 +0,0 @@ | |||
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). | ||
9 | * | ||
10 | * Derived from "arch/i386/mm/init.c" | ||
11 | * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds | ||
12 | * | ||
13 | * Dave Engebretsen <engebret@us.ibm.com> | ||
14 | * Rework for PPC64 port. | ||
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 | #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> | ||
31 | #include <linux/mm.h> | ||
32 | #include <linux/swap.h> | ||
33 | #include <linux/stddef.h> | ||
34 | #include <linux/vmalloc.h> | ||
35 | #include <linux/init.h> | ||
36 | #include <linux/delay.h> | ||
37 | #include <linux/bootmem.h> | ||
38 | #include <linux/highmem.h> | ||
39 | #include <linux/idr.h> | ||
40 | #include <linux/nodemask.h> | ||
41 | #include <linux/module.h> | ||
42 | |||
43 | #include <asm/pgalloc.h> | ||
44 | #include <asm/page.h> | ||
45 | #include <asm/prom.h> | ||
46 | #include <asm/lmb.h> | ||
47 | #include <asm/rtas.h> | ||
48 | #include <asm/io.h> | ||
49 | #include <asm/mmu_context.h> | ||
50 | #include <asm/pgtable.h> | ||
51 | #include <asm/mmu.h> | ||
52 | #include <asm/uaccess.h> | ||
53 | #include <asm/smp.h> | ||
54 | #include <asm/machdep.h> | ||
55 | #include <asm/tlb.h> | ||
56 | #include <asm/eeh.h> | ||
57 | #include <asm/processor.h> | ||
58 | #include <asm/mmzone.h> | ||
59 | #include <asm/cputable.h> | ||
60 | #include <asm/ppcdebug.h> | ||
61 | #include <asm/sections.h> | ||
62 | #include <asm/system.h> | ||
63 | #include <asm/iommu.h> | ||
64 | #include <asm/abs_addr.h> | ||
65 | #include <asm/vdso.h> | ||
66 | #include <asm/imalloc.h> | ||
67 | |||
68 | /* | ||
69 | * This is called by /dev/mem to know if a given address has to | ||
70 | * be mapped non-cacheable or not | ||
71 | */ | ||
72 | int page_is_ram(unsigned long pfn) | ||
73 | { | ||
74 | int i; | ||
75 | unsigned long paddr = (pfn << PAGE_SHIFT); | ||
76 | |||
77 | for (i=0; i < lmb.memory.cnt; i++) { | ||
78 | unsigned long base; | ||
79 | |||
80 | base = lmb.memory.region[i].base; | ||
81 | |||
82 | if ((paddr >= base) && | ||
83 | (paddr < (base + lmb.memory.region[i].size))) { | ||
84 | return 1; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | return 0; | ||
89 | } | ||
90 | EXPORT_SYMBOL(page_is_ram); | ||
91 | |||
92 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr, | ||
93 | unsigned long size, pgprot_t vma_prot) | ||
94 | { | ||
95 | if (ppc_md.phys_mem_access_prot) | ||
96 | return ppc_md.phys_mem_access_prot(file, addr, size, vma_prot); | ||
97 | |||
98 | if (!page_is_ram(addr >> PAGE_SHIFT)) | ||
99 | vma_prot = __pgprot(pgprot_val(vma_prot) | ||
100 | | _PAGE_GUARDED | _PAGE_NO_CACHE); | ||
101 | return vma_prot; | ||
102 | } | ||
103 | EXPORT_SYMBOL(phys_mem_access_prot); | ||
104 | |||
105 | void show_mem(void) | ||
106 | { | ||
107 | unsigned long total = 0, reserved = 0; | ||
108 | unsigned long shared = 0, cached = 0; | ||
109 | struct page *page; | ||
110 | pg_data_t *pgdat; | ||
111 | unsigned long i; | ||
112 | |||
113 | printk("Mem-info:\n"); | ||
114 | show_free_areas(); | ||
115 | printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); | ||
116 | for_each_pgdat(pgdat) { | ||
117 | for (i = 0; i < pgdat->node_spanned_pages; i++) { | ||
118 | page = pgdat_page_nr(pgdat, i); | ||
119 | total++; | ||
120 | if (PageReserved(page)) | ||
121 | reserved++; | ||
122 | else if (PageSwapCache(page)) | ||
123 | cached++; | ||
124 | else if (page_count(page)) | ||
125 | shared += page_count(page) - 1; | ||
126 | } | ||
127 | } | ||
128 | printk("%ld pages of RAM\n", total); | ||
129 | printk("%ld reserved pages\n", reserved); | ||
130 | printk("%ld pages shared\n", shared); | ||
131 | printk("%ld pages swap cached\n", cached); | ||
132 | } | ||
133 | |||
134 | /* | ||
135 | * This is called when a page has been modified by the kernel. | ||
136 | * It just marks the page as not i-cache clean. We do the i-cache | ||
137 | * flush later when the page is given to a user process, if necessary. | ||
138 | */ | ||
139 | void flush_dcache_page(struct page *page) | ||
140 | { | ||
141 | if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) | ||
142 | return; | ||
143 | /* avoid an atomic op if possible */ | ||
144 | if (test_bit(PG_arch_1, &page->flags)) | ||
145 | clear_bit(PG_arch_1, &page->flags); | ||
146 | } | ||
147 | EXPORT_SYMBOL(flush_dcache_page); | ||
148 | |||
149 | void clear_user_page(void *page, unsigned long vaddr, struct page *pg) | ||
150 | { | ||
151 | clear_page(page); | ||
152 | |||
153 | if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) | ||
154 | return; | ||
155 | /* | ||
156 | * We shouldnt have to do this, but some versions of glibc | ||
157 | * require it (ld.so assumes zero filled pages are icache clean) | ||
158 | * - Anton | ||
159 | */ | ||
160 | |||
161 | /* avoid an atomic op if possible */ | ||
162 | if (test_bit(PG_arch_1, &pg->flags)) | ||
163 | clear_bit(PG_arch_1, &pg->flags); | ||
164 | } | ||
165 | EXPORT_SYMBOL(clear_user_page); | ||
166 | |||
167 | void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, | ||
168 | struct page *pg) | ||
169 | { | ||
170 | copy_page(vto, vfrom); | ||
171 | |||
172 | /* | ||
173 | * We should be able to use the following optimisation, however | ||
174 | * there are two problems. | ||
175 | * Firstly a bug in some versions of binutils meant PLT sections | ||
176 | * were not marked executable. | ||
177 | * Secondly the first word in the GOT section is blrl, used | ||
178 | * to establish the GOT address. Until recently the GOT was | ||
179 | * not marked executable. | ||
180 | * - Anton | ||
181 | */ | ||
182 | #if 0 | ||
183 | if (!vma->vm_file && ((vma->vm_flags & VM_EXEC) == 0)) | ||
184 | return; | ||
185 | #endif | ||
186 | |||
187 | if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) | ||
188 | return; | ||
189 | |||
190 | /* avoid an atomic op if possible */ | ||
191 | if (test_bit(PG_arch_1, &pg->flags)) | ||
192 | clear_bit(PG_arch_1, &pg->flags); | ||
193 | } | ||
194 | |||
195 | void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, | ||
196 | unsigned long addr, int len) | ||
197 | { | ||
198 | unsigned long maddr; | ||
199 | |||
200 | maddr = (unsigned long)page_address(page) + (addr & ~PAGE_MASK); | ||
201 | flush_icache_range(maddr, maddr + len); | ||
202 | } | ||
203 | EXPORT_SYMBOL(flush_icache_user_range); | ||
204 | |||
205 | /* | ||
206 | * This is called at the end of handling a user page fault, when the | ||
207 | * fault has been handled by updating a PTE in the linux page tables. | ||
208 | * We use it to preload an HPTE into the hash table corresponding to | ||
209 | * the updated linux PTE. | ||
210 | * | ||
211 | * This must always be called with the mm->page_table_lock held | ||
212 | */ | ||
213 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long ea, | ||
214 | pte_t pte) | ||
215 | { | ||
216 | unsigned long vsid; | ||
217 | void *pgdir; | ||
218 | pte_t *ptep; | ||
219 | int local = 0; | ||
220 | cpumask_t tmp; | ||
221 | unsigned long flags; | ||
222 | |||
223 | /* handle i-cache coherency */ | ||
224 | if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE) && | ||
225 | !cpu_has_feature(CPU_FTR_NOEXECUTE)) { | ||
226 | unsigned long pfn = pte_pfn(pte); | ||
227 | if (pfn_valid(pfn)) { | ||
228 | struct page *page = pfn_to_page(pfn); | ||
229 | if (!PageReserved(page) | ||
230 | && !test_bit(PG_arch_1, &page->flags)) { | ||
231 | __flush_dcache_icache(page_address(page)); | ||
232 | set_bit(PG_arch_1, &page->flags); | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | |||
237 | /* We only want HPTEs for linux PTEs that have _PAGE_ACCESSED set */ | ||
238 | if (!pte_young(pte)) | ||
239 | return; | ||
240 | |||
241 | pgdir = vma->vm_mm->pgd; | ||
242 | if (pgdir == NULL) | ||
243 | return; | ||
244 | |||
245 | ptep = find_linux_pte(pgdir, ea); | ||
246 | if (!ptep) | ||
247 | return; | ||
248 | |||
249 | vsid = get_vsid(vma->vm_mm->context.id, ea); | ||
250 | |||
251 | local_irq_save(flags); | ||
252 | tmp = cpumask_of_cpu(smp_processor_id()); | ||
253 | if (cpus_equal(vma->vm_mm->cpu_vm_mask, tmp)) | ||
254 | local = 1; | ||
255 | |||
256 | __hash_page(ea, pte_val(pte) & (_PAGE_USER|_PAGE_RW), vsid, ptep, | ||
257 | 0x300, local); | ||
258 | local_irq_restore(flags); | ||
259 | } | ||
diff --git a/arch/powerpc/mm/mmu_context.c b/arch/powerpc/mm/mmu_context_32.c index a8816e0f6a86..a8816e0f6a86 100644 --- a/arch/powerpc/mm/mmu_context.c +++ b/arch/powerpc/mm/mmu_context_32.c | |||
diff --git a/arch/powerpc/mm/mmu_context64.c b/arch/powerpc/mm/mmu_context_64.c index 714a84dd8d5d..714a84dd8d5d 100644 --- a/arch/powerpc/mm/mmu_context64.c +++ b/arch/powerpc/mm/mmu_context_64.c | |||
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable_32.c index 5792e533916f..5792e533916f 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable_32.c | |||
diff --git a/arch/powerpc/mm/pgtable64.c b/arch/powerpc/mm/pgtable_64.c index 724f97e5dee5..724f97e5dee5 100644 --- a/arch/powerpc/mm/pgtable64.c +++ b/arch/powerpc/mm/pgtable_64.c | |||
diff --git a/arch/powerpc/mm/ppc_mmu.c b/arch/powerpc/mm/ppc_mmu_32.c index cef9e83cc7e9..cef9e83cc7e9 100644 --- a/arch/powerpc/mm/ppc_mmu.c +++ b/arch/powerpc/mm/ppc_mmu_32.c | |||
diff --git a/arch/powerpc/mm/tlb.c b/arch/powerpc/mm/tlb_32.c index 6c3dc3c44c86..6c3dc3c44c86 100644 --- a/arch/powerpc/mm/tlb.c +++ b/arch/powerpc/mm/tlb_32.c | |||