diff options
21 files changed, 132 insertions, 59 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h index 1c64bc6330bc..0c4e470571ca 100644 --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h | |||
| @@ -36,12 +36,13 @@ | |||
| 36 | #ifdef CONFIG_HUGETLB_PAGE | 36 | #ifdef CONFIG_HUGETLB_PAGE |
| 37 | static inline int hash__hugepd_ok(hugepd_t hpd) | 37 | static inline int hash__hugepd_ok(hugepd_t hpd) |
| 38 | { | 38 | { |
| 39 | unsigned long hpdval = hpd_val(hpd); | ||
| 39 | /* | 40 | /* |
| 40 | * if it is not a pte and have hugepd shift mask | 41 | * if it is not a pte and have hugepd shift mask |
| 41 | * set, then it is a hugepd directory pointer | 42 | * set, then it is a hugepd directory pointer |
| 42 | */ | 43 | */ |
| 43 | if (!(hpd.pd & _PAGE_PTE) && | 44 | if (!(hpdval & _PAGE_PTE) && |
| 44 | ((hpd.pd & HUGEPD_SHIFT_MASK) != 0)) | 45 | ((hpdval & HUGEPD_SHIFT_MASK) != 0)) |
| 45 | return true; | 46 | return true; |
| 46 | return false; | 47 | return false; |
| 47 | } | 48 | } |
diff --git a/arch/powerpc/include/asm/book3s/64/hash.h b/arch/powerpc/include/asm/book3s/64/hash.h index f61cad3de4e6..4c935f7504f7 100644 --- a/arch/powerpc/include/asm/book3s/64/hash.h +++ b/arch/powerpc/include/asm/book3s/64/hash.h | |||
| @@ -201,6 +201,10 @@ extern int __meminit hash__vmemmap_create_mapping(unsigned long start, | |||
| 201 | unsigned long phys); | 201 | unsigned long phys); |
| 202 | extern void hash__vmemmap_remove_mapping(unsigned long start, | 202 | extern void hash__vmemmap_remove_mapping(unsigned long start, |
| 203 | unsigned long page_size); | 203 | unsigned long page_size); |
| 204 | |||
| 205 | int hash__create_section_mapping(unsigned long start, unsigned long end); | ||
| 206 | int hash__remove_section_mapping(unsigned long start, unsigned long end); | ||
| 207 | |||
| 204 | #endif /* !__ASSEMBLY__ */ | 208 | #endif /* !__ASSEMBLY__ */ |
| 205 | #endif /* __KERNEL__ */ | 209 | #endif /* __KERNEL__ */ |
| 206 | #endif /* _ASM_POWERPC_BOOK3S_64_HASH_H */ | 210 | #endif /* _ASM_POWERPC_BOOK3S_64_HASH_H */ |
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index ede215167d1a..7f4025a6c69e 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h | |||
| @@ -21,12 +21,12 @@ static inline pte_t *hugepd_page(hugepd_t hpd) | |||
| 21 | * We have only four bits to encode, MMU page size | 21 | * We have only four bits to encode, MMU page size |
| 22 | */ | 22 | */ |
| 23 | BUILD_BUG_ON((MMU_PAGE_COUNT - 1) > 0xf); | 23 | BUILD_BUG_ON((MMU_PAGE_COUNT - 1) > 0xf); |
| 24 | return __va(hpd.pd & HUGEPD_ADDR_MASK); | 24 | return __va(hpd_val(hpd) & HUGEPD_ADDR_MASK); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | static inline unsigned int hugepd_mmu_psize(hugepd_t hpd) | 27 | static inline unsigned int hugepd_mmu_psize(hugepd_t hpd) |
| 28 | { | 28 | { |
| 29 | return (hpd.pd & HUGEPD_SHIFT_MASK) >> 2; | 29 | return (hpd_val(hpd) & HUGEPD_SHIFT_MASK) >> 2; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | static inline unsigned int hugepd_shift(hugepd_t hpd) | 32 | static inline unsigned int hugepd_shift(hugepd_t hpd) |
| @@ -52,18 +52,20 @@ static inline pte_t *hugepd_page(hugepd_t hpd) | |||
| 52 | { | 52 | { |
| 53 | BUG_ON(!hugepd_ok(hpd)); | 53 | BUG_ON(!hugepd_ok(hpd)); |
| 54 | #ifdef CONFIG_PPC_8xx | 54 | #ifdef CONFIG_PPC_8xx |
| 55 | return (pte_t *)__va(hpd.pd & ~(_PMD_PAGE_MASK | _PMD_PRESENT_MASK)); | 55 | return (pte_t *)__va(hpd_val(hpd) & |
| 56 | ~(_PMD_PAGE_MASK | _PMD_PRESENT_MASK)); | ||
| 56 | #else | 57 | #else |
| 57 | return (pte_t *)((hpd.pd & ~HUGEPD_SHIFT_MASK) | PD_HUGE); | 58 | return (pte_t *)((hpd_val(hpd) & |
| 59 | ~HUGEPD_SHIFT_MASK) | PD_HUGE); | ||
| 58 | #endif | 60 | #endif |
| 59 | } | 61 | } |
| 60 | 62 | ||
| 61 | static inline unsigned int hugepd_shift(hugepd_t hpd) | 63 | static inline unsigned int hugepd_shift(hugepd_t hpd) |
| 62 | { | 64 | { |
| 63 | #ifdef CONFIG_PPC_8xx | 65 | #ifdef CONFIG_PPC_8xx |
| 64 | return ((hpd.pd & _PMD_PAGE_MASK) >> 1) + 17; | 66 | return ((hpd_val(hpd) & _PMD_PAGE_MASK) >> 1) + 17; |
| 65 | #else | 67 | #else |
| 66 | return hpd.pd & HUGEPD_SHIFT_MASK; | 68 | return hpd_val(hpd) & HUGEPD_SHIFT_MASK; |
| 67 | #endif | 69 | #endif |
| 68 | } | 70 | } |
| 69 | 71 | ||
diff --git a/arch/powerpc/include/asm/nohash/pgtable.h b/arch/powerpc/include/asm/nohash/pgtable.h index 172849727054..0cd8a3852763 100644 --- a/arch/powerpc/include/asm/nohash/pgtable.h +++ b/arch/powerpc/include/asm/nohash/pgtable.h | |||
| @@ -227,9 +227,10 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | |||
| 227 | static inline int hugepd_ok(hugepd_t hpd) | 227 | static inline int hugepd_ok(hugepd_t hpd) |
| 228 | { | 228 | { |
| 229 | #ifdef CONFIG_PPC_8xx | 229 | #ifdef CONFIG_PPC_8xx |
| 230 | return ((hpd.pd & 0x4) != 0); | 230 | return ((hpd_val(hpd) & 0x4) != 0); |
| 231 | #else | 231 | #else |
| 232 | return (hpd.pd > 0); | 232 | /* We clear the top bit to indicate hugepd */ |
| 233 | return ((hpd_val(hpd) & PD_HUGE) == 0); | ||
| 233 | #endif | 234 | #endif |
| 234 | } | 235 | } |
| 235 | 236 | ||
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index 56398e7e6100..47120bf2670c 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h | |||
| @@ -294,15 +294,12 @@ extern long long virt_phys_offset; | |||
| 294 | #include <asm/pgtable-types.h> | 294 | #include <asm/pgtable-types.h> |
| 295 | #endif | 295 | #endif |
| 296 | 296 | ||
| 297 | typedef struct { signed long pd; } hugepd_t; | ||
| 298 | 297 | ||
| 299 | #ifndef CONFIG_HUGETLB_PAGE | 298 | #ifndef CONFIG_HUGETLB_PAGE |
| 300 | #define is_hugepd(pdep) (0) | 299 | #define is_hugepd(pdep) (0) |
| 301 | #define pgd_huge(pgd) (0) | 300 | #define pgd_huge(pgd) (0) |
| 302 | #endif /* CONFIG_HUGETLB_PAGE */ | 301 | #endif /* CONFIG_HUGETLB_PAGE */ |
| 303 | 302 | ||
| 304 | #define __hugepd(x) ((hugepd_t) { (x) }) | ||
| 305 | |||
| 306 | struct page; | 303 | struct page; |
| 307 | extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); | 304 | extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); |
| 308 | extern void copy_user_page(void *to, void *from, unsigned long vaddr, | 305 | extern void copy_user_page(void *to, void *from, unsigned long vaddr, |
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h index e157489ee7a1..ae0a23091a9b 100644 --- a/arch/powerpc/include/asm/perf_event_server.h +++ b/arch/powerpc/include/asm/perf_event_server.h | |||
| @@ -65,6 +65,7 @@ struct power_pmu { | |||
| 65 | #define PPMU_HAS_SSLOT 0x00000020 /* Has sampled slot in MMCRA */ | 65 | #define PPMU_HAS_SSLOT 0x00000020 /* Has sampled slot in MMCRA */ |
| 66 | #define PPMU_HAS_SIER 0x00000040 /* Has SIER */ | 66 | #define PPMU_HAS_SIER 0x00000040 /* Has SIER */ |
| 67 | #define PPMU_ARCH_207S 0x00000080 /* PMC is architecture v2.07S */ | 67 | #define PPMU_ARCH_207S 0x00000080 /* PMC is architecture v2.07S */ |
| 68 | #define PPMU_NO_SIAR 0x00000100 /* Do not use SIAR */ | ||
| 68 | 69 | ||
| 69 | /* | 70 | /* |
| 70 | * Values for flags to get_alternatives() | 71 | * Values for flags to get_alternatives() |
diff --git a/arch/powerpc/include/asm/pgtable-be-types.h b/arch/powerpc/include/asm/pgtable-be-types.h index 49c0a5a80efa..9c0f5db5cf46 100644 --- a/arch/powerpc/include/asm/pgtable-be-types.h +++ b/arch/powerpc/include/asm/pgtable-be-types.h | |||
| @@ -104,4 +104,12 @@ static inline bool pmd_xchg(pmd_t *pmdp, pmd_t old, pmd_t new) | |||
| 104 | return pmd_raw(old) == prev; | 104 | return pmd_raw(old) == prev; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | typedef struct { __be64 pdbe; } hugepd_t; | ||
| 108 | #define __hugepd(x) ((hugepd_t) { cpu_to_be64(x) }) | ||
| 109 | |||
| 110 | static inline unsigned long hpd_val(hugepd_t x) | ||
| 111 | { | ||
| 112 | return be64_to_cpu(x.pdbe); | ||
| 113 | } | ||
| 114 | |||
| 107 | #endif /* _ASM_POWERPC_PGTABLE_BE_TYPES_H */ | 115 | #endif /* _ASM_POWERPC_PGTABLE_BE_TYPES_H */ |
diff --git a/arch/powerpc/include/asm/pgtable-types.h b/arch/powerpc/include/asm/pgtable-types.h index e7f4f3e0fcde..8bd3b13fe2fb 100644 --- a/arch/powerpc/include/asm/pgtable-types.h +++ b/arch/powerpc/include/asm/pgtable-types.h | |||
| @@ -66,4 +66,11 @@ static inline bool pte_xchg(pte_t *ptep, pte_t old, pte_t new) | |||
| 66 | } | 66 | } |
| 67 | #endif | 67 | #endif |
| 68 | 68 | ||
| 69 | typedef struct { unsigned long pd; } hugepd_t; | ||
| 70 | #define __hugepd(x) ((hugepd_t) { (x) }) | ||
| 71 | static inline unsigned long hpd_val(hugepd_t x) | ||
| 72 | { | ||
| 73 | return x.pd; | ||
| 74 | } | ||
| 75 | |||
| 69 | #endif /* _ASM_POWERPC_PGTABLE_TYPES_H */ | 76 | #endif /* _ASM_POWERPC_PGTABLE_TYPES_H */ |
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h index c56ea8c84abb..c4ced1d01d57 100644 --- a/arch/powerpc/include/asm/ppc-opcode.h +++ b/arch/powerpc/include/asm/ppc-opcode.h | |||
| @@ -157,7 +157,7 @@ | |||
| 157 | #define PPC_INST_MCRXR 0x7c000400 | 157 | #define PPC_INST_MCRXR 0x7c000400 |
| 158 | #define PPC_INST_MCRXR_MASK 0xfc0007fe | 158 | #define PPC_INST_MCRXR_MASK 0xfc0007fe |
| 159 | #define PPC_INST_MFSPR_PVR 0x7c1f42a6 | 159 | #define PPC_INST_MFSPR_PVR 0x7c1f42a6 |
| 160 | #define PPC_INST_MFSPR_PVR_MASK 0xfc1fffff | 160 | #define PPC_INST_MFSPR_PVR_MASK 0xfc1ffffe |
| 161 | #define PPC_INST_MFTMR 0x7c0002dc | 161 | #define PPC_INST_MFTMR 0x7c0002dc |
| 162 | #define PPC_INST_MSGSND 0x7c00019c | 162 | #define PPC_INST_MSGSND 0x7c00019c |
| 163 | #define PPC_INST_MSGCLR 0x7c0001dc | 163 | #define PPC_INST_MSGCLR 0x7c0001dc |
| @@ -174,13 +174,13 @@ | |||
| 174 | #define PPC_INST_RFDI 0x4c00004e | 174 | #define PPC_INST_RFDI 0x4c00004e |
| 175 | #define PPC_INST_RFMCI 0x4c00004c | 175 | #define PPC_INST_RFMCI 0x4c00004c |
| 176 | #define PPC_INST_MFSPR_DSCR 0x7c1102a6 | 176 | #define PPC_INST_MFSPR_DSCR 0x7c1102a6 |
| 177 | #define PPC_INST_MFSPR_DSCR_MASK 0xfc1fffff | 177 | #define PPC_INST_MFSPR_DSCR_MASK 0xfc1ffffe |
| 178 | #define PPC_INST_MTSPR_DSCR 0x7c1103a6 | 178 | #define PPC_INST_MTSPR_DSCR 0x7c1103a6 |
| 179 | #define PPC_INST_MTSPR_DSCR_MASK 0xfc1fffff | 179 | #define PPC_INST_MTSPR_DSCR_MASK 0xfc1ffffe |
| 180 | #define PPC_INST_MFSPR_DSCR_USER 0x7c0302a6 | 180 | #define PPC_INST_MFSPR_DSCR_USER 0x7c0302a6 |
| 181 | #define PPC_INST_MFSPR_DSCR_USER_MASK 0xfc1fffff | 181 | #define PPC_INST_MFSPR_DSCR_USER_MASK 0xfc1ffffe |
| 182 | #define PPC_INST_MTSPR_DSCR_USER 0x7c0303a6 | 182 | #define PPC_INST_MTSPR_DSCR_USER 0x7c0303a6 |
| 183 | #define PPC_INST_MTSPR_DSCR_USER_MASK 0xfc1fffff | 183 | #define PPC_INST_MTSPR_DSCR_USER_MASK 0xfc1ffffe |
| 184 | #define PPC_INST_MFVSRD 0x7c000066 | 184 | #define PPC_INST_MFVSRD 0x7c000066 |
| 185 | #define PPC_INST_MTVSRD 0x7c000166 | 185 | #define PPC_INST_MTVSRD 0x7c000166 |
| 186 | #define PPC_INST_SLBFEE 0x7c0007a7 | 186 | #define PPC_INST_SLBFEE 0x7c0007a7 |
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index 8180bfd7ab93..9de7f79e702b 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c | |||
| @@ -298,9 +298,17 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity) | |||
| 298 | * | 298 | * |
| 299 | * For pHyp, we have to enable IO for log retrieval. Otherwise, | 299 | * For pHyp, we have to enable IO for log retrieval. Otherwise, |
| 300 | * 0xFF's is always returned from PCI config space. | 300 | * 0xFF's is always returned from PCI config space. |
| 301 | * | ||
| 302 | * When the @severity is EEH_LOG_PERM, the PE is going to be | ||
| 303 | * removed. Prior to that, the drivers for devices included in | ||
| 304 | * the PE will be closed. The drivers rely on working IO path | ||
| 305 | * to bring the devices to quiet state. Otherwise, PCI traffic | ||
| 306 | * from those devices after they are removed is like to cause | ||
| 307 | * another unexpected EEH error. | ||
| 301 | */ | 308 | */ |
| 302 | if (!(pe->type & EEH_PE_PHB)) { | 309 | if (!(pe->type & EEH_PE_PHB)) { |
| 303 | if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG)) | 310 | if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG) || |
| 311 | severity == EEH_LOG_PERM) | ||
| 304 | eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); | 312 | eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); |
| 305 | 313 | ||
| 306 | /* | 314 | /* |
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index e4744ff38a17..925a4ef90559 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c | |||
| @@ -463,6 +463,10 @@ static int fpr_set(struct task_struct *target, const struct user_regset *regset, | |||
| 463 | 463 | ||
| 464 | flush_fp_to_thread(target); | 464 | flush_fp_to_thread(target); |
| 465 | 465 | ||
| 466 | for (i = 0; i < 32 ; i++) | ||
| 467 | buf[i] = target->thread.TS_FPR(i); | ||
| 468 | buf[32] = target->thread.fp_state.fpscr; | ||
| 469 | |||
| 466 | /* copy to local buffer then write that out */ | 470 | /* copy to local buffer then write that out */ |
| 467 | i = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, -1); | 471 | i = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, -1); |
| 468 | if (i) | 472 | if (i) |
| @@ -672,6 +676,9 @@ static int vsr_set(struct task_struct *target, const struct user_regset *regset, | |||
| 672 | flush_altivec_to_thread(target); | 676 | flush_altivec_to_thread(target); |
| 673 | flush_vsx_to_thread(target); | 677 | flush_vsx_to_thread(target); |
| 674 | 678 | ||
| 679 | for (i = 0; i < 32 ; i++) | ||
| 680 | buf[i] = target->thread.fp_state.fpr[i][TS_VSRLOWOFFSET]; | ||
| 681 | |||
| 675 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | 682 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
| 676 | buf, 0, 32 * sizeof(double)); | 683 | buf, 0, 32 * sizeof(double)); |
| 677 | if (!ret) | 684 | if (!ret) |
| @@ -1019,6 +1026,10 @@ static int tm_cfpr_set(struct task_struct *target, | |||
| 1019 | flush_fp_to_thread(target); | 1026 | flush_fp_to_thread(target); |
| 1020 | flush_altivec_to_thread(target); | 1027 | flush_altivec_to_thread(target); |
| 1021 | 1028 | ||
| 1029 | for (i = 0; i < 32; i++) | ||
| 1030 | buf[i] = target->thread.TS_CKFPR(i); | ||
| 1031 | buf[32] = target->thread.ckfp_state.fpscr; | ||
| 1032 | |||
| 1022 | /* copy to local buffer then write that out */ | 1033 | /* copy to local buffer then write that out */ |
| 1023 | i = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, -1); | 1034 | i = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, -1); |
| 1024 | if (i) | 1035 | if (i) |
| @@ -1283,6 +1294,9 @@ static int tm_cvsx_set(struct task_struct *target, | |||
| 1283 | flush_altivec_to_thread(target); | 1294 | flush_altivec_to_thread(target); |
| 1284 | flush_vsx_to_thread(target); | 1295 | flush_vsx_to_thread(target); |
| 1285 | 1296 | ||
| 1297 | for (i = 0; i < 32 ; i++) | ||
| 1298 | buf[i] = target->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET]; | ||
| 1299 | |||
| 1286 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, | 1300 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
| 1287 | buf, 0, 32 * sizeof(double)); | 1301 | buf, 0, 32 * sizeof(double)); |
| 1288 | if (!ret) | 1302 | if (!ret) |
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 80334937e14f..67e19a0821be 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
| @@ -747,7 +747,7 @@ static unsigned long __init htab_get_table_size(void) | |||
| 747 | } | 747 | } |
| 748 | 748 | ||
| 749 | #ifdef CONFIG_MEMORY_HOTPLUG | 749 | #ifdef CONFIG_MEMORY_HOTPLUG |
| 750 | int create_section_mapping(unsigned long start, unsigned long end) | 750 | int hash__create_section_mapping(unsigned long start, unsigned long end) |
| 751 | { | 751 | { |
| 752 | int rc = htab_bolt_mapping(start, end, __pa(start), | 752 | int rc = htab_bolt_mapping(start, end, __pa(start), |
| 753 | pgprot_val(PAGE_KERNEL), mmu_linear_psize, | 753 | pgprot_val(PAGE_KERNEL), mmu_linear_psize, |
| @@ -761,7 +761,7 @@ int create_section_mapping(unsigned long start, unsigned long end) | |||
| 761 | return rc; | 761 | return rc; |
| 762 | } | 762 | } |
| 763 | 763 | ||
| 764 | int remove_section_mapping(unsigned long start, unsigned long end) | 764 | int hash__remove_section_mapping(unsigned long start, unsigned long end) |
| 765 | { | 765 | { |
| 766 | int rc = htab_remove_mapping(start, end, mmu_linear_psize, | 766 | int rc = htab_remove_mapping(start, end, mmu_linear_psize, |
| 767 | mmu_kernel_ssize); | 767 | mmu_kernel_ssize); |
diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c b/arch/powerpc/mm/hugetlbpage-hash64.c index d5026f3800b6..37b5f91e381b 100644 --- a/arch/powerpc/mm/hugetlbpage-hash64.c +++ b/arch/powerpc/mm/hugetlbpage-hash64.c | |||
| @@ -125,11 +125,14 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, | |||
| 125 | int hugepd_ok(hugepd_t hpd) | 125 | int hugepd_ok(hugepd_t hpd) |
| 126 | { | 126 | { |
| 127 | bool is_hugepd; | 127 | bool is_hugepd; |
| 128 | unsigned long hpdval; | ||
| 129 | |||
| 130 | hpdval = hpd_val(hpd); | ||
| 128 | 131 | ||
| 129 | /* | 132 | /* |
| 130 | * We should not find this format in page directory, warn otherwise. | 133 | * We should not find this format in page directory, warn otherwise. |
| 131 | */ | 134 | */ |
| 132 | is_hugepd = (((hpd.pd & 0x3) == 0x0) && ((hpd.pd & HUGEPD_SHIFT_MASK) != 0)); | 135 | is_hugepd = (((hpdval & 0x3) == 0x0) && ((hpdval & HUGEPD_SHIFT_MASK) != 0)); |
| 133 | WARN(is_hugepd, "Found wrong page directory format\n"); | 136 | WARN(is_hugepd, "Found wrong page directory format\n"); |
| 134 | return 0; | 137 | return 0; |
| 135 | } | 138 | } |
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 289df38fb7e0..8c3389cbcd12 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
| @@ -53,7 +53,7 @@ static u64 gpage_freearray[MAX_NUMBER_GPAGES]; | |||
| 53 | static unsigned nr_gpages; | 53 | static unsigned nr_gpages; |
| 54 | #endif | 54 | #endif |
| 55 | 55 | ||
| 56 | #define hugepd_none(hpd) ((hpd).pd == 0) | 56 | #define hugepd_none(hpd) (hpd_val(hpd) == 0) |
| 57 | 57 | ||
| 58 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) | 58 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) |
| 59 | { | 59 | { |
| @@ -103,24 +103,24 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, | |||
| 103 | for (i = 0; i < num_hugepd; i++, hpdp++) { | 103 | for (i = 0; i < num_hugepd; i++, hpdp++) { |
| 104 | if (unlikely(!hugepd_none(*hpdp))) | 104 | if (unlikely(!hugepd_none(*hpdp))) |
| 105 | break; | 105 | break; |
| 106 | else | 106 | else { |
| 107 | #ifdef CONFIG_PPC_BOOK3S_64 | 107 | #ifdef CONFIG_PPC_BOOK3S_64 |
| 108 | hpdp->pd = __pa(new) | | 108 | *hpdp = __hugepd(__pa(new) | |
| 109 | (shift_to_mmu_psize(pshift) << 2); | 109 | (shift_to_mmu_psize(pshift) << 2)); |
| 110 | #elif defined(CONFIG_PPC_8xx) | 110 | #elif defined(CONFIG_PPC_8xx) |
| 111 | hpdp->pd = __pa(new) | | 111 | *hpdp = __hugepd(__pa(new) | |
| 112 | (pshift == PAGE_SHIFT_8M ? _PMD_PAGE_8M : | 112 | (pshift == PAGE_SHIFT_8M ? _PMD_PAGE_8M : |
| 113 | _PMD_PAGE_512K) | | 113 | _PMD_PAGE_512K) | _PMD_PRESENT); |
| 114 | _PMD_PRESENT; | ||
| 115 | #else | 114 | #else |
| 116 | /* We use the old format for PPC_FSL_BOOK3E */ | 115 | /* We use the old format for PPC_FSL_BOOK3E */ |
| 117 | hpdp->pd = ((unsigned long)new & ~PD_HUGE) | pshift; | 116 | *hpdp = __hugepd(((unsigned long)new & ~PD_HUGE) | pshift); |
| 118 | #endif | 117 | #endif |
| 118 | } | ||
| 119 | } | 119 | } |
| 120 | /* If we bailed from the for loop early, an error occurred, clean up */ | 120 | /* If we bailed from the for loop early, an error occurred, clean up */ |
| 121 | if (i < num_hugepd) { | 121 | if (i < num_hugepd) { |
| 122 | for (i = i - 1 ; i >= 0; i--, hpdp--) | 122 | for (i = i - 1 ; i >= 0; i--, hpdp--) |
| 123 | hpdp->pd = 0; | 123 | *hpdp = __hugepd(0); |
| 124 | kmem_cache_free(cachep, new); | 124 | kmem_cache_free(cachep, new); |
| 125 | } | 125 | } |
| 126 | spin_unlock(&mm->page_table_lock); | 126 | spin_unlock(&mm->page_table_lock); |
| @@ -454,7 +454,7 @@ static void free_hugepd_range(struct mmu_gather *tlb, hugepd_t *hpdp, int pdshif | |||
| 454 | return; | 454 | return; |
| 455 | 455 | ||
| 456 | for (i = 0; i < num_hugepd; i++, hpdp++) | 456 | for (i = 0; i < num_hugepd; i++, hpdp++) |
| 457 | hpdp->pd = 0; | 457 | *hpdp = __hugepd(0); |
| 458 | 458 | ||
| 459 | if (shift >= pdshift) | 459 | if (shift >= pdshift) |
| 460 | hugepd_free(tlb, hugepte); | 460 | hugepd_free(tlb, hugepte); |
| @@ -810,12 +810,8 @@ static int __init hugetlbpage_init(void) | |||
| 810 | * if we have pdshift and shift value same, we don't | 810 | * if we have pdshift and shift value same, we don't |
| 811 | * use pgt cache for hugepd. | 811 | * use pgt cache for hugepd. |
| 812 | */ | 812 | */ |
| 813 | if (pdshift > shift) { | 813 | if (pdshift > shift) |
| 814 | pgtable_cache_add(pdshift - shift, NULL); | 814 | pgtable_cache_add(pdshift - shift, NULL); |
| 815 | if (!PGT_CACHE(pdshift - shift)) | ||
| 816 | panic("hugetlbpage_init(): could not create " | ||
| 817 | "pgtable cache for %d bit pagesize\n", shift); | ||
| 818 | } | ||
| 819 | #if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_8xx) | 815 | #if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_8xx) |
| 820 | else if (!hugepte_cache) { | 816 | else if (!hugepte_cache) { |
| 821 | /* | 817 | /* |
| @@ -852,9 +848,6 @@ static int __init hugetlbpage_init(void) | |||
| 852 | else if (mmu_psize_defs[MMU_PAGE_2M].shift) | 848 | else if (mmu_psize_defs[MMU_PAGE_2M].shift) |
| 853 | HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_2M].shift; | 849 | HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_2M].shift; |
| 854 | #endif | 850 | #endif |
| 855 | else | ||
| 856 | panic("%s: Unable to set default huge page size\n", __func__); | ||
| 857 | |||
| 858 | return 0; | 851 | return 0; |
| 859 | } | 852 | } |
| 860 | 853 | ||
diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c index a175cd82ae8c..f2108c40e697 100644 --- a/arch/powerpc/mm/init-common.c +++ b/arch/powerpc/mm/init-common.c | |||
| @@ -78,8 +78,12 @@ void pgtable_cache_add(unsigned shift, void (*ctor)(void *)) | |||
| 78 | align = max_t(unsigned long, align, minalign); | 78 | align = max_t(unsigned long, align, minalign); |
| 79 | name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift); | 79 | name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift); |
| 80 | new = kmem_cache_create(name, table_size, align, 0, ctor); | 80 | new = kmem_cache_create(name, table_size, align, 0, ctor); |
| 81 | if (!new) | ||
| 82 | panic("Could not allocate pgtable cache for order %d", shift); | ||
| 83 | |||
| 81 | kfree(name); | 84 | kfree(name); |
| 82 | pgtable_cache[shift - 1] = new; | 85 | pgtable_cache[shift - 1] = new; |
| 86 | |||
| 83 | pr_debug("Allocated pgtable cache for order %d\n", shift); | 87 | pr_debug("Allocated pgtable cache for order %d\n", shift); |
| 84 | } | 88 | } |
| 85 | 89 | ||
| @@ -88,7 +92,7 @@ void pgtable_cache_init(void) | |||
| 88 | { | 92 | { |
| 89 | pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor); | 93 | pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor); |
| 90 | 94 | ||
| 91 | if (PMD_INDEX_SIZE && !PGT_CACHE(PMD_INDEX_SIZE)) | 95 | if (PMD_CACHE_INDEX && !PGT_CACHE(PMD_CACHE_INDEX)) |
| 92 | pgtable_cache_add(PMD_CACHE_INDEX, pmd_ctor); | 96 | pgtable_cache_add(PMD_CACHE_INDEX, pmd_ctor); |
| 93 | /* | 97 | /* |
| 94 | * In all current configs, when the PUD index exists it's the | 98 | * In all current configs, when the PUD index exists it's the |
| @@ -97,11 +101,4 @@ void pgtable_cache_init(void) | |||
| 97 | */ | 101 | */ |
| 98 | if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE)) | 102 | if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE)) |
| 99 | pgtable_cache_add(PUD_INDEX_SIZE, pud_ctor); | 103 | pgtable_cache_add(PUD_INDEX_SIZE, pud_ctor); |
| 100 | |||
| 101 | if (!PGT_CACHE(PGD_INDEX_SIZE)) | ||
| 102 | panic("Couldn't allocate pgd cache"); | ||
| 103 | if (PMD_INDEX_SIZE && !PGT_CACHE(PMD_INDEX_SIZE)) | ||
| 104 | panic("Couldn't allocate pmd pgtable caches"); | ||
| 105 | if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE)) | ||
| 106 | panic("Couldn't allocate pud pgtable caches"); | ||
| 107 | } | 104 | } |
diff --git a/arch/powerpc/mm/pgtable-book3s64.c b/arch/powerpc/mm/pgtable-book3s64.c index ebf9782bacf9..653ff6c74ebe 100644 --- a/arch/powerpc/mm/pgtable-book3s64.c +++ b/arch/powerpc/mm/pgtable-book3s64.c | |||
| @@ -126,3 +126,21 @@ void mmu_cleanup_all(void) | |||
| 126 | else if (mmu_hash_ops.hpte_clear_all) | 126 | else if (mmu_hash_ops.hpte_clear_all) |
| 127 | mmu_hash_ops.hpte_clear_all(); | 127 | mmu_hash_ops.hpte_clear_all(); |
| 128 | } | 128 | } |
| 129 | |||
| 130 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
| 131 | int create_section_mapping(unsigned long start, unsigned long end) | ||
| 132 | { | ||
| 133 | if (radix_enabled()) | ||
| 134 | return -ENODEV; | ||
| 135 | |||
| 136 | return hash__create_section_mapping(start, end); | ||
| 137 | } | ||
| 138 | |||
| 139 | int remove_section_mapping(unsigned long start, unsigned long end) | ||
| 140 | { | ||
| 141 | if (radix_enabled()) | ||
| 142 | return -ENODEV; | ||
| 143 | |||
| 144 | return hash__remove_section_mapping(start, end); | ||
| 145 | } | ||
| 146 | #endif /* CONFIG_MEMORY_HOTPLUG */ | ||
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index fd3e4034c04d..270eb9b74e2e 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c | |||
| @@ -295,6 +295,8 @@ static inline void perf_read_regs(struct pt_regs *regs) | |||
| 295 | */ | 295 | */ |
| 296 | if (TRAP(regs) != 0xf00) | 296 | if (TRAP(regs) != 0xf00) |
| 297 | use_siar = 0; | 297 | use_siar = 0; |
| 298 | else if ((ppmu->flags & PPMU_NO_SIAR)) | ||
| 299 | use_siar = 0; | ||
| 298 | else if (marked) | 300 | else if (marked) |
| 299 | use_siar = 1; | 301 | use_siar = 1; |
| 300 | else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING)) | 302 | else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING)) |
diff --git a/arch/powerpc/perf/power9-events-list.h b/arch/powerpc/perf/power9-events-list.h index 6447dc1c3d89..929b56d47ad9 100644 --- a/arch/powerpc/perf/power9-events-list.h +++ b/arch/powerpc/perf/power9-events-list.h | |||
| @@ -16,7 +16,7 @@ EVENT(PM_CYC, 0x0001e) | |||
| 16 | EVENT(PM_ICT_NOSLOT_CYC, 0x100f8) | 16 | EVENT(PM_ICT_NOSLOT_CYC, 0x100f8) |
| 17 | EVENT(PM_CMPLU_STALL, 0x1e054) | 17 | EVENT(PM_CMPLU_STALL, 0x1e054) |
| 18 | EVENT(PM_INST_CMPL, 0x00002) | 18 | EVENT(PM_INST_CMPL, 0x00002) |
| 19 | EVENT(PM_BRU_CMPL, 0x40060) | 19 | EVENT(PM_BRU_CMPL, 0x10012) |
| 20 | EVENT(PM_BR_MPRED_CMPL, 0x400f6) | 20 | EVENT(PM_BR_MPRED_CMPL, 0x400f6) |
| 21 | 21 | ||
| 22 | /* All L1 D cache load references counted at finish, gated by reject */ | 22 | /* All L1 D cache load references counted at finish, gated by reject */ |
diff --git a/arch/powerpc/perf/power9-pmu.c b/arch/powerpc/perf/power9-pmu.c index 346010e8d463..7332634e18c9 100644 --- a/arch/powerpc/perf/power9-pmu.c +++ b/arch/powerpc/perf/power9-pmu.c | |||
| @@ -384,7 +384,7 @@ static struct power_pmu power9_isa207_pmu = { | |||
| 384 | .bhrb_filter_map = power9_bhrb_filter_map, | 384 | .bhrb_filter_map = power9_bhrb_filter_map, |
| 385 | .get_constraint = isa207_get_constraint, | 385 | .get_constraint = isa207_get_constraint, |
| 386 | .disable_pmc = isa207_disable_pmc, | 386 | .disable_pmc = isa207_disable_pmc, |
| 387 | .flags = PPMU_HAS_SIER | PPMU_ARCH_207S, | 387 | .flags = PPMU_NO_SIAR | PPMU_ARCH_207S, |
| 388 | .n_generic = ARRAY_SIZE(power9_generic_events), | 388 | .n_generic = ARRAY_SIZE(power9_generic_events), |
| 389 | .generic_events = power9_generic_events, | 389 | .generic_events = power9_generic_events, |
| 390 | .cache_events = &power9_cache_events, | 390 | .cache_events = &power9_cache_events, |
diff --git a/arch/powerpc/sysdev/xics/icp-opal.c b/arch/powerpc/sysdev/xics/icp-opal.c index d38e86fd5720..60c57657c772 100644 --- a/arch/powerpc/sysdev/xics/icp-opal.c +++ b/arch/powerpc/sysdev/xics/icp-opal.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <asm/xics.h> | 20 | #include <asm/xics.h> |
| 21 | #include <asm/io.h> | 21 | #include <asm/io.h> |
| 22 | #include <asm/opal.h> | 22 | #include <asm/opal.h> |
| 23 | #include <asm/kvm_ppc.h> | ||
| 23 | 24 | ||
| 24 | static void icp_opal_teardown_cpu(void) | 25 | static void icp_opal_teardown_cpu(void) |
| 25 | { | 26 | { |
| @@ -39,7 +40,26 @@ static void icp_opal_flush_ipi(void) | |||
| 39 | * Should we be flagging idle loop instead? | 40 | * Should we be flagging idle loop instead? |
| 40 | * Or creating some task to be scheduled? | 41 | * Or creating some task to be scheduled? |
| 41 | */ | 42 | */ |
| 42 | opal_int_eoi((0x00 << 24) | XICS_IPI); | 43 | if (opal_int_eoi((0x00 << 24) | XICS_IPI) > 0) |
| 44 | force_external_irq_replay(); | ||
| 45 | } | ||
| 46 | |||
| 47 | static unsigned int icp_opal_get_xirr(void) | ||
| 48 | { | ||
| 49 | unsigned int kvm_xirr; | ||
| 50 | __be32 hw_xirr; | ||
| 51 | int64_t rc; | ||
| 52 | |||
| 53 | /* Handle an interrupt latched by KVM first */ | ||
| 54 | kvm_xirr = kvmppc_get_xics_latch(); | ||
| 55 | if (kvm_xirr) | ||
| 56 | return kvm_xirr; | ||
| 57 | |||
| 58 | /* Then ask OPAL */ | ||
| 59 | rc = opal_int_get_xirr(&hw_xirr, false); | ||
| 60 | if (rc < 0) | ||
| 61 | return 0; | ||
| 62 | return be32_to_cpu(hw_xirr); | ||
| 43 | } | 63 | } |
| 44 | 64 | ||
| 45 | static unsigned int icp_opal_get_irq(void) | 65 | static unsigned int icp_opal_get_irq(void) |
| @@ -47,12 +67,8 @@ static unsigned int icp_opal_get_irq(void) | |||
| 47 | unsigned int xirr; | 67 | unsigned int xirr; |
| 48 | unsigned int vec; | 68 | unsigned int vec; |
| 49 | unsigned int irq; | 69 | unsigned int irq; |
| 50 | int64_t rc; | ||
| 51 | 70 | ||
| 52 | rc = opal_int_get_xirr(&xirr, false); | 71 | xirr = icp_opal_get_xirr(); |
| 53 | if (rc < 0) | ||
| 54 | return 0; | ||
| 55 | xirr = be32_to_cpu(xirr); | ||
| 56 | vec = xirr & 0x00ffffff; | 72 | vec = xirr & 0x00ffffff; |
| 57 | if (vec == XICS_IRQ_SPURIOUS) | 73 | if (vec == XICS_IRQ_SPURIOUS) |
| 58 | return 0; | 74 | return 0; |
| @@ -67,7 +83,8 @@ static unsigned int icp_opal_get_irq(void) | |||
| 67 | xics_mask_unknown_vec(vec); | 83 | xics_mask_unknown_vec(vec); |
| 68 | 84 | ||
| 69 | /* We might learn about it later, so EOI it */ | 85 | /* We might learn about it later, so EOI it */ |
| 70 | opal_int_eoi(xirr); | 86 | if (opal_int_eoi(xirr) > 0) |
| 87 | force_external_irq_replay(); | ||
| 71 | 88 | ||
| 72 | return 0; | 89 | return 0; |
| 73 | } | 90 | } |
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c b/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c index c22860ab9733..30e1ac62e8cb 100644 --- a/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c +++ b/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c | |||
| @@ -66,7 +66,7 @@ int pmc56_overflow(void) | |||
| 66 | 66 | ||
| 67 | FAIL_IF(ebb_event_enable(&event)); | 67 | FAIL_IF(ebb_event_enable(&event)); |
| 68 | 68 | ||
| 69 | mtspr(SPRN_PMC1, pmc_sample_period(sample_period)); | 69 | mtspr(SPRN_PMC2, pmc_sample_period(sample_period)); |
| 70 | mtspr(SPRN_PMC5, 0); | 70 | mtspr(SPRN_PMC5, 0); |
| 71 | mtspr(SPRN_PMC6, 0); | 71 | mtspr(SPRN_PMC6, 0); |
| 72 | 72 | ||
