Linux s390 Architecture development
 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 1/5] s390/mm: Remove gmap_asce from mm_context_t
Date: Tue, 24 Nov 2026 14:59:44 +0100	[thread overview]
Message-ID: <20261124135948.1295745-2-hca@linux.ibm.com> (raw)
In-Reply-To: <20261124135948.1295745-1-hca@linux.ibm.com>

After the gmap rework mm->context.gmap_asce is always 0.
Remove it, and simplify the mm code accordingly.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
 arch/s390/include/asm/mmu.h         |  1 -
 arch/s390/include/asm/mmu_context.h |  1 -
 arch/s390/include/asm/tlbflush.h    | 12 +---------
 arch/s390/mm/pgtable.c              | 34 +++++------------------------
 4 files changed, 7 insertions(+), 41 deletions(-)

diff --git a/arch/s390/include/asm/mmu.h b/arch/s390/include/asm/mmu.h
index d4fd7bf3692e..3bf06dcba050 100644
--- a/arch/s390/include/asm/mmu.h
+++ b/arch/s390/include/asm/mmu.h
@@ -12,7 +12,6 @@ typedef struct {
 	atomic_t flush_count;
 	unsigned int flush_mm;
 	struct list_head gmap_list;
-	unsigned long gmap_asce;
 	unsigned long asce;
 	unsigned long asce_limit;
 	unsigned long vdso_base;
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index bd1ef5e2d2eb..4e5da0017c15 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -27,7 +27,6 @@ static inline int init_new_context(struct task_struct *tsk,
 	cpumask_clear(&mm->context.cpu_attach_mask);
 	atomic_set(&mm->context.flush_count, 0);
 	atomic_set(&mm->context.protected_count, 0);
-	mm->context.gmap_asce = 0;
 	mm->context.flush_mm = 0;
 #if IS_ENABLED(CONFIG_KVM)
 	mm->context.allow_cow_sharing = 1;
diff --git a/arch/s390/include/asm/tlbflush.h b/arch/s390/include/asm/tlbflush.h
index 163ccbbe8c47..ca517013b5d0 100644
--- a/arch/s390/include/asm/tlbflush.h
+++ b/arch/s390/include/asm/tlbflush.h
@@ -46,22 +46,12 @@ static inline void __tlb_flush_global(void)
  */
 static inline void __tlb_flush_mm(struct mm_struct *mm)
 {
-	unsigned long gmap_asce;
-
 	preempt_disable();
 	atomic_inc(&mm->context.flush_count);
 	/* Reset TLB flush mask */
 	cpumask_copy(mm_cpumask(mm), &mm->context.cpu_attach_mask);
 	barrier();
-	gmap_asce = READ_ONCE(mm->context.gmap_asce);
-	if (gmap_asce != -1UL) {
-		if (gmap_asce)
-			__tlb_flush_idte(gmap_asce);
-		__tlb_flush_idte(mm->context.asce);
-	} else {
-		/* Global TLB flush */
-		__tlb_flush_global();
-	}
+	__tlb_flush_idte(mm->context.asce);
 	atomic_dec(&mm->context.flush_count);
 	preempt_enable();
 }
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index da076928b63b..561d280d485f 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -39,41 +39,19 @@ EXPORT_SYMBOL_GPL(pgprot_writecombine);
 static inline void ptep_ipte_local(struct mm_struct *mm, unsigned long addr,
 				   pte_t *ptep, int nodat)
 {
-	unsigned long opt, asce;
-
-	if (machine_has_tlb_guest()) {
-		opt = 0;
-		asce = READ_ONCE(mm->context.gmap_asce);
-		if (asce == 0UL || nodat)
-			opt |= IPTE_NODAT;
-		if (asce != -1UL) {
-			asce = asce ? : mm->context.asce;
-			opt |= IPTE_GUEST_ASCE;
-		}
-		__ptep_ipte(addr, ptep, opt, asce, IPTE_LOCAL);
-	} else {
+	if (machine_has_tlb_guest())
+		__ptep_ipte(addr, ptep, IPTE_NODAT | IPTE_GUEST_ASCE, mm->context.asce, IPTE_LOCAL);
+	else
 		__ptep_ipte(addr, ptep, 0, 0, IPTE_LOCAL);
-	}
 }
 
 static inline void ptep_ipte_global(struct mm_struct *mm, unsigned long addr,
 				    pte_t *ptep, int nodat)
 {
-	unsigned long opt, asce;
-
-	if (machine_has_tlb_guest()) {
-		opt = 0;
-		asce = READ_ONCE(mm->context.gmap_asce);
-		if (asce == 0UL || nodat)
-			opt |= IPTE_NODAT;
-		if (asce != -1UL) {
-			asce = asce ? : mm->context.asce;
-			opt |= IPTE_GUEST_ASCE;
-		}
-		__ptep_ipte(addr, ptep, opt, asce, IPTE_GLOBAL);
-	} else {
+	if (machine_has_tlb_guest())
+		__ptep_ipte(addr, ptep, IPTE_NODAT | IPTE_GUEST_ASCE, mm->context.asce, IPTE_GLOBAL);
+	else
 		__ptep_ipte(addr, ptep, 0, 0, IPTE_GLOBAL);
-	}
 }
 
 static inline pte_t ptep_flush_direct(struct mm_struct *mm,
-- 
2.53.0


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

Thread overview: 7+ 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 ` Heiko Carstens [this message]
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 ` [PATCH 5/5] s390/mm: Add pudp_idte() helper Heiko Carstens
2026-11-24 14:07 ` [PATCH 0/5] s390/mm: Deduplicate machine_has_tlb_guest() usage sashiko-bot

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-2-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