From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA026C433EF for ; Wed, 22 Sep 2021 19:02:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AFD3760F9D for ; Wed, 22 Sep 2021 19:02:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AFD3760F9D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=c/Mcw1lDat1O26Y/E79la9gF73O8LDC5y59VfH3iOls=; b=CX/8l2No4pwW85 ag09LYhTRON+iClP4fnxVBdAQMmBYTogrRZtdEGYaHy0Az5MS+cXS05l7MfZxr2MG2cpK3Cck8FgB VVG/Iirm+w6L9AXQ7QERObeKm3AvL+dFPMUNDYeGKNedo0K2MvP3w0wADt5Ceq0f8ZTyzUF+41HDF Cr82bJlDvsXhykTcgCO5N3IhqleS7l27gzu45WnxiTKR2f/FiO0PSKwK3D9mBi8RbpKmj2/afMWmB vO5aCsJ9tsgJH6Qpnr9m2r7dz2imkff0vflPXct9E542eIYoH2TX+RJaFtRLmotITyW9IXWVX2Bv2 Qo9+uEqFe14BEWLuJAhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT7TX-009STm-Bw; Wed, 22 Sep 2021 19:00:11 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT7TO-009SQL-PN for linux-arm-kernel@lists.infradead.org; Wed, 22 Sep 2021 19:00:04 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E4C146109E; Wed, 22 Sep 2021 19:00:01 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mT7TM-00COD9-8g; Wed, 22 Sep 2021 20:00:00 +0100 Date: Wed, 22 Sep 2021 19:59:59 +0100 Message-ID: <874kacv3kg.wl-maz@kernel.org> From: Marc Zyngier To: dann frazier Cc: Catalin Marinas , Will Deacon , Suzuki K Poulose , Mark Brown , linux-arm-kernel@lists.infradead.org, Mark Rutland Subject: Re: [PATCH] arm64: Restore forced disabling of KPTI on ThunderX In-Reply-To: <20210922135924.3109291-1-dann.frazier@canonical.com> References: <20210922135924.3109291-1-dann.frazier@canonical.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: dann.frazier@canonical.com, catalin.marinas@arm.com, will@kernel.org, suzuki.poulose@arm.com, broonie@kernel.org, linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210922_120002_887894_667986D7 X-CRM114-Status: GOOD ( 27.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 22 Sep 2021 14:59:24 +0100, dann frazier wrote: > > A noted side-effect of commit 0c6c2d3615ef ("arm64: Generate cpucaps.h") > is that cpucaps are now sorted, changing the enumeration order. This > assumed no dependencies between cpucaps, which turned out not to be true > in one case. UNMAP_KERNEL_AT_EL0 currently needs to be processed after > WORKAROUND_CAVIUM_27456. ThunderX systems are incompatible with KPTI, so > unmap_kernel_at_el0() bails if WORKAROUND_CAVIUM_27456 is set. But because > of the sorting, WORKAROUND_CAVIUM_27456 will not yet have been considered > when unmap_kernel_at_el0() checks for it, so the kernel tries to > run w/ KPTI - and quickly falls over. > > Because all ThunderX implementations have homogeneous CPUs, we can remove > this dependency by just checking the current CPU for the erratum. > > Fixes: 0c6c2d3615ef ("arm64: Generate cpucaps.h") > Suggested-by: Suzuki K Poulose > Cc: stable@vger.kernel.org # 5.13+ > Signed-off-by: dann frazier > --- > arch/arm64/kernel/cpufeature.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > index f8a3067d10c6..7275b49034f3 100644 > --- a/arch/arm64/kernel/cpufeature.c > +++ b/arch/arm64/kernel/cpufeature.c > @@ -1528,7 +1528,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry, > * ThunderX leads to apparent I-cache corruption of kernel text, which > * ends as well as you might imagine. Don't even try. > */ > - if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_27456)) { > + if (this_cpu_has_cap(ARM64_WORKAROUND_CAVIUM_27456)) { > str = "ARM64_WORKAROUND_CAVIUM_27456"; > __kpti_forced = -1; > } Ouch, nice catch. Hopefully, nobody will build a big-little system using TX1 in this instance of the universe. Acked-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel