diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-06-02 17:17:45 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-06-09 02:47:38 -0400 |
commit | 944916858a430a0627e483657d4cfa2cd2dfb4f7 (patch) | |
tree | 37fa713f9c336daab10b132bd3e00c57f6111b71 | |
parent | 91c60b5b8209627590b31c07262e40c27d27d272 (diff) |
powerpc: Shield code specific to 64-bit server processors
This is a random collection of added ifdef's around portions of
code that only mak sense on server processors. Using either
CONFIG_PPC_STD_MMU_64 or CONFIG_PPC_BOOK3S as seems appropriate.
This is meant to make the future merging of Book3E 64-bit support
easier.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/include/asm/lppaca.h | 6 | ||||
-rw-r--r-- | arch/powerpc/include/asm/mmu.h | 4 | ||||
-rw-r--r-- | arch/powerpc/include/asm/pgtable-ppc64.h | 5 | ||||
-rw-r--r-- | arch/powerpc/kernel/irq.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci_64.c | 5 | ||||
-rw-r--r-- | arch/powerpc/kernel/process.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 5 | ||||
-rw-r--r-- | arch/powerpc/mm/Makefile | 7 | ||||
-rw-r--r-- | arch/powerpc/mm/init_64.c | 2 |
10 files changed, 32 insertions, 8 deletions
diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h index d2a65e8ca6ae..f78f65c38f05 100644 --- a/arch/powerpc/include/asm/lppaca.h +++ b/arch/powerpc/include/asm/lppaca.h | |||
@@ -20,6 +20,11 @@ | |||
20 | #define _ASM_POWERPC_LPPACA_H | 20 | #define _ASM_POWERPC_LPPACA_H |
21 | #ifdef __KERNEL__ | 21 | #ifdef __KERNEL__ |
22 | 22 | ||
23 | /* These definitions relate to hypervisors that only exist when using | ||
24 | * a server type processor | ||
25 | */ | ||
26 | #ifdef CONFIG_PPC_BOOK3S | ||
27 | |||
23 | //============================================================================= | 28 | //============================================================================= |
24 | // | 29 | // |
25 | // This control block contains the data that is shared between the | 30 | // This control block contains the data that is shared between the |
@@ -158,5 +163,6 @@ struct slb_shadow { | |||
158 | 163 | ||
159 | extern struct slb_shadow slb_shadow[]; | 164 | extern struct slb_shadow slb_shadow[]; |
160 | 165 | ||
166 | #endif /* CONFIG_PPC_BOOK3S */ | ||
161 | #endif /* __KERNEL__ */ | 167 | #endif /* __KERNEL__ */ |
162 | #endif /* _ASM_POWERPC_LPPACA_H */ | 168 | #endif /* _ASM_POWERPC_LPPACA_H */ |
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index 325b7208a146..fb57ded592f9 100644 --- a/arch/powerpc/include/asm/mmu.h +++ b/arch/powerpc/include/asm/mmu.h | |||
@@ -74,10 +74,10 @@ extern void early_init_mmu_secondary(void); | |||
74 | #endif /* !__ASSEMBLY__ */ | 74 | #endif /* !__ASSEMBLY__ */ |
75 | 75 | ||
76 | 76 | ||
77 | #ifdef CONFIG_PPC64 | 77 | #if defined(CONFIG_PPC_STD_MMU_64) |
78 | /* 64-bit classic hash table MMU */ | 78 | /* 64-bit classic hash table MMU */ |
79 | # include <asm/mmu-hash64.h> | 79 | # include <asm/mmu-hash64.h> |
80 | #elif defined(CONFIG_PPC_STD_MMU) | 80 | #elif defined(CONFIG_PPC_STD_MMU_32) |
81 | /* 32-bit classic hash table MMU */ | 81 | /* 32-bit classic hash table MMU */ |
82 | # include <asm/mmu-hash32.h> | 82 | # include <asm/mmu-hash32.h> |
83 | #elif defined(CONFIG_40x) | 83 | #elif defined(CONFIG_40x) |
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h index c40db05f21e0..8cd083c61503 100644 --- a/arch/powerpc/include/asm/pgtable-ppc64.h +++ b/arch/powerpc/include/asm/pgtable-ppc64.h | |||
@@ -31,9 +31,11 @@ | |||
31 | #error TASK_SIZE_USER64 exceeds pagetable range | 31 | #error TASK_SIZE_USER64 exceeds pagetable range |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
34 | #if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT)) | 35 | #if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT)) |
35 | #error TASK_SIZE_USER64 exceeds user VSID range | 36 | #error TASK_SIZE_USER64 exceeds user VSID range |
36 | #endif | 37 | #endif |
38 | #endif | ||
37 | 39 | ||
38 | /* | 40 | /* |
39 | * Define the address range of the vmalloc VM area. | 41 | * Define the address range of the vmalloc VM area. |
@@ -199,8 +201,11 @@ static inline unsigned long pte_update(struct mm_struct *mm, | |||
199 | if (!huge) | 201 | if (!huge) |
200 | assert_pte_locked(mm, addr); | 202 | assert_pte_locked(mm, addr); |
201 | 203 | ||
204 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
202 | if (old & _PAGE_HASHPTE) | 205 | if (old & _PAGE_HASHPTE) |
203 | hpte_need_flush(mm, addr, ptep, old, huge); | 206 | hpte_need_flush(mm, addr, ptep, old, huge); |
207 | #endif | ||
208 | |||
204 | return old; | 209 | return old; |
205 | } | 210 | } |
206 | 211 | ||
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 7d46e5d5b207..8564a412e7a6 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -117,6 +117,7 @@ notrace void raw_local_irq_restore(unsigned long en) | |||
117 | if (!en) | 117 | if (!en) |
118 | return; | 118 | return; |
119 | 119 | ||
120 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
120 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { | 121 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { |
121 | /* | 122 | /* |
122 | * Do we need to disable preemption here? Not really: in the | 123 | * Do we need to disable preemption here? Not really: in the |
@@ -134,6 +135,7 @@ notrace void raw_local_irq_restore(unsigned long en) | |||
134 | if (local_paca->lppaca_ptr->int_dword.any_int) | 135 | if (local_paca->lppaca_ptr->int_dword.any_int) |
135 | iseries_handle_interrupts(); | 136 | iseries_handle_interrupts(); |
136 | } | 137 | } |
138 | #endif /* CONFIG_PPC_STD_MMU_64 */ | ||
137 | 139 | ||
138 | /* | 140 | /* |
139 | * if (get_paca()->hard_enabled) return; | 141 | * if (get_paca()->hard_enabled) return; |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index dd6c7a3bf72c..461c91625a80 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -420,6 +420,9 @@ int pcibios_unmap_io_space(struct pci_bus *bus) | |||
420 | * so flushing the hash table is the only sane way to make sure | 420 | * so flushing the hash table is the only sane way to make sure |
421 | * that no hash entries are covering that removed bridge area | 421 | * that no hash entries are covering that removed bridge area |
422 | * while still allowing other busses overlapping those pages | 422 | * while still allowing other busses overlapping those pages |
423 | * | ||
424 | * Note: If we ever support P2P hotplug on Book3E, we'll have | ||
425 | * to do an appropriate TLB flush here too | ||
423 | */ | 426 | */ |
424 | if (bus->self) { | 427 | if (bus->self) { |
425 | struct resource *res = bus->resource[0]; | 428 | struct resource *res = bus->resource[0]; |
@@ -427,8 +430,10 @@ int pcibios_unmap_io_space(struct pci_bus *bus) | |||
427 | pr_debug("IO unmapping for PCI-PCI bridge %s\n", | 430 | pr_debug("IO unmapping for PCI-PCI bridge %s\n", |
428 | pci_name(bus->self)); | 431 | pci_name(bus->self)); |
429 | 432 | ||
433 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
430 | __flush_hash_table_range(&init_mm, res->start + _IO_BASE, | 434 | __flush_hash_table_range(&init_mm, res->start + _IO_BASE, |
431 | res->end + _IO_BASE + 1); | 435 | res->end + _IO_BASE + 1); |
436 | #endif | ||
432 | return 0; | 437 | return 0; |
433 | } | 438 | } |
434 | 439 | ||
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 7b44a33f03c2..3e7135bbe40f 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -650,7 +650,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
650 | p->thread.ksp_limit = (unsigned long)task_stack_page(p) + | 650 | p->thread.ksp_limit = (unsigned long)task_stack_page(p) + |
651 | _ALIGN_UP(sizeof(struct thread_info), 16); | 651 | _ALIGN_UP(sizeof(struct thread_info), 16); |
652 | 652 | ||
653 | #ifdef CONFIG_PPC64 | 653 | #ifdef CONFIG_PPC_STD_MMU_64 |
654 | if (cpu_has_feature(CPU_FTR_SLB)) { | 654 | if (cpu_has_feature(CPU_FTR_SLB)) { |
655 | unsigned long sp_vsid; | 655 | unsigned long sp_vsid; |
656 | unsigned long llp = mmu_psize_defs[mmu_linear_psize].sllp; | 656 | unsigned long llp = mmu_psize_defs[mmu_linear_psize].sllp; |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index ce01ff2474da..d4405b95bfaa 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -585,7 +585,7 @@ static void __init check_cpu_pa_features(unsigned long node) | |||
585 | ibm_pa_features, ARRAY_SIZE(ibm_pa_features)); | 585 | ibm_pa_features, ARRAY_SIZE(ibm_pa_features)); |
586 | } | 586 | } |
587 | 587 | ||
588 | #ifdef CONFIG_PPC64 | 588 | #ifdef CONFIG_PPC_STD_MMU_64 |
589 | static void __init check_cpu_slb_size(unsigned long node) | 589 | static void __init check_cpu_slb_size(unsigned long node) |
590 | { | 590 | { |
591 | u32 *slb_size_ptr; | 591 | u32 *slb_size_ptr; |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index c410c606955d..42221055f0c4 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -417,9 +417,11 @@ void __init setup_system(void) | |||
417 | if (ppc64_caches.iline_size != 0x80) | 417 | if (ppc64_caches.iline_size != 0x80) |
418 | printk("ppc64_caches.icache_line_size = 0x%x\n", | 418 | printk("ppc64_caches.icache_line_size = 0x%x\n", |
419 | ppc64_caches.iline_size); | 419 | ppc64_caches.iline_size); |
420 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
420 | if (htab_address) | 421 | if (htab_address) |
421 | printk("htab_address = 0x%p\n", htab_address); | 422 | printk("htab_address = 0x%p\n", htab_address); |
422 | printk("htab_hash_mask = 0x%lx\n", htab_hash_mask); | 423 | printk("htab_hash_mask = 0x%lx\n", htab_hash_mask); |
424 | #endif /* CONFIG_PPC_STD_MMU_64 */ | ||
423 | if (PHYSICAL_START > 0) | 425 | if (PHYSICAL_START > 0) |
424 | printk("physical_start = 0x%lx\n", | 426 | printk("physical_start = 0x%lx\n", |
425 | PHYSICAL_START); | 427 | PHYSICAL_START); |
@@ -511,8 +513,9 @@ void __init setup_arch(char **cmdline_p) | |||
511 | irqstack_early_init(); | 513 | irqstack_early_init(); |
512 | emergency_stack_init(); | 514 | emergency_stack_init(); |
513 | 515 | ||
516 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
514 | stabs_alloc(); | 517 | stabs_alloc(); |
515 | 518 | #endif | |
516 | /* set up the bootmem stuff with available memory */ | 519 | /* set up the bootmem stuff with available memory */ |
517 | do_init_bootmem(); | 520 | do_init_bootmem(); |
518 | sparse_init(); | 521 | sparse_init(); |
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile index b746f4ca4209..c4bcf072cb3c 100644 --- a/arch/powerpc/mm/Makefile +++ b/arch/powerpc/mm/Makefile | |||
@@ -11,10 +11,11 @@ obj-y := fault.o mem.o pgtable.o gup.o \ | |||
11 | pgtable_$(CONFIG_WORD_SIZE).o | 11 | pgtable_$(CONFIG_WORD_SIZE).o |
12 | obj-$(CONFIG_PPC_MMU_NOHASH) += mmu_context_nohash.o tlb_nohash.o \ | 12 | obj-$(CONFIG_PPC_MMU_NOHASH) += mmu_context_nohash.o tlb_nohash.o \ |
13 | tlb_nohash_low.o | 13 | tlb_nohash_low.o |
14 | hash-$(CONFIG_PPC_NATIVE) := hash_native_64.o | 14 | obj-$(CONFIG_PPC64) += mmap_64.o |
15 | obj-$(CONFIG_PPC64) += hash_utils_64.o \ | 15 | hash64-$(CONFIG_PPC_NATIVE) := hash_native_64.o |
16 | obj-$(CONFIG_PPC_STD_MMU_64) += hash_utils_64.o \ | ||
16 | slb_low.o slb.o stab.o \ | 17 | slb_low.o slb.o stab.o \ |
17 | mmap_64.o $(hash-y) | 18 | mmap_64.o $(hash64-y) |
18 | obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o | 19 | obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o |
19 | obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \ | 20 | obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \ |
20 | tlb_hash$(CONFIG_WORD_SIZE).o \ | 21 | tlb_hash$(CONFIG_WORD_SIZE).o \ |
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index 3e6a6543f53a..68a821add28d 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c | |||
@@ -66,6 +66,7 @@ | |||
66 | 66 | ||
67 | #include "mmu_decl.h" | 67 | #include "mmu_decl.h" |
68 | 68 | ||
69 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
69 | #if PGTABLE_RANGE > USER_VSID_RANGE | 70 | #if PGTABLE_RANGE > USER_VSID_RANGE |
70 | #warning Limited user VSID range means pagetable space is wasted | 71 | #warning Limited user VSID range means pagetable space is wasted |
71 | #endif | 72 | #endif |
@@ -73,6 +74,7 @@ | |||
73 | #if (TASK_SIZE_USER64 < PGTABLE_RANGE) && (TASK_SIZE_USER64 < USER_VSID_RANGE) | 74 | #if (TASK_SIZE_USER64 < PGTABLE_RANGE) && (TASK_SIZE_USER64 < USER_VSID_RANGE) |
74 | #warning TASK_SIZE is smaller than it needs to be. | 75 | #warning TASK_SIZE is smaller than it needs to be. |
75 | #endif | 76 | #endif |
77 | #endif /* CONFIG_PPC_STD_MMU_64 */ | ||
76 | 78 | ||
77 | phys_addr_t memstart_addr = ~0; | 79 | phys_addr_t memstart_addr = ~0; |
78 | phys_addr_t kernstart_addr; | 80 | phys_addr_t kernstart_addr; |