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 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 51A4CC77B6C for ; Thu, 13 Apr 2023 11:21:08 +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=54maB6F/gD1Ez6ZerTtj1ZmF69MgABilnEBpO6qYkjw=; b=bmMCHK1AeztCt/ PVr6vWjIKZkNWqOFFtfkyC+ob0O16o22KQm8pdaOjUraCYJvdNjnd6g7tCJWUkyykDJduZ45GFu/U kkbUVvPETJZBT/mgpK6CmjQsxx5h7N6OaGEhkVf0iENxCoykxT/fCi50hTuW2/wgBUXCQRWDXUAQa RR1+Xco1O/GaGVBJc3XXw3XHD4XOCb54/qVOBVsQDffLMRO0I9dBdC8O8XFXhFjmraGfvUGo7O1T9 wWpoo1IHQAzkE+pfNBMLeFS2vCWqIMCFBFqJMTx7B7g+SQJXrrESNnLqVbWFcI5aNa2rzRqnNMVHI qwdLlPLfqXn+pw10w7qA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmuzu-0062p8-29; Thu, 13 Apr 2023 11:20:14 +0000 Received: from mail-db5eur02on20604.outbound.protection.outlook.com ([2a01:111:f400:fe12::604] helo=EUR02-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmuzr-0062ni-2e for linux-arm-kernel@lists.infradead.org; Thu, 13 Apr 2023 11:20:13 +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=1BRJuDFqbG5oOotnhqszZVxFdPZc4ZXh0baZVpCwAtw=; b=ibi4MctMiUNHcKuAWQGPrtGzco4hLc0k7xNvxTu2AvOwalF0YtBkACEccZzO+5YtKWfTcUeG8d1ev2cVcIcivpa06YEZUpIccYGOK4JWdz6tjnDZZ3QC/3hdAYQuuFyiodL31vgmCLlb67m/hhsiBaFcVyILEavSjKe4mx/zD+0= Received: from DB6P195CA0009.EURP195.PROD.OUTLOOK.COM (2603:10a6:4:cb::19) by DB3PR08MB8986.eurprd08.prod.outlook.com (2603:10a6:10:42b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 13 Apr 2023 11:05:35 +0000 Received: from DBAEUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:cb:cafe::21) by DB6P195CA0009.outlook.office365.com (2603:10a6:4:cb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.32 via Frontend Transport; Thu, 13 Apr 2023 11:05:35 +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 DBAEUR03FT013.mail.protection.outlook.com (100.127.142.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.29 via Frontend Transport; Thu, 13 Apr 2023 11:05:35 +0000 Received: ("Tessian outbound 945aec65ec65:v136"); Thu, 13 Apr 2023 11:05:35 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: de206a47072dd0d2 X-CR-MTA-TID: 64aa7808 Received: from 8119b9e59c89.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6B793FD3-F466-44FF-B3C7-8B564A475EB9.1; Thu, 13 Apr 2023 11:05:29 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8119b9e59c89.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 13 Apr 2023 11:05:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ISuuUooTxrEltOSGIOHHXmA55RHHSHhxTF1sfRl9G/PW1ODGa28gbNurXO9KC39KE+2lzvWxqjhVCyEASGhXrc3Wh4iaXVfaoYSSvCIQhC+vM9Ags+vQSexRa9m9j13baBmOkDr/D9SNcOUJ1KK0vw8za+wEaReiU8ILClJwIGq5VXoPjxP0lEDr9LBe4EcC8JJwcXohtsmyyuFTHkHtw/k7sjVSsfiqrm5TM/ZdTLlYbCJ46s9giWK+tSKtIGAtkojukvE0BdgsqSQ5gWDAh2uCHA//5IDIT5/JkN1+zAxuAKMp8edoGuO5YktcFxlwo8k0vR/ofMkqUewp4RP5iA== 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=1BRJuDFqbG5oOotnhqszZVxFdPZc4ZXh0baZVpCwAtw=; b=G2sgotAg7cqddm7ygGhX98ku4eYsJAxPtScDULpVt9MFm7ln5g0Zjad9WIr+3JVc8vGNiG1Yb5brlauTO2LNXBef1gewK00H5gLTPdD+zOnlWirvQaA5X1aEQLnvs5WsudFJJK1vKA2SyRn7ID8HBoNkxya48lPcqJDYNpWWBIpLTcHV07TRzXGXp07blG9vchl8keTBDqtEp2NBDhd1Yvvnmz3mWuY+RQzSMUUTycpCeYw/9fi7jIdoNdHU9xKZnDHsWStrrmFuA8jTJ9h81fQGlV9JtDlsazWhUZFIxmFBzU97PqQk5uaBSiAHD4LdYHwsgdJow8ak4T7LjL9Rxg== 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=1BRJuDFqbG5oOotnhqszZVxFdPZc4ZXh0baZVpCwAtw=; b=ibi4MctMiUNHcKuAWQGPrtGzco4hLc0k7xNvxTu2AvOwalF0YtBkACEccZzO+5YtKWfTcUeG8d1ev2cVcIcivpa06YEZUpIccYGOK4JWdz6tjnDZZ3QC/3hdAYQuuFyiodL31vgmCLlb67m/hhsiBaFcVyILEavSjKe4mx/zD+0= Received: from AS9PR06CA0428.eurprd06.prod.outlook.com (2603:10a6:20b:49e::10) by AS8PR08MB9742.eurprd08.prod.outlook.com (2603:10a6:20b:616::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 13 Apr 2023 11:05:26 +0000 Received: from AM7EUR03FT045.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:49e:cafe::69) by AS9PR06CA0428.outlook.office365.com (2603:10a6:20b:49e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.32 via Frontend Transport; Thu, 13 Apr 2023 11:05:26 +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 AM7EUR03FT045.mail.protection.outlook.com (100.127.140.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.31 via Frontend Transport; Thu, 13 Apr 2023 11:05:26 +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; Thu, 13 Apr 2023 11:05:20 +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; Thu, 13 Apr 2023 11:05:20 +0000 From: Joey Gouly To: CC: , , , , , , , , , , Subject: [PATCH v2 15/19] arm64: add encodings of PIRx_ELx registers Date: Thu, 13 Apr 2023 12:05:09 +0100 Message-ID: <20230413110513.243326-16-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230413110513.243326-1-joey.gouly@arm.com> References: <20230413110513.243326-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT045:EE_|AS8PR08MB9742:EE_|DBAEUR03FT013:EE_|DB3PR08MB8986:EE_ X-MS-Office365-Filtering-Correlation-Id: 3aa0e75e-24e7-4def-b703-08db3c0f01d7 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: DB9Yuq1ajGm2+Q3A6XabOWOZKvRWLtxgPJ82nuZDdNCcq6xsn07lXa3ocB9QuB54nzeQHdYvJvqSAkMWyuplUZP7ycg2VMcyHtBNra/6zEjxGEJZNfTGdagWcumRSnPvfSVQHDZma0Hv3aTZYyC14advksxAGt4/op9j1j1SDsWfEWpqGROJZO3CmMsagB/jfk9XhsCMMsVR+BKCUtyBQf74kO8kHKB1LzfZCQ3DaN2Mrq68EKFJjZGcr/8FYpNLrD4YDpmPd8cWHoq6AjcU7wkQ4hTAEtXoA1kRbJ82halexQlbpQibIEgtq5czMmStR28J7AwDbt6Ro6qOMvkWHamYYbpkHJixD73241F86YSqVRWfhuNtLFA9ntivhmQqElOKs86R9jdYyDcqpHCkbfmVXr/PtgFWXiCG2/7kY8s46mppWwX72RgIoY/rDO2IX/3E5RivDF4Lfcb/QpZMAYHTP3F3DhjybQvYhKTXsqN05ClOiyfBCj7exrTf/N2B5x+Ov0Ynw3szY4V8K4i4QtQAdzRWvkFN8FC2hhlpD2Bx+l8dTwXCGvXStP7DgITHv7Q8kiT4qKlO7Qk8g6o4Ck33ixqJuu/BoZU0PeFd3ifD+X8Rn8mWlozANxXTNpkFmWNFj2kj/oF5VU82k/bCvsFfRUvPUmlj5B3MFI3NdjULAkSMEqjF6WPu1tKTbnhocpyxzayA+nI/RyH7w+ZtqrStJZ7nhVRwowIrwICNKEM= 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:(13230028)(4636009)(396003)(346002)(39860400002)(376002)(136003)(451199021)(36840700001)(46966006)(40470700004)(36860700001)(426003)(40480700001)(5660300002)(41300700001)(86362001)(81166007)(36756003)(2906002)(40460700003)(44832011)(8676002)(70586007)(4326008)(8936002)(70206006)(82310400005)(6916009)(356005)(83380400001)(82740400003)(2616005)(47076005)(186003)(1076003)(54906003)(316002)(26005)(7696005)(6666004)(478600001)(336012)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9742 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4b2b11d3-b8ae-4386-3fa8-08db3c0efc78 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AEoTmtCQDLqR59JCoBe5tsh7y4UceYLklSbO1zKBD56J1oT+b14+qJRvTbfTEVlpfmvPmzDX7WjqUPPEC5yGIphEzdJ992YWQSiTFdGsfwCApdnkf9khUMIpWlLXFbqXMkTafEdFNShV0XQbWZPxSheVZ9WsxgCU2HNmKlBK9pBJYFXcjhGUWRGjrJraMumcjL40DMqImrvhIRaupOsrG0GNy0VMcHiI0lpo8XzkU3FAjnCTJf2Raj4epCDxl5rHQb0jzwbe7TRGKxrxcvkZPbTUsZ0PIu6CLYKwUQkEHWs8TJjYQ/sKRY8aZYdpXzPi7cL3gYIjjHTPt8QDjoc9+BDnCrvRRU8xku4PZgnPSvzoXcwEBNL5Y7FJ+62qzUsxvCZWlR2ouxkjqnyFm1Xeb4OwT8GZylD1pXHXXGBBrBwihdh6HkyLhbu2ahIQkr0Z/I1QVSGbXacrYAwSobeZJCIvcrkUaYy3oJhN7dpvK5xnYHumpo6puGFVQuHSatbDoA1uK1RFJdx8z9x7l/l/tPpHTzFYoVfo4qGuCNjLwONn4pGaUSmoMovB7vAm/KlL+pdl9iubp9/CMXJ/Ns79J8co8vviBfD2UP9UiaCOO9FovfIfJ4Mb7v8OnQ/y35ftodh/5Jc/1UBw7e3kd8VjwMBZ6BMG+ARjXnZWfcoYEVxdVJsI0PZzToQ4MAgPCf1FT4YqbpozKyJVY6JckPIhzA== 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:(13230028)(4636009)(376002)(39850400004)(346002)(396003)(136003)(451199021)(40470700004)(36840700001)(46966006)(82740400003)(83380400001)(36860700001)(2616005)(47076005)(426003)(40480700001)(336012)(36756003)(86362001)(107886003)(26005)(1076003)(186003)(6666004)(7696005)(478600001)(40460700003)(82310400005)(54906003)(44832011)(316002)(4326008)(6916009)(81166007)(41300700001)(2906002)(5660300002)(8676002)(8936002)(70206006)(70586007);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 11:05:35.5991 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3aa0e75e-24e7-4def-b703-08db3c0f01d7 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: DBAEUR03FT013.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR08MB8986 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230413_042011_917588_ADFEBE1D X-CRM114-Status: GOOD ( 11.08 ) 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 The encodings used in the permission indirection registers means that the values that Linux puts in the PTEs do not need to be changed. The E0 values are replicated in E1, with the execute permissions removed. This is needed as the futex operations access user mappings with privileged loads/stores. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/pgtable-hwdef.h | 8 ++++++++ arch/arm64/include/asm/pgtable-prot.h | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h index f658aafc47df..11c81e700335 100644 --- a/arch/arm64/include/asm/pgtable-hwdef.h +++ b/arch/arm64/include/asm/pgtable-hwdef.h @@ -170,6 +170,14 @@ #define PTE_ATTRINDX(t) (_AT(pteval_t, (t)) << 2) #define PTE_ATTRINDX_MASK (_AT(pteval_t, 7) << 2) +/* + * PIIndex[3:0] encoding (Permission Indirection Extension) + */ +#define PTE_PI_IDX_0 6 +#define PTE_PI_IDX_1 51 +#define PTE_PI_IDX_2 53 +#define PTE_PI_IDX_3 54 + /* * Memory Attribute override for Stage-2 (MemAttr[3:0]) */ diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h index a45af0a22b25..f5a6de8588b2 100644 --- a/arch/arm64/include/asm/pgtable-prot.h +++ b/arch/arm64/include/asm/pgtable-prot.h @@ -107,4 +107,28 @@ extern bool arm64_use_ng_mappings; #endif /* __ASSEMBLY__ */ +#define pte_pi_index(pte) ( \ + ((pte & BIT(PTE_PI_IDX_3)) >> (PTE_PI_IDX_3 - 3)) | \ + ((pte & BIT(PTE_PI_IDX_2)) >> (PTE_PI_IDX_2 - 2)) | \ + ((pte & BIT(PTE_PI_IDX_1)) >> (PTE_PI_IDX_1 - 1)) | \ + ((pte & BIT(PTE_PI_IDX_0)) >> (PTE_PI_IDX_0 - 0))) + +#define PIE_E0 ( \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_EXECONLY), PIE_X_O) | \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_READONLY_EXEC), PIE_RX) | \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_SHARED_EXEC), PIE_RWX) | \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_READONLY), PIE_R) | \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_SHARED), PIE_RW)) + +#define PIE_E1 ( \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_EXECONLY), PIE_NONE_O) | \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_READONLY_EXEC), PIE_R) | \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_SHARED_EXEC), PIE_RW) | \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_READONLY), PIE_R) | \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_SHARED), PIE_RW) | \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_KERNEL_ROX), PIE_RX) | \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_KERNEL_EXEC), PIE_RWX) | \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_KERNEL_RO), PIE_R) | \ + PIRx_ELx_PERM(pte_pi_index(_PAGE_KERNEL), PIE_RW)) + #endif /* __ASM_PGTABLE_PROT_H */ -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel