summaryrefslogtreecommitdiffstats
path: root/arch/s390/mm/page-states.c
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2023-10-27 14:12:35 +0200
committerVasily Gorbik <gor@linux.ibm.com>2023-11-05 22:34:57 +0100
commit92b519f3bc1c90e098bb3f12d8e739fc56c2d444 (patch)
treec1610b7fa2ee794be3de66e26fb37f5a152d85c1 /arch/s390/mm/page-states.c
parents390/ap: fix vanishing crypto cards in SE environment (diff)
downloadlinux-92b519f3bc1c90e098bb3f12d8e739fc56c2d444.tar.xz
linux-92b519f3bc1c90e098bb3f12d8e739fc56c2d444.zip
s390/cmma: cleanup inline assemblies
Cleanup cmma related inline assemblies: - consolidate inline assemblies - use symbolic names - add same white space where missing - add braces to for-loops which contain a multi-line statement Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390/mm/page-states.c')
-rw-r--r--arch/s390/mm/page-states.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/arch/s390/mm/page-states.c b/arch/s390/mm/page-states.c
index a31acb2c4ef2..202dacdf17db 100644
--- a/arch/s390/mm/page-states.c
+++ b/arch/s390/mm/page-states.c
@@ -40,7 +40,7 @@ static inline int cmma_test_essa(void)
" .insn rrf,0xb9ab0000,%[tmp],%[tmp],%[cmd],0\n"
"0: la %[rc],0\n"
"1:\n"
- EX_TABLE(0b,1b)
+ EX_TABLE(0b, 1b)
: [rc] "+&d" (rc), [tmp] "+&d" (tmp)
: [cmd] "i" (ESSA_GET_STATE));
return rc;
@@ -58,37 +58,41 @@ void __init cmma_init(void)
cmma_flag = 2;
}
-static inline void set_page_unused(struct page *page, int order)
+static __always_inline void essa(unsigned long paddr, unsigned char cmd)
{
- int i, rc;
+ unsigned long rc;
- for (i = 0; i < (1 << order); i++)
- asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0"
- : "=&d" (rc)
- : "a" (page_to_phys(page + i)),
- "i" (ESSA_SET_UNUSED));
+ asm volatile(
+ " .insn rrf,0xb9ab0000,%[rc],%[paddr],%[cmd],0"
+ : [rc] "=d" (rc)
+ : [paddr] "d" (paddr),
+ [cmd] "i" (cmd));
}
-static inline void set_page_stable_dat(struct page *page, int order)
+static __always_inline void __set_page_state(struct page *page, int order, unsigned char cmd)
{
- int i, rc;
+ unsigned long paddr = page_to_phys(page);
+ unsigned long num_pages = 1UL << order;
- for (i = 0; i < (1 << order); i++)
- asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0"
- : "=&d" (rc)
- : "a" (page_to_phys(page + i)),
- "i" (ESSA_SET_STABLE));
+ while (num_pages--) {
+ essa(paddr, cmd);
+ paddr += PAGE_SIZE;
+ }
}
-static inline void set_page_stable_nodat(struct page *page, int order)
+static inline void set_page_unused(struct page *page, int order)
{
- int i, rc;
+ __set_page_state(page, order, ESSA_SET_UNUSED);
+}
- for (i = 0; i < (1 << order); i++)
- asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0"
- : "=&d" (rc)
- : "a" (page_to_phys(page + i)),
- "i" (ESSA_SET_STABLE_NODAT));
+static inline void set_page_stable_dat(struct page *page, int order)
+{
+ __set_page_state(page, order, ESSA_SET_STABLE);
+}
+
+static inline void set_page_stable_nodat(struct page *page, int order)
+{
+ __set_page_state(page, order, ESSA_SET_STABLE_NODAT);
}
static void mark_kernel_pmd(pud_t *pud, unsigned long addr, unsigned long end)