From: "Michal Suchánek" <msuchanek@suse.de>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org,
"Gautham R . Shenoy" <ego@linux.vnet.ibm.com>,
Mahesh Jagannath Salgaonkar <mahesh@linux.vnet.ibm.com>,
kvm-ppc@vger.kernel.org,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
Subject: Re: [PATCH 1/2] powerpc/64s: move machine check SLB flushing to mm/slb.c
Date: Wed, 08 Aug 2018 20:22:52 +0000 [thread overview]
Message-ID: <20180808222252.5be0feac@kitsune.suse.cz> (raw)
In-Reply-To: <20180803041350.25493-1-npiggin@gmail.com>
On Fri, 3 Aug 2018 14:13:49 +1000
Nicholas Piggin <npiggin@gmail.com> wrote:
> The machine check code that flushes and restores bolted segments in
> real mode belongs in mm/slb.c. This will be used by pseries machine
> check and idle code.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/include/asm/book3s/64/mmu-hash.h | 3 ++
> arch/powerpc/kernel/mce_power.c | 21 ++--------
> arch/powerpc/mm/slb.c | 38
> +++++++++++++++++++ 3 files changed, 44 insertions(+), 18 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
> b/arch/powerpc/include/asm/book3s/64/mmu-hash.h index
> 2f74bdc805e0..d4e398185b3a 100644 ---
> a/arch/powerpc/include/asm/book3s/64/mmu-hash.h +++
> b/arch/powerpc/include/asm/book3s/64/mmu-hash.h @@ -497,6 +497,9 @@
> extern void hpte_init_native(void);
> extern void slb_initialize(void);
> extern void slb_flush_and_rebolt(void);
> +extern void slb_flush_all_realmode(void);
> +extern void __slb_restore_bolted_realmode(void);
> +extern void slb_restore_bolted_realmode(void);
>
> extern void slb_vmalloc_update(void);
> extern void slb_set_size(u16 size);
> diff --git a/arch/powerpc/kernel/mce_power.c
> b/arch/powerpc/kernel/mce_power.c index d6756af6ec78..50f7b9817246
> 100644 --- a/arch/powerpc/kernel/mce_power.c
> +++ b/arch/powerpc/kernel/mce_power.c
> @@ -62,11 +62,8 @@ static unsigned long addr_to_pfn(struct pt_regs
> *regs, unsigned long addr) #ifdef CONFIG_PPC_BOOK3S_64
> static void flush_and_reload_slb(void)
> {
> - struct slb_shadow *slb;
> - unsigned long i, n;
> -
> /* Invalidate all SLBs */
> - asm volatile("slbmte %0,%0; slbia" : : "r" (0));
> + slb_flush_all_realmode();
>
> #ifdef CONFIG_KVM_BOOK3S_HANDLER
> /*
> @@ -76,22 +73,10 @@ static void flush_and_reload_slb(void)
> if (get_paca()->kvm_hstate.in_guest)
> return;
> #endif
> -
> - /* For host kernel, reload the SLBs from shadow SLB buffer.
> */
> - slb = get_slb_shadow();
> - if (!slb)
> + if (early_radix_enabled())
> return;
And we lose the check that the shadow slb exists. Is !slb equivalent to
early_radix_enabled()
>
> - n = min_t(u32, be32_to_cpu(slb->persistent), SLB_MIN_SIZE);
> -
> - /* Load up the SLB entries from shadow SLB */
> - for (i = 0; i < n; i++) {
> - unsigned long rb > be64_to_cpu(slb->save_area[i].esid);
> - unsigned long rs > be64_to_cpu(slb->save_area[i].vsid); -
> - rb = (rb & ~0xFFFul) | i;
> - asm volatile("slbmte %0,%1" : : "r" (rs), "r" (rb));
> - }
> + slb_restore_bolted_realmode();
> }
> #endif
>
> diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
> index cb796724a6fc..136db8652577 100644
> --- a/arch/powerpc/mm/slb.c
> +++ b/arch/powerpc/mm/slb.c
> @@ -90,6 +90,44 @@ static inline void create_shadowed_slbe(unsigned
> long ea, int ssize, : "memory" );
> }
>
> +/*
> + * Insert bolted entries into SLB (which may not be empty).
> + */
> +void __slb_restore_bolted_realmode(void)
> +{
> + struct slb_shadow *p = get_slb_shadow();
> + enum slb_index index;
or can we get here at some point when shadow slb is not populated?
Thanks
Michal
> +
> + /* No isync needed because realmode. */
> + for (index = 0; index < SLB_NUM_BOLTED; index++) {
> + asm volatile("slbmte %0,%1" :
> + : "r" (be64_to_cpu(p->save_area[index].vsid)),
> + "r" (be64_to_cpu(p->save_area[index].esid)));
> + }
> +}
> +
> +/*
> + * Insert bolted entries into an empty SLB.
> + * This is not the same as rebolt because the bolted segments
> + * (e.g., kstack) are not changed (rebolted).
> + */
> +void slb_restore_bolted_realmode(void)
> +{
> + __slb_restore_bolted_realmode();
> + get_paca()->slb_cache_ptr = 0;
> +}
> +
> +/*
> + * This flushes all SLB entries including 0, so it must be realmode.
> + */
> +void slb_flush_all_realmode(void)
> +{
> + /*
> + * This flushes all SLB entries including 0, so it must be
> realmode.
> + */
> + asm volatile("slbmte %0,%0; slbia" : : "r" (0));
> +}
> +
> static void __slb_flush_and_rebolt(void)
> {
> /* If you change this make sure you change SLB_NUM_BOLTED
next prev parent reply other threads:[~2018-08-08 20:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-03 4:13 [PATCH 1/2] powerpc/64s: move machine check SLB flushing to mm/slb.c Nicholas Piggin
2018-08-03 4:13 ` [PATCH 2/2] powerpc/64s: reimplement book3s idle code in C Nicholas Piggin
2018-08-09 14:57 ` Gautham R Shenoy
2018-08-09 23:30 ` Nicholas Piggin
2018-08-08 20:22 ` Michal Suchánek [this message]
2018-08-08 22:45 ` [PATCH 1/2] powerpc/64s: move machine check SLB flushing to mm/slb.c 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=20180808222252.5be0feac@kitsune.suse.cz \
--to=msuchanek@suse.de \
--cc=akshay.adiga@linux.vnet.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=ego@linux.vnet.ibm.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mahesh@linux.vnet.ibm.com \
--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