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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEE05C433EF for ; Mon, 11 Oct 2021 03:28:49 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 9404A60238 for ; Mon, 11 Oct 2021 03:28:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9404A60238 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HSPQk3tGcz307f for ; Mon, 11 Oct 2021 14:28:46 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=a4YjLDMT; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HSPPz0qVpz2xbB for ; Mon, 11 Oct 2021 14:28:07 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=a4YjLDMT; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4HSPPx6yqyz4xbT; Mon, 11 Oct 2021 14:28:05 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1633922886; bh=3baH5QewyQbCgQVzBWlsDgB/cVMlKpnWUxMHk+PnPd8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=a4YjLDMTWaR17budh/yrDuLZjrrqdz505tFQGLFWeywekecn1lP4OZC0vMqTcMUOO JJY9iXLkKZ+rBkwdORGXv7mQUic4YfD48sBx+pJOvY7n2siwhOewIKm7vDyHREIvYG TVAFT7FAcF/x5mVGumOGZuC1i59eD5v/vPgUDulihJVwJ2TnHkuFC6qloPnWEeFV2p S88/pzJvmDqTuByB/GNtzfFyaoWl77ibA3D9MPXThxZYhdf9pTQvwX+ZYzJvXYePCH Sfznxwk2ZFNixb26i93NxbAnijY7NnXLqZwg3FKtJpQZKqa3ky0Qm0IgNayPAKzN41 ov7Zracz5CX3w== From: Michael Ellerman To: Christophe Leroy , "Aneesh Kumar K.V" , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v6 19/22] powerpc/book3s64/hash/kuap: Enable kuap on hash In-Reply-To: References: <20201125051634.509286-1-aneesh.kumar@linux.ibm.com> <20201125051634.509286-20-aneesh.kumar@linux.ibm.com> Date: Mon, 11 Oct 2021 14:28:05 +1100 Message-ID: <87v924me9m.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sandipan Das Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Christophe Leroy writes: > Le 25/11/2020 =C3=A0 06:16, Aneesh Kumar K.V a =C3=A9crit=C2=A0: >> Reviewed-by: Sandipan Das >> Signed-off-by: Aneesh Kumar K.V >> --- >> arch/powerpc/mm/book3s64/pkeys.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >>=20 >> diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64= /pkeys.c >> index f747d66cc87d..84f8664ffc47 100644 >> --- a/arch/powerpc/mm/book3s64/pkeys.c >> +++ b/arch/powerpc/mm/book3s64/pkeys.c >> @@ -257,7 +257,12 @@ void __init setup_kuep(bool disabled) >> #ifdef CONFIG_PPC_KUAP >> void __init setup_kuap(bool disabled) >> { >> - if (disabled || !early_radix_enabled()) >> + if (disabled) >> + return; >> + /* >> + * On hash if PKEY feature is not enabled, disable KUAP too. >> + */ >> + if (!early_radix_enabled() && !early_mmu_has_feature(MMU_FTR_PKEY)) > > pkey_early_init_devtree() bails out without setting MMU_FTR_PKEY with=20 > the following: > > /* > * Only P7 and above supports SPRN_AMR update with MSR[PR] =3D 1 > */ > if (!early_cpu_has_feature(CPU_FTR_ARCH_206)) > return; > > > > Why would it be impossible to do KUAP in that case ? KUAP doesn't=20 > require updating SPRN_AMR with MSR[PR] =3D 1 You're right, it would be possible to do KUAP in that case. That's an artifact of KUAP being implemented using PKEYs on hash. For the PKEYs user-visible API we want AMR to be user controlled. It's possible we could untangle all that, allowing KUAP to be implemented on earlier CPUs, but I'm not sure it's going to be high on anyone's todo list. cheers