Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp199851pxb; Tue, 19 Oct 2021 00:37:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmFd7S6hQO4aMhLeOM5RvbFgUmNvs/aE6nURTkY1DIckw8mc8zA6u06OGq4Gz7TcCKy2uo X-Received: by 2002:a17:907:1c0e:: with SMTP id nc14mr36834534ejc.103.1634629019841; Tue, 19 Oct 2021 00:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634629019; cv=none; d=google.com; s=arc-20160816; b=hO3BiuLtJS/ul+AkFmnTN8ueY81dEGMoMhH+OS+yE5NySg9UPtor1BgMJnsjbUnbwm SNGgVIcF2PdniKgVeFm8gxoxtvxC0bHE3kPrm8VxtIpOMmI/IbdXx3akA8c8G1SWlir6 5+wfSX9hiUt2nbenhcjKrtqi12M8xkyAo8hjWdRPUi2nWe05Sa4zgXFCt0CE2PcKTCuB Nf5MwijmXHpxqVVQhfz1IY68WQWXowWVBOAqOYJ/ErELQkw4ImKmo7e7kxlATUOaH5Ka oPhxoMQyx+5ODc3rTAMEgEX7lx+32GSWTToauiB2NsLOW5cGzf4vGBn65kWPVQXNerSN zeWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=aVUFpZEWXnPGVJ9O+PlNwnvx7zs33k0fauhUjlhQlXc=; b=wljCpEM8iD3JmJ+kETYEgScZE/SvgeknTWtKEdL1AtZln0KQ+p+JzR9KuXQJ9fdTlk LAv4pMQPpWOe30rkRk63KoFmQQhARBqANxqoEKT8Fdw+AR4UoaGjGBYoFes6WEdlF95U s1zCDHn9hvrYd32+FxtqW1437XfY0vmoL9TUVZnuxWAB99HVUFhTu3DgSL83VFSoFMIX NuKvoHOsFzj97C3A/W8OFyopNFgyHDm53DWLnUcquMAxK8HCeKXwSbR1QQmJSRzfo71Y fCe3I9qO5sh+OkN/WTvhijCvhyx8GdcGWYhbRME33MECRiVHjBkHSH2/30qbK2nN1o/J DPYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hd32si27021940ejc.312.2021.10.19.00.36.25; Tue, 19 Oct 2021 00:36:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234713AbhJSHeI (ORCPT + 99 others); Tue, 19 Oct 2021 03:34:08 -0400 Received: from pegase2.c-s.fr ([93.17.235.10]:59985 "EHLO pegase2.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234649AbhJSHeB (ORCPT ); Tue, 19 Oct 2021 03:34:01 -0400 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4HYQPd3jrjz9sT9; Tue, 19 Oct 2021 09:30:13 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AKGJQN7DE-Yn; Tue, 19 Oct 2021 09:30:13 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4HYQP819njz9sTD; Tue, 19 Oct 2021 09:29:48 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1E4838B775; Tue, 19 Oct 2021 09:29:48 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 2jZeURx9P_0S; Tue, 19 Oct 2021 09:29:48 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.203.71]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 3A9398B77B; Tue, 19 Oct 2021 09:29:47 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.16.1/8.16.1) with ESMTPS id 19J7Tf013188478 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 09:29:41 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.16.1/8.16.1/Submit) id 19J7Tfse3188477; Tue, 19 Oct 2021 09:29:41 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v3 20/22] powerpc/kuap: Wire-up KUAP on 85xx in 32 bits mode. Date: Tue, 19 Oct 2021 09:29:31 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1634628571; l=1685; s=20211009; h=from:subject:message-id; bh=J1J7ZXwdkDiJFq4NXO9q71rKXXtH/9QJY9ZvF65BJWk=; b=B/Bh6yAQXN/30bptJ7jGyC9m5IYMJp1NcMzPlDArAV0riesyc2CZXp81bmsWEKPESey5jc6RLfI0 k+ZXEpRzC7U8iX1VtKwxKdcdNDlD075NmECom6xYOzzKIU4qQ2MW X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds KUAP support to 85xx in 32 bits mode. This is done by reading the content of SPRN_MAS1 and checking the TID at the time user pgtable is loaded. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_fsl_booke.S | 12 ++++++++++++ arch/powerpc/platforms/Kconfig.cputype | 1 + 2 files changed, 13 insertions(+) diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S index 4622b50a5208..ac2b4dcf5fd3 100644 --- a/arch/powerpc/kernel/head_fsl_booke.S +++ b/arch/powerpc/kernel/head_fsl_booke.S @@ -462,6 +462,12 @@ END_BTB_FLUSH_SECTION mfspr r11,SPRN_SPRG_THREAD lwz r11,PGDIR(r11) +#ifdef CONFIG_PPC_KUAP + mfspr r12, SPRN_MAS1 + rlwinm. r12,r12,0,0x3fff0000 + beq 2f /* KUAP fault */ +#endif + 4: /* Mask of required permission bits. Note that while we * do copy ESR:ST to _PAGE_RW position as trying to write @@ -571,6 +577,12 @@ END_BTB_FLUSH_SECTION mfspr r11,SPRN_SPRG_THREAD lwz r11,PGDIR(r11) +#ifdef CONFIG_PPC_KUAP + mfspr r12, SPRN_MAS1 + rlwinm. r12,r12,0,0x3fff0000 + beq 2f /* KUAP fault */ +#endif + /* Make up the required permissions for user code */ #ifdef CONFIG_PTE_64BIT li r13,_PAGE_PRESENT | _PAGE_BAP_UX diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index 3ea415bcf9b8..611d6efc047b 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -37,6 +37,7 @@ config PPC_BOOK3S_32 config PPC_85xx bool "Freescale 85xx" select E500 + select PPC_HAVE_KUAP config PPC_8xx bool "Freescale 8xx" -- 2.31.1