aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2016-06-14 06:38:40 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2016-08-24 03:23:55 -0400
commit34eeaf376dbe53849acc3d4edc4efc2ad97ab23e (patch)
tree64143e09710f21f442555078e950793b5318b694
parent44b6cc8130e80e673ba8b3baf8e41891fe484786 (diff)
s390/mm: merge local / non-local IPTE helper
Merge the __ptep_ipte and __ptep_ipte_local functions into a single __ptep_ipte function with an additional parameter. The __pte_ipte_range function is still extra as the while loops makes it hard to merge. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/include/asm/pgtable.h30
-rw-r--r--arch/s390/mm/pageattr.c4
-rw-r--r--arch/s390/mm/pgtable.c8
3 files changed, 19 insertions, 23 deletions
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 72c7f60bfe83..7ef2306e35f3 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -874,35 +874,31 @@ static inline pte_t pte_mkhuge(pte_t pte)
874} 874}
875#endif 875#endif
876 876
877static inline void __ptep_ipte(unsigned long address, pte_t *ptep) 877#define IPTE_GLOBAL 0
878{ 878#define IPTE_LOCAL 1
879 unsigned long pto = (unsigned long) ptep;
880
881 /* Invalidation + global TLB flush for the pte */
882 asm volatile(
883 " ipte %2,%3"
884 : "=m" (*ptep) : "m" (*ptep), "a" (pto), "a" (address));
885}
886 879
887static inline void __ptep_ipte_local(unsigned long address, pte_t *ptep) 880static inline void __ptep_ipte(unsigned long address, pte_t *ptep, int local)
888{ 881{
889 unsigned long pto = (unsigned long) ptep; 882 unsigned long pto = (unsigned long) ptep;
890 883
891 /* Invalidation + local TLB flush for the pte */ 884 /* Invalidation + TLB flush for the pte */
892 asm volatile( 885 asm volatile(
893 " .insn rrf,0xb2210000,%2,%3,0,1" 886 " .insn rrf,0xb2210000,%[r1],%[r2],0,%[m4]"
894 : "=m" (*ptep) : "m" (*ptep), "a" (pto), "a" (address)); 887 : "+m" (*ptep) : [r1] "a" (pto), [r2] "a" (address),
888 [m4] "i" (local));
895} 889}
896 890
897static inline void __ptep_ipte_range(unsigned long address, int nr, pte_t *ptep) 891static inline void __ptep_ipte_range(unsigned long address, int nr,
892 pte_t *ptep, int local)
898{ 893{
899 unsigned long pto = (unsigned long) ptep; 894 unsigned long pto = (unsigned long) ptep;
900 895
901 /* Invalidate a range of ptes + global TLB flush of the ptes */ 896 /* Invalidate a range of ptes + TLB flush of the ptes */
902 do { 897 do {
903 asm volatile( 898 asm volatile(
904 " .insn rrf,0xb2210000,%2,%0,%1,0" 899 " .insn rrf,0xb2210000,%[r1],%[r2],%[r3],%[m4]"
905 : "+a" (address), "+a" (nr) : "a" (pto) : "memory"); 900 : [r2] "+a" (address), [r3] "+a" (nr)
901 : [r1] "a" (pto), [m4] "i" (local) : "memory");
906 } while (nr != 255); 902 } while (nr != 255);
907} 903}
908 904
diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c
index af7cf28cf97e..44f150312a16 100644
--- a/arch/s390/mm/pageattr.c
+++ b/arch/s390/mm/pageattr.c
@@ -309,11 +309,11 @@ static void ipte_range(pte_t *pte, unsigned long address, int nr)
309 int i; 309 int i;
310 310
311 if (test_facility(13)) { 311 if (test_facility(13)) {
312 __ptep_ipte_range(address, nr - 1, pte); 312 __ptep_ipte_range(address, nr - 1, pte, IPTE_GLOBAL);
313 return; 313 return;
314 } 314 }
315 for (i = 0; i < nr; i++) { 315 for (i = 0; i < nr; i++) {
316 __ptep_ipte(address, pte); 316 __ptep_ipte(address, pte, IPTE_GLOBAL);
317 address += PAGE_SIZE; 317 address += PAGE_SIZE;
318 pte++; 318 pte++;
319 } 319 }
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 5f092015aaa7..1dc6cad9a5ac 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -35,9 +35,9 @@ static inline pte_t ptep_flush_direct(struct mm_struct *mm,
35 atomic_inc(&mm->context.flush_count); 35 atomic_inc(&mm->context.flush_count);
36 if (MACHINE_HAS_TLB_LC && 36 if (MACHINE_HAS_TLB_LC &&
37 cpumask_equal(mm_cpumask(mm), cpumask_of(smp_processor_id()))) 37 cpumask_equal(mm_cpumask(mm), cpumask_of(smp_processor_id())))
38 __ptep_ipte_local(addr, ptep); 38 __ptep_ipte(addr, ptep, IPTE_LOCAL);
39 else 39 else
40 __ptep_ipte(addr, ptep); 40 __ptep_ipte(addr, ptep, IPTE_GLOBAL);
41 atomic_dec(&mm->context.flush_count); 41 atomic_dec(&mm->context.flush_count);
42 return old; 42 return old;
43} 43}
@@ -56,7 +56,7 @@ static inline pte_t ptep_flush_lazy(struct mm_struct *mm,
56 pte_val(*ptep) |= _PAGE_INVALID; 56 pte_val(*ptep) |= _PAGE_INVALID;
57 mm->context.flush_mm = 1; 57 mm->context.flush_mm = 1;
58 } else 58 } else
59 __ptep_ipte(addr, ptep); 59 __ptep_ipte(addr, ptep, IPTE_GLOBAL);
60 atomic_dec(&mm->context.flush_count); 60 atomic_dec(&mm->context.flush_count);
61 return old; 61 return old;
62} 62}
@@ -620,7 +620,7 @@ bool test_and_clear_guest_dirty(struct mm_struct *mm, unsigned long addr)
620 pte = *ptep; 620 pte = *ptep;
621 if (dirty && (pte_val(pte) & _PAGE_PRESENT)) { 621 if (dirty && (pte_val(pte) & _PAGE_PRESENT)) {
622 pgste = pgste_pte_notify(mm, addr, ptep, pgste); 622 pgste = pgste_pte_notify(mm, addr, ptep, pgste);
623 __ptep_ipte(addr, ptep); 623 __ptep_ipte(addr, ptep, IPTE_GLOBAL);
624 if (MACHINE_HAS_ESOP || !(pte_val(pte) & _PAGE_WRITE)) 624 if (MACHINE_HAS_ESOP || !(pte_val(pte) & _PAGE_WRITE))
625 pte_val(pte) |= _PAGE_PROTECT; 625 pte_val(pte) |= _PAGE_PROTECT;
626 else 626 else