From patchwork Fri Mar 10 17:36:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13169886 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 04680C6FD1C for ; Fri, 10 Mar 2023 17:53:28 +0000 (UTC) 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: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PwDF8ps3TI2AfdnDwux0BoPufbg0It/FOeppnhQ5m3g=; b=cog21pcpL1Slle p3Bxt8NU7euwD1/O12R0RjhPrhbk0irx1AJAtc/xalJUmLUF9eGICjzh38GsX0EhYgPB1cBAWaIJl Z6uevNp89Ls+mNc2t7tU+nzypwjmCCd6vK1gz3pWeIDHlrA5C5y536c6kuZPYM90IMLKMK+7AOzY+ e8kXRAXcPPpkNUaRP6TMRAesfFOxtohS/2AH8LDM38ilvZaj2X85Gq5Swljl76Vwl6BBQPH3jJ/BY zNxQwJH7N+68ntbgkWaJCMHOaBHqf5eQQ5jHgsKM5452wgMz+d5WeT/UQKWbCyklmc0n0XCx6mnuW qEuyn7WnGbvGa6rrmASA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pagus-00FgYR-Qc; Fri, 10 Mar 2023 17:52:31 +0000 Received: from mail-db8eur05on20622.outbound.protection.outlook.com ([2a01:111:f400:7e1a::622] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pagup-00FgVu-J1 for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2023 17:52:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aIEyyZP+mdotnGTkzfCegHNP2jinZChnxjXssNufs0s=; b=VC2CIjQPOgqsEjvkWtSAytFz3HRLkG0gzWgKxI9ht7JvrxsH2yA4naUjxkdV98d0rkCuOAMlQT3pD3MZNPyfetnyb5XMDaCjLVqzQ+BWWAKIF0uLlyLFavkx5fW7XmseXUE5afRBuIMJ9aZpFwysw2YaABAsBj5nOvKEgwaeylg= Received: from FR0P281CA0064.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::8) by DU2PR08MB10229.eurprd08.prod.outlook.com (2603:10a6:10:496::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.18; Fri, 10 Mar 2023 17:37:23 +0000 Received: from VI1EUR03FT040.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:49:cafe::ad) by FR0P281CA0064.outlook.office365.com (2603:10a6:d10:49::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19 via Frontend Transport; Fri, 10 Mar 2023 17:37:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VI1EUR03FT040.mail.protection.outlook.com (100.127.145.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19 via Frontend Transport; Fri, 10 Mar 2023 17:37:23 +0000 Received: ("Tessian outbound cfb430c87a1e:v135"); Fri, 10 Mar 2023 17:37:23 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c8685ca53d2a61c9 X-CR-MTA-TID: 64aa7808 Received: from d4c4c11cbe8c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A05287ED-AF8B-44DD-A6F8-7CE009C6CA5F.1; Fri, 10 Mar 2023 17:37:16 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d4c4c11cbe8c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 10 Mar 2023 17:37:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mXvKaDe/sICNdVxr1m//qK+uPR+10v2EgqKTxWhPPA4GtbUJxRZhu7QuzmRRnzlDamS5RRaw7oKt7ZXG3vR4V5KnPplE2WOJ3rOLKVkAWetXEko6y3axt5f0hBnahz9ZYqbBH8CQKYFZ31GE+KsqCsh9jg/gB5soNeSa/l1s1JCh8qFoC5pzlvbsfFk2FEqnUz2ZEzjmLHjyc6hRD5gOG1nuiAjzkKJmt33ROiLWOnl/VbZWgMS7CKe3F5vk3zAgr7iVbXuJkpHEkb8D4Jf9ZuQOTGx78YrN2C3y5nfLE9LOmEP/jSKAYjP8/yTKNa/Phgyec4DaVEv1/O6mBtVpYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aIEyyZP+mdotnGTkzfCegHNP2jinZChnxjXssNufs0s=; b=K+EmtV0bf5+iJwq+cRcw0bwI3DhZbnOXwO04JrbIJdjqNqY98thrauOegzsBO2HHFjHZoymYHxGC2AGHEqjQ0PUZHlG7rl3Jno+hB7z0NJB3zjDIJ1jNc3/wVW/VeDqMBQotBWRXehU7PUJToR2YpilKCC6UkjDV8dfquJJxuMtlut87ajqfRcgOQ5cKhg9LCfgpr6PRL824FuMHsHURRjGl9TY4lZLVDi7NRNpvZdFAukvPWqO2SRJhF8og//JY2CU+0lV3Sq99KPBdS+9C9fxONyl3ios6uxDfzVlXTwDonEUT8O6jt+UCy0/3uGUW+HVsarNvMFVWpYV00pfOQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aIEyyZP+mdotnGTkzfCegHNP2jinZChnxjXssNufs0s=; b=VC2CIjQPOgqsEjvkWtSAytFz3HRLkG0gzWgKxI9ht7JvrxsH2yA4naUjxkdV98d0rkCuOAMlQT3pD3MZNPyfetnyb5XMDaCjLVqzQ+BWWAKIF0uLlyLFavkx5fW7XmseXUE5afRBuIMJ9aZpFwysw2YaABAsBj5nOvKEgwaeylg= Received: from DU2PR04CA0026.eurprd04.prod.outlook.com (2603:10a6:10:3b::31) by DU0PR08MB8496.eurprd08.prod.outlook.com (2603:10a6:10:403::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19; Fri, 10 Mar 2023 17:37:15 +0000 Received: from DBAEUR03FT042.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:3b:cafe::99) by DU2PR04CA0026.outlook.office365.com (2603:10a6:10:3b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.20 via Frontend Transport; Fri, 10 Mar 2023 17:37:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT042.mail.protection.outlook.com (100.127.142.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.20 via Frontend Transport; Fri, 10 Mar 2023 17:37:15 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Fri, 10 Mar 2023 17:37:14 +0000 Received: from e124191.cambridge.arm.com (10.1.197.45) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.17 via Frontend Transport; Fri, 10 Mar 2023 17:37:14 +0000 From: Joey Gouly To: , Mark Rutland CC: , Joey Gouly Subject: [PATCH v1 2/2] aarch64: enable Permission Indirection Extension Date: Fri, 10 Mar 2023 17:36:57 +0000 Message-ID: <20230310173657.57228-2-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230310173657.57228-1-joey.gouly@arm.com> References: <20230310173657.57228-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT042:EE_|DU0PR08MB8496:EE_|VI1EUR03FT040:EE_|DU2PR08MB10229:EE_ X-MS-Office365-Filtering-Correlation-Id: 9780b1d8-0e9c-404f-70df-08db218e1b9d x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: DCWCeHip/xN1pY+9hYo7j7kN4fAiFcvxxR3rL8L7khCSidnUiNsrmzfCcUwidWjTj5UTJLOB7xH60F5+OqlUJTvwNckp2Nla62W0k72WjoUm2gmBqTPwwLDU9dROndlG5QgNaU4RYQfF7cTPrnOwtJh3lRafTKIUllIqmAx1J+CKDPOARL9S+D5Ismtv/EkK/rrjh7iR0qVvrKe17aP7XLQ7sBwpGaXnqNkkzUCbYdyq/7+KB1X7BUn+92N9VdT7/hoVe5NvATre7faTE8YVDag+3WhqfPX/rulN6hdNzSQthA88P0Fmx5f2PWXIWQ5MbTvHZ6dej/ObZaulKO+QxSXfWEEpKRNAowoeznXlPcNh4YDyYqZgNhUWKXJwLFcT88LSJ4HM4szcsl850u4GMnpzBtJnhxasFR70RFZ/uXyKpvDhU0cpRQXeGLPVl9N1Vsy2l6bHvIYSztvpp1tvMP2L7qgESmDpmjClcWx9fEUeH3u8G8abfHDeeRaMhNO52CThO2BkVj8hkHM50Mm0/jdmloJzKL1CtJE16OMpRV5gvitGSxxMa9I7sO9oGqBW0QLjAD+SuBM//CzgydkDk/UYPNyCVRaF3iG++W+IphENsC6aI0Y59SkD62eA2mX24HeqspCpH9cuXARk3pbi7oGNcbapzmOT7Pr+osVF3vk45N5yqXwoL2ngd+cM2eucBDIEPa2TZHytOEyZ5edFKIF3vA/82xTcMFqZau7kWHM= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230025)(4636009)(396003)(376002)(136003)(346002)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(82310400005)(82740400003)(36860700001)(83380400001)(426003)(47076005)(36756003)(6636002)(40480700001)(110136005)(478600001)(54906003)(81166007)(316002)(356005)(336012)(8936002)(40460700003)(41300700001)(7696005)(2616005)(6666004)(26005)(186003)(1076003)(5660300002)(44832011)(70586007)(8676002)(2906002)(86362001)(4326008)(70206006)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8496 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR03FT040.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 3e5fe5ea-a80a-48a9-4e33-08db218e16bc X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Lh/95stsBzIMOE+v8JE90re0FEo5Kcl+6dE4VO7RxNAZR7dIG7mn7v1CwU/HhiRcJjkt2MkSbQMmqvvcaN7bQa3pkm4uKm46N3yVvV4waaomyGfeJjxVLVhoMC00e0BnQ4uIyO7z153BUnbZ3FRR0cNvTCokO6kfdFsQeKqGERAMmtnWaBN0q5DELqby/oNU6qJsy3VqzierDxigTXVI1pKhT7aqFV2DJgXWfBaCjjJlra8gcu5X8KxzeyrB67Nf3bz69L+7OAFr5lvdLVnlsnsBFXZOjyYu33aNsiPu9wjojSdySVN3hOoZSlbwlJGmFtr+W6bqOPsjCRd+jVEKRsf4c2UkhjUK8vVlGjTRaRdRWt89/DbRbRIRDjjUpk4vsrjIbry7cK30RyM46Xell/62V+72Pq6NYQlQ7kxUshk9zI1WNuz5Ibp0GJ7PWare+ILtxZxtCS5wCyJerEAXlQDggadnS9jZiUxEp2fq3PfjdfhNLxM8c4O743VH2iJ8DiK+4qwKj9BVWcbF+HPIufyBHV9yFkQ2dDHUceUmAoqmj/GwpWxTa3lOPLTJ5oG39NFLB+yo2w+53WFoLKULnx7p9ZXGbguS7YFsmPVsY2VAQDfSi/FmRgGdG5mx1dY5pJjwFmCrfJyyY9omz56pRt1j0+IgT/cjGBwef8HSOnXEq6cTj2jDXT/DHj8ESy45e/ML/utwTUzYfL/OP8VXig== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230025)(4636009)(136003)(346002)(376002)(396003)(39860400002)(451199018)(36840700001)(40470700004)(46966006)(8676002)(44832011)(2906002)(4326008)(26005)(5660300002)(1076003)(8936002)(36756003)(70586007)(40460700003)(40480700001)(6636002)(110136005)(70206006)(316002)(41300700001)(86362001)(54906003)(7696005)(478600001)(6666004)(82740400003)(81166007)(36860700001)(186003)(2616005)(83380400001)(82310400005)(336012)(47076005)(426003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2023 17:37:23.4495 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9780b1d8-0e9c-404f-70df-08db218e1b9d X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR03FT040.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB10229 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230310_095227_639659_B22874D1 X-CRM114-Status: UNSURE ( 8.74 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allow lower ELs to access the registers associated with the Permission Indirection Extension. Signed-off-by: Joey Gouly --- arch/aarch64/include/asm/cpu.h | 2 ++ arch/aarch64/init.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/arch/aarch64/include/asm/cpu.h b/arch/aarch64/include/asm/cpu.h index 3686e08..fe732dc 100644 --- a/arch/aarch64/include/asm/cpu.h +++ b/arch/aarch64/include/asm/cpu.h @@ -52,6 +52,7 @@ #define SCR_EL3_HXEn BIT(38) #define SCR_EL3_EnTP2 BIT(41) #define SCR_EL3_TCR2EN BIT(43) +#define SCR_EL3_PIEN BIT(45) #define HCR_EL2_RES1 BIT(1) @@ -75,6 +76,7 @@ #define ID_AA64MMFR1_EL1_HCX BITS(43, 40) #define ID_AA64MMFR3_EL1_TCRX BITS(4, 0) +#define ID_AA64MMFR3_EL1_S1PIE BITS(11, 8) #define ID_AA64PFR1_EL1_MTE BITS(11, 8) #define ID_AA64PFR1_EL1_SME BITS(27, 24) diff --git a/arch/aarch64/init.c b/arch/aarch64/init.c index f004e41..0fd7535 100644 --- a/arch/aarch64/init.c +++ b/arch/aarch64/init.c @@ -67,6 +67,9 @@ void cpu_init_el3(void) if (mrs_field(ID_AA64MMFR3_EL1, TCRX)) scr |= SCR_EL3_TCR2EN; + if (mrs_field(ID_AA64MMFR3_EL1, S1PIE)) + scr |= SCR_EL3_PIEN; + if (mrs_field(ID_AA64PFR1_EL1, MTE) >= 2) scr |= SCR_EL3_ATA;