Browse Source

s390/pgtable: introduce and use generic csp inline asm

We have already two inline assemblies which make use of the csp
instruction. Since I need a third instance let's introduce a generic
inline assmebly which can be used by everyone.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Heiko Carstens 9 năm trước cách đây
mục cha
commit
4ccccc522b

+ 15 - 9
arch/s390/include/asm/pgtable.h

@@ -424,6 +424,19 @@ static inline int mm_use_skey(struct mm_struct *mm)
 	return 0;
 	return 0;
 }
 }
 
 
+static inline void csp(unsigned int *ptr, unsigned int old, unsigned int new)
+{
+	register unsigned long reg2 asm("2") = old;
+	register unsigned long reg3 asm("3") = new;
+	unsigned long address = (unsigned long)ptr | 1;
+
+	asm volatile(
+		"	csp	%0,%3"
+		: "+d" (reg2), "+m" (*ptr)
+		: "d" (reg3), "d" (address)
+		: "cc");
+}
+
 /*
 /*
  * pgd/pmd/pte query functions
  * pgd/pmd/pte query functions
  */
  */
@@ -1068,15 +1081,8 @@ static inline pmd_t mk_pmd_phys(unsigned long physpage, pgprot_t pgprot)
 
 
 static inline void __pmdp_csp(pmd_t *pmdp)
 static inline void __pmdp_csp(pmd_t *pmdp)
 {
 {
-	register unsigned long reg2 asm("2") = pmd_val(*pmdp);
-	register unsigned long reg3 asm("3") = pmd_val(*pmdp) |
-					       _SEGMENT_ENTRY_INVALID;
-	register unsigned long reg4 asm("4") = ((unsigned long) pmdp) + 5;
-
-	asm volatile(
-		"	csp %1,%3"
-		: "=m" (*pmdp)
-		: "d" (reg2), "d" (reg3), "d" (reg4), "m" (*pmdp) : "cc");
+	csp((unsigned int *)pmdp + 1, pmd_val(*pmdp),
+	    pmd_val(*pmdp) | _SEGMENT_ENTRY_INVALID);
 }
 }
 
 
 static inline void __pmdp_idte(unsigned long address, pmd_t *pmdp)
 static inline void __pmdp_idte(unsigned long address, pmd_t *pmdp)

+ 4 - 11
arch/s390/include/asm/tlbflush.h

@@ -5,6 +5,7 @@
 #include <linux/sched.h>
 #include <linux/sched.h>
 #include <asm/processor.h>
 #include <asm/processor.h>
 #include <asm/pgalloc.h>
 #include <asm/pgalloc.h>
+#include <asm/pgtable.h>
 
 
 /*
 /*
  * Flush all TLB entries on the local CPU.
  * Flush all TLB entries on the local CPU.
@@ -44,17 +45,9 @@ void smp_ptlb_all(void);
  */
  */
 static inline void __tlb_flush_global(void)
 static inline void __tlb_flush_global(void)
 {
 {
-	register unsigned long reg2 asm("2");
-	register unsigned long reg3 asm("3");
-	register unsigned long reg4 asm("4");
-	long dummy;
-
-	dummy = 0;
-	reg2 = reg3 = 0;
-	reg4 = ((unsigned long) &dummy) + 1;
-	asm volatile(
-		"	csp	%0,%2"
-		: : "d" (reg2), "d" (reg3), "d" (reg4), "m" (dummy) : "cc" );
+	unsigned int dummy = 0;
+
+	csp(&dummy, 0, 0);
 }
 }
 
 
 /*
 /*