The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 5/5] s390/mm: Add pudp_idte() helper
Date: Tue, 24 Nov 2026 14:59:48 +0100	[thread overview]
Message-ID: <20261124135948.1295745-6-hca@linux.ibm.com> (raw)
In-Reply-To: <20261124135948.1295745-1-hca@linux.ibm.com>

Add a common pudp_idte() helper in order to avoid the
repeated machine_has_tlb_guest() checks.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
 arch/s390/include/asm/pgtable.h | 10 ++++++++++
 arch/s390/mm/pgtable.c          | 18 ++++--------------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 0d5ea2dca786..e8bb46071306 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -1698,6 +1698,16 @@ static __always_inline void __pudp_idte(unsigned long addr, pud_t *pudp,
 	}
 }
 
+static __always_inline void pudp_idte(unsigned long addr, pud_t *pudp,
+				      unsigned long opt, unsigned long asce,
+				      int local)
+{
+	if (machine_has_tlb_guest())
+		__pudp_idte(addr, pudp, opt, asce, local);
+	else
+		__pudp_idte(addr, pudp, 0, 0, local);
+}
+
 pmd_t pmdp_xchg_direct(struct mm_struct *, unsigned long, pmd_t *, pmd_t);
 pmd_t pmdp_xchg_lazy(struct mm_struct *, unsigned long, pmd_t *, pmd_t);
 pud_t pudp_xchg_direct(struct mm_struct *, unsigned long, pud_t *, pud_t);
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 72b62ad480bd..23125e88d17a 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -218,24 +218,14 @@ pmd_t pmdp_xchg_lazy(struct mm_struct *mm, unsigned long addr,
 }
 EXPORT_SYMBOL(pmdp_xchg_lazy);
 
-static inline void pudp_idte_local(struct mm_struct *mm,
-				   unsigned long addr, pud_t *pudp)
+static inline void pudp_idte_local(struct mm_struct *mm, unsigned long addr, pud_t *pudp)
 {
-	if (machine_has_tlb_guest())
-		__pudp_idte(addr, pudp, IDTE_NODAT | IDTE_GUEST_ASCE,
-			    mm->context.asce, IDTE_LOCAL);
-	else
-		__pudp_idte(addr, pudp, 0, 0, IDTE_LOCAL);
+	pudp_idte(addr, pudp, IDTE_NODAT | IDTE_GUEST_ASCE, mm->context.asce, IDTE_LOCAL);
 }
 
-static inline void pudp_idte_global(struct mm_struct *mm,
-				    unsigned long addr, pud_t *pudp)
+static inline void pudp_idte_global(struct mm_struct *mm, unsigned long addr, pud_t *pudp)
 {
-	if (machine_has_tlb_guest())
-		__pudp_idte(addr, pudp, IDTE_NODAT | IDTE_GUEST_ASCE,
-			    mm->context.asce, IDTE_GLOBAL);
-	else
-		__pudp_idte(addr, pudp, 0, 0, IDTE_GLOBAL);
+	pudp_idte(addr, pudp, IDTE_NODAT | IDTE_GUEST_ASCE, mm->context.asce, IDTE_GLOBAL);
 }
 
 static inline pud_t pudp_flush_direct(struct mm_struct *mm,
-- 
2.53.0


      parent reply	other threads:[~2026-11-24 13:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 13:59 [PATCH 0/5] s390/mm: Deduplicate machine_has_tlb_guest() usage Heiko Carstens
2026-11-24 13:59 ` [PATCH 1/5] s390/mm: Remove gmap_asce from mm_context_t Heiko Carstens
2026-11-24 13:59 ` [PATCH 2/5] s390/mm: Remove unused nodat parameter from ptep flush helpers Heiko Carstens
2026-11-24 13:59 ` [PATCH 3/5] s390/mm: Add ptep_ipte() helper Heiko Carstens
2026-11-24 13:59 ` [PATCH 4/5] s390/mm: Add pmdp_idte() helper Heiko Carstens
2026-11-24 13:59 ` Heiko Carstens [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261124135948.1295745-6-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=gerald.schaefer@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox