mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: Heiko Carstens <hca@linux.ibm.com>,
	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>,
	Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] s390/mm: Add ptep_ipte() helper
Date: Wed, 25 Nov 2026 13:15:02 +0100	[thread overview]
Message-ID: <f243aa68-5b4c-4dd8-acdf-4a57a090b2a2@linux.ibm.com> (raw)
In-Reply-To: <20261124135948.1295745-4-hca@linux.ibm.com>



Am 24.11.26 um 14:59 schrieb Heiko Carstens:
> Add a common ptep_ipte() helper in order to avoid the
> repeated machine_has_tlb_guest() checks.
> 
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>



> ---
>   arch/s390/include/asm/pgtable.h | 11 +++++++++++
>   arch/s390/kvm/gmap/dat.c        |  5 +----
>   arch/s390/mm/pgtable.c          | 10 ++--------
>   3 files changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
> index 2d5c2ab06de9..378d2db6e6be 100644
> --- a/arch/s390/include/asm/pgtable.h
> +++ b/arch/s390/include/asm/pgtable.h
> @@ -21,6 +21,7 @@
>   #include <linux/atomic.h>
>   #include <linux/mmap_lock.h>
>   #include <asm/ctlreg.h>
> +#include <asm/machine.h>
>   #include <asm/bug.h>
>   #include <asm/page.h>
>   #include <asm/uv.h>
> @@ -1156,6 +1157,16 @@ static __always_inline void __ptep_ipte(unsigned long address, pte_t *ptep,
>   		: [r1] "a" (pto), [m4] "i" (local) : "memory");
>   }
>   
> +static __always_inline void ptep_ipte(unsigned long address, pte_t *ptep,
> +				      unsigned long opt, unsigned long asce,
> +				      int local)
> +{
> +	if (machine_has_tlb_guest())
> +		__ptep_ipte(address, ptep, opt, asce, local);
> +	else
> +		__ptep_ipte(address, ptep, 0, 0, local);
> +}
> +
>   static __always_inline void __ptep_ipte_range(unsigned long address, int nr,
>   					      pte_t *ptep, int local)
>   {
> diff --git a/arch/s390/kvm/gmap/dat.c b/arch/s390/kvm/gmap/dat.c
> index 7a25e41a1423..909d665a67a9 100644
> --- a/arch/s390/kvm/gmap/dat.c
> +++ b/arch/s390/kvm/gmap/dat.c
> @@ -173,10 +173,7 @@ union pgste __dat_ptep_xchg(union pte *ptep, union pgste pgste, union pte new, g
>   	if (!old.h.i) {
>   		unsigned long opts = IPTE_GUEST_ASCE | (pgste.nodat ? IPTE_NODAT : 0);
>   
> -		if (machine_has_tlb_guest())
> -			__ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, opts, asce.val, IPTE_GLOBAL);
> -		else
> -			__ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, 0, 0, IPTE_GLOBAL);
> +		ptep_ipte(gfn_to_gpa(gfn), (void *)ptep, opts, asce.val, IPTE_GLOBAL);
>   	}
>   
>   	if (uses_skeys) {
> diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
> index 1aa5fe0b30d8..f6a960f39abf 100644
> --- a/arch/s390/mm/pgtable.c
> +++ b/arch/s390/mm/pgtable.c
> @@ -38,18 +38,12 @@ EXPORT_SYMBOL_GPL(pgprot_writecombine);
>   
>   static inline void ptep_ipte_local(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
>   {
> -	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);
> +	ptep_ipte(addr, ptep, IPTE_NODAT | IPTE_GUEST_ASCE, mm->context.asce, IPTE_LOCAL);
>   }
>   
>   static inline void ptep_ipte_global(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
>   {
> -	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);
> +	ptep_ipte(addr, ptep, IPTE_NODAT | IPTE_GUEST_ASCE, mm->context.asce, IPTE_GLOBAL);
>   }
>   
>   static inline pte_t ptep_flush_direct(struct mm_struct *mm, unsigned long addr, pte_t *ptep)


  reply	other threads:[~2026-11-25 12:15 UTC|newest]

Thread overview: 8+ 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-25 12:15   ` Christian Borntraeger [this message]
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 17:00 ` [PATCH 0/5] s390/mm: Deduplicate machine_has_tlb_guest() usage Claudio Imbrenda

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=f243aa68-5b4c-4dd8-acdf-4a57a090b2a2@linux.ibm.com \
    --to=borntraeger@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=gerald.schaefer@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@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

all inboxes | Powered by JetHome®