All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/64: Disable use of radix under a hypervisor
@ 2017-02-16  2:49 Paul Mackerras
  2017-02-16 12:18 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Mackerras @ 2017-02-16  2:49 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Michael Ellerman

Currently, if the kernel is running on a POWER9 processor under a
hypervisor, it may try to use the radix MMU even though it doesn't have
the necessary code to do so (it doesn't negotiate use of radix, and it
doesn't do the H_REGISTER_PROC_TBL hcall).  If the hypervisor supports
both radix and HPT, then it will set up the guest to use HPT (since the
guest doesn't request radix in the CAS call), but if the radix feature
bit is set in the ibm,pa-features property (which is valid, since
ibm,pa-features is defined to represent the capabilities of the
processor) the guest will try to use radix, resulting in a crash when
it turns the MMU on.

This makes the minimal fix for the current code, which is to disable
radix unless we are running in hypervisor mode.

Fixes: 2bfd65e45e87 ("powerpc/mm/radix: Add radix callbacks for early init routines")
Cc: stable@vger.kernel.org # v4.7+
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
 arch/powerpc/mm/init_64.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 93abf8a..8e15880 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -347,7 +347,8 @@ early_param("disable_radix", parse_disable_radix);
 void __init mmu_early_init_devtree(void)
 {
 	/* Disable radix mode based on kernel command line. */
-	if (disable_radix)
+	/* We don't yet have the machinery to do radix as a guest. */
+	if (disable_radix || !(mfmsr() & MSR_HV))
 		cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX;
 
 	if (early_radix_enabled())
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: powerpc/64: Disable use of radix under a hypervisor
  2017-02-16  2:49 [PATCH] powerpc/64: Disable use of radix under a hypervisor Paul Mackerras
@ 2017-02-16 12:18 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2017-02-16 12:18 UTC (permalink / raw)
  To: Paul Mackerras, linuxppc-dev; +Cc: Michael Ellerman

On Thu, 2017-02-16 at 02:49:21 UTC, Paul Mackerras wrote:
> Currently, if the kernel is running on a POWER9 processor under a
> hypervisor, it may try to use the radix MMU even though it doesn't have
> the necessary code to do so (it doesn't negotiate use of radix, and it
> doesn't do the H_REGISTER_PROC_TBL hcall).  If the hypervisor supports
> both radix and HPT, then it will set up the guest to use HPT (since the
> guest doesn't request radix in the CAS call), but if the radix feature
> bit is set in the ibm,pa-features property (which is valid, since
> ibm,pa-features is defined to represent the capabilities of the
> processor) the guest will try to use radix, resulting in a crash when
> it turns the MMU on.
> 
> This makes the minimal fix for the current code, which is to disable
> radix unless we are running in hypervisor mode.
> 
> Fixes: 2bfd65e45e87 ("powerpc/mm/radix: Add radix callbacks for early init routines")
> Cc: stable@vger.kernel.org # v4.7+
> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/3f91a89d424a79f8082525db5a375e

cheers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-16 12:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-16  2:49 [PATCH] powerpc/64: Disable use of radix under a hypervisor Paul Mackerras
2017-02-16 12:18 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.