From patchwork Tue Jul 18 07:11:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bader X-Patchwork-Id: 789949 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3xBWYc650qz9sBR; Tue, 18 Jul 2017 17:11:48 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1dXMfV-0000Mu-MR; Tue, 18 Jul 2017 07:11:41 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dXMfR-0000Mp-1M for kernel-team@lists.canonical.com; Tue, 18 Jul 2017 07:11:37 +0000 Received: from 1.general.smb.uk.vpn ([10.172.193.28]) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1dXMfQ-0006E5-BG; Tue, 18 Jul 2017 07:11:36 +0000 Subject: Re: [PATCH] [Zesty] UBUNTU: SAUCE: powerpc/powernv: Tell OPAL about our MMU mode on POWER9 To: Michael Ellerman , Breno Leitao , kernel-team@lists.canonical.com References: <1499352195-9886-1-git-send-email-leitao@debian.org> <87bmoi1rn5.fsf@concordia.ellerman.id.au> From: Stefan Bader Message-ID: <257fb62e-f7ba-aa1c-8868-3033a4394d7f@canonical.com> Date: Tue, 18 Jul 2017 09:11:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <87bmoi1rn5.fsf@concordia.ellerman.id.au> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com On 18.07.2017 03:05, Michael Ellerman wrote: > Breno Leitao writes: > >> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c >> index e0f856bfbfe8..a3b6de84f49c 100644 >> --- a/arch/powerpc/platforms/powernv/opal.c >> +++ b/arch/powerpc/platforms/powernv/opal.c >> @@ -66,11 +68,24 @@ void opal_configure_cores(void) >> * but it might clobber a bunch. >> */ >> #ifdef __BIG_ENDIAN__ >> - opal_reinit_cpus(OPAL_REINIT_CPUS_HILE_BE); >> + reinit_flags |= OPAL_REINIT_CPUS_HILE_BE; >> #else >> - opal_reinit_cpus(OPAL_REINIT_CPUS_HILE_LE); >> + reinit_flags |= OPAL_REINIT_CPUS_HILE_LE; >> #endif >> >> + /* >> + * POWER9 always support running hash: >> + * ie. Host hash supports hash guests >> + * Host radix supports hash/radix guests >> + */ >> + if (cpu_has_feature(CPU_FTR_ARCH_300)) { > > This is wrong. It can break booting on bare-metal Power8 machines with > some versions of firmware. > > Fix here: > > https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?h=fixes&id=a70b487b07cf4201bc6702e7f646fa593b23009f > > http://patchwork.ozlabs.org/patch/789381/ Ok, that is in linux-next by now (see attached). -Stefan > > > cheers > Acked-by: Kleber Sacilotto de Souza From a70b487b07cf4201bc6702e7f646fa593b23009f Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Mon, 17 Jul 2017 21:19:01 +1000 Subject: [PATCH] powerpc/powernv: Fix boot on Power8 bare metal due to opal_configure_cores() In commit 1c0eaf0f56d6 ("powerpc/powernv: Tell OPAL about our MMU mode on POWER9"), we added additional flags to the OPAL call to configure CPUs at boot. These flags only work on Power9 firmwares, and worse can cause boot failures on Power8 machines, so we check for CPU_FTR_ARCH_300 (aka POWER9) before adding the extra flags. Unfortunately we forgot that opal_configure_cores() is called before the CPU feature checks are dynamically patched, meaning the check always returns true. We definitely need to do something to make the CPU feature checks less prone to bugs like this, but for now the minimal fix is to use early_cpu_has_feature(). Reported-and-tested-by: Abdul Haleem Fixes: 1c0eaf0f56d6 ("powerpc/powernv: Tell OPAL about our MMU mode on POWER9") Signed-off-by: Michael Ellerman BugLink: http://bugs.launchpad.net/bugs/1702159 (cherry-picked from commit a70b487b07cf4201bc6702e7f646fa593b23009f linux-next) Signed-off-by: Stefan Bader Acked-by: Stefan Bader --- arch/powerpc/platforms/powernv/opal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 9b87abb..cad6b57 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -78,7 +78,7 @@ void opal_configure_cores(void) * ie. Host hash supports hash guests * Host radix supports hash/radix guests */ - if (cpu_has_feature(CPU_FTR_ARCH_300)) { + if (early_cpu_has_feature(CPU_FTR_ARCH_300)) { reinit_flags |= OPAL_REINIT_CPUS_MMU_HASH; if (early_radix_enabled()) reinit_flags |= OPAL_REINIT_CPUS_MMU_RADIX; -- 2.7.4