linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@ozlabs.org>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 06/10] powerpc/mm/radix: implement LPID based TLB flushes to be used by KVM
Date: Mon, 7 May 2018 15:15:26 +1000	[thread overview]
Message-ID: <20180507051526.GE9440@fergus.ozlabs.ibm.com> (raw)
In-Reply-To: <20180506073731.13097-7-npiggin@gmail.com>

On Sun, May 06, 2018 at 05:37:27PM +1000, Nicholas Piggin wrote:
> Implement a local TLB flush for invalidating an LPID with variants for
> process or partition scope. And a global TLB flush for invalidating
> a partition scoped page of an LPID.
> 
> These will be used by KVM in subsequent patches.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>  .../include/asm/book3s/64/tlbflush-radix.h    |   7 +
>  arch/powerpc/mm/tlb-radix.c                   | 207 ++++++++++++++++++
>  2 files changed, 214 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> index 19b45ba6caf9..ef5c3f2994c9 100644
> --- a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> @@ -51,4 +51,11 @@ extern void radix__flush_tlb_all(void);
>  extern void radix__flush_tlb_pte_p9_dd1(unsigned long old_pte, struct mm_struct *mm,
>  					unsigned long address);
>  
> +extern void radix__flush_tlb_lpid_page(unsigned int lpid,
> +					unsigned long addr,
> +					unsigned long page_size);
> +extern void radix__flush_pwc_lpid(unsigned int lpid);
> +extern void radix__local_flush_tlb_lpid(unsigned int lpid);
> +extern void radix__local_flush_tlb_lpid_guest(unsigned int lpid);
> +
>  #endif
> diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c
> index a5d7309c2d05..5ac3206c51cc 100644
> --- a/arch/powerpc/mm/tlb-radix.c
> +++ b/arch/powerpc/mm/tlb-radix.c
> @@ -118,6 +118,53 @@ static inline void __tlbie_pid(unsigned long pid, unsigned long ric)
>  	trace_tlbie(0, 0, rb, rs, ric, prs, r);
>  }
>  
> +static inline void __tlbiel_lpid(unsigned long lpid, int set,
> +				unsigned long ric)
> +{
> +	unsigned long rb,rs,prs,r;
> +
> +	rb = PPC_BIT(52); /* IS = 2 */
> +	rb |= set << PPC_BITLSHIFT(51);
> +	rs = 0;  /* LPID comes from LPIDR */
> +	prs = 0; /* partition scoped */
> +	r = 1;   /* radix format */
> +
> +	asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
> +		     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
> +	trace_tlbie(lpid, 1, rb, rs, ric, prs, r);

Do we really want 128 trace entries every time
radix__local_flush_tlb_lpid() or radix__local_flush_tlb_lpid_guest()
is called?  That seems like overkill to me.  Could we move the
trace_tlbie calls here and in __tlbiel_lpid_guest() into the callers
instead?

Paul.

  reply	other threads:[~2018-05-07  5:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180506073731.13097-1-npiggin@gmail.com>
2018-05-06  7:37 ` [PATCH 06/10] powerpc/mm/radix: implement LPID based TLB flushes to be used by KVM Nicholas Piggin
2018-05-07  5:15   ` Paul Mackerras [this message]
2018-05-07  9:38     ` Nicholas Piggin

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=20180507051526.GE9440@fergus.ozlabs.ibm.com \
    --to=paulus@ozlabs.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.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;
as well as URLs for NNTP newsgroup(s).