aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/include/asm/book3s/64/pgtable.h22
-rw-r--r--arch/powerpc/mm/pgtable-book3s64.c22
-rw-r--r--arch/powerpc/platforms/pseries/papr_scm.c5
3 files changed, 33 insertions, 16 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
index 2e6ada28da64..c9bfe526ca9d 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -1258,21 +1258,13 @@ extern pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
1258 1258
1259#define pmd_move_must_withdraw pmd_move_must_withdraw 1259#define pmd_move_must_withdraw pmd_move_must_withdraw
1260struct spinlock; 1260struct spinlock;
1261static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, 1261extern int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,
1262 struct spinlock *old_pmd_ptl, 1262 struct spinlock *old_pmd_ptl,
1263 struct vm_area_struct *vma) 1263 struct vm_area_struct *vma);
1264{ 1264/*
1265 if (radix_enabled()) 1265 * Hash translation mode use the deposited table to store hash pte
1266 return false; 1266 * slot information.
1267 /* 1267 */
1268 * Archs like ppc64 use pgtable to store per pmd
1269 * specific information. So when we switch the pmd,
1270 * we should also withdraw and deposit the pgtable
1271 */
1272 return true;
1273}
1274
1275
1276#define arch_needs_pgtable_deposit arch_needs_pgtable_deposit 1268#define arch_needs_pgtable_deposit arch_needs_pgtable_deposit
1277static inline bool arch_needs_pgtable_deposit(void) 1269static inline bool arch_needs_pgtable_deposit(void)
1278{ 1270{
diff --git a/arch/powerpc/mm/pgtable-book3s64.c b/arch/powerpc/mm/pgtable-book3s64.c
index f3c31f5e1026..ecd31569a120 100644
--- a/arch/powerpc/mm/pgtable-book3s64.c
+++ b/arch/powerpc/mm/pgtable-book3s64.c
@@ -400,3 +400,25 @@ void arch_report_meminfo(struct seq_file *m)
400 atomic_long_read(&direct_pages_count[MMU_PAGE_1G]) << 20); 400 atomic_long_read(&direct_pages_count[MMU_PAGE_1G]) << 20);
401} 401}
402#endif /* CONFIG_PROC_FS */ 402#endif /* CONFIG_PROC_FS */
403
404/*
405 * For hash translation mode, we use the deposited table to store hash slot
406 * information and they are stored at PTRS_PER_PMD offset from related pmd
407 * location. Hence a pmd move requires deposit and withdraw.
408 *
409 * For radix translation with split pmd ptl, we store the deposited table in the
410 * pmd page. Hence if we have different pmd page we need to withdraw during pmd
411 * move.
412 *
413 * With hash we use deposited table always irrespective of anon or not.
414 * With radix we use deposited table only for anonymous mapping.
415 */
416int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,
417 struct spinlock *old_pmd_ptl,
418 struct vm_area_struct *vma)
419{
420 if (radix_enabled())
421 return (new_pmd_ptl != old_pmd_ptl) && vma_is_anonymous(vma);
422
423 return true;
424}
diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
index 7d6457ab5d34..bba281b1fe1b 100644
--- a/arch/powerpc/platforms/pseries/papr_scm.c
+++ b/arch/powerpc/platforms/pseries/papr_scm.c
@@ -43,6 +43,7 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
43{ 43{
44 unsigned long ret[PLPAR_HCALL_BUFSIZE]; 44 unsigned long ret[PLPAR_HCALL_BUFSIZE];
45 uint64_t rc, token; 45 uint64_t rc, token;
46 uint64_t saved = 0;
46 47
47 /* 48 /*
48 * When the hypervisor cannot map all the requested memory in a single 49 * When the hypervisor cannot map all the requested memory in a single
@@ -56,6 +57,8 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
56 rc = plpar_hcall(H_SCM_BIND_MEM, ret, p->drc_index, 0, 57 rc = plpar_hcall(H_SCM_BIND_MEM, ret, p->drc_index, 0,
57 p->blocks, BIND_ANY_ADDR, token); 58 p->blocks, BIND_ANY_ADDR, token);
58 token = ret[0]; 59 token = ret[0];
60 if (!saved)
61 saved = ret[1];
59 cond_resched(); 62 cond_resched();
60 } while (rc == H_BUSY); 63 } while (rc == H_BUSY);
61 64
@@ -64,7 +67,7 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
64 return -ENXIO; 67 return -ENXIO;
65 } 68 }
66 69
67 p->bound_addr = ret[1]; 70 p->bound_addr = saved;
68 71
69 dev_dbg(&p->pdev->dev, "bound drc %x to %pR\n", p->drc_index, &p->res); 72 dev_dbg(&p->pdev->dev, "bound drc %x to %pR\n", p->drc_index, &p->res);
70 73