Commit 83fd57a7 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'powerpc-4.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:
 "Two fixes for fallout from the hugetlb changes we merged this cycle.

  Ten other fixes, four only affect Power9, and the rest are a bit of a
  mixture though nothing terrible.

  Thanks to: Aneesh Kumar K.V, Anton Blanchard, Benjamin Herrenschmidt,
  Dave Martin, Gavin Shan, Madhavan Srinivasan, Nicholas Piggin, Reza
  Arbab"

* tag 'powerpc-4.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc: Ignore reserved field in DCSR and PVR reads and writes
  powerpc/ptrace: Preserve previous TM fprs/vsrs on short regset write
  powerpc/ptrace: Preserve previous fprs/vsrs on short regset write
  powerpc/perf: Use MSR to report privilege level on P9 DD1
  selftest/powerpc: Wrong PMC initialized in pmc56_overflow test
  powerpc/eeh: Enable IO path on permanent error
  powerpc/perf: Fix PM_BRU_CMPL event code for power9
  powerpc/mm: Fix little-endian 4K hugetlb
  powerpc/mm/hugetlb: Don't panic when we don't find the default huge page size
  powerpc: Fix pgtable pmd cache init
  powerpc/icp-opal: Fix missing KVM case and harden replay
  powerpc/mm: Fix memory hotplug BUG() on radix
parents 4c9eff7a 178f3582
...@@ -36,12 +36,13 @@ ...@@ -36,12 +36,13 @@
#ifdef CONFIG_HUGETLB_PAGE #ifdef CONFIG_HUGETLB_PAGE
static inline int hash__hugepd_ok(hugepd_t hpd) static inline int hash__hugepd_ok(hugepd_t hpd)
{ {
unsigned long hpdval = hpd_val(hpd);
/* /*
* if it is not a pte and have hugepd shift mask * if it is not a pte and have hugepd shift mask
* set, then it is a hugepd directory pointer * set, then it is a hugepd directory pointer
*/ */
if (!(hpd.pd & _PAGE_PTE) && if (!(hpdval & _PAGE_PTE) &&
((hpd.pd & HUGEPD_SHIFT_MASK) != 0)) ((hpdval & HUGEPD_SHIFT_MASK) != 0))
return true; return true;
return false; return false;
} }
......
...@@ -201,6 +201,10 @@ extern int __meminit hash__vmemmap_create_mapping(unsigned long start, ...@@ -201,6 +201,10 @@ extern int __meminit hash__vmemmap_create_mapping(unsigned long start,
unsigned long phys); unsigned long phys);
extern void hash__vmemmap_remove_mapping(unsigned long start, extern void hash__vmemmap_remove_mapping(unsigned long start,
unsigned long page_size); unsigned long page_size);
int hash__create_section_mapping(unsigned long start, unsigned long end);
int hash__remove_section_mapping(unsigned long start, unsigned long end);
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_BOOK3S_64_HASH_H */ #endif /* _ASM_POWERPC_BOOK3S_64_HASH_H */
...@@ -21,12 +21,12 @@ static inline pte_t *hugepd_page(hugepd_t hpd) ...@@ -21,12 +21,12 @@ static inline pte_t *hugepd_page(hugepd_t hpd)
* We have only four bits to encode, MMU page size * We have only four bits to encode, MMU page size
*/ */
BUILD_BUG_ON((MMU_PAGE_COUNT - 1) > 0xf); BUILD_BUG_ON((MMU_PAGE_COUNT - 1) > 0xf);
return __va(hpd.pd & HUGEPD_ADDR_MASK); return __va(hpd_val(hpd) & HUGEPD_ADDR_MASK);
} }
static inline unsigned int hugepd_mmu_psize(hugepd_t hpd) static inline unsigned int hugepd_mmu_psize(hugepd_t hpd)
{ {
return (hpd.pd & HUGEPD_SHIFT_MASK) >> 2; return (hpd_val(hpd) & HUGEPD_SHIFT_MASK) >> 2;
} }
static inline unsigned int hugepd_shift(hugepd_t hpd) static inline unsigned int hugepd_shift(hugepd_t hpd)
...@@ -52,18 +52,20 @@ static inline pte_t *hugepd_page(hugepd_t hpd) ...@@ -52,18 +52,20 @@ static inline pte_t *hugepd_page(hugepd_t hpd)
{ {
BUG_ON(!hugepd_ok(hpd)); BUG_ON(!hugepd_ok(hpd));
#ifdef CONFIG_PPC_8xx #ifdef CONFIG_PPC_8xx
return (pte_t *)__va(hpd.pd & ~(_PMD_PAGE_MASK | _PMD_PRESENT_MASK)); return (pte_t *)__va(hpd_val(hpd) &
~(_PMD_PAGE_MASK | _PMD_PRESENT_MASK));
#else #else
return (pte_t *)((hpd.pd & ~HUGEPD_SHIFT_MASK) | PD_HUGE); return (pte_t *)((hpd_val(hpd) &
~HUGEPD_SHIFT_MASK) | PD_HUGE);
#endif #endif
} }
static inline unsigned int hugepd_shift(hugepd_t hpd) static inline unsigned int hugepd_shift(hugepd_t hpd)
{ {
#ifdef CONFIG_PPC_8xx #ifdef CONFIG_PPC_8xx
return ((hpd.pd & _PMD_PAGE_MASK) >> 1) + 17; return ((hpd_val(hpd) & _PMD_PAGE_MASK) >> 1) + 17;
#else #else
return hpd.pd & HUGEPD_SHIFT_MASK; return hpd_val(hpd) & HUGEPD_SHIFT_MASK;
#endif #endif
} }
......
...@@ -227,9 +227,10 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, ...@@ -227,9 +227,10 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
static inline int hugepd_ok(hugepd_t hpd) static inline int hugepd_ok(hugepd_t hpd)
{ {
#ifdef CONFIG_PPC_8xx #ifdef CONFIG_PPC_8xx
return ((hpd.pd & 0x4) != 0); return ((hpd_val(hpd) & 0x4) != 0);
#else #else
return (hpd.pd > 0); /* We clear the top bit to indicate hugepd */
return ((hpd_val(hpd) & PD_HUGE) == 0);
#endif #endif
} }
......
...@@ -294,15 +294,12 @@ extern long long virt_phys_offset; ...@@ -294,15 +294,12 @@ extern long long virt_phys_offset;
#include <asm/pgtable-types.h> #include <asm/pgtable-types.h>
#endif #endif
typedef struct { signed long pd; } hugepd_t;
#ifndef CONFIG_HUGETLB_PAGE #ifndef CONFIG_HUGETLB_PAGE
#define is_hugepd(pdep) (0) #define is_hugepd(pdep) (0)
#define pgd_huge(pgd) (0) #define pgd_huge(pgd) (0)
#endif /* CONFIG_HUGETLB_PAGE */ #endif /* CONFIG_HUGETLB_PAGE */
#define __hugepd(x) ((hugepd_t) { (x) })
struct page; struct page;
extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
extern void copy_user_page(void *to, void *from, unsigned long vaddr, extern void copy_user_page(void *to, void *from, unsigned long vaddr,
......
...@@ -65,6 +65,7 @@ struct power_pmu { ...@@ -65,6 +65,7 @@ struct power_pmu {
#define PPMU_HAS_SSLOT 0x00000020 /* Has sampled slot in MMCRA */ #define PPMU_HAS_SSLOT 0x00000020 /* Has sampled slot in MMCRA */
#define PPMU_HAS_SIER 0x00000040 /* Has SIER */ #define PPMU_HAS_SIER 0x00000040 /* Has SIER */
#define PPMU_ARCH_207S 0x00000080 /* PMC is architecture v2.07S */ #define PPMU_ARCH_207S 0x00000080 /* PMC is architecture v2.07S */
#define PPMU_NO_SIAR 0x00000100 /* Do not use SIAR */
/* /*
* Values for flags to get_alternatives() * Values for flags to get_alternatives()
......
...@@ -104,4 +104,12 @@ static inline bool pmd_xchg(pmd_t *pmdp, pmd_t old, pmd_t new) ...@@ -104,4 +104,12 @@ static inline bool pmd_xchg(pmd_t *pmdp, pmd_t old, pmd_t new)
return pmd_raw(old) == prev; return pmd_raw(old) == prev;
} }
typedef struct { __be64 pdbe; } hugepd_t;
#define __hugepd(x) ((hugepd_t) { cpu_to_be64(x) })
static inline unsigned long hpd_val(hugepd_t x)
{
return be64_to_cpu(x.pdbe);
}
#endif /* _ASM_POWERPC_PGTABLE_BE_TYPES_H */ #endif /* _ASM_POWERPC_PGTABLE_BE_TYPES_H */
...@@ -66,4 +66,11 @@ static inline bool pte_xchg(pte_t *ptep, pte_t old, pte_t new) ...@@ -66,4 +66,11 @@ static inline bool pte_xchg(pte_t *ptep, pte_t old, pte_t new)
} }
#endif #endif
typedef struct { unsigned long pd; } hugepd_t;
#define __hugepd(x) ((hugepd_t) { (x) })
static inline unsigned long hpd_val(hugepd_t x)
{
return x.pd;
}
#endif /* _ASM_POWERPC_PGTABLE_TYPES_H */ #endif /* _ASM_POWERPC_PGTABLE_TYPES_H */
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
#define PPC_INST_MCRXR 0x7c000400 #define PPC_INST_MCRXR 0x7c000400
#define PPC_INST_MCRXR_MASK 0xfc0007fe #define PPC_INST_MCRXR_MASK 0xfc0007fe
#define PPC_INST_MFSPR_PVR 0x7c1f42a6 #define PPC_INST_MFSPR_PVR 0x7c1f42a6
#define PPC_INST_MFSPR_PVR_MASK 0xfc1fffff #define PPC_INST_MFSPR_PVR_MASK 0xfc1ffffe
#define PPC_INST_MFTMR 0x7c0002dc #define PPC_INST_MFTMR 0x7c0002dc
#define PPC_INST_MSGSND 0x7c00019c #define PPC_INST_MSGSND 0x7c00019c
#define PPC_INST_MSGCLR 0x7c0001dc #define PPC_INST_MSGCLR 0x7c0001dc
...@@ -174,13 +174,13 @@ ...@@ -174,13 +174,13 @@
#define PPC_INST_RFDI 0x4c00004e #define PPC_INST_RFDI 0x4c00004e
#define PPC_INST_RFMCI 0x4c00004c #define PPC_INST_RFMCI 0x4c00004c
#define PPC_INST_MFSPR_DSCR 0x7c1102a6 #define PPC_INST_MFSPR_DSCR 0x7c1102a6
#define PPC_INST_MFSPR_DSCR_MASK 0xfc1fffff #define PPC_INST_MFSPR_DSCR_MASK 0xfc1ffffe
#define PPC_INST_MTSPR_DSCR 0x7c1103a6 #define PPC_INST_MTSPR_DSCR 0x7c1103a6
#define PPC_INST_MTSPR_DSCR_MASK 0xfc1fffff #define PPC_INST_MTSPR_DSCR_MASK 0xfc1ffffe
#define PPC_INST_MFSPR_DSCR_USER 0x7c0302a6 #define PPC_INST_MFSPR_DSCR_USER 0x7c0302a6
#define PPC_INST_MFSPR_DSCR_USER_MASK 0xfc1fffff #define PPC_INST_MFSPR_DSCR_USER_MASK 0xfc1ffffe
#define PPC_INST_MTSPR_DSCR_USER 0x7c0303a6 #define PPC_INST_MTSPR_DSCR_USER 0x7c0303a6
#define PPC_INST_MTSPR_DSCR_USER_MASK 0xfc1fffff #define PPC_INST_MTSPR_DSCR_USER_MASK 0xfc1ffffe
#define PPC_INST_MFVSRD 0x7c000066 #define PPC_INST_MFVSRD 0x7c000066
#define PPC_INST_MTVSRD 0x7c000166 #define PPC_INST_MTVSRD 0x7c000166
#define PPC_INST_SLBFEE 0x7c0007a7 #define PPC_INST_SLBFEE 0x7c0007a7
......
...@@ -298,9 +298,17 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity) ...@@ -298,9 +298,17 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity)
* *
* For pHyp, we have to enable IO for log retrieval. Otherwise, * For pHyp, we have to enable IO for log retrieval. Otherwise,
* 0xFF's is always returned from PCI config space. * 0xFF's is always returned from PCI config space.
*
* When the @severity is EEH_LOG_PERM, the PE is going to be
* removed. Prior to that, the drivers for devices included in
* the PE will be closed. The drivers rely on working IO path
* to bring the devices to quiet state. Otherwise, PCI traffic
* from those devices after they are removed is like to cause
* another unexpected EEH error.
*/ */
if (!(pe->type & EEH_PE_PHB)) { if (!(pe->type & EEH_PE_PHB)) {
if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG)) if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG) ||
severity == EEH_LOG_PERM)
eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
/* /*
......
...@@ -463,6 +463,10 @@ static int fpr_set(struct task_struct *target, const struct user_regset *regset, ...@@ -463,6 +463,10 @@ static int fpr_set(struct task_struct *target, const struct user_regset *regset,
flush_fp_to_thread(target); flush_fp_to_thread(target);
for (i = 0; i < 32 ; i++)
buf[i] = target->thread.TS_FPR(i);
buf[32] = target->thread.fp_state.fpscr;
/* copy to local buffer then write that out */ /* copy to local buffer then write that out */
i = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, -1); i = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, -1);
if (i) if (i)
...@@ -672,6 +676,9 @@ static int vsr_set(struct task_struct *target, const struct user_regset *regset, ...@@ -672,6 +676,9 @@ static int vsr_set(struct task_struct *target, const struct user_regset *regset,
flush_altivec_to_thread(target); flush_altivec_to_thread(target);
flush_vsx_to_thread(target); flush_vsx_to_thread(target);
for (i = 0; i < 32 ; i++)
buf[i] = target->thread.fp_state.fpr[i][TS_VSRLOWOFFSET];
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
buf, 0, 32 * sizeof(double)); buf, 0, 32 * sizeof(double));
if (!ret) if (!ret)
...@@ -1019,6 +1026,10 @@ static int tm_cfpr_set(struct task_struct *target, ...@@ -1019,6 +1026,10 @@ static int tm_cfpr_set(struct task_struct *target,
flush_fp_to_thread(target); flush_fp_to_thread(target);
flush_altivec_to_thread(target); flush_altivec_to_thread(target);
for (i = 0; i < 32; i++)
buf[i] = target->thread.TS_CKFPR(i);
buf[32] = target->thread.ckfp_state.fpscr;
/* copy to local buffer then write that out */ /* copy to local buffer then write that out */
i = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, -1); i = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, -1);
if (i) if (i)
...@@ -1283,6 +1294,9 @@ static int tm_cvsx_set(struct task_struct *target, ...@@ -1283,6 +1294,9 @@ static int tm_cvsx_set(struct task_struct *target,
flush_altivec_to_thread(target); flush_altivec_to_thread(target);
flush_vsx_to_thread(target); flush_vsx_to_thread(target);
for (i = 0; i < 32 ; i++)
buf[i] = target->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET];
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
buf, 0, 32 * sizeof(double)); buf, 0, 32 * sizeof(double));
if (!ret) if (!ret)
......
...@@ -747,7 +747,7 @@ static unsigned long __init htab_get_table_size(void) ...@@ -747,7 +747,7 @@ static unsigned long __init htab_get_table_size(void)
} }
#ifdef CONFIG_MEMORY_HOTPLUG #ifdef CONFIG_MEMORY_HOTPLUG
int create_section_mapping(unsigned long start, unsigned long end) int hash__create_section_mapping(unsigned long start, unsigned long end)
{ {
int rc = htab_bolt_mapping(start, end, __pa(start), int rc = htab_bolt_mapping(start, end, __pa(start),
pgprot_val(PAGE_KERNEL), mmu_linear_psize, pgprot_val(PAGE_KERNEL), mmu_linear_psize,
...@@ -761,7 +761,7 @@ int create_section_mapping(unsigned long start, unsigned long end) ...@@ -761,7 +761,7 @@ int create_section_mapping(unsigned long start, unsigned long end)
return rc; return rc;
} }
int remove_section_mapping(unsigned long start, unsigned long end) int hash__remove_section_mapping(unsigned long start, unsigned long end)
{ {
int rc = htab_remove_mapping(start, end, mmu_linear_psize, int rc = htab_remove_mapping(start, end, mmu_linear_psize,
mmu_kernel_ssize); mmu_kernel_ssize);
......
...@@ -125,11 +125,14 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, ...@@ -125,11 +125,14 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
int hugepd_ok(hugepd_t hpd) int hugepd_ok(hugepd_t hpd)
{ {
bool is_hugepd; bool is_hugepd;
unsigned long hpdval;
hpdval = hpd_val(hpd);
/* /*
* We should not find this format in page directory, warn otherwise. * We should not find this format in page directory, warn otherwise.
*/ */
is_hugepd = (((hpd.pd & 0x3) == 0x0) && ((hpd.pd & HUGEPD_SHIFT_MASK) != 0)); is_hugepd = (((hpdval & 0x3) == 0x0) && ((hpdval & HUGEPD_SHIFT_MASK) != 0));
WARN(is_hugepd, "Found wrong page directory format\n"); WARN(is_hugepd, "Found wrong page directory format\n");
return 0; return 0;
} }
......
...@@ -53,7 +53,7 @@ static u64 gpage_freearray[MAX_NUMBER_GPAGES]; ...@@ -53,7 +53,7 @@ static u64 gpage_freearray[MAX_NUMBER_GPAGES];
static unsigned nr_gpages; static unsigned nr_gpages;
#endif #endif
#define hugepd_none(hpd) ((hpd).pd == 0) #define hugepd_none(hpd) (hpd_val(hpd) == 0)
pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
{ {
...@@ -103,24 +103,24 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, ...@@ -103,24 +103,24 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
for (i = 0; i < num_hugepd; i++, hpdp++) { for (i = 0; i < num_hugepd; i++, hpdp++) {
if (unlikely(!hugepd_none(*hpdp))) if (unlikely(!hugepd_none(*hpdp)))
break; break;
else else {
#ifdef CONFIG_PPC_BOOK3S_64 #ifdef CONFIG_PPC_BOOK3S_64
hpdp->pd = __pa(new) | *hpdp = __hugepd(__pa(new) |
(shift_to_mmu_psize(pshift) << 2); (shift_to_mmu_psize(pshift) << 2));
#elif defined(CONFIG_PPC_8xx) #elif defined(CONFIG_PPC_8xx)
hpdp->pd = __pa(new) | *hpdp = __hugepd(__pa(new) |
(pshift == PAGE_SHIFT_8M ? _PMD_PAGE_8M : (pshift == PAGE_SHIFT_8M ? _PMD_PAGE_8M :
_PMD_PAGE_512K) | _PMD_PAGE_512K) | _PMD_PRESENT);
_PMD_PRESENT;
#else #else
/* We use the old format for PPC_FSL_BOOK3E */ /* We use the old format for PPC_FSL_BOOK3E */
hpdp->pd = ((unsigned long)new & ~PD_HUGE) | pshift; *hpdp = __hugepd(((unsigned long)new & ~PD_HUGE) | pshift);
#endif #endif
}
} }
/* If we bailed from the for loop early, an error occurred, clean up */ /* If we bailed from the for loop early, an error occurred, clean up */
if (i < num_hugepd) { if (i < num_hugepd) {
for (i = i - 1 ; i >= 0; i--, hpdp--) for (i = i - 1 ; i >= 0; i--, hpdp--)
hpdp->pd = 0; *hpdp = __hugepd(0);
kmem_cache_free(cachep, new); kmem_cache_free(cachep, new);
} }
spin_unlock(&mm->page_table_lock); 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,7 +454,7 @@ static void free_hugepd_range(struct mmu_gather *tlb, hugepd_t *hpdp, int pdshif
return; return;
for (i = 0; i < num_hugepd; i++, hpdp++) for (i = 0; i < num_hugepd; i++, hpdp++)
hpdp->pd = 0; *hpdp = __hugepd(0);
if (shift >= pdshift) if (shift >= pdshift)
hugepd_free(tlb, hugepte); hugepd_free(tlb, hugepte);
...@@ -810,12 +810,8 @@ static int __init hugetlbpage_init(void) ...@@ -810,12 +810,8 @@ static int __init hugetlbpage_init(void)
* if we have pdshift and shift value same, we don't * if we have pdshift and shift value same, we don't
* use pgt cache for hugepd. * use pgt cache for hugepd.
*/ */
if (pdshift > shift) { if (pdshift > shift)
pgtable_cache_add(pdshift - shift, NULL); pgtable_cache_add(pdshift - shift, NULL);
if (!PGT_CACHE(pdshift - shift))
panic("hugetlbpage_init(): could not create "
"pgtable cache for %d bit pagesize\n", shift);
}
#if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_8xx) #if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_8xx)
else if (!hugepte_cache) { else if (!hugepte_cache) {
/* /*
...@@ -852,9 +848,6 @@ static int __init hugetlbpage_init(void) ...@@ -852,9 +848,6 @@ static int __init hugetlbpage_init(void)
else if (mmu_psize_defs[MMU_PAGE_2M].shift) else if (mmu_psize_defs[MMU_PAGE_2M].shift)
HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_2M].shift; HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_2M].shift;
#endif #endif
else
panic("%s: Unable to set default huge page size\n", __func__);
return 0; return 0;
} }
......
...@@ -78,8 +78,12 @@ void pgtable_cache_add(unsigned shift, void (*ctor)(void *)) ...@@ -78,8 +78,12 @@ void pgtable_cache_add(unsigned shift, void (*ctor)(void *))
align = max_t(unsigned long, align, minalign); align = max_t(unsigned long, align, minalign);
name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift); name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift);
new = kmem_cache_create(name, table_size, align, 0, ctor); new = kmem_cache_create(name, table_size, align, 0, ctor);
if (!new)
panic("Could not allocate pgtable cache for order %d", shift);
kfree(name); kfree(name);
pgtable_cache[shift - 1] = new; pgtable_cache[shift - 1] = new;
pr_debug("Allocated pgtable cache for order %d\n", shift); pr_debug("Allocated pgtable cache for order %d\n", shift);
} }
...@@ -88,7 +92,7 @@ void pgtable_cache_init(void) ...@@ -88,7 +92,7 @@ void pgtable_cache_init(void)
{ {
pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor); pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor);
if (PMD_INDEX_SIZE && !PGT_CACHE(PMD_INDEX_SIZE)) if (PMD_CACHE_INDEX && !PGT_CACHE(PMD_CACHE_INDEX))
pgtable_cache_add(PMD_CACHE_INDEX, pmd_ctor); pgtable_cache_add(PMD_CACHE_INDEX, pmd_ctor);
/* /*
* In all current configs, when the PUD index exists it's the * In all current configs, when the PUD index exists it's the
...@@ -97,11 +101,4 @@ void pgtable_cache_init(void) ...@@ -97,11 +101,4 @@ void pgtable_cache_init(void)
*/ */
if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE)) if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE))
pgtable_cache_add(PUD_INDEX_SIZE, pud_ctor); pgtable_cache_add(PUD_INDEX_SIZE, pud_ctor);
if (!PGT_CACHE(PGD_INDEX_SIZE))
panic("Couldn't allocate pgd cache");
if (PMD_INDEX_SIZE && !PGT_CACHE(PMD_INDEX_SIZE))
panic("Couldn't allocate pmd pgtable caches");
if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE))
panic("Couldn't allocate pud pgtable caches");
} }
...@@ -126,3 +126,21 @@ void mmu_cleanup_all(void) ...@@ -126,3 +126,21 @@ void mmu_cleanup_all(void)
else if (mmu_hash_ops.hpte_clear_all) else if (mmu_hash_ops.hpte_clear_all)
mmu_hash_ops.hpte_clear_all(); mmu_hash_ops.hpte_clear_all();
} }
#ifdef CONFIG_MEMORY_HOTPLUG
int create_section_mapping(unsigned long start, unsigned long end)
{
if (radix_enabled())
return -ENODEV;
return hash__create_section_mapping(start, end);
}
int remove_section_mapping(unsigned long start, unsigned long end)
{
if (radix_enabled())
return -ENODEV;
return hash__remove_section_mapping(start, end);
}
#endif /* CONFIG_MEMORY_HOTPLUG */
...@@ -295,6 +295,8 @@ static inline void perf_read_regs(struct pt_regs *regs) ...@@ -295,6 +295,8 @@ static inline void perf_read_regs(struct pt_regs *regs)
*/ */
if (TRAP(regs) != 0xf00) if (TRAP(regs) != 0xf00)
use_siar = 0; use_siar = 0;
else if ((ppmu->flags & PPMU_NO_SIAR))
use_siar = 0;
else if (marked) else if (marked)
use_siar = 1; use_siar = 1;
else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING)) else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING))
......
...@@ -16,7 +16,7 @@ EVENT(PM_CYC, 0x0001e) ...@@ -16,7 +16,7 @@ EVENT(PM_CYC, 0x0001e)
EVENT(PM_ICT_NOSLOT_CYC, 0x100f8) EVENT(PM_ICT_NOSLOT_CYC, 0x100f8)
EVENT(PM_CMPLU_STALL, 0x1e054) EVENT(PM_CMPLU_STALL, 0x1e054)
EVENT(PM_INST_CMPL, 0x00002) EVENT(PM_INST_CMPL, 0x00002)
EVENT(PM_BRU_CMPL, 0x40060) EVENT(PM_BRU_CMPL, 0x10012)
EVENT(PM_BR_MPRED_CMPL, 0x400f6) EVENT(PM_BR_MPRED_CMPL, 0x400f6)
/* All L1 D cache load references counted at finish, gated by reject */ /* All L1 D cache load references counted at finish, gated by reject */
......
...@@ -384,7 +384,7 @@ static struct power_pmu power9_isa207_pmu = { ...@@ -384,7 +384,7 @@ static struct power_pmu power9_isa207_pmu = {
.bhrb_filter_map = power9_bhrb_filter_map, .bhrb_filter_map = power9_bhrb_filter_map,
.get_constraint = isa207_get_constraint, .get_constraint = isa207_get_constraint,
.disable_pmc = isa207_disable_pmc, .disable_pmc = isa207_disable_pmc,
.flags = PPMU_HAS_SIER | PPMU_ARCH_207S, .flags = PPMU_NO_SIAR | PPMU_ARCH_207S,
.n_generic = ARRAY_SIZE(power9_generic_events), .n_generic = ARRAY_SIZE(power9_generic_events),
.generic_events = power9_generic_events, .generic_events = power9_generic_events,
.cache_events = &power9_cache_events, .cache_events = &power9_cache_events,
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <asm/xics.h> #include <asm/xics.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/opal.h> #include <asm/opal.h>
#include <asm/kvm_ppc.h>
static void icp_opal_teardown_cpu(void) static void icp_opal_teardown_cpu(void)
{ {
...@@ -39,7 +40,26 @@ static void icp_opal_flush_ipi(void) ...@@ -39,7 +40,26 @@ static void icp_opal_flush_ipi(void)
* Should we be flagging idle loop instead? * Should we be flagging idle loop instead?
* Or creating some task to be scheduled? * Or creating some task to be scheduled?
*/ */
opal_int_eoi((0x00 << 24) | XICS_IPI); if (opal_int_eoi((0x00 << 24) | XICS_IPI) > 0)
force_external_irq_replay();
}
static unsigned int icp_opal_get_xirr(void)
{
unsigned int kvm_xirr;
__be32 hw_xirr;
int64_t rc;
/* Handle an interrupt latched by KVM first */
kvm_xirr = kvmppc_get_xics_latch();
if (kvm_xirr)
return kvm_xirr;
/* Then ask OPAL */
rc = opal_int_get_xirr(&hw_xirr, false);
if (rc < 0)
return 0;
return be32_to_cpu(hw_xirr);
} }
static unsigned int icp_opal_get_irq(void) static unsigned int icp_opal_get_irq(void)
...@@ -47,12 +67,8 @@ static unsigned int icp_opal_get_irq(void) ...@@ -47,12 +67,8 @@ static unsigned int icp_opal_get_irq(void)
unsigned int xirr; unsigned int xirr;
unsigned int vec; unsigned int vec;
unsigned int irq; unsigned int irq;
int64_t rc;
rc = opal_int_get_xirr(&xirr, false); xirr = icp_opal_get_xirr();
if (rc < 0)
return 0;
xirr = be32_to_cpu(xirr);
vec = xirr & 0x00ffffff; vec = xirr & 0x00ffffff;
if (vec == XICS_IRQ_SPURIOUS) if (vec == XICS_IRQ_SPURIOUS)
return 0; return 0;
...@@ -67,7 +83,8 @@ static unsigned int icp_opal_get_irq(void) ...@@ -67,7 +83,8 @@ static unsigned int icp_opal_get_irq(void)
xics_mask_unknown_vec(vec); xics_mask_unknown_vec(vec);
/* We might learn about it later, so EOI it */ /* We might learn about it later, so EOI it */
opal_int_eoi(xirr); if (opal_int_eoi(xirr) > 0)
force_external_irq_replay();
return 0; return 0;
} }
......
...@@ -66,7 +66,7 @@ int pmc56_overflow(void) ...@@ -66,7 +66,7 @@ int pmc56_overflow(void)
FAIL_IF(ebb_event_enable(&event)); FAIL_IF(ebb_event_enable(&event));
mtspr(SPRN_PMC1, pmc_sample_period(sample_period)); mtspr(SPRN_PMC2, pmc_sample_period(sample_period));
mtspr(SPRN_PMC5, 0); mtspr(SPRN_PMC5, 0);
mtspr(SPRN_PMC6, 0); mtspr(SPRN_PMC6, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment