From patchwork Tue Aug 30 10:48:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12959106 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 6C3D9ECAAD4 for ; Tue, 30 Aug 2022 11:02:35 +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=RAlXNXDMZ8nFq4NS1isZXTD8gjB9XCtqsU2ohg1TkpA=; b=Xi3HandsKXaXMd rhuoUkZJK7fLHPLM8oeDCYdoFdYUyPD8F7GFxh9W/ocbGt0OCdj00sByXmdO3dIrDTFxmqmWj42ch qiFRGOKh6IuNUVnkNd9IFuOdOTUzlFulMBVamz/BieolmLhxESx3USF99BFVvRuP2cHgXRxyv0bU7 iyA1PpqS/SUkb+9rwwz19+Ag4gpHkOP2P2H0+660jOATPyTmEwOjvPEKZhNsGIl9YkNC9F3FlrqpG 2iWUhDKg5xV/1B2H4CxSnmqKrvADB5gpV80D8h6SNqHn1ewZL8d9o6lEM4lk1HxFJPPHW/ugN6DkN iEzwUY7zT0LkjYZuUe5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSypu-00GIS0-AE; Tue, 30 Aug 2022 10:51:14 +0000 Received: from mail-am6eur05on2051.outbound.protection.outlook.com ([40.107.22.51] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSyng-00GHrH-W8 for linux-arm-kernel@lists.infradead.org; Tue, 30 Aug 2022 10:49:00 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Xid+2s/ZxwKZkRpFlXL3y2iO6b0bJNiSvCTv3EBwfXi4yFyZfEbE2FN47yn2J6QuIGs6Etf10NPUa/VRJRBtDBNYoDRVxV/l3MijGNP8DIOHNQUByuoSf+JxGYpBowcmlmMOXBHwbk5rOrfzmFymyOdJyzri6zEbKwfEaiOjSD56zCMycBI+t7quzvacMniMVMj8S5coO9eteN6J0lZbUy2nTSoE2AVTs+wfqcciEt+qMKY0Jfaif0PJ+dP9fXN+cOYYMZIC4Qg4vaAEcer/BTAVJKDcUzwQAm7qyNUgzem+ItZJIdNGSt4YLcgfv0yko3C5vHIAMUStBQ8b5tAo/g== ARC-Message-Signature: i=2; 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=sDy0YBHcIH9jYmIgUAW5lXLbpatP4IX3ebtaTJKVaK0=; b=Y2+NRXEKEl/wMH6v49LSH5fr4Wozoysaki0ZZVK+C4iQlEi+gHMtNY8ZKWxth33LqkEDU55t8hdlwR3Uw9+kNyuaDRYmMjnRjB5lijcNMyQKFlpcqp9fMWsSxRDvkdDyT0ZB73EY+ka1JX0IbX6fYZo2WUHG8WAxCI9yIqvtqNNGODdeKs7jI7g1lRpw94FwESxD9935dA1GRvxseR4kE9jFHsYUEr3i9VOi4G1EaGEvTPk2c9PYyVDWEF/NbnU+RrM9o1CXxu3db0Ew2dDrYxQDESh1gPpzUGCmx2En6n71gGJKdV/ihupiby000E4WFltmo2q8uWAW5ZsDQdPTJA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) 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=sDy0YBHcIH9jYmIgUAW5lXLbpatP4IX3ebtaTJKVaK0=; b=9U23j1DceUHYrvxZrgMR7em0FFkkvlPjtT0V/O5u9zxUC4wfNvVarChFLg9V7V/gdA+Q0lmrN1cnxQhOLy59Sfa++ijoN/ypYWruB9uoQvS9EKRMj68OOw3iNPpf8Ex7cD96162dAxnSA9k4UDYLAsb0Rs3q05ErFToOPxj3srI= Received: from AS9PR04CA0045.eurprd04.prod.outlook.com (2603:10a6:20b:46a::15) by DB8PR08MB3932.eurprd08.prod.outlook.com (2603:10a6:10:a2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Tue, 30 Aug 2022 10:48:48 +0000 Received: from AM7EUR03FT057.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:46a:cafe::1c) by AS9PR04CA0045.outlook.office365.com (2603:10a6:20b:46a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21 via Frontend Transport; Tue, 30 Aug 2022 10:48:47 +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=bestguesspass 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 AM7EUR03FT057.mail.protection.outlook.com (100.127.140.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 10:48:47 +0000 Received: ("Tessian outbound cc6a8ab50b6b:v123"); Tue, 30 Aug 2022 10:48:47 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e020170d1e434c83 X-CR-MTA-TID: 64aa7808 Received: from 5b87920a314a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3A06C7C9-D5BA-4EA2-A995-0F54A0C2A70E.1; Tue, 30 Aug 2022 10:48:39 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5b87920a314a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 30 Aug 2022 10:48:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jl5//uJCPkcK7Qncd9K5OjcZo9PlAvVDxZ8o70xzyCdrUiGXlAa44+vT+DjTI4SxYCVlou8VnctsCyPNt1OZXgLLkgg5IggG0Cdaa4AvOHzf30e7sHOjLP+Ve0gMqqFKwHkve1Ny5uaczyndo++MHD+B9s1pEI1ROTQbC+pO+6dUSB4VYUQIGziwpiMjqbuW1sDDeCqa1H7fq6rAYOO0+JRqWyUQR22ISVg+gtnWu5bvxepnA+Zq9OKwAXtAYAfFMTdKdclL+0uZbDw3/uxBXSAT95I/wN5B49LqZgaMFuGvjy7jT/ll1k5JMszaaqrWNubyMoZDfelNS3oE4TrS2w== 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=sDy0YBHcIH9jYmIgUAW5lXLbpatP4IX3ebtaTJKVaK0=; b=fu5kfFSGdkq693P8rCMij3hKolx87Tk4BANnyOmMS4ZTBxSmxUAEzhdxrOHKjnHnefZ0RE4F6+9bkF7+O4bkM0Lna8yBDAC6Kl7LOWddaFbXWG4HwEfo2IKr6Pdmcds364Nyhnq6ZMIuka3kowiWozacHM/qq/mFB9so8sQ7Pd+VbSg6z3i3CMBwstzTHpHkWAyOMF7asSOSXHuwY2mq6FhbZQOHQsEZ9eQgF8pCI4AEYfgi3sKlKoA0OIIRH29tcIhAmp6wSX+AuksXF6BzUBmnZDDA9833kSiFrZAIyRadywJfnrmChk+ahfknyVR4YDUv++SmXZVzLymM/7P+/A== 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=sDy0YBHcIH9jYmIgUAW5lXLbpatP4IX3ebtaTJKVaK0=; b=9U23j1DceUHYrvxZrgMR7em0FFkkvlPjtT0V/O5u9zxUC4wfNvVarChFLg9V7V/gdA+Q0lmrN1cnxQhOLy59Sfa++ijoN/ypYWruB9uoQvS9EKRMj68OOw3iNPpf8Ex7cD96162dAxnSA9k4UDYLAsb0Rs3q05ErFToOPxj3srI= Received: from DU2PR04CA0322.eurprd04.prod.outlook.com (2603:10a6:10:2b5::27) by DB8PR08MB5452.eurprd08.prod.outlook.com (2603:10a6:10:111::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Tue, 30 Aug 2022 10:48:38 +0000 Received: from DBAEUR03FT048.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b5:cafe::76) by DU2PR04CA0322.outlook.office365.com (2603:10a6:10:2b5::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21 via Frontend Transport; Tue, 30 Aug 2022 10:48:38 +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 DBAEUR03FT048.mail.protection.outlook.com (100.127.142.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 10:48:38 +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.9; Tue, 30 Aug 2022 10:48:37 +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.9 via Frontend Transport; Tue, 30 Aug 2022 10:48:37 +0000 From: Joey Gouly To: CC: , , , , , , Subject: [PATCH v2 1/3] arm64: module: move find_section to header Date: Tue, 30 Aug 2022 11:48:31 +0100 Message-ID: <20220830104833.34636-2-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220830104833.34636-1-joey.gouly@arm.com> References: <20220830104833.34636-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: a9166911-47fa-4dc2-94aa-08da8a75377a X-MS-TrafficTypeDiagnostic: DB8PR08MB5452:EE_|AM7EUR03FT057:EE_|DB8PR08MB3932:EE_ 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: KorwlHUpl38hEjk+fI8lMO5FC2ZAuec98YvTymLYSbKpm3ug8H4Y/xPCsTu4nDaz8rEbaXpAXFXTUCB47CtTEAfxg+IcTaF8Tme8LnJ/uKAurzF46w0lhqzxsITBRxLhjEo+IunuV/4qYD5Rg2K44Nsbc6j5Q1Wi5U7AKGHn6iAXg2HmgOLk26vaFkDdWktAiA9isbtobnrmpykg2GsUHb1n4O72pbfb0lu/TezICglEIKrd598CbJXq1r19Rz3qboDf85iswh0gKFuRWUusx0aRL7ASFHhZhpiv0NPQ6dygCAEDDgaIv3csaiGk8IvxPqK25+RfBb1t5cW/A66XAsrA3JtSMGJgeuWVhB5wQgVyToC/wMbATVTmZEMOqF5LI3WDtZrjvjjGD1P3aZczC96NJhmnPSUKtBFUqSu7feeSilbHIvLURn8+55xcRB5x8QwBVx7cclNB5GBuupI6NpjdfP8uU9rVGZV7A/N7z98GKI/Q5UZii5/nqOtedQ+DC37p1CA+CIF+dLd+gznav7v1//Hllz8WJE0xoc58YEg4Y/x41QC4argTMlo7MIeluWqVwf2f0UlIxPL/pCAYW4RbIUhaBwnDYLU8ZQE1wyFqOm0SrYHEHMehBxau8k6Vb0p3E/BP5Aw9yb0S9sqX/rNI9RiKWZrvOPOKpIUO94613p+9GOviVtcC7TrDuodZddQGnrnpg4axAMWhh568W5oXZWRFSt13M7mcR9D4F3cvou3s5XN3QRQdLS5hbZf7GfomzVQdhpl4pcUBo1uZAKhZIeBqiBMtCMO6KhtOCT5+gAhHwasEbyfwmoI2tTUk 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:(13230016)(4636009)(39860400002)(136003)(396003)(376002)(346002)(46966006)(40470700004)(36840700001)(6916009)(2616005)(316002)(82740400003)(1076003)(186003)(82310400005)(86362001)(81166007)(54906003)(356005)(36756003)(36860700001)(2906002)(83380400001)(70586007)(40460700003)(8676002)(70206006)(4326008)(336012)(40480700001)(6666004)(478600001)(44832011)(47076005)(41300700001)(8936002)(426003)(7696005)(26005)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5452 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT057.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 21005fe6-69d8-4347-5252-08da8a753236 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hWdBfzRfuQ8W9TUb3G2wg/yBpLPQOxmscoeYiyLJGFyY7+WfnWbcYWnxyc88Pp21PcMOupfdV3tOtUS8HKitxGu31tdkySVMzfO3iVgck4WHOZsfaQZVIHEJdf/DAfWVOkbC+1o3TFJEpUE+18TaCEkFtS9hzTco3IS9Ft9n3Rn2wxxNXHRqLJv0PPwFQ9k/JURrL25pWpzQ7KjvuWs6LIAGbcdbuyl77FCrvYj6K8k8wqvFUytXHmav+eMBOhn54TPGeyCRef6zi1QmiU9BWCI4kNe8sQ35QxORW0bmR/ZVTFAhDf2aquswf9m4pgxkJr4UenSx9MF/uqS8x7mdwviiwKgP/KmyMtIZ32Lv2YKIpBLPAviumR1wfaWTlbDz6PfdRLCPMAuDbIHMLoYRdh7E6WChJv03zxDZsXXuDGF8YHthGGOYqK8ci9+2uw0Db9/liPabNX+aQuCDR2pNtibsnWyDlTSNkWPVoq6f8SGyK8SE2izFePq3/Wo8jiY3bfeNnPpSeS7uavIphUT5+K7WPdjYrbA2KrDtM1qLMCH3ejNqk4F5VM+b8Y2+VfUIVnajV9vjwV6hbdbyvYTPU4qsW5H8DM45DrT5WMQD16Qncnuovth6QgWINZ07wGTPDFbEuweT39vKLlyTj7ZlqUddlPVEHRVCYz8M6AdzutilBDKq8jUZxtCZfpOMCaIzr3953t/WLSzLTBGaQ+FGN/F5r7aLNcb/4Vjfa9qKUL74R4mEa9FBuww/Jl3mfoeJsSDaQ3SBEoDZd1bUKGOToQ== 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:(13230016)(4636009)(396003)(376002)(39860400002)(346002)(136003)(40470700004)(46966006)(36840700001)(7696005)(41300700001)(478600001)(26005)(6666004)(1076003)(107886003)(186003)(83380400001)(47076005)(426003)(336012)(44832011)(2906002)(8936002)(5660300002)(6916009)(82310400005)(40480700001)(40460700003)(2616005)(316002)(54906003)(70206006)(8676002)(70586007)(36756003)(4326008)(81166007)(86362001)(82740400003)(36860700001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2022 10:48:47.2308 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a9166911-47fa-4dc2-94aa-08da8a75377a 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: AM7EUR03FT057.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB3932 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220830_034857_172421_346C1F83 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move it to the header so that the implementation can be shared by the alternatives code. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Acked-by: Mark Rutland --- arch/arm64/include/asm/module.h | 15 +++++++++++++++ arch/arm64/kernel/module.c | 15 --------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/arm64/include/asm/module.h b/arch/arm64/include/asm/module.h index 4e7fa2623896..22f1be47cc92 100644 --- a/arch/arm64/include/asm/module.h +++ b/arch/arm64/include/asm/module.h @@ -65,4 +65,19 @@ static inline bool plt_entry_is_initialized(const struct plt_entry *e) return e->adrp || e->add || e->br; } +static inline const Elf_Shdr *find_section(const Elf_Ehdr *hdr, + const Elf_Shdr *sechdrs, + const char *name) +{ + const Elf_Shdr *s, *se; + const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; + + for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++) { + if (strcmp(name, secstrs + s->sh_name) == 0) + return s; + } + + return NULL; +} + #endif /* __ASM_MODULE_H */ diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c index f2d4bb14bfab..76b41e4ca9fa 100644 --- a/arch/arm64/kernel/module.c +++ b/arch/arm64/kernel/module.c @@ -476,21 +476,6 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, return -ENOEXEC; } -static const Elf_Shdr *find_section(const Elf_Ehdr *hdr, - const Elf_Shdr *sechdrs, - const char *name) -{ - const Elf_Shdr *s, *se; - const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; - - for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++) { - if (strcmp(name, secstrs + s->sh_name) == 0) - return s; - } - - return NULL; -} - static inline void __init_plt(struct plt_entry *plt, unsigned long addr) { *plt = get_plt_entry(addr, plt); From patchwork Tue Aug 30 10:48:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12959107 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 1388CECAAD4 for ; Tue, 30 Aug 2022 11:02:44 +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=d9pht2/vEVFpRSQH+6wJPZBp+CAXX0J4vGmAdP9dYOo=; b=je/Z6EQp0pv4Uh C2CwBW94g7ZwoNB6FWi/3JEF4icBKmE4fWCcHM1OOB8JodTImOtfottcrxLLcv/U40WwYM30xFpjo 24ZO3+K37dsc9cnEo1D9et4OtgmjC+LHzDaQ8izc40hYJ5rYBuJnnRF8yMoKiXSgheQ9N3l6D6m7L 5jMnfL50u5ZuPzA9kQ10UWYidk9CeYfnIYjaG4yCe2iXdDaSV8M68Jq/9t+afISJTIh/Yd96j6xsa QwmRD/nunFiHA7Tqm6LdeNfzNilZ3NiIp0/ggLzRzT+uV+pOGG1G3iUup3Ik2TwJSf40PmMCl9+QZ HNyleSd6ahahve1L9ISg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSyr6-00GIvX-KZ; Tue, 30 Aug 2022 10:52:28 +0000 Received: from mail-eopbgr150057.outbound.protection.outlook.com ([40.107.15.57] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSyo1-00GHza-Vb for linux-arm-kernel@lists.infradead.org; Tue, 30 Aug 2022 10:49:22 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=BPb/8R9+/TAin3roxeGdOcNNcM7B3Dy1HDx9ZsDWiyldhoYv4/IFjeHlClKsUoFJvhBAGz0SzAivhGvvVbkR/oTJw4dNQL9ETs/vsJpDQh/l0G962xYtLOfWGsdTFsI/k0rB6g42i2OafFikBPHCrG/Km/b4P7kOyB/fSWiTvI/ZUejMtS8sVUBz9mMy84imbVc00tk97bT6HQ+/+o6nczFVafNwo9lPxxnkOySYHsl6ORyveVKi7xM6mEhiclJLLlM1cwEmtM+uWjsuREqF/mUDH5i58BEzxzQimqHGrybVIXvmKzx//0TEtepGLDcaU8eCR4tUoAixGZP608Kg1Q== ARC-Message-Signature: i=2; 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=d6+/UCR2MiSnuqgte8oXEX+334tRoHH8QDkDUsdRZUo=; b=OKPHuz9yDzvLMJWeZUSSCgxltoC+Q0JwTHMe7+GufguEIeTTJGEOzVbMb5UmXnwO+94MwoN871EBIlaDHzo/OclcmU4eVB2KPCm9RzNEu2sKZz/L2nUoiS+iZCBKTxR3VWZ1sVpb+G7Snv/b/5v/0oYQzXBA5FwTTy3eIBVjhKxpFGWvlZXFAGwPmhKWqXp+aqywvxsmIKotJXHxFsdrPKCetnQDKnwrwK55kybqcC/1msg4hUi820TxCDa5/y+U5DXWTMr0cjUAA551kYpK//pjdTJCYJ8ig0Eqs015jTPu/v6BjW3WmmDntKtHBA6YMgTolVruKUOvr+P2d2br+A== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) 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=d6+/UCR2MiSnuqgte8oXEX+334tRoHH8QDkDUsdRZUo=; b=n/EVfu3E0PFm2p5t4DkL7XKUCF9u0JhTl29Rd7fry0ZtOuF35KvZsaoIXlmzKYnGm/JvNdOu7PXDmyY3IYovK94AB0OsN/8fJQRzBZjpNjX9KQL/YAePIZSKCSl9qI7kzwU5P2tzNGovpwDtuAW+r068zx4qXFUiO7NN605y+ZI= Received: from DU2PR04CA0069.eurprd04.prod.outlook.com (2603:10a6:10:232::14) by AM9PR08MB6999.eurprd08.prod.outlook.com (2603:10a6:20b:41a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Tue, 30 Aug 2022 10:49:10 +0000 Received: from DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:232:cafe::e6) by DU2PR04CA0069.outlook.office365.com (2603:10a6:10:232::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21 via Frontend Transport; Tue, 30 Aug 2022 10:49:10 +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 DBAEUR03FT054.mail.protection.outlook.com (100.127.142.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 10:49:10 +0000 Received: ("Tessian outbound c883b5ba7b70:v123"); Tue, 30 Aug 2022 10:49:09 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f6ab031f17d23de4 X-CR-MTA-TID: 64aa7808 Received: from 9350c361415a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BDA31C4D-D037-4C5B-BCA4-C99A8BFAA9E7.1; Tue, 30 Aug 2022 10:49:02 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9350c361415a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 30 Aug 2022 10:49:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D7llfDyX++gZBH5mJ3Acbm0GqWFvbal2/Lr3+3pG8Si67ZUAKNcA1AkDQDHDxy/GPTt1MmQ1p6Xj+Qi8AJnUGDDkzAjJZtKgf5/LiJhewK5N0MEDBra+KMC4cjaOlOSp7ahmSco1M2i5IdH+BvBIAFfnD6dc1NT1n0AOf/CRG5TLCwbQci0qkl0k0Qj7Ue0nTsDVDI0QQGUKWwm2pqhknlyQg5kAxZYa/ntLPUXVDBRMbDs8X/YOamyp2qXhMNMcyoz8kHRHA7KvTyDjms5nxJUz8P1yQ8yGIS6lgR+bg1wHrB209Yf/tXBAM5HOM3iMCyuWpX7lZc7bduxELMj5rQ== 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=d6+/UCR2MiSnuqgte8oXEX+334tRoHH8QDkDUsdRZUo=; b=Wwz/fBvL7gP4JkAD5h1FUAzFEE/sItJJWb1dIJl46sqQPAOCe7klqZzqaOufG1joWEw0CRoTYetPXA2+G8+lnYp9fzxHn6uxpnnudBBklBEgW8cjEzKhmN3ENWvKuHnVkHYSODzBswH51AX9uFcjlb+am1vK6DKgUlF4cBrbkJ7YPbuYuKGqCImdmfyZ2cMd8T7t9r5LSLXOFat14xEOtmzikSURFJxpgVkWVPZm7MwRbbFXEOIIBkuJvrXo0KH1jHtT7kq8tZvvEeMyojPryNrVZlEO28t9gnV8B+gVN/N/UnqrQrTI72E4okkqyHzyE1rgwLgpYdyaEZZwYTeKZA== 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=d6+/UCR2MiSnuqgte8oXEX+334tRoHH8QDkDUsdRZUo=; b=n/EVfu3E0PFm2p5t4DkL7XKUCF9u0JhTl29Rd7fry0ZtOuF35KvZsaoIXlmzKYnGm/JvNdOu7PXDmyY3IYovK94AB0OsN/8fJQRzBZjpNjX9KQL/YAePIZSKCSl9qI7kzwU5P2tzNGovpwDtuAW+r068zx4qXFUiO7NN605y+ZI= Received: from FR3P281CA0070.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4b::22) by AM6PR08MB3416.eurprd08.prod.outlook.com (2603:10a6:20b:50::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.16; Tue, 30 Aug 2022 10:48:59 +0000 Received: from VE1EUR03FT053.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:4b:cafe::ca) by FR3P281CA0070.outlook.office365.com (2603:10a6:d10:4b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Tue, 30 Aug 2022 10:48:58 +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 VE1EUR03FT053.mail.protection.outlook.com (10.152.19.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 10:48:58 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2507.9; Tue, 30 Aug 2022 10:48:38 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.9; Tue, 30 Aug 2022 10:48:37 +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.9 via Frontend Transport; Tue, 30 Aug 2022 10:48:37 +0000 From: Joey Gouly To: CC: , , , , , , Subject: [PATCH v2 2/3] arm64: alternative: patch alternatives in the vDSO Date: Tue, 30 Aug 2022 11:48:32 +0100 Message-ID: <20220830104833.34636-3-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220830104833.34636-1-joey.gouly@arm.com> References: <20220830104833.34636-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 70ea9d8d-1b35-4d0d-8dd5-08da8a75450a X-MS-TrafficTypeDiagnostic: AM6PR08MB3416:EE_|DBAEUR03FT054:EE_|AM9PR08MB6999:EE_ 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: dOCUf1woTXJhXjBgJiTe7nFPReLFkNF8YSUaFeE8HSRMGcqG7Y9bvIRGmUcGKkp9Iib50h31nCye+wSR34IWOCm0rdHrlDux554hcnDLUylxp9KK6cu0T77P52rzUnlGf6CD/y6Dx80H5Xc/FDYUfpnPA38s6xctlVTm51SPsdYHqewVBANzs93gd1RcctyyHug8KLjQkCy/xJTMGe6qYK2oHRKjWbpOA9ks6DE9uHVbT5VCuKtFZMxH7aiLj2pcYMHGzPbCzQ0py4MOj+sp+pl5UbBGFXNt8yvX5BJ6lm0BqptBZ2WRPSSxfkf63MepgtzKuouU4Xfg2pVlIlC8T/Nf9kz9izk0Xikw3L410RrEYhKzJdwPU3XR6ttCT9efd6fKKo5jByMd4Ju0L4A5K0uX+HqF5r8IIVXV/Td9wlAgAg/rN5SuuE/67n+2B5d6o/Urxl/jtuZDC+gs0e/1M990lb9+45x5TyKHSELGgUXavpifvBla2/3Id+ijv5Ac7qmbM/8w2Ln7de2oSufz/DhBOZ3pWNIpMFtcPGeHrjglIwss/1lFblPiTGRQl4ZRUy6NYIQUWwYg5Ii2RfxYi6nEHUXdzPEXapryLlib7ts+jRcoqqsv3uA+rLLJjWH5Sy6A5pCqTZjY1PooaUCXaN2x9Px4vCSyfZVyfsr6u8Ew3sI6mzq4WBVn0xXMHE/2D+T/eV0EbmihcV+rmamkr5fn2RE/yiDbkgM8NkVIop0HABT6ls6tNs3eH8YJjvJRYRcM59nxWdoYJEd4GM8iD/kTScAzulEna451gEoYr8NcZ+8zRiPlFdIzSLWlrGXY 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:(13230016)(4636009)(376002)(136003)(396003)(346002)(39860400002)(36840700001)(40470700004)(46966006)(1076003)(2906002)(426003)(186003)(2616005)(316002)(5660300002)(336012)(41300700001)(83380400001)(44832011)(8936002)(478600001)(54906003)(6916009)(8676002)(4326008)(47076005)(36756003)(82740400003)(70586007)(6666004)(26005)(7696005)(81166007)(82310400005)(356005)(86362001)(40460700003)(36860700001)(40480700001)(70206006)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3416 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8046c7b9-5c4a-4160-c688-08da8a753e5b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sGzlOpW+xWScIGgP/2SUrx4zHvlyy3fidHcAwUvN7PSRpr/BQZA0Tn49gFfmtJ9WbktCKyKPh6pKNCtJUCMA1KJG2Wmr1zKdlUV5azl9WxIbTSNI6PPJ00xdlzB7eJob8TxDb/jANyIOwmDfRpdpIwk0vKo+ppNpBzvj8SlIGH/v/FOFvuBqLSCNHkMt0FM1x2mx8tvp5YN1ysoqrkw4/gh8YMTbjIRBS8vo2XIHwus1kkeBGiH3rQImxWAcZrPXGUt1A4rzMxx1HdxELvABd0UriQA4Wgqzomo1ub+yiJ57gNDYsPrsUw0gasIaqUYUOB8GAihRVP+YEADZRICf86nHwSc9+n/2VfOoqK7xhkO11ZF7//6k15246U6aAw+rZLUcHWrYe5fAQ1A6oqqE4CYJQwMnVxL0HSynr0OlsjJJ4wVNnRiE1VYp6vBcV2pea7gFu5gcgg8tQ4pjbsNpZ7FDn/IMMuvndDL5CyGniY1r6sagcVblX99DyE27jC5ddkTo6vu7dqvW4xvmMLh4rIGF4zQR6s1yfwWY0fz/ULeewvLAnZ5rVbmLLT0XgJEToKTxlZAWUquJj6OrhlmcvxH/hO/A3qzQnCdesYKyXIoxQ7aNx0TGWoTdlnOQ3HUJOd/izdC1Kv0RGg4GA3RxJ5KzioB0BujCg4Vy6HipB7/m1hc6Y0IIbkTvFfkW4SmqzviN9EEsjZdQxIirHpZWZhnpYO3QTlDo1isZM1IOyoKHoyCdh5rVlOMH4yzY7wce+bobFbOeeEgAxqdBO/ADnQ== 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:(13230016)(4636009)(136003)(376002)(39860400002)(346002)(396003)(46966006)(40470700004)(36840700001)(1076003)(47076005)(186003)(2616005)(316002)(6916009)(107886003)(36756003)(44832011)(7696005)(26005)(83380400001)(6666004)(336012)(2906002)(426003)(86362001)(82740400003)(82310400005)(4326008)(36860700001)(40480700001)(8936002)(5660300002)(41300700001)(478600001)(8676002)(70206006)(70586007)(54906003)(40460700003)(81166007);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2022 10:49:10.0472 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 70ea9d8d-1b35-4d0d-8dd5-08da8a75450a 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: DBAEUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6999 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220830_034918_178010_3C8284AD X-CRM114-Status: GOOD ( 15.00 ) 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 Make it possible to use alternatives in the vDSO, so that better implementations can be used if possible. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Vincenzo Frascino Cc: Mark Rutland Acked-by: Mark Rutland --- arch/arm64/include/asm/vdso.h | 3 +++ arch/arm64/kernel/alternative.c | 28 ++++++++++++++++++++++++++++ arch/arm64/kernel/vdso.c | 3 --- arch/arm64/kernel/vdso/vdso.lds.S | 7 +++++++ 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/vdso.h b/arch/arm64/include/asm/vdso.h index f99dcb94b438..b4ae32109932 100644 --- a/arch/arm64/include/asm/vdso.h +++ b/arch/arm64/include/asm/vdso.h @@ -26,6 +26,9 @@ (void *)(vdso_offset_##name - VDSO_LBASE + (unsigned long)(base)); \ }) +extern char vdso_start[], vdso_end[]; +extern char vdso32_start[], vdso32_end[]; + #endif /* !__ASSEMBLY__ */ #endif /* __ASM_VDSO_H */ diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c index 9bcaa5eacf16..a97775963f35 100644 --- a/arch/arm64/kernel/alternative.c +++ b/arch/arm64/kernel/alternative.c @@ -10,11 +10,14 @@ #include #include +#include #include #include #include #include +#include #include +#include #include #define __ALT_PTR(a, f) ((void *)&(a)->f + (a)->f) @@ -192,6 +195,30 @@ static void __nocfi __apply_alternatives(struct alt_region *region, bool is_modu } } +void apply_alternatives_vdso(void) +{ + struct alt_region region; + const struct elf64_hdr *hdr; + const struct elf64_shdr *shdr; + const struct elf64_shdr *alt; + DECLARE_BITMAP(all_capabilities, ARM64_NPATCHABLE); + + bitmap_fill(all_capabilities, ARM64_NPATCHABLE); + + hdr = (struct elf64_hdr *)vdso_start; + shdr = (void *)hdr + hdr->e_shoff; + alt = find_section(hdr, shdr, ".altinstructions"); + if (!alt) + return; + + region = (struct alt_region){ + .begin = (void *)hdr + alt->sh_offset, + .end = (void *)hdr + alt->sh_offset + alt->sh_size, + }; + + __apply_alternatives(®ion, false, &all_capabilities[0]); +} + /* * We might be patching the stop_machine state machine, so implement a * really simple polling protocol here. @@ -225,6 +252,7 @@ static int __apply_alternatives_multi_stop(void *unused) void __init apply_alternatives_all(void) { + apply_alternatives_vdso(); /* better not try code patching on a live SMP system */ stop_machine(__apply_alternatives_multi_stop, NULL, cpu_online_mask); } diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index a61fc4f989b3..ac93a2ee9c07 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -29,9 +29,6 @@ #include #include -extern char vdso_start[], vdso_end[]; -extern char vdso32_start[], vdso32_end[]; - enum vdso_abi { VDSO_ABI_AA64, VDSO_ABI_AA32, diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S index e69fb4aaaf3e..6028f1fe2d1c 100644 --- a/arch/arm64/kernel/vdso/vdso.lds.S +++ b/arch/arm64/kernel/vdso/vdso.lds.S @@ -48,6 +48,13 @@ SECTIONS PROVIDE (_etext = .); PROVIDE (etext = .); + . = ALIGN(4); + .altinstructions : { + __alt_instructions = .; + *(.altinstructions) + __alt_instructions_end = .; + } + .dynamic : { *(.dynamic) } :text :dynamic .rela.dyn : ALIGN(8) { *(.rela .rela*) } From patchwork Tue Aug 30 10:48:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12959116 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 7783EECAAD4 for ; Tue, 30 Aug 2022 11:07:57 +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=J+5m/Kuyj9ae0yCadjJoJ/lv2XrarjCEIiro0ZpTTu0=; b=LZ+hbWeBclUKE5 YgGEP6G1worKkTrBpQZsHGOyob6fSW/SZHUvcDtQ8SEUWbhvpGhjEDGWCHEcK/2Tt9JkZ19yqsqAw lRMxTuP4avgSkUXh7vUaCbiT9gZg3bOL4yRUNCZwwtEWkKVczBHgT+jET1IlA+8Ww5cWcdVaeV2q4 e8PeQ0jzoOJRFiDLCnvJ5tXtJ1c7GoeJwu3mNdyy6shHU5u4xzZAD1CWh93icdKha8RP4gNXQsB3L bSP3894gdF18dT3KO2ZfN4aWe0AwHJ79KhMYcdjZ2mJ5rMgaU2M4JhDYwfSRD8LT6RWln0/A6Zqko I4bXbDn62cgKKJBtha4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSz2N-00GOXG-HI; Tue, 30 Aug 2022 11:04:16 +0000 Received: from mail-eopbgr70088.outbound.protection.outlook.com ([40.107.7.88] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSz1Z-00GOBl-Us for linux-arm-kernel@lists.infradead.org; Tue, 30 Aug 2022 11:03:22 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=RvDJxptXlJ78XBI3N1uu0NyWkJ9GXm+5jhAO2kFkeMYz2FPiuRRl9Xv93bAM7APgSG2ZKGCT/EumnfSWMnBB2CicBdCy9OR+kmfmChfSsCLKob0Vc0sEgEKDdRm75186wW5PRf1qcltaTVTtc8DmXFb5Qaz42Dq5TTFp5OCA8FJ9nN8as3PNLKcTEkBeKHk1k5l3v5icR9S1ocbFD1HrdDccRMfI6wlTdzB17vR01M/LotroH3h+m450tNBTwLaTF/sXANEYX1qo8kghsuxpt9gmUnGV5sxQmnWnYOy3TMCNsGCEZYKXVBSiS0lkW3vQR7kxvs0gxGaC0wkyng/94w== ARC-Message-Signature: i=2; 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=GULmGIjFLBUDLBlhjtZ1vX0gEb9BmxWwOuDN1QHMhmw=; b=hDJuDcD4uSXchDKTwEH1BCKN605bmATKjv7QdhTT9exuI79mzRp3sOY0EsxXMVmqDLJnkIHXAusQCiLlZY8Yn5u6RI9kuJdsgWls+MBVy+xFc/y2hR3jBtTJVYWUYOsvl6UokEyjlFzG6WIXcSpQNgxF/10Y3KPbht45JMuCBOg4mMZDlqEQIIDb8izQVsb6Uda2zwiEoQ8M/n3QpG7ByQ1ACi4BCaqItKkoIxwzCRUEirbg239N8DLi4MP7txVFzd+6bl1AJ+I1CiewVKjUyTd+jdycqkXu7HzlcZhAb9IfV2q6pwlpMGkinoVpfgMsKGKRmX2IOD3F0aAcUgX+xw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) 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=GULmGIjFLBUDLBlhjtZ1vX0gEb9BmxWwOuDN1QHMhmw=; b=dgbD2dogvzx665HrhTsinXap3E5/r/oV8QW0H1pCpYd1DGoVyi6E4cZM9AgP8reBC1eMjKhlX6jKfkgaezNnrkzZke4msLVowQsMOYeq/W2Kn4OzODnIejqzOAXSyv5K7JADQyhxwJPlLIPxiZnkMou3AzED0X2+6hAVFOivlDg= Received: from AS9PR06CA0375.eurprd06.prod.outlook.com (2603:10a6:20b:460::19) by PA4PR08MB7484.eurprd08.prod.outlook.com (2603:10a6:102:2a8::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Tue, 30 Aug 2022 10:48:48 +0000 Received: from AM7EUR03FT012.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:460:cafe::f7) by AS9PR06CA0375.outlook.office365.com (2603:10a6:20b:460::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 10:48:48 +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 AM7EUR03FT012.mail.protection.outlook.com (100.127.141.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 10:48:48 +0000 Received: ("Tessian outbound fa99bf31ee7d:v123"); Tue, 30 Aug 2022 10:48:48 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: dfac08aef188c36b X-CR-MTA-TID: 64aa7808 Received: from e84ec40945b6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D64521A5-40AA-44BA-9CE6-358637A1F060.1; Tue, 30 Aug 2022 10:48:41 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e84ec40945b6.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 30 Aug 2022 10:48:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=niFYhqy/l1sSNGfF8U7xKh+hJDRZ0HVduht1j3Tz6Z4Dg/MLY4c+Elq/GXbEF5TNfQrmzlC5Y9xbN28BaC1qFTKnKhEzQ0/nu/35duxS60527cCesXrVLOgJutXsBNPbH18Ie+skPZAr3M13U28wrO5jFnJRHvGedlx7v2aDkwTqLMLEaSAk9hK7oTNUBJuzcSdWw+vQ3PXQQPTrabDoJqru32PsjKVJaFYy4Oql8rFAYHefFxds3FMD4M9+QUcnQay8hzx6tbYyAdqwqvIEX7Pnk8Ub/b7dwu3XynskixPExPj5XDUdlDnB5ZY4aD6A0R4V5XAzlrzaE91+Q8ClMg== 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=GULmGIjFLBUDLBlhjtZ1vX0gEb9BmxWwOuDN1QHMhmw=; b=n+R5gsxyGKOL9g1bFjkV2/peTasJF6ZqhKZWF7u4/f/TZG+TFAt5x9VRCuFp5mGuFQ1z0x8HJ28ONOkwIY9fh38e2sG3taVokYhMpjm6MdX9CwaI5+WE74OXdE27EtiW4WSPUrXpiAhDtIu1y2jZ4lPcSXQh+Ck9xEJQfrkT3CL6kW362rdxoW5ygnMAIKB0w7t7I9bfzbGAsTfoCEgP0MqJ/fEVVU+AfOJQR0jaz9m5vnfbsGx/x23xLv6ConSYx5lttBQiaQNNrV/3uR963sO+cS8r9EwKUags/rmzdiulSmL5WeJItoicKRyI/VOJZ6lO+bVFYMNMbgR7BfHiEQ== 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=GULmGIjFLBUDLBlhjtZ1vX0gEb9BmxWwOuDN1QHMhmw=; b=dgbD2dogvzx665HrhTsinXap3E5/r/oV8QW0H1pCpYd1DGoVyi6E4cZM9AgP8reBC1eMjKhlX6jKfkgaezNnrkzZke4msLVowQsMOYeq/W2Kn4OzODnIejqzOAXSyv5K7JADQyhxwJPlLIPxiZnkMou3AzED0X2+6hAVFOivlDg= Received: from DU2PR04CA0327.eurprd04.prod.outlook.com (2603:10a6:10:2b5::32) by DBBPR08MB4695.eurprd08.prod.outlook.com (2603:10a6:10:db::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Tue, 30 Aug 2022 10:48:39 +0000 Received: from DBAEUR03FT048.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b5:cafe::9f) by DU2PR04CA0327.outlook.office365.com (2603:10a6:10:2b5::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21 via Frontend Transport; Tue, 30 Aug 2022 10:48:39 +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 DBAEUR03FT048.mail.protection.outlook.com (100.127.142.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Tue, 30 Aug 2022 10:48:39 +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.9; Tue, 30 Aug 2022 10:48:38 +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.9 via Frontend Transport; Tue, 30 Aug 2022 10:48:37 +0000 From: Joey Gouly To: CC: , , , , , , Subject: [PATCH v2 3/3] arm64: vdso: use SYS_CNTVCTSS_EL0 for gettimeofday Date: Tue, 30 Aug 2022 11:48:33 +0100 Message-ID: <20220830104833.34636-4-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220830104833.34636-1-joey.gouly@arm.com> References: <20220830104833.34636-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: dbb3c8b1-4463-4688-fe1b-08da8a753816 X-MS-TrafficTypeDiagnostic: DBBPR08MB4695:EE_|AM7EUR03FT012:EE_|PA4PR08MB7484:EE_ 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: /13hRWRQHSXu6TAKALP2Q9Urq9Hw5dv0xFQLqhDBQlGPLEMdVotxyfOPZ5yQm0+Z4jg+AyL4FpN9jlnxs6rrFowyvhX6/CO9fPxIHnyoVBjyGgn8COEzEKELeolEswSfgx8d91ghvGy8840YluxUE2cRvbao7cS7uajga1IqG+AO/q6vVkSFgfjSDqnGQZtYO5GhaJ3v3CbqTalC3Wo8bGpk3sE0FqJ2efR2up9ONGPvjTYrGUyo3HoAOjSYrgvn77jWf+b7DJjaJWgoWLyoPYPfEV209H6DRFCmnBjtyqvU9+VQ0132fRy0OCze+EnFzsvivdo+ybwu/ZBXTlcMgLYvTdw8azLz2QGzL2dVUxCNEJ6aN0plFiDuBVCGV3xzX0ZPa9lbz87POlW/TTWrBcp4Mn0EFcHd78lhaU2qiIffW2wsBI1gQf+inHUBGPoQRXVete1kEKh5xRC5Ju3uPkXFELKt5mW5u4ahnfuPnPaSNWXX8ruZgKCSPeT/7cnCQ90MiCfeSKZKswGyxW3/5LVaSkFQhwyXQahB4WFR4tZt4bkjXyQbJfig7bLZvzaUhrEUNNvxmjtnF3uMZtNB/5qjzFZS38WQHyONFx5PB/noDmmZO5f/5+jZjgB1eTYe7x3rJmC/15bAl3fn7s3Akbh3/R/PHMVmb08Z+w5QbaA8FGGv54H3JDO9K+l9d4ks+VMLGAm8aTCq+inlU4uELS3HJrkWO8KLEKWJ98H69J0H8jQAQzCorX5BVHe5n2iKee5lvb1nuZsC9LxZLE+DiS9Qes6TEMWuA17PWbi7BAo= 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:(13230016)(4636009)(39860400002)(136003)(376002)(396003)(346002)(46966006)(36840700001)(40470700004)(6916009)(4326008)(70206006)(70586007)(316002)(54906003)(40460700003)(8676002)(82310400005)(8936002)(36860700001)(40480700001)(5660300002)(2906002)(356005)(82740400003)(81166007)(44832011)(36756003)(6666004)(7696005)(26005)(86362001)(478600001)(41300700001)(336012)(426003)(186003)(2616005)(1076003)(47076005)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4695 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: c10b12dc-a4aa-4c70-a846-08da8a7532f2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0aHWdCIRZR1mNukaCqLrz0KdEMFIzy+qjPycXR5UVSFJZT4X9dcPJkyO8VO2b7N9BR+ZY4eZTGxCEQ9o+ceRGtvlN8GIlFL+9wlGTq4a001EwtRqX1vlnpEVA4ChESQDdGt80gxz4MvANKJaPVcEHtUnqf8SJgHsxOVPicK1huEUsScyiCSB63LYg/v6cNIs2PYdQgTHYWQC1WTBZy+CQnT8VzN3Ul1f+YtPbJz8m6qp/WFhBd1XN5Zdb6DhTwChkvotk6fO2xyeydCG8uBz0eCAZlmnJixHCoL+jmFS5eBNsicFZa1CSx3B6uWiVaJArUAjCjLJw7aByexi+IIsTi3CWXlKX45fiY0Ft46xuZP82EjqhH+XA7Cuw5E6L/UekZZSAKh0hRi07j1h4gzGwm6gIByaHeXOWMRVvzbXwSF8SrvB6AOaOgFvqgugxdG69g6L8SI+aGosTQnxpadcM6iBc2/7dKWwiNTMNrQWhRYDxjhZBkMTiZvXHycBXXOGDq3XwDnW+17TBpJXcA96cA4RWQYLUT2pb5o1meMrDJHi+tQWIt9gHgpGJ1KMNWtA6UW1KmVor2W+/AQJzwCLlDsKZ26suMKAB9JKo4XFhnJA/jVu0e6SW3TxaGrh5lW2oTXMoETgNhT5On8WdhhFc3NCN7Yt1JOzCEhaOyfDXWwgl669u4kY9ZMWD79mG2KAQ83yGa3hrYpFO9EqUkL7mHzwbsqPiv2Ch1Qd+AM5Dw59QDhZYoTP1CrmB+PkYU3zvYZQR8XEhXcMpyM0vBN7fg== 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:(13230016)(4636009)(376002)(396003)(346002)(39860400002)(136003)(46966006)(36840700001)(40470700004)(6916009)(36860700001)(81166007)(82740400003)(86362001)(40460700003)(316002)(70206006)(70586007)(2906002)(54906003)(426003)(47076005)(44832011)(83380400001)(5660300002)(1076003)(2616005)(7696005)(4326008)(8676002)(186003)(478600001)(82310400005)(40480700001)(107886003)(8936002)(26005)(6666004)(41300700001)(336012)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2022 10:48:48.2559 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dbb3c8b1-4463-4688-fe1b-08da8a753816 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: AM7EUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7484 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220830_040321_381540_4AF4938A X-CRM114-Status: GOOD ( 11.05 ) 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 If FEAT_ECV is implemented, the self-synchronized counter CNTVCTSS_EL0 can be used, removing the need for an ISB. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Vincenzo Frascino Cc: Mark Rutland Cc: Andre Przywara Acked-by: Mark Rutland --- arch/arm64/include/asm/vdso/gettimeofday.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/include/asm/vdso/gettimeofday.h index 4f7a629df81f..764d13e2916c 100644 --- a/arch/arm64/include/asm/vdso/gettimeofday.h +++ b/arch/arm64/include/asm/vdso/gettimeofday.h @@ -7,8 +7,10 @@ #ifndef __ASSEMBLY__ +#include #include #include +#include #define VDSO_HAS_CLOCK_GETRES 1 @@ -78,11 +80,20 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode, return 0; /* - * This isb() is required to prevent that the counter value + * If FEAT_ECV is available, use the self-synchronizing counter. + * Otherwise the isb is required to prevent that the counter value * is speculated. - */ - isb(); - asm volatile("mrs %0, cntvct_el0" : "=r" (res) :: "memory"); + */ + asm volatile( + ALTERNATIVE("isb\n" + "mrs %0, cntvct_el0", + "nop\n" + __mrs_s("%0", SYS_CNTVCTSS_EL0), + ARM64_HAS_ECV) + : "=r" (res) + : + : "memory"); + arch_counter_enforce_ordering(res); return res;