aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2018-07-05 04:47:00 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2018-07-15 21:37:21 -0400
commit2bf1071a8d50928a4ae366bb3108833166c2b70c (patch)
treeebffef07f7ebbb9bb1ba231c4cb8ff00cc6fd795
parentce397d215ccd07b8ae3f71db689aedb85d56ab40 (diff)
powerpc/64s: Remove POWER9 DD1 support
POWER9 DD1 was never a product. It is no longer supported by upstream firmware, and it is not effectively supported in Linux due to lack of testing. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> [mpe: Remove arch_make_huge_pte() entirely] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/include/asm/book3s/64/hugetlb.h20
-rw-r--r--arch/powerpc/include/asm/book3s/64/pgtable.h5
-rw-r--r--arch/powerpc/include/asm/book3s/64/radix.h35
-rw-r--r--arch/powerpc/include/asm/book3s/64/tlbflush-radix.h2
-rw-r--r--arch/powerpc/include/asm/cputable.h13
-rw-r--r--arch/powerpc/include/asm/paca.h5
-rw-r--r--arch/powerpc/kernel/asm-offsets.c1
-rw-r--r--arch/powerpc/kernel/cputable.c19
-rw-r--r--arch/powerpc/kernel/dt_cpu_ftrs.c4
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S4
-rw-r--r--arch/powerpc/kernel/idle_book3s.S50
-rw-r--r--arch/powerpc/kernel/process.c10
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_radix.c15
-rw-r--r--arch/powerpc/kvm/book3s_hv.c10
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S16
-rw-r--r--arch/powerpc/kvm/book3s_xive_template.c39
-rw-r--r--arch/powerpc/mm/hash_utils_64.c30
-rw-r--r--arch/powerpc/mm/hugetlbpage.c9
-rw-r--r--arch/powerpc/mm/mmu_context_book3s64.c12
-rw-r--r--arch/powerpc/mm/pgtable-radix.c60
-rw-r--r--arch/powerpc/mm/tlb-radix.c18
-rw-r--r--arch/powerpc/perf/core-book3s.c34
-rw-r--r--arch/powerpc/perf/isa207-common.c12
-rw-r--r--arch/powerpc/perf/isa207-common.h5
-rw-r--r--arch/powerpc/perf/power9-pmu.c54
-rw-r--r--arch/powerpc/platforms/powernv/idle.c28
-rw-r--r--arch/powerpc/platforms/powernv/smp.c27
-rw-r--r--arch/powerpc/sysdev/xive/common.c8
-rw-r--r--arch/powerpc/xmon/xmon.c1
-rw-r--r--drivers/misc/cxl/cxl.h8
-rw-r--r--drivers/misc/cxl/cxllib.c4
-rw-r--r--drivers/misc/cxl/pci.c41
32 files changed, 66 insertions, 533 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/hugetlb.h b/arch/powerpc/include/asm/book3s/64/hugetlb.h
index c459f937d484..50888388a359 100644
--- a/arch/powerpc/include/asm/book3s/64/hugetlb.h
+++ b/arch/powerpc/include/asm/book3s/64/hugetlb.h
@@ -32,26 +32,6 @@ static inline int hstate_get_psize(struct hstate *hstate)
32 } 32 }
33} 33}
34 34
35#define arch_make_huge_pte arch_make_huge_pte
36static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma,
37 struct page *page, int writable)
38{
39 unsigned long page_shift;
40
41 if (!cpu_has_feature(CPU_FTR_POWER9_DD1))
42 return entry;
43
44 page_shift = huge_page_shift(hstate_vma(vma));
45 /*
46 * We don't support 1G hugetlb pages yet.
47 */
48 VM_WARN_ON(page_shift == mmu_psize_defs[MMU_PAGE_1G].shift);
49 if (page_shift == mmu_psize_defs[MMU_PAGE_2M].shift)
50 return __pte(pte_val(entry) | R_PAGE_LARGE);
51 else
52 return entry;
53}
54
55#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE 35#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE
56static inline bool gigantic_page_supported(void) 36static inline bool gigantic_page_supported(void)
57{ 37{
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
index 63cee159022b..d334e6b9a46d 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -474,9 +474,8 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
474{ 474{
475 if (full && radix_enabled()) { 475 if (full && radix_enabled()) {
476 /* 476 /*
477 * Let's skip the DD1 style pte update here. We know that 477 * We know that this is a full mm pte clear and
478 * this is a full mm pte clear and hence can be sure there is 478 * hence can be sure there is no parallel set_pte.
479 * no parallel set_pte.
480 */ 479 */
481 return radix__ptep_get_and_clear_full(mm, addr, ptep, full); 480 return radix__ptep_get_and_clear_full(mm, addr, ptep, full);
482 } 481 }
diff --git a/arch/powerpc/include/asm/book3s/64/radix.h b/arch/powerpc/include/asm/book3s/64/radix.h
index ef9f96742ce1..3ab3f7aef022 100644
--- a/arch/powerpc/include/asm/book3s/64/radix.h
+++ b/arch/powerpc/include/asm/book3s/64/radix.h
@@ -12,12 +12,6 @@
12#include <asm/book3s/64/radix-4k.h> 12#include <asm/book3s/64/radix-4k.h>
13#endif 13#endif
14 14
15/*
16 * For P9 DD1 only, we need to track whether the pte's huge.
17 */
18#define R_PAGE_LARGE _RPAGE_RSV1
19
20
21#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
22#include <asm/book3s/64/tlbflush-radix.h> 16#include <asm/book3s/64/tlbflush-radix.h>
23#include <asm/cpu_has_feature.h> 17#include <asm/cpu_has_feature.h>
@@ -154,20 +148,7 @@ static inline unsigned long radix__pte_update(struct mm_struct *mm,
154{ 148{
155 unsigned long old_pte; 149 unsigned long old_pte;
156 150
157 if (cpu_has_feature(CPU_FTR_POWER9_DD1)) { 151 old_pte = __radix_pte_update(ptep, clr, set);
158
159 unsigned long new_pte;
160
161 old_pte = __radix_pte_update(ptep, ~0ul, 0);
162 /*
163 * new value of pte
164 */
165 new_pte = (old_pte | set) & ~clr;
166 radix__flush_tlb_pte_p9_dd1(old_pte, mm, addr);
167 if (new_pte)
168 __radix_pte_update(ptep, 0, new_pte);
169 } else
170 old_pte = __radix_pte_update(ptep, clr, set);
171 if (!huge) 152 if (!huge)
172 assert_pte_locked(mm, addr); 153 assert_pte_locked(mm, addr);
173 154
@@ -253,8 +234,6 @@ static inline int radix__pmd_trans_huge(pmd_t pmd)
253 234
254static inline pmd_t radix__pmd_mkhuge(pmd_t pmd) 235static inline pmd_t radix__pmd_mkhuge(pmd_t pmd)
255{ 236{
256 if (cpu_has_feature(CPU_FTR_POWER9_DD1))
257 return __pmd(pmd_val(pmd) | _PAGE_PTE | R_PAGE_LARGE);
258 return __pmd(pmd_val(pmd) | _PAGE_PTE); 237 return __pmd(pmd_val(pmd) | _PAGE_PTE);
259} 238}
260 239
@@ -285,18 +264,14 @@ static inline unsigned long radix__get_tree_size(void)
285 unsigned long rts_field; 264 unsigned long rts_field;
286 /* 265 /*
287 * We support 52 bits, hence: 266 * We support 52 bits, hence:
288 * DD1 52-28 = 24, 0b11000 267 * bits 52 - 31 = 21, 0b10101
289 * Others 52-31 = 21, 0b10101
290 * RTS encoding details 268 * RTS encoding details
291 * bits 0 - 3 of rts -> bits 6 - 8 unsigned long 269 * bits 0 - 3 of rts -> bits 6 - 8 unsigned long
292 * bits 4 - 5 of rts -> bits 62 - 63 of unsigned long 270 * bits 4 - 5 of rts -> bits 62 - 63 of unsigned long
293 */ 271 */
294 if (cpu_has_feature(CPU_FTR_POWER9_DD1)) 272 rts_field = (0x5UL << 5); /* 6 - 8 bits */
295 rts_field = (0x3UL << 61); 273 rts_field |= (0x2UL << 61);
296 else { 274
297 rts_field = (0x5UL << 5); /* 6 - 8 bits */
298 rts_field |= (0x2UL << 61);
299 }
300 return rts_field; 275 return rts_field;
301} 276}
302 277
diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
index ef5c3f2994c9..1154a6dc6d26 100644
--- a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
+++ b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
@@ -48,8 +48,6 @@ extern void radix__flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmad
48extern void radix__flush_tlb_pwc(struct mmu_gather *tlb, unsigned long addr); 48extern void radix__flush_tlb_pwc(struct mmu_gather *tlb, unsigned long addr);
49extern void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr); 49extern void radix__flush_tlb_collapsed_pmd(struct mm_struct *mm, unsigned long addr);
50extern void radix__flush_tlb_all(void); 50extern void radix__flush_tlb_all(void);
51extern void radix__flush_tlb_pte_p9_dd1(unsigned long old_pte, struct mm_struct *mm,
52 unsigned long address);
53 51
54extern void radix__flush_tlb_lpid_page(unsigned int lpid, 52extern void radix__flush_tlb_lpid_page(unsigned int lpid,
55 unsigned long addr, 53 unsigned long addr,
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index 9c0a3083571b..f980f91cad8a 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -210,7 +210,6 @@ static inline void cpu_feature_keys_init(void) { }
210#define CPU_FTR_DAWR LONG_ASM_CONST(0x0000008000000000) 210#define CPU_FTR_DAWR LONG_ASM_CONST(0x0000008000000000)
211#define CPU_FTR_DABRX LONG_ASM_CONST(0x0000010000000000) 211#define CPU_FTR_DABRX LONG_ASM_CONST(0x0000010000000000)
212#define CPU_FTR_PMAO_BUG LONG_ASM_CONST(0x0000020000000000) 212#define CPU_FTR_PMAO_BUG LONG_ASM_CONST(0x0000020000000000)
213#define CPU_FTR_POWER9_DD1 LONG_ASM_CONST(0x0000040000000000)
214#define CPU_FTR_POWER9_DD2_1 LONG_ASM_CONST(0x0000080000000000) 213#define CPU_FTR_POWER9_DD2_1 LONG_ASM_CONST(0x0000080000000000)
215#define CPU_FTR_P9_TM_HV_ASSIST LONG_ASM_CONST(0x0000100000000000) 214#define CPU_FTR_P9_TM_HV_ASSIST LONG_ASM_CONST(0x0000100000000000)
216#define CPU_FTR_P9_TM_XER_SO_BUG LONG_ASM_CONST(0x0000200000000000) 215#define CPU_FTR_P9_TM_XER_SO_BUG LONG_ASM_CONST(0x0000200000000000)
@@ -464,8 +463,6 @@ static inline void cpu_feature_keys_init(void) { }
464 CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \ 463 CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \
465 CPU_FTR_TM_COMP | CPU_FTR_ARCH_300 | CPU_FTR_PKEY | \ 464 CPU_FTR_TM_COMP | CPU_FTR_ARCH_300 | CPU_FTR_PKEY | \
466 CPU_FTR_P9_TLBIE_BUG | CPU_FTR_P9_TIDR) 465 CPU_FTR_P9_TLBIE_BUG | CPU_FTR_P9_TIDR)
467#define CPU_FTRS_POWER9_DD1 ((CPU_FTRS_POWER9 | CPU_FTR_POWER9_DD1) & \
468 (~CPU_FTR_SAO))
469#define CPU_FTRS_POWER9_DD2_0 CPU_FTRS_POWER9 466#define CPU_FTRS_POWER9_DD2_0 CPU_FTRS_POWER9
470#define CPU_FTRS_POWER9_DD2_1 (CPU_FTRS_POWER9 | CPU_FTR_POWER9_DD2_1) 467#define CPU_FTRS_POWER9_DD2_1 (CPU_FTRS_POWER9 | CPU_FTR_POWER9_DD2_1)
471#define CPU_FTRS_POWER9_DD2_2 (CPU_FTRS_POWER9 | CPU_FTR_POWER9_DD2_1 | \ 468#define CPU_FTRS_POWER9_DD2_2 (CPU_FTRS_POWER9 | CPU_FTR_POWER9_DD2_1 | \
@@ -489,16 +486,14 @@ static inline void cpu_feature_keys_init(void) { }
489#define CPU_FTRS_POSSIBLE \ 486#define CPU_FTRS_POSSIBLE \
490 (CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | CPU_FTRS_POWER8 | \ 487 (CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | CPU_FTRS_POWER8 | \
491 CPU_FTRS_POWER8_DD1 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_VSX_COMP | \ 488 CPU_FTRS_POWER8_DD1 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_VSX_COMP | \
492 CPU_FTRS_POWER9 | CPU_FTRS_POWER9_DD1 | CPU_FTRS_POWER9_DD2_1 | \ 489 CPU_FTRS_POWER9 | CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2)
493 CPU_FTRS_POWER9_DD2_2)
494#else 490#else
495#define CPU_FTRS_POSSIBLE \ 491#define CPU_FTRS_POSSIBLE \
496 (CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | \ 492 (CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | \
497 CPU_FTRS_POWER6 | CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | \ 493 CPU_FTRS_POWER6 | CPU_FTRS_POWER7 | CPU_FTRS_POWER8E | \
498 CPU_FTRS_POWER8 | CPU_FTRS_POWER8_DD1 | CPU_FTRS_CELL | \ 494 CPU_FTRS_POWER8 | CPU_FTRS_POWER8_DD1 | CPU_FTRS_CELL | \
499 CPU_FTRS_PA6T | CPU_FTR_VSX_COMP | CPU_FTR_ALTIVEC_COMP | \ 495 CPU_FTRS_PA6T | CPU_FTR_VSX_COMP | CPU_FTR_ALTIVEC_COMP | \
500 CPU_FTRS_POWER9 | CPU_FTRS_POWER9_DD1 | CPU_FTRS_POWER9_DD2_1 | \ 496 CPU_FTRS_POWER9 | CPU_FTRS_POWER9_DD2_1 | CPU_FTRS_POWER9_DD2_2)
501 CPU_FTRS_POWER9_DD2_2)
502#endif /* CONFIG_CPU_LITTLE_ENDIAN */ 497#endif /* CONFIG_CPU_LITTLE_ENDIAN */
503#endif 498#endif
504#else 499#else
@@ -567,7 +562,7 @@ enum {
567#define CPU_FTRS_ALWAYS \ 562#define CPU_FTRS_ALWAYS \
568 (CPU_FTRS_POSSIBLE & ~CPU_FTR_HVMODE & CPU_FTRS_POWER7 & \ 563 (CPU_FTRS_POSSIBLE & ~CPU_FTR_HVMODE & CPU_FTRS_POWER7 & \
569 CPU_FTRS_POWER8E & CPU_FTRS_POWER8 & CPU_FTRS_POWER8_DD1 & \ 564 CPU_FTRS_POWER8E & CPU_FTRS_POWER8 & CPU_FTRS_POWER8_DD1 & \
570 CPU_FTRS_POWER9 & CPU_FTRS_POWER9_DD1 & CPU_FTRS_POWER9_DD2_1 & \ 565 CPU_FTRS_POWER9 & CPU_FTRS_POWER9_DD2_1 & \
571 CPU_FTRS_DT_CPU_BASE) 566 CPU_FTRS_DT_CPU_BASE)
572#else 567#else
573#define CPU_FTRS_ALWAYS \ 568#define CPU_FTRS_ALWAYS \
@@ -575,7 +570,7 @@ enum {
575 CPU_FTRS_POWER6 & CPU_FTRS_POWER7 & CPU_FTRS_CELL & \ 570 CPU_FTRS_POWER6 & CPU_FTRS_POWER7 & CPU_FTRS_CELL & \
576 CPU_FTRS_PA6T & CPU_FTRS_POWER8 & CPU_FTRS_POWER8E & \ 571 CPU_FTRS_PA6T & CPU_FTRS_POWER8 & CPU_FTRS_POWER8E & \
577 CPU_FTRS_POWER8_DD1 & ~CPU_FTR_HVMODE & CPU_FTRS_POSSIBLE & \ 572 CPU_FTRS_POWER8_DD1 & ~CPU_FTR_HVMODE & CPU_FTRS_POSSIBLE & \
578 CPU_FTRS_POWER9 & CPU_FTRS_POWER9_DD1 & CPU_FTRS_POWER9_DD2_1 & \ 573 CPU_FTRS_POWER9 & CPU_FTRS_POWER9_DD2_1 & \
579 CPU_FTRS_DT_CPU_BASE) 574 CPU_FTRS_DT_CPU_BASE)
580#endif /* CONFIG_CPU_LITTLE_ENDIAN */ 575#endif /* CONFIG_CPU_LITTLE_ENDIAN */
581#endif 576#endif
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 6d34bd71139d..4e9cede5a7e7 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -187,11 +187,6 @@ struct paca_struct {
187 u8 subcore_sibling_mask; 187 u8 subcore_sibling_mask;
188 /* Flag to request this thread not to stop */ 188 /* Flag to request this thread not to stop */
189 atomic_t dont_stop; 189 atomic_t dont_stop;
190 /*
191 * Pointer to an array which contains pointer
192 * to the sibling threads' paca.
193 */
194 struct paca_struct **thread_sibling_pacas;
195 /* The PSSCR value that the kernel requested before going to stop */ 190 /* The PSSCR value that the kernel requested before going to stop */
196 u64 requested_psscr; 191 u64 requested_psscr;
197 192
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 0a0544335950..89cf15566c4e 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -766,7 +766,6 @@ int main(void)
766 OFFSET(PACA_THREAD_IDLE_STATE, paca_struct, thread_idle_state); 766 OFFSET(PACA_THREAD_IDLE_STATE, paca_struct, thread_idle_state);
767 OFFSET(PACA_THREAD_MASK, paca_struct, thread_mask); 767 OFFSET(PACA_THREAD_MASK, paca_struct, thread_mask);
768 OFFSET(PACA_SUBCORE_SIBLING_MASK, paca_struct, subcore_sibling_mask); 768 OFFSET(PACA_SUBCORE_SIBLING_MASK, paca_struct, subcore_sibling_mask);
769 OFFSET(PACA_SIBLING_PACA_PTRS, paca_struct, thread_sibling_pacas);
770 OFFSET(PACA_REQ_PSSCR, paca_struct, requested_psscr); 769 OFFSET(PACA_REQ_PSSCR, paca_struct, requested_psscr);
771 OFFSET(PACA_DONT_STOP, paca_struct, dont_stop); 770 OFFSET(PACA_DONT_STOP, paca_struct, dont_stop);
772#define STOP_SPR(x, f) OFFSET(x, paca_struct, stop_sprs.f) 771#define STOP_SPR(x, f) OFFSET(x, paca_struct, stop_sprs.f)
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index c8fc9691f8c7..bc75a2908a7e 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -485,25 +485,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
485 .machine_check_early = __machine_check_early_realmode_p8, 485 .machine_check_early = __machine_check_early_realmode_p8,
486 .platform = "power8", 486 .platform = "power8",
487 }, 487 },
488 { /* Power9 DD1*/
489 .pvr_mask = 0xffffff00,
490 .pvr_value = 0x004e0100,
491 .cpu_name = "POWER9 (raw)",
492 .cpu_features = CPU_FTRS_POWER9_DD1,
493 .cpu_user_features = COMMON_USER_POWER9,
494 .cpu_user_features2 = COMMON_USER2_POWER9,
495 .mmu_features = MMU_FTRS_POWER9,
496 .icache_bsize = 128,
497 .dcache_bsize = 128,
498 .num_pmcs = 6,
499 .pmc_type = PPC_PMC_IBM,
500 .oprofile_cpu_type = "ppc64/power9",
501 .oprofile_type = PPC_OPROFILE_INVALID,
502 .cpu_setup = __setup_cpu_power9,
503 .cpu_restore = __restore_cpu_power9,
504 .machine_check_early = __machine_check_early_realmode_p9,
505 .platform = "power9",
506 },
507 { /* Power9 DD2.0 */ 488 { /* Power9 DD2.0 */
508 .pvr_mask = 0xffffefff, 489 .pvr_mask = 0xffffefff,
509 .pvr_value = 0x004e0200, 490 .pvr_value = 0x004e0200,
diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
index 4be1c0de9406..98c373a4c1cf 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -701,9 +701,7 @@ static __init void cpufeatures_cpu_quirks(void)
701 /* 701 /*
702 * Not all quirks can be derived from the cpufeatures device tree. 702 * Not all quirks can be derived from the cpufeatures device tree.
703 */ 703 */
704 if ((version & 0xffffff00) == 0x004e0100) 704 if ((version & 0xffffefff) == 0x004e0200)
705 cur_cpu_spec->cpu_features |= CPU_FTR_POWER9_DD1;
706 else if ((version & 0xffffefff) == 0x004e0200)
707 ; /* DD2.0 has no feature flag */ 705 ; /* DD2.0 has no feature flag */
708 else if ((version & 0xffffefff) == 0x004e0201) 706 else if ((version & 0xffffefff) == 0x004e0201)
709 cur_cpu_spec->cpu_features |= CPU_FTR_POWER9_DD2_1; 707 cur_cpu_spec->cpu_features |= CPU_FTR_POWER9_DD2_1;
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 285c6465324a..76a14702cb9c 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -276,9 +276,7 @@ BEGIN_FTR_SECTION
276 * 276 *
277 * This interrupt can wake directly from idle. If that is the case, 277 * This interrupt can wake directly from idle. If that is the case,
278 * the machine check is handled then the idle wakeup code is called 278 * the machine check is handled then the idle wakeup code is called
279 * to restore state. In that case, the POWER9 DD1 idle PACA workaround 279 * to restore state.
280 * is not applied in the early machine check code, which will cause
281 * bugs.
282 */ 280 */
283 mr r11,r1 /* Save r1 */ 281 mr r11,r1 /* Save r1 */
284 lhz r10,PACA_IN_MCE(r13) 282 lhz r10,PACA_IN_MCE(r13)
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index e734f6e45abc..d85d5515a091 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -467,43 +467,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_P9_TM_XER_SO_BUG)
467#endif 467#endif
468 468
469/* 469/*
470 * On waking up from stop 0,1,2 with ESL=1 on POWER9 DD1,
471 * HSPRG0 will be set to the HSPRG0 value of one of the
472 * threads in this core. Thus the value we have in r13
473 * may not be this thread's paca pointer.
474 *
475 * Fortunately, the TIR remains invariant. Since this thread's
476 * paca pointer is recorded in all its sibling's paca, we can
477 * correctly recover this thread's paca pointer if we
478 * know the index of this thread in the core.
479 *
480 * This index can be obtained from the TIR.
481 *
482 * i.e, thread's position in the core = TIR.
483 * If this value is i, then this thread's paca is
484 * paca->thread_sibling_pacas[i].
485 */
486power9_dd1_recover_paca:
487 mfspr r4, SPRN_TIR
488 /*
489 * Since each entry in thread_sibling_pacas is 8 bytes
490 * we need to left-shift by 3 bits. Thus r4 = i * 8
491 */
492 sldi r4, r4, 3
493 /* Get &paca->thread_sibling_pacas[0] in r5 */
494 ld r5, PACA_SIBLING_PACA_PTRS(r13)
495 /* Load paca->thread_sibling_pacas[i] into r13 */
496 ldx r13, r4, r5
497 SET_PACA(r13)
498 /*
499 * Indicate that we have lost NVGPR state
500 * which needs to be restored from the stack.
501 */
502 li r3, 1
503 stb r3,PACA_NAPSTATELOST(r13)
504 blr
505
506/*
507 * Called from machine check handler for powersave wakeups. 470 * Called from machine check handler for powersave wakeups.
508 * Low level machine check processing has already been done. Now just 471 * Low level machine check processing has already been done. Now just
509 * go through the wake up path to get everything in order. 472 * go through the wake up path to get everything in order.
@@ -537,9 +500,6 @@ pnv_powersave_wakeup:
537 ld r2, PACATOC(r13) 500 ld r2, PACATOC(r13)
538 501
539BEGIN_FTR_SECTION 502BEGIN_FTR_SECTION
540BEGIN_FTR_SECTION_NESTED(70)
541 bl power9_dd1_recover_paca
542END_FTR_SECTION_NESTED_IFSET(CPU_FTR_POWER9_DD1, 70)
543 bl pnv_restore_hyp_resource_arch300 503 bl pnv_restore_hyp_resource_arch300
544FTR_SECTION_ELSE 504FTR_SECTION_ELSE
545 bl pnv_restore_hyp_resource_arch207 505 bl pnv_restore_hyp_resource_arch207
@@ -602,22 +562,12 @@ END_FTR_SECTION_IFCLR(CPU_FTR_POWER9_DD2_1)
602 LOAD_REG_ADDRBASE(r5,pnv_first_deep_stop_state) 562 LOAD_REG_ADDRBASE(r5,pnv_first_deep_stop_state)
603 ld r4,ADDROFF(pnv_first_deep_stop_state)(r5) 563 ld r4,ADDROFF(pnv_first_deep_stop_state)(r5)
604 564
605BEGIN_FTR_SECTION_NESTED(71)
606 /*
607 * Assume that we are waking up from the state
608 * same as the Requested Level (RL) in the PSSCR
609 * which are Bits 60-63
610 */
611 ld r5,PACA_REQ_PSSCR(r13)
612 rldicl r5,r5,0,60
613FTR_SECTION_ELSE_NESTED(71)
614 /* 565 /*
615 * 0-3 bits correspond to Power-Saving Level Status 566 * 0-3 bits correspond to Power-Saving Level Status
616 * which indicates the idle state we are waking up from 567 * which indicates the idle state we are waking up from
617 */ 568 */
618 mfspr r5, SPRN_PSSCR 569 mfspr r5, SPRN_PSSCR
619 rldicl r5,r5,4,60 570 rldicl r5,r5,4,60
620ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_POWER9_DD1, 71)
621 li r0, 0 /* clear requested_psscr to say we're awake */ 571 li r0, 0 /* clear requested_psscr to say we're awake */
622 std r0, PACA_REQ_PSSCR(r13) 572 std r0, PACA_REQ_PSSCR(r13)
623 cmpd cr4,r5,r4 573 cmpd cr4,r5,r4
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 9ef4aea9fffe..27f0caee55ea 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1250,17 +1250,9 @@ struct task_struct *__switch_to(struct task_struct *prev,
1250 * mappings. If the new process has the foreign real address 1250 * mappings. If the new process has the foreign real address
1251 * mappings, we must issue a cp_abort to clear any state and 1251 * mappings, we must issue a cp_abort to clear any state and
1252 * prevent snooping, corruption or a covert channel. 1252 * prevent snooping, corruption or a covert channel.
1253 *
1254 * DD1 allows paste into normal system memory so we do an
1255 * unpaired copy, rather than cp_abort, to clear the buffer,
1256 * since cp_abort is quite expensive.
1257 */ 1253 */
1258 if (current_thread_info()->task->thread.used_vas) { 1254 if (current_thread_info()->task->thread.used_vas)
1259 asm volatile(PPC_CP_ABORT); 1255 asm volatile(PPC_CP_ABORT);
1260 } else if (cpu_has_feature(CPU_FTR_POWER9_DD1)) {
1261 asm volatile(PPC_COPY(%0, %1)
1262 : : "r"(dummy_copy_buffer), "r"(0));
1263 }
1264 } 1256 }
1265#endif /* CONFIG_PPC_BOOK3S_64 */ 1257#endif /* CONFIG_PPC_BOOK3S_64 */
1266 1258
diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c
index 176f911ee983..0af1c0aea1fe 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_radix.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c
@@ -66,10 +66,7 @@ int kvmppc_mmu_radix_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
66 bits = root & RPDS_MASK; 66 bits = root & RPDS_MASK;
67 root = root & RPDB_MASK; 67 root = root & RPDB_MASK;
68 68
69 /* P9 DD1 interprets RTS (radix tree size) differently */
70 offset = rts + 31; 69 offset = rts + 31;
71 if (cpu_has_feature(CPU_FTR_POWER9_DD1))
72 offset -= 3;
73 70
74 /* current implementations only support 52-bit space */ 71 /* current implementations only support 52-bit space */
75 if (offset != 52) 72 if (offset != 52)
@@ -160,17 +157,7 @@ static unsigned long kvmppc_radix_update_pte(struct kvm *kvm, pte_t *ptep,
160 unsigned long clr, unsigned long set, 157 unsigned long clr, unsigned long set,
161 unsigned long addr, unsigned int shift) 158 unsigned long addr, unsigned int shift)
162{ 159{
163 unsigned long old = 0; 160 return __radix_pte_update(ptep, clr, set);
164
165 if (!(clr & _PAGE_PRESENT) && cpu_has_feature(CPU_FTR_POWER9_DD1) &&
166 pte_present(*ptep)) {
167 /* have to invalidate it first */
168 old = __radix_pte_update(ptep, _PAGE_PRESENT, 0);
169 kvmppc_radix_tlbie_page(kvm, addr, shift);
170 set |= _PAGE_PRESENT;
171 old &= _PAGE_PRESENT;
172 }
173 return __radix_pte_update(ptep, clr, set) | old;
174} 161}
175 162
176void kvmppc_radix_set_pte_at(struct kvm *kvm, unsigned long addr, 163void kvmppc_radix_set_pte_at(struct kvm *kvm, unsigned long addr,
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index de686b340f4a..b568582120a3 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -1693,14 +1693,6 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
1693 r = set_vpa(vcpu, &vcpu->arch.dtl, addr, len); 1693 r = set_vpa(vcpu, &vcpu->arch.dtl, addr, len);
1694 break; 1694 break;
1695 case KVM_REG_PPC_TB_OFFSET: 1695 case KVM_REG_PPC_TB_OFFSET:
1696 /*
1697 * POWER9 DD1 has an erratum where writing TBU40 causes
1698 * the timebase to lose ticks. So we don't let the
1699 * timebase offset be changed on P9 DD1. (It is
1700 * initialized to zero.)
1701 */
1702 if (cpu_has_feature(CPU_FTR_POWER9_DD1))
1703 break;
1704 /* round up to multiple of 2^24 */ 1696 /* round up to multiple of 2^24 */
1705 vcpu->arch.vcore->tb_offset = 1697 vcpu->arch.vcore->tb_offset =
1706 ALIGN(set_reg_val(id, *val), 1UL << 24); 1698 ALIGN(set_reg_val(id, *val), 1UL << 24);
@@ -2026,8 +2018,6 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm,
2026 /* 2018 /*
2027 * Set the default HFSCR for the guest from the host value. 2019 * Set the default HFSCR for the guest from the host value.
2028 * This value is only used on POWER9. 2020 * This value is only used on POWER9.
2029 * On POWER9 DD1, TM doesn't work, so we make sure to
2030 * prevent the guest from using it.
2031 * On POWER9, we want to virtualize the doorbell facility, so we 2021 * On POWER9, we want to virtualize the doorbell facility, so we
2032 * turn off the HFSCR bit, which causes those instructions to trap. 2022 * turn off the HFSCR bit, which causes those instructions to trap.
2033 */ 2023 */
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 153988d878e8..6e4554b273f1 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -917,9 +917,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_DAWR)
917 mtspr SPRN_PID, r7 917 mtspr SPRN_PID, r7
918 mtspr SPRN_WORT, r8 918 mtspr SPRN_WORT, r8
919BEGIN_FTR_SECTION 919BEGIN_FTR_SECTION
920 PPC_INVALIDATE_ERAT
921END_FTR_SECTION_IFSET(CPU_FTR_POWER9_DD1)
922BEGIN_FTR_SECTION
923 /* POWER8-only registers */ 920 /* POWER8-only registers */
924 ld r5, VCPU_TCSCR(r4) 921 ld r5, VCPU_TCSCR(r4)
925 ld r6, VCPU_ACOP(r4) 922 ld r6, VCPU_ACOP(r4)
@@ -1912,7 +1909,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
1912 ld r5, VCPU_KVM(r9) 1909 ld r5, VCPU_KVM(r9)
1913 lbz r0, KVM_RADIX(r5) 1910 lbz r0, KVM_RADIX(r5)
1914 cmpwi cr2, r0, 0 1911 cmpwi cr2, r0, 0
1915 beq cr2, 4f 1912 beq cr2, 2f
1916 1913
1917 /* 1914 /*
1918 * Radix: do eieio; tlbsync; ptesync sequence in case we 1915 * Radix: do eieio; tlbsync; ptesync sequence in case we
@@ -1952,11 +1949,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
1952 bdnz 1b 1949 bdnz 1b
1953 ptesync 1950 ptesync
1954 1951
19552: /* Flush the ERAT on radix P9 DD1 guest exit */ 19522:
1956BEGIN_FTR_SECTION
1957 PPC_INVALIDATE_ERAT
1958END_FTR_SECTION_IFSET(CPU_FTR_POWER9_DD1)
19594:
1960#endif /* CONFIG_PPC_RADIX_MMU */ 1953#endif /* CONFIG_PPC_RADIX_MMU */
1961 1954
1962 /* 1955 /*
@@ -3367,11 +3360,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300)
3367 mtspr SPRN_CIABR, r0 3360 mtspr SPRN_CIABR, r0
3368 mtspr SPRN_DAWRX, r0 3361 mtspr SPRN_DAWRX, r0
3369 3362
3370 /* Flush the ERAT on radix P9 DD1 guest exit */
3371BEGIN_FTR_SECTION
3372 PPC_INVALIDATE_ERAT
3373END_FTR_SECTION_IFSET(CPU_FTR_POWER9_DD1)
3374
3375BEGIN_MMU_FTR_SECTION 3363BEGIN_MMU_FTR_SECTION
3376 b 4f 3364 b 4f
3377END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_RADIX) 3365END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_RADIX)
diff --git a/arch/powerpc/kvm/book3s_xive_template.c b/arch/powerpc/kvm/book3s_xive_template.c
index 6e41ba7ec8f4..4171ede8722b 100644
--- a/arch/powerpc/kvm/book3s_xive_template.c
+++ b/arch/powerpc/kvm/book3s_xive_template.c
@@ -25,18 +25,6 @@ static void GLUE(X_PFX,ack_pending)(struct kvmppc_xive_vcpu *xc)
25 */ 25 */
26 eieio(); 26 eieio();
27 27
28 /*
29 * DD1 bug workaround: If PIPR is less favored than CPPR
30 * ignore the interrupt or we might incorrectly lose an IPB
31 * bit.
32 */
33 if (cpu_has_feature(CPU_FTR_POWER9_DD1)) {
34 __be64 qw1 = __x_readq(__x_tima + TM_QW1_OS);
35 u8 pipr = be64_to_cpu(qw1) & 0xff;
36 if (pipr >= xc->hw_cppr)
37 return;
38 }
39
40 /* Perform the acknowledge OS to register cycle. */ 28 /* Perform the acknowledge OS to register cycle. */
41 ack = be16_to_cpu(__x_readw(__x_tima + TM_SPC_ACK_OS_REG)); 29 ack = be16_to_cpu(__x_readw(__x_tima + TM_SPC_ACK_OS_REG));
42 30
@@ -89,8 +77,15 @@ static void GLUE(X_PFX,source_eoi)(u32 hw_irq, struct xive_irq_data *xd)
89 /* If the XIVE supports the new "store EOI facility, use it */ 77 /* If the XIVE supports the new "store EOI facility, use it */
90 if (xd->flags & XIVE_IRQ_FLAG_STORE_EOI) 78 if (xd->flags & XIVE_IRQ_FLAG_STORE_EOI)
91 __x_writeq(0, __x_eoi_page(xd) + XIVE_ESB_STORE_EOI); 79 __x_writeq(0, __x_eoi_page(xd) + XIVE_ESB_STORE_EOI);
92 else if (hw_irq && xd->flags & XIVE_IRQ_FLAG_EOI_FW) { 80 else if (hw_irq && xd->flags & XIVE_IRQ_FLAG_EOI_FW)
93 opal_int_eoi(hw_irq); 81 opal_int_eoi(hw_irq);
82 else if (xd->flags & XIVE_IRQ_FLAG_LSI) {
83 /*
84 * For LSIs the HW EOI cycle is used rather than PQ bits,
85 * as they are automatically re-triggred in HW when still
86 * pending.
87 */
88 __x_readq(__x_eoi_page(xd) + XIVE_ESB_LOAD_EOI);
94 } else { 89 } else {
95 uint64_t eoi_val; 90 uint64_t eoi_val;
96 91
@@ -102,20 +97,12 @@ static void GLUE(X_PFX,source_eoi)(u32 hw_irq, struct xive_irq_data *xd)
102 * 97 *
103 * This allows us to then do a re-trigger if Q was set 98 * This allows us to then do a re-trigger if Q was set
104 * rather than synthetizing an interrupt in software 99 * rather than synthetizing an interrupt in software
105 *
106 * For LSIs, using the HW EOI cycle works around a problem
107 * on P9 DD1 PHBs where the other ESB accesses don't work
108 * properly.
109 */ 100 */
110 if (xd->flags & XIVE_IRQ_FLAG_LSI) 101 eoi_val = GLUE(X_PFX,esb_load)(xd, XIVE_ESB_SET_PQ_00);
111 __x_readq(__x_eoi_page(xd) + XIVE_ESB_LOAD_EOI); 102
112 else { 103 /* Re-trigger if needed */
113 eoi_val = GLUE(X_PFX,esb_load)(xd, XIVE_ESB_SET_PQ_00); 104 if ((eoi_val & 1) && __x_trig_page(xd))
114 105 __x_writeq(0, __x_trig_page(xd));
115 /* Re-trigger if needed */
116 if ((eoi_val & 1) && __x_trig_page(xd))
117 __x_writeq(0, __x_trig_page(xd));
118 }
119 } 106 }
120} 107}
121 108
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 8318716e5075..5a72e980e25a 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -808,31 +808,6 @@ int hash__remove_section_mapping(unsigned long start, unsigned long end)
808} 808}
809#endif /* CONFIG_MEMORY_HOTPLUG */ 809#endif /* CONFIG_MEMORY_HOTPLUG */
810 810
811static void update_hid_for_hash(void)
812{
813 unsigned long hid0;
814 unsigned long rb = 3UL << PPC_BITLSHIFT(53); /* IS = 3 */
815
816 asm volatile("ptesync": : :"memory");
817 /* prs = 0, ric = 2, rs = 0, r = 1 is = 3 */
818 asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
819 : : "r"(rb), "i"(0), "i"(0), "i"(2), "r"(0) : "memory");
820 asm volatile("eieio; tlbsync; ptesync; isync; slbia": : :"memory");
821 trace_tlbie(0, 0, rb, 0, 2, 0, 0);
822
823 /*
824 * now switch the HID
825 */
826 hid0 = mfspr(SPRN_HID0);
827 hid0 &= ~HID0_POWER9_RADIX;
828 mtspr(SPRN_HID0, hid0);
829 asm volatile("isync": : :"memory");
830
831 /* Wait for it to happen */
832 while ((mfspr(SPRN_HID0) & HID0_POWER9_RADIX))
833 cpu_relax();
834}
835
836static void __init hash_init_partition_table(phys_addr_t hash_table, 811static void __init hash_init_partition_table(phys_addr_t hash_table,
837 unsigned long htab_size) 812 unsigned long htab_size)
838{ 813{
@@ -845,8 +820,6 @@ static void __init hash_init_partition_table(phys_addr_t hash_table,
845 htab_size = __ilog2(htab_size) - 18; 820 htab_size = __ilog2(htab_size) - 18;
846 mmu_partition_table_set_entry(0, hash_table | htab_size, 0); 821 mmu_partition_table_set_entry(0, hash_table | htab_size, 0);
847 pr_info("Partition table %p\n", partition_tb); 822 pr_info("Partition table %p\n", partition_tb);
848 if (cpu_has_feature(CPU_FTR_POWER9_DD1))
849 update_hid_for_hash();
850} 823}
851 824
852static void __init htab_initialize(void) 825static void __init htab_initialize(void)
@@ -1077,9 +1050,6 @@ void hash__early_init_mmu_secondary(void)
1077 /* Initialize hash table for that CPU */ 1050 /* Initialize hash table for that CPU */
1078 if (!firmware_has_feature(FW_FEATURE_LPAR)) { 1051 if (!firmware_has_feature(FW_FEATURE_LPAR)) {
1079 1052
1080 if (cpu_has_feature(CPU_FTR_POWER9_DD1))
1081 update_hid_for_hash();
1082
1083 if (!cpu_has_feature(CPU_FTR_ARCH_300)) 1053 if (!cpu_has_feature(CPU_FTR_ARCH_300))
1084 mtspr(SPRN_SDR1, _SDR1); 1054 mtspr(SPRN_SDR1, _SDR1);
1085 else 1055 else
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 7c5f479c5c00..ec7538a802f9 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -620,15 +620,12 @@ static int __init add_huge_page_size(unsigned long long size)
620 * firmware we only add hugetlb support for page sizes that can be 620 * firmware we only add hugetlb support for page sizes that can be
621 * supported by linux page table layout. 621 * supported by linux page table layout.
622 * For now we have 622 * For now we have
623 * Radix: 2M 623 * Radix: 2M and 1G
624 * Hash: 16M and 16G 624 * Hash: 16M and 16G
625 */ 625 */
626 if (radix_enabled()) { 626 if (radix_enabled()) {
627 if (mmu_psize != MMU_PAGE_2M) { 627 if (mmu_psize != MMU_PAGE_2M && mmu_psize != MMU_PAGE_1G)
628 if (cpu_has_feature(CPU_FTR_POWER9_DD1) || 628 return -EINVAL;
629 (mmu_psize != MMU_PAGE_1G))
630 return -EINVAL;
631 }
632 } else { 629 } else {
633 if (mmu_psize != MMU_PAGE_16M && mmu_psize != MMU_PAGE_16G) 630 if (mmu_psize != MMU_PAGE_16M && mmu_psize != MMU_PAGE_16G)
634 return -EINVAL; 631 return -EINVAL;
diff --git a/arch/powerpc/mm/mmu_context_book3s64.c b/arch/powerpc/mm/mmu_context_book3s64.c
index f3d4b4a0e561..39e9ef0eb78b 100644
--- a/arch/powerpc/mm/mmu_context_book3s64.c
+++ b/arch/powerpc/mm/mmu_context_book3s64.c
@@ -273,15 +273,7 @@ void arch_exit_mmap(struct mm_struct *mm)
273#ifdef CONFIG_PPC_RADIX_MMU 273#ifdef CONFIG_PPC_RADIX_MMU
274void radix__switch_mmu_context(struct mm_struct *prev, struct mm_struct *next) 274void radix__switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
275{ 275{
276 276 mtspr(SPRN_PID, next->context.id);
277 if (cpu_has_feature(CPU_FTR_POWER9_DD1)) { 277 isync();
278 isync();
279 mtspr(SPRN_PID, next->context.id);
280 isync();
281 asm volatile(PPC_INVALIDATE_ERAT : : :"memory");
282 } else {
283 mtspr(SPRN_PID, next->context.id);
284 isync();
285 }
286} 278}
287#endif 279#endif
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index 96f68c5aa1f5..bba168d02235 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -226,16 +226,6 @@ void radix__mark_rodata_ro(void)
226{ 226{
227 unsigned long start, end; 227 unsigned long start, end;
228 228
229 /*
230 * mark_rodata_ro() will mark itself as !writable at some point.
231 * Due to DD1 workaround in radix__pte_update(), we'll end up with
232 * an invalid pte and the system will crash quite severly.
233 */
234 if (cpu_has_feature(CPU_FTR_POWER9_DD1)) {
235 pr_warn("Warning: Unable to mark rodata read only on P9 DD1\n");
236 return;
237 }
238
239 start = (unsigned long)_stext; 229 start = (unsigned long)_stext;
240 end = (unsigned long)__init_begin; 230 end = (unsigned long)__init_begin;
241 231
@@ -533,35 +523,6 @@ found:
533 return; 523 return;
534} 524}
535 525
536static void update_hid_for_radix(void)
537{
538 unsigned long hid0;
539 unsigned long rb = 3UL << PPC_BITLSHIFT(53); /* IS = 3 */
540
541 asm volatile("ptesync": : :"memory");
542 /* prs = 0, ric = 2, rs = 0, r = 1 is = 3 */
543 asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
544 : : "r"(rb), "i"(1), "i"(0), "i"(2), "r"(0) : "memory");
545 /* prs = 1, ric = 2, rs = 0, r = 1 is = 3 */
546 asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
547 : : "r"(rb), "i"(1), "i"(1), "i"(2), "r"(0) : "memory");
548 asm volatile("eieio; tlbsync; ptesync; isync; slbia": : :"memory");
549 trace_tlbie(0, 0, rb, 0, 2, 0, 1);
550 trace_tlbie(0, 0, rb, 0, 2, 1, 1);
551
552 /*
553 * now switch the HID
554 */
555 hid0 = mfspr(SPRN_HID0);
556 hid0 |= HID0_POWER9_RADIX;
557 mtspr(SPRN_HID0, hid0);
558 asm volatile("isync": : :"memory");
559
560 /* Wait for it to happen */
561 while (!(mfspr(SPRN_HID0) & HID0_POWER9_RADIX))
562 cpu_relax();
563}
564
565static void radix_init_amor(void) 526static void radix_init_amor(void)
566{ 527{
567 /* 528 /*
@@ -576,22 +537,12 @@ static void radix_init_amor(void)
576 537
577static void radix_init_iamr(void) 538static void radix_init_iamr(void)
578{ 539{
579 unsigned long iamr;
580
581 /*
582 * The IAMR should set to 0 on DD1.
583 */
584 if (cpu_has_feature(CPU_FTR_POWER9_DD1))
585 iamr = 0;
586 else
587 iamr = (1ul << 62);
588
589 /* 540 /*
590 * Radix always uses key0 of the IAMR to determine if an access is 541 * Radix always uses key0 of the IAMR to determine if an access is
591 * allowed. We set bit 0 (IBM bit 1) of key0, to prevent instruction 542 * allowed. We set bit 0 (IBM bit 1) of key0, to prevent instruction
592 * fetch. 543 * fetch.
593 */ 544 */
594 mtspr(SPRN_IAMR, iamr); 545 mtspr(SPRN_IAMR, (1ul << 62));
595} 546}
596 547
597void __init radix__early_init_mmu(void) 548void __init radix__early_init_mmu(void)
@@ -644,8 +595,6 @@ void __init radix__early_init_mmu(void)
644 595
645 if (!firmware_has_feature(FW_FEATURE_LPAR)) { 596 if (!firmware_has_feature(FW_FEATURE_LPAR)) {
646 radix_init_native(); 597 radix_init_native();
647 if (cpu_has_feature(CPU_FTR_POWER9_DD1))
648 update_hid_for_radix();
649 lpcr = mfspr(SPRN_LPCR); 598 lpcr = mfspr(SPRN_LPCR);
650 mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR); 599 mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR);
651 radix_init_partition_table(); 600 radix_init_partition_table();
@@ -671,10 +620,6 @@ void radix__early_init_mmu_secondary(void)
671 * update partition table control register and UPRT 620 * update partition table control register and UPRT
672 */ 621 */
673 if (!firmware_has_feature(FW_FEATURE_LPAR)) { 622 if (!firmware_has_feature(FW_FEATURE_LPAR)) {
674
675 if (cpu_has_feature(CPU_FTR_POWER9_DD1))
676 update_hid_for_radix();
677
678 lpcr = mfspr(SPRN_LPCR); 623 lpcr = mfspr(SPRN_LPCR);
679 mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR); 624 mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR);
680 625
@@ -1095,8 +1040,7 @@ void radix__ptep_set_access_flags(struct vm_area_struct *vma, pte_t *ptep,
1095 * To avoid NMMU hang while relaxing access, we need mark 1040 * To avoid NMMU hang while relaxing access, we need mark
1096 * the pte invalid in between. 1041 * the pte invalid in between.
1097 */ 1042 */
1098 if (cpu_has_feature(CPU_FTR_POWER9_DD1) || 1043 if (atomic_read(&mm->context.copros) > 0) {
1099 atomic_read(&mm->context.copros) > 0) {
1100 unsigned long old_pte, new_pte; 1044 unsigned long old_pte, new_pte;
1101 1045
1102 old_pte = __radix_pte_update(ptep, ~0, 0); 1046 old_pte = __radix_pte_update(ptep, ~0, 0);
diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c
index 67a6e86d3e7e..902767b8a9c1 100644
--- a/arch/powerpc/mm/tlb-radix.c
+++ b/arch/powerpc/mm/tlb-radix.c
@@ -994,24 +994,6 @@ void radix__flush_tlb_all(void)
994 asm volatile("eieio; tlbsync; ptesync": : :"memory"); 994 asm volatile("eieio; tlbsync; ptesync": : :"memory");
995} 995}
996 996
997void radix__flush_tlb_pte_p9_dd1(unsigned long old_pte, struct mm_struct *mm,
998 unsigned long address)
999{
1000 /*
1001 * We track page size in pte only for DD1, So we can
1002 * call this only on DD1.
1003 */
1004 if (!cpu_has_feature(CPU_FTR_POWER9_DD1)) {
1005 VM_WARN_ON(1);
1006 return;
1007 }
1008
1009 if (old_pte & R_PAGE_LARGE)
1010 radix__flush_tlb_page_psize(mm, address, MMU_PAGE_2M);
1011 else
1012 radix__flush_tlb_page_psize(mm, address, mmu_virtual_psize);
1013}
1014
1015#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE 997#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
1016extern void radix_kvm_prefetch_workaround(struct mm_struct *mm) 998extern void radix_kvm_prefetch_workaround(struct mm_struct *mm)
1017{ 999{
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 3f66fcf8ad99..01f92c4a9f02 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -128,10 +128,6 @@ static inline void power_pmu_bhrb_disable(struct perf_event *event) {}
128static void power_pmu_sched_task(struct perf_event_context *ctx, bool sched_in) {} 128static void power_pmu_sched_task(struct perf_event_context *ctx, bool sched_in) {}
129static inline void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw) {} 129static inline void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw) {}
130static void pmao_restore_workaround(bool ebb) { } 130static void pmao_restore_workaround(bool ebb) { }
131static bool use_ic(u64 event)
132{
133 return false;
134}
135#endif /* CONFIG_PPC32 */ 131#endif /* CONFIG_PPC32 */
136 132
137static bool regs_use_siar(struct pt_regs *regs) 133static bool regs_use_siar(struct pt_regs *regs)
@@ -714,14 +710,6 @@ static void pmao_restore_workaround(bool ebb)
714 mtspr(SPRN_PMC6, pmcs[5]); 710 mtspr(SPRN_PMC6, pmcs[5]);
715} 711}
716 712
717static bool use_ic(u64 event)
718{
719 if (cpu_has_feature(CPU_FTR_POWER9_DD1) &&
720 (event == 0x200f2 || event == 0x300f2))
721 return true;
722
723 return false;
724}
725#endif /* CONFIG_PPC64 */ 713#endif /* CONFIG_PPC64 */
726 714
727static void perf_event_interrupt(struct pt_regs *regs); 715static void perf_event_interrupt(struct pt_regs *regs);
@@ -1046,7 +1034,6 @@ static u64 check_and_compute_delta(u64 prev, u64 val)
1046static void power_pmu_read(struct perf_event *event) 1034static void power_pmu_read(struct perf_event *event)
1047{ 1035{
1048 s64 val, delta, prev; 1036 s64 val, delta, prev;
1049 struct cpu_hw_events *cpuhw = this_cpu_ptr(&cpu_hw_events);
1050 1037
1051 if (event->hw.state & PERF_HES_STOPPED) 1038 if (event->hw.state & PERF_HES_STOPPED)
1052 return; 1039 return;
@@ -1056,13 +1043,6 @@ static void power_pmu_read(struct perf_event *event)
1056 1043
1057 if (is_ebb_event(event)) { 1044 if (is_ebb_event(event)) {
1058 val = read_pmc(event->hw.idx); 1045 val = read_pmc(event->hw.idx);
1059 if (use_ic(event->attr.config)) {
1060 val = mfspr(SPRN_IC);
1061 if (val > cpuhw->ic_init)
1062 val = val - cpuhw->ic_init;
1063 else
1064 val = val + (0 - cpuhw->ic_init);
1065 }
1066 local64_set(&event->hw.prev_count, val); 1046 local64_set(&event->hw.prev_count, val);
1067 return; 1047 return;
1068 } 1048 }
@@ -1076,13 +1056,6 @@ static void power_pmu_read(struct perf_event *event)
1076 prev = local64_read(&event->hw.prev_count); 1056 prev = local64_read(&event->hw.prev_count);
1077 barrier(); 1057 barrier();
1078 val = read_pmc(event->hw.idx); 1058 val = read_pmc(event->hw.idx);
1079 if (use_ic(event->attr.config)) {
1080 val = mfspr(SPRN_IC);
1081 if (val > cpuhw->ic_init)
1082 val = val - cpuhw->ic_init;
1083 else
1084 val = val + (0 - cpuhw->ic_init);
1085 }
1086 delta = check_and_compute_delta(prev, val); 1059 delta = check_and_compute_delta(prev, val);
1087 if (!delta) 1060 if (!delta)
1088 return; 1061 return;
@@ -1535,13 +1508,6 @@ nocheck:
1535 event->attr.branch_sample_type); 1508 event->attr.branch_sample_type);
1536 } 1509 }
1537 1510
1538 /*
1539 * Workaround for POWER9 DD1 to use the Instruction Counter
1540 * register value for instruction counting
1541 */
1542 if (use_ic(event->attr.config))
1543 cpuhw->ic_init = mfspr(SPRN_IC);
1544
1545 perf_pmu_enable(event->pmu); 1511 perf_pmu_enable(event->pmu);
1546 local_irq_restore(flags); 1512 local_irq_restore(flags);
1547 return ret; 1513 return ret;
diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c
index 2efee3f196f5..177de814286f 100644
--- a/arch/powerpc/perf/isa207-common.c
+++ b/arch/powerpc/perf/isa207-common.c
@@ -59,7 +59,7 @@ static bool is_event_valid(u64 event)
59{ 59{
60 u64 valid_mask = EVENT_VALID_MASK; 60 u64 valid_mask = EVENT_VALID_MASK;
61 61
62 if (cpu_has_feature(CPU_FTR_ARCH_300) && !cpu_has_feature(CPU_FTR_POWER9_DD1)) 62 if (cpu_has_feature(CPU_FTR_ARCH_300))
63 valid_mask = p9_EVENT_VALID_MASK; 63 valid_mask = p9_EVENT_VALID_MASK;
64 64
65 return !(event & ~valid_mask); 65 return !(event & ~valid_mask);
@@ -86,8 +86,6 @@ static void mmcra_sdar_mode(u64 event, unsigned long *mmcra)
86 * Incase of Power9: 86 * Incase of Power9:
87 * Marked event: MMCRA[SDAR_MODE] will be set to 0b00 ('No Updates'), 87 * Marked event: MMCRA[SDAR_MODE] will be set to 0b00 ('No Updates'),
88 * or if group already have any marked events. 88 * or if group already have any marked events.
89 * Non-Marked events (for DD1):
90 * MMCRA[SDAR_MODE] will be set to 0b01
91 * For rest 89 * For rest
92 * MMCRA[SDAR_MODE] will be set from event code. 90 * MMCRA[SDAR_MODE] will be set from event code.
93 * If sdar_mode from event is zero, default to 0b01. Hardware 91 * If sdar_mode from event is zero, default to 0b01. Hardware
@@ -96,7 +94,7 @@ static void mmcra_sdar_mode(u64 event, unsigned long *mmcra)
96 if (cpu_has_feature(CPU_FTR_ARCH_300)) { 94 if (cpu_has_feature(CPU_FTR_ARCH_300)) {
97 if (is_event_marked(event) || (*mmcra & MMCRA_SAMPLE_ENABLE)) 95 if (is_event_marked(event) || (*mmcra & MMCRA_SAMPLE_ENABLE))
98 *mmcra &= MMCRA_SDAR_MODE_NO_UPDATES; 96 *mmcra &= MMCRA_SDAR_MODE_NO_UPDATES;
99 else if (!cpu_has_feature(CPU_FTR_POWER9_DD1) && p9_SDAR_MODE(event)) 97 else if (p9_SDAR_MODE(event))
100 *mmcra |= p9_SDAR_MODE(event) << MMCRA_SDAR_MODE_SHIFT; 98 *mmcra |= p9_SDAR_MODE(event) << MMCRA_SDAR_MODE_SHIFT;
101 else 99 else
102 *mmcra |= MMCRA_SDAR_MODE_DCACHE; 100 *mmcra |= MMCRA_SDAR_MODE_DCACHE;
@@ -106,7 +104,7 @@ static void mmcra_sdar_mode(u64 event, unsigned long *mmcra)
106 104
107static u64 thresh_cmp_val(u64 value) 105static u64 thresh_cmp_val(u64 value)
108{ 106{
109 if (cpu_has_feature(CPU_FTR_ARCH_300) && !cpu_has_feature(CPU_FTR_POWER9_DD1)) 107 if (cpu_has_feature(CPU_FTR_ARCH_300))
110 return value << p9_MMCRA_THR_CMP_SHIFT; 108 return value << p9_MMCRA_THR_CMP_SHIFT;
111 109
112 return value << MMCRA_THR_CMP_SHIFT; 110 return value << MMCRA_THR_CMP_SHIFT;
@@ -114,7 +112,7 @@ static u64 thresh_cmp_val(u64 value)
114 112
115static unsigned long combine_from_event(u64 event) 113static unsigned long combine_from_event(u64 event)
116{ 114{
117 if (cpu_has_feature(CPU_FTR_ARCH_300) && !cpu_has_feature(CPU_FTR_POWER9_DD1)) 115 if (cpu_has_feature(CPU_FTR_ARCH_300))
118 return p9_EVENT_COMBINE(event); 116 return p9_EVENT_COMBINE(event);
119 117
120 return EVENT_COMBINE(event); 118 return EVENT_COMBINE(event);
@@ -122,7 +120,7 @@ static unsigned long combine_from_event(u64 event)
122 120
123static unsigned long combine_shift(unsigned long pmc) 121static unsigned long combine_shift(unsigned long pmc)
124{ 122{
125 if (cpu_has_feature(CPU_FTR_ARCH_300) && !cpu_has_feature(CPU_FTR_POWER9_DD1)) 123 if (cpu_has_feature(CPU_FTR_ARCH_300))
126 return p9_MMCR1_COMBINE_SHIFT(pmc); 124 return p9_MMCR1_COMBINE_SHIFT(pmc);
127 125
128 return MMCR1_COMBINE_SHIFT(pmc); 126 return MMCR1_COMBINE_SHIFT(pmc);
diff --git a/arch/powerpc/perf/isa207-common.h b/arch/powerpc/perf/isa207-common.h
index 6a0b586c935a..0028f4b9490d 100644
--- a/arch/powerpc/perf/isa207-common.h
+++ b/arch/powerpc/perf/isa207-common.h
@@ -158,11 +158,6 @@
158 CNST_PMC_VAL(1) | CNST_PMC_VAL(2) | CNST_PMC_VAL(3) | \ 158 CNST_PMC_VAL(1) | CNST_PMC_VAL(2) | CNST_PMC_VAL(3) | \
159 CNST_PMC_VAL(4) | CNST_PMC_VAL(5) | CNST_PMC_VAL(6) | CNST_NC_VAL 159 CNST_PMC_VAL(4) | CNST_PMC_VAL(5) | CNST_PMC_VAL(6) | CNST_NC_VAL
160 160
161/*
162 * Lets restrict use of PMC5 for instruction counting.
163 */
164#define P9_DD1_TEST_ADDER (ISA207_TEST_ADDER | CNST_PMC_VAL(5))
165
166/* Bits in MMCR1 for PowerISA v2.07 */ 161/* Bits in MMCR1 for PowerISA v2.07 */
167#define MMCR1_UNIT_SHIFT(pmc) (60 - (4 * ((pmc) - 1))) 162#define MMCR1_UNIT_SHIFT(pmc) (60 - (4 * ((pmc) - 1)))
168#define MMCR1_COMBINE_SHIFT(pmc) (35 - ((pmc) - 1)) 163#define MMCR1_COMBINE_SHIFT(pmc) (35 - ((pmc) - 1))
diff --git a/arch/powerpc/perf/power9-pmu.c b/arch/powerpc/perf/power9-pmu.c
index 2ca0b33b4efb..e012b1030a5b 100644
--- a/arch/powerpc/perf/power9-pmu.c
+++ b/arch/powerpc/perf/power9-pmu.c
@@ -219,12 +219,6 @@ static struct attribute_group power9_pmu_events_group = {
219 .attrs = power9_events_attr, 219 .attrs = power9_events_attr,
220}; 220};
221 221
222static const struct attribute_group *power9_isa207_pmu_attr_groups[] = {
223 &isa207_pmu_format_group,
224 &power9_pmu_events_group,
225 NULL,
226};
227
228PMU_FORMAT_ATTR(event, "config:0-51"); 222PMU_FORMAT_ATTR(event, "config:0-51");
229PMU_FORMAT_ATTR(pmcxsel, "config:0-7"); 223PMU_FORMAT_ATTR(pmcxsel, "config:0-7");
230PMU_FORMAT_ATTR(mark, "config:8"); 224PMU_FORMAT_ATTR(mark, "config:8");
@@ -267,17 +261,6 @@ static const struct attribute_group *power9_pmu_attr_groups[] = {
267 NULL, 261 NULL,
268}; 262};
269 263
270static int power9_generic_events_dd1[] = {
271 [PERF_COUNT_HW_CPU_CYCLES] = PM_CYC,
272 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = PM_ICT_NOSLOT_CYC,
273 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = PM_CMPLU_STALL,
274 [PERF_COUNT_HW_INSTRUCTIONS] = PM_INST_DISP,
275 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = PM_BR_CMPL_ALT,
276 [PERF_COUNT_HW_BRANCH_MISSES] = PM_BR_MPRED_CMPL,
277 [PERF_COUNT_HW_CACHE_REFERENCES] = PM_LD_REF_L1,
278 [PERF_COUNT_HW_CACHE_MISSES] = PM_LD_MISS_L1_FIN,
279};
280
281static int power9_generic_events[] = { 264static int power9_generic_events[] = {
282 [PERF_COUNT_HW_CPU_CYCLES] = PM_CYC, 265 [PERF_COUNT_HW_CPU_CYCLES] = PM_CYC,
283 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = PM_ICT_NOSLOT_CYC, 266 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = PM_ICT_NOSLOT_CYC,
@@ -439,25 +422,6 @@ static int power9_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
439 422
440#undef C 423#undef C
441 424
442static struct power_pmu power9_isa207_pmu = {
443 .name = "POWER9",
444 .n_counter = MAX_PMU_COUNTERS,
445 .add_fields = ISA207_ADD_FIELDS,
446 .test_adder = P9_DD1_TEST_ADDER,
447 .compute_mmcr = isa207_compute_mmcr,
448 .config_bhrb = power9_config_bhrb,
449 .bhrb_filter_map = power9_bhrb_filter_map,
450 .get_constraint = isa207_get_constraint,
451 .get_alternatives = power9_get_alternatives,
452 .disable_pmc = isa207_disable_pmc,
453 .flags = PPMU_NO_SIAR | PPMU_ARCH_207S,
454 .n_generic = ARRAY_SIZE(power9_generic_events_dd1),
455 .generic_events = power9_generic_events_dd1,
456 .cache_events = &power9_cache_events,
457 .attr_groups = power9_isa207_pmu_attr_groups,
458 .bhrb_nr = 32,
459};
460
461static struct power_pmu power9_pmu = { 425static struct power_pmu power9_pmu = {
462 .name = "POWER9", 426 .name = "POWER9",
463 .n_counter = MAX_PMU_COUNTERS, 427 .n_counter = MAX_PMU_COUNTERS,
@@ -500,23 +464,7 @@ static int __init init_power9_pmu(void)
500 } 464 }
501 } 465 }
502 466
503 if (cpu_has_feature(CPU_FTR_POWER9_DD1)) { 467 rc = register_power_pmu(&power9_pmu);
504 /*
505 * Since PM_INST_CMPL may not provide right counts in all
506 * sampling scenarios in power9 DD1, instead use PM_INST_DISP.
507 */
508 EVENT_VAR(PM_INST_CMPL, _g).id = PM_INST_DISP;
509 /*
510 * Power9 DD1 should use PM_BR_CMPL_ALT event code for
511 * "branches" to provide correct counter value.
512 */
513 EVENT_VAR(PM_BR_CMPL, _g).id = PM_BR_CMPL_ALT;
514 EVENT_VAR(PM_BR_CMPL, _c).id = PM_BR_CMPL_ALT;
515 rc = register_power_pmu(&power9_isa207_pmu);
516 } else {
517 rc = register_power_pmu(&power9_pmu);
518 }
519
520 if (rc) 468 if (rc)
521 return rc; 469 return rc;
522 470
diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
index 1c5d0675b43c..12f13acee1f6 100644
--- a/arch/powerpc/platforms/powernv/idle.c
+++ b/arch/powerpc/platforms/powernv/idle.c
@@ -177,11 +177,6 @@ static void pnv_alloc_idle_core_states(void)
177 paca_ptrs[cpu]->core_idle_state_ptr = core_idle_state; 177 paca_ptrs[cpu]->core_idle_state_ptr = core_idle_state;
178 paca_ptrs[cpu]->thread_idle_state = PNV_THREAD_RUNNING; 178 paca_ptrs[cpu]->thread_idle_state = PNV_THREAD_RUNNING;
179 paca_ptrs[cpu]->thread_mask = 1 << j; 179 paca_ptrs[cpu]->thread_mask = 1 << j;
180 if (!cpu_has_feature(CPU_FTR_POWER9_DD1))
181 continue;
182 paca_ptrs[cpu]->thread_sibling_pacas =
183 kmalloc_node(paca_ptr_array_size,
184 GFP_KERNEL, node);
185 } 180 }
186 } 181 }
187 182
@@ -805,29 +800,6 @@ static int __init pnv_init_idle_states(void)
805 800
806 pnv_alloc_idle_core_states(); 801 pnv_alloc_idle_core_states();
807 802
808 /*
809 * For each CPU, record its PACA address in each of it's
810 * sibling thread's PACA at the slot corresponding to this
811 * CPU's index in the core.
812 */
813 if (cpu_has_feature(CPU_FTR_POWER9_DD1)) {
814 int cpu;
815
816 pr_info("powernv: idle: Saving PACA pointers of all CPUs in their thread sibling PACA\n");
817 for_each_present_cpu(cpu) {
818 int base_cpu = cpu_first_thread_sibling(cpu);
819 int idx = cpu_thread_in_core(cpu);
820 int i;
821
822 for (i = 0; i < threads_per_core; i++) {
823 int j = base_cpu + i;
824
825 paca_ptrs[j]->thread_sibling_pacas[idx] =
826 paca_ptrs[cpu];
827 }
828 }
829 }
830
831 if (supported_cpuidle_states & OPAL_PM_NAP_ENABLED) 803 if (supported_cpuidle_states & OPAL_PM_NAP_ENABLED)
832 ppc_md.power_save = power7_idle; 804 ppc_md.power_save = power7_idle;
833 805
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index b80909957792..0d354e19ef92 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -283,23 +283,6 @@ static void pnv_cause_ipi(int cpu)
283 ic_cause_ipi(cpu); 283 ic_cause_ipi(cpu);
284} 284}
285 285
286static void pnv_p9_dd1_cause_ipi(int cpu)
287{
288 int this_cpu = get_cpu();
289
290 /*
291 * POWER9 DD1 has a global addressed msgsnd, but for now we restrict
292 * IPIs to same core, because it requires additional synchronization
293 * for inter-core doorbells which we do not implement.
294 */
295 if (cpumask_test_cpu(cpu, cpu_sibling_mask(this_cpu)))
296 doorbell_global_ipi(cpu);
297 else
298 ic_cause_ipi(cpu);
299
300 put_cpu();
301}
302
303static void __init pnv_smp_probe(void) 286static void __init pnv_smp_probe(void)
304{ 287{
305 if (xive_enabled()) 288 if (xive_enabled())
@@ -311,14 +294,10 @@ static void __init pnv_smp_probe(void)
311 ic_cause_ipi = smp_ops->cause_ipi; 294 ic_cause_ipi = smp_ops->cause_ipi;
312 WARN_ON(!ic_cause_ipi); 295 WARN_ON(!ic_cause_ipi);
313 296
314 if (cpu_has_feature(CPU_FTR_ARCH_300)) { 297 if (cpu_has_feature(CPU_FTR_ARCH_300))
315 if (cpu_has_feature(CPU_FTR_POWER9_DD1)) 298 smp_ops->cause_ipi = doorbell_global_ipi;
316 smp_ops->cause_ipi = pnv_p9_dd1_cause_ipi; 299 else
317 else
318 smp_ops->cause_ipi = doorbell_global_ipi;
319 } else {
320 smp_ops->cause_ipi = pnv_cause_ipi; 300 smp_ops->cause_ipi = pnv_cause_ipi;
321 }
322 } 301 }
323} 302}
324 303
diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index 3459015092fa..4758173df426 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -319,7 +319,7 @@ void xive_do_source_eoi(u32 hw_irq, struct xive_irq_data *xd)
319 * The FW told us to call it. This happens for some 319 * The FW told us to call it. This happens for some
320 * interrupt sources that need additional HW whacking 320 * interrupt sources that need additional HW whacking
321 * beyond the ESB manipulation. For example LPC interrupts 321 * beyond the ESB manipulation. For example LPC interrupts
322 * on P9 DD1.0 need a latch to be clared in the LPC bridge 322 * on P9 DD1.0 needed a latch to be clared in the LPC bridge
323 * itself. The Firmware will take care of it. 323 * itself. The Firmware will take care of it.
324 */ 324 */
325 if (WARN_ON_ONCE(!xive_ops->eoi)) 325 if (WARN_ON_ONCE(!xive_ops->eoi))
@@ -337,9 +337,9 @@ void xive_do_source_eoi(u32 hw_irq, struct xive_irq_data *xd)
337 * This allows us to then do a re-trigger if Q was set 337 * This allows us to then do a re-trigger if Q was set
338 * rather than synthesizing an interrupt in software 338 * rather than synthesizing an interrupt in software
339 * 339 *
340 * For LSIs, using the HW EOI cycle works around a problem 340 * For LSIs the HW EOI cycle is used rather than PQ bits,
341 * on P9 DD1 PHBs where the other ESB accesses don't work 341 * as they are automatically re-triggred in HW when still
342 * properly. 342 * pending.
343 */ 343 */
344 if (xd->flags & XIVE_IRQ_FLAG_LSI) 344 if (xd->flags & XIVE_IRQ_FLAG_LSI)
345 xive_esb_read(xd, XIVE_ESB_LOAD_EOI); 345 xive_esb_read(xd, XIVE_ESB_LOAD_EOI);
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 47166ad2a669..21119cfe8474 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2429,7 +2429,6 @@ static void dump_one_paca(int cpu)
2429 DUMP(p, thread_idle_state, "%#-*x"); 2429 DUMP(p, thread_idle_state, "%#-*x");
2430 DUMP(p, thread_mask, "%#-*x"); 2430 DUMP(p, thread_mask, "%#-*x");
2431 DUMP(p, subcore_sibling_mask, "%#-*x"); 2431 DUMP(p, subcore_sibling_mask, "%#-*x");
2432 DUMP(p, thread_sibling_pacas, "%-*px");
2433 DUMP(p, requested_psscr, "%#-*llx"); 2432 DUMP(p, requested_psscr, "%#-*llx");
2434 DUMP(p, stop_sprs.pid, "%#-*llx"); 2433 DUMP(p, stop_sprs.pid, "%#-*llx");
2435 DUMP(p, stop_sprs.ldbar, "%#-*llx"); 2434 DUMP(p, stop_sprs.ldbar, "%#-*llx");
diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index 918d4fb742d1..505f973e13f3 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -865,14 +865,6 @@ static inline bool cxl_is_power9(void)
865 return false; 865 return false;
866} 866}
867 867
868static inline bool cxl_is_power9_dd1(void)
869{
870 if ((pvr_version_is(PVR_POWER9)) &&
871 cpu_has_feature(CPU_FTR_POWER9_DD1))
872 return true;
873 return false;
874}
875
876ssize_t cxl_pci_afu_read_err_buffer(struct cxl_afu *afu, char *buf, 868ssize_t cxl_pci_afu_read_err_buffer(struct cxl_afu *afu, char *buf,
877 loff_t off, size_t count); 869 loff_t off, size_t count);
878 870
diff --git a/drivers/misc/cxl/cxllib.c b/drivers/misc/cxl/cxllib.c
index 0bc7c31cf739..5a3f91255258 100644
--- a/drivers/misc/cxl/cxllib.c
+++ b/drivers/misc/cxl/cxllib.c
@@ -102,10 +102,6 @@ int cxllib_get_xsl_config(struct pci_dev *dev, struct cxllib_xsl_config *cfg)
102 rc = cxl_get_xsl9_dsnctl(dev, capp_unit_id, &cfg->dsnctl); 102 rc = cxl_get_xsl9_dsnctl(dev, capp_unit_id, &cfg->dsnctl);
103 if (rc) 103 if (rc)
104 return rc; 104 return rc;
105 if (cpu_has_feature(CPU_FTR_POWER9_DD1)) {
106 /* workaround for DD1 - nbwind = capiind */
107 cfg->dsnctl |= ((u64)0x02 << (63-47));
108 }
109 105
110 cfg->version = CXL_XSL_CONFIG_CURRENT_VERSION; 106 cfg->version = CXL_XSL_CONFIG_CURRENT_VERSION;
111 cfg->log_bar_size = CXL_CAPI_WINDOW_LOG_SIZE; 107 cfg->log_bar_size = CXL_CAPI_WINDOW_LOG_SIZE;
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index 429d6de1dde7..2af0d4c47b76 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -465,23 +465,21 @@ int cxl_get_xsl9_dsnctl(struct pci_dev *dev, u64 capp_unit_id, u64 *reg)
465 /* nMMU_ID Defaults to: b’000001001’*/ 465 /* nMMU_ID Defaults to: b’000001001’*/
466 xsl_dsnctl |= ((u64)0x09 << (63-28)); 466 xsl_dsnctl |= ((u64)0x09 << (63-28));
467 467
468 if (!(cxl_is_power9_dd1())) { 468 /*
469 /* 469 * Used to identify CAPI packets which should be sorted into
470 * Used to identify CAPI packets which should be sorted into 470 * the Non-Blocking queues by the PHB. This field should match
471 * the Non-Blocking queues by the PHB. This field should match 471 * the PHB PBL_NBW_CMPM register
472 * the PHB PBL_NBW_CMPM register 472 * nbwind=0x03, bits [57:58], must include capi indicator.
473 * nbwind=0x03, bits [57:58], must include capi indicator. 473 * Not supported on P9 DD1.
474 * Not supported on P9 DD1. 474 */
475 */ 475 xsl_dsnctl |= (nbwind << (63-55));
476 xsl_dsnctl |= (nbwind << (63-55));
477 476
478 /* 477 /*
479 * Upper 16b address bits of ASB_Notify messages sent to the 478 * Upper 16b address bits of ASB_Notify messages sent to the
480 * system. Need to match the PHB’s ASN Compare/Mask Register. 479 * system. Need to match the PHB’s ASN Compare/Mask Register.
481 * Not supported on P9 DD1. 480 * Not supported on P9 DD1.
482 */ 481 */
483 xsl_dsnctl |= asnind; 482 xsl_dsnctl |= asnind;
484 }
485 483
486 *reg = xsl_dsnctl; 484 *reg = xsl_dsnctl;
487 return 0; 485 return 0;
@@ -539,15 +537,8 @@ static int init_implementation_adapter_regs_psl9(struct cxl *adapter,
539 /* Snoop machines */ 537 /* Snoop machines */
540 cxl_p1_write(adapter, CXL_PSL9_APCDEDALLOC, 0x800F000200000000ULL); 538 cxl_p1_write(adapter, CXL_PSL9_APCDEDALLOC, 0x800F000200000000ULL);
541 539
542 if (cxl_is_power9_dd1()) { 540 /* Enable NORST and DD2 features */
543 /* Disabling deadlock counter CAR */ 541 cxl_p1_write(adapter, CXL_PSL9_DEBUG, 0xC000000000000000ULL);
544 cxl_p1_write(adapter, CXL_PSL9_GP_CT, 0x0020000000000001ULL);
545 /* Enable NORST */
546 cxl_p1_write(adapter, CXL_PSL9_DEBUG, 0x8000000000000000ULL);
547 } else {
548 /* Enable NORST and DD2 features */
549 cxl_p1_write(adapter, CXL_PSL9_DEBUG, 0xC000000000000000ULL);
550 }
551 542
552 /* 543 /*
553 * Check if PSL has data-cache. We need to flush adapter datacache 544 * Check if PSL has data-cache. We need to flush adapter datacache