]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/mm: Replace the CSP instruction with CSPG
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 3 Nov 2025 13:39:28 +0000 (14:39 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Thu, 6 Nov 2025 13:12:31 +0000 (14:12 +0100)
The CSPG instruction is part of the Dat-Enhancement facility 1, which
is always available. Given that it can be used everywhere where also
the CSP instruction can be used, replace CSP with CSPG everywhere.

This allows to remove the csp() inline assembly. Also remove the
unused gmap_pmdp_csp() function.

Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/pgtable.h
arch/s390/include/asm/tlbflush.h
arch/s390/mm/gmap.c

index b7100c6a405449bb292b22dc7194e9c7061f81c9..bb915cbffc7bc79c6213f7708851d31f857db71f 100644 (file)
@@ -648,18 +648,6 @@ static inline int mm_uses_skeys(struct mm_struct *mm)
        return 0;
 }
 
-static inline void csp(unsigned int *ptr, unsigned int old, unsigned int new)
-{
-       union register_pair r1 = { .even = old, .odd = new, };
-       unsigned long address = (unsigned long)ptr | 1;
-
-       asm volatile(
-               "       csp     %[r1],%[address]"
-               : [r1] "+&d" (r1.pair), "+m" (*ptr)
-               : [address] "d" (address)
-               : "cc");
-}
-
 /**
  * cspg() - Compare and Swap and Purge (CSPG)
  * @ptr: Pointer to the value to be exchanged
@@ -1402,7 +1390,6 @@ int set_pgste_bits(struct mm_struct *mm, unsigned long addr,
 int get_pgste(struct mm_struct *mm, unsigned long hva, unsigned long *pgstep);
 int pgste_perform_essa(struct mm_struct *mm, unsigned long hva, int orc,
                        unsigned long *oldpte, unsigned long *oldpgste);
-void gmap_pmdp_csp(struct mm_struct *mm, unsigned long vmaddr);
 void gmap_pmdp_invalidate(struct mm_struct *mm, unsigned long vmaddr);
 void gmap_pmdp_idte_local(struct mm_struct *mm, unsigned long vmaddr);
 void gmap_pmdp_idte_global(struct mm_struct *mm, unsigned long vmaddr);
@@ -1692,10 +1679,10 @@ static inline pmd_t mk_pmd_phys(unsigned long physpage, pgprot_t pgprot)
 
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLB_PAGE */
 
-static inline void __pmdp_csp(pmd_t *pmdp)
+static inline void __pmdp_cspg(pmd_t *pmdp)
 {
-       csp((unsigned int *)pmdp + 1, pmd_val(*pmdp),
-           pmd_val(*pmdp) | _SEGMENT_ENTRY_INVALID);
+       cspg((unsigned long *)pmdp, pmd_val(*pmdp),
+            pmd_val(*pmdp) | _SEGMENT_ENTRY_INVALID);
 }
 
 #define IDTE_GLOBAL    0
index c7f04f9e99b30fbfe9bd0e56dbc377a879ccfc45..be8ca0d854d38ed0904847e9af8c194641d55fe1 100644 (file)
@@ -35,9 +35,9 @@ static inline void __tlb_flush_idte(unsigned long asce)
  */
 static inline void __tlb_flush_global(void)
 {
-       unsigned int dummy = 0;
+       unsigned long dummy = 0;
 
-       csp(&dummy, 0, 0);
+       cspg(&dummy, 0, 0);
 }
 
 /*
index f9174be33023aa849f27b7310906812871638f9c..603d9e5febb56e6a743ded2e552c4aff3e484fdd 100644 (file)
@@ -2007,7 +2007,7 @@ static void gmap_pmdp_clear(struct mm_struct *mm, unsigned long vmaddr,
                                                   _SEGMENT_ENTRY_GMAP_UC |
                                                   _SEGMENT_ENTRY));
                        if (purge)
-                               __pmdp_csp(pmdp);
+                               __pmdp_cspg(pmdp);
                        set_pmd(pmdp, __pmd(_SEGMENT_ENTRY_EMPTY));
                }
                spin_unlock(&gmap->guest_table_lock);
@@ -2027,17 +2027,6 @@ void gmap_pmdp_invalidate(struct mm_struct *mm, unsigned long vmaddr)
 }
 EXPORT_SYMBOL_GPL(gmap_pmdp_invalidate);
 
-/**
- * gmap_pmdp_csp - csp all affected guest pmd entries
- * @mm: pointer to the process mm_struct
- * @vmaddr: virtual address in the process address space
- */
-void gmap_pmdp_csp(struct mm_struct *mm, unsigned long vmaddr)
-{
-       gmap_pmdp_clear(mm, vmaddr, 1);
-}
-EXPORT_SYMBOL_GPL(gmap_pmdp_csp);
-
 /**
  * gmap_pmdp_idte_local - invalidate and clear a guest pmd entry
  * @mm: pointer to the process mm_struct