]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
s390/mm: merge local / non-local IPTE helper
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 14 Jun 2016 10:38:40 +0000 (12:38 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 24 Aug 2016 07:23:55 +0000 (09:23 +0200)
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>
arch/s390/include/asm/pgtable.h
arch/s390/mm/pageattr.c
arch/s390/mm/pgtable.c

index 72c7f60bfe83ec78e55d39ebb67fe14edf5e2f72..7ef2306e35f353b6ded3465a47cbc3ebbac7ce74 100644 (file)
@@ -874,35 +874,31 @@ static inline pte_t pte_mkhuge(pte_t pte)
 }
 #endif
 
-static inline void __ptep_ipte(unsigned long address, pte_t *ptep)
-{
-       unsigned long pto = (unsigned long) ptep;
-
-       /* Invalidation + global TLB flush for the pte */
-       asm volatile(
-               "       ipte    %2,%3"
-               : "=m" (*ptep) : "m" (*ptep), "a" (pto), "a" (address));
-}
+#define IPTE_GLOBAL    0
+#define        IPTE_LOCAL      1
 
-static inline void __ptep_ipte_local(unsigned long address, pte_t *ptep)
+static inline void __ptep_ipte(unsigned long address, pte_t *ptep, int local)
 {
        unsigned long pto = (unsigned long) ptep;
 
-       /* Invalidation + local TLB flush for the pte */
+       /* Invalidation + TLB flush for the pte */
        asm volatile(
-               "       .insn rrf,0xb2210000,%2,%3,0,1"
-               : "=m" (*ptep) : "m" (*ptep), "a" (pto), "a" (address));
+               "       .insn rrf,0xb2210000,%[r1],%[r2],0,%[m4]"
+               : "+m" (*ptep) : [r1] "a" (pto), [r2] "a" (address),
+                 [m4] "i" (local));
 }
 
-static inline void __ptep_ipte_range(unsigned long address, int nr, pte_t *ptep)
+static inline void __ptep_ipte_range(unsigned long address, int nr,
+                                    pte_t *ptep, int local)
 {
        unsigned long pto = (unsigned long) ptep;
 
-       /* Invalidate a range of ptes + global TLB flush of the ptes */
+       /* Invalidate a range of ptes + TLB flush of the ptes */
        do {
                asm volatile(
-                       "       .insn rrf,0xb2210000,%2,%0,%1,0"
-                       : "+a" (address), "+a" (nr) : "a" (pto) : "memory");
+                       "       .insn rrf,0xb2210000,%[r1],%[r2],%[r3],%[m4]"
+                       : [r2] "+a" (address), [r3] "+a" (nr)
+                       : [r1] "a" (pto), [m4] "i" (local) : "memory");
        } while (nr != 255);
 }
 
index af7cf28cf97edcc71551917cf66cfb0214f56946..44f150312a16195b5a21821b2d8fe7c458d8cb09 100644 (file)
@@ -309,11 +309,11 @@ static void ipte_range(pte_t *pte, unsigned long address, int nr)
        int i;
 
        if (test_facility(13)) {
-               __ptep_ipte_range(address, nr - 1, pte);
+               __ptep_ipte_range(address, nr - 1, pte, IPTE_GLOBAL);
                return;
        }
        for (i = 0; i < nr; i++) {
-               __ptep_ipte(address, pte);
+               __ptep_ipte(address, pte, IPTE_GLOBAL);
                address += PAGE_SIZE;
                pte++;
        }
index 5f092015aaa75d1f2096a6162fa2ea1526806886..1dc6cad9a5acff94e4d977ea2cef90d6f0dc5402 100644 (file)
@@ -35,9 +35,9 @@ static inline pte_t ptep_flush_direct(struct mm_struct *mm,
        atomic_inc(&mm->context.flush_count);
        if (MACHINE_HAS_TLB_LC &&
            cpumask_equal(mm_cpumask(mm), cpumask_of(smp_processor_id())))
-               __ptep_ipte_local(addr, ptep);
+               __ptep_ipte(addr, ptep, IPTE_LOCAL);
        else
-               __ptep_ipte(addr, ptep);
+               __ptep_ipte(addr, ptep, IPTE_GLOBAL);
        atomic_dec(&mm->context.flush_count);
        return old;
 }
@@ -56,7 +56,7 @@ static inline pte_t ptep_flush_lazy(struct mm_struct *mm,
                pte_val(*ptep) |= _PAGE_INVALID;
                mm->context.flush_mm = 1;
        } else
-               __ptep_ipte(addr, ptep);
+               __ptep_ipte(addr, ptep, IPTE_GLOBAL);
        atomic_dec(&mm->context.flush_count);
        return old;
 }
@@ -620,7 +620,7 @@ bool test_and_clear_guest_dirty(struct mm_struct *mm, unsigned long addr)
        pte = *ptep;
        if (dirty && (pte_val(pte) & _PAGE_PRESENT)) {
                pgste = pgste_pte_notify(mm, addr, ptep, pgste);
-               __ptep_ipte(addr, ptep);
+               __ptep_ipte(addr, ptep, IPTE_GLOBAL);
                if (MACHINE_HAS_ESOP || !(pte_val(pte) & _PAGE_WRITE))
                        pte_val(pte) |= _PAGE_PROTECT;
                else