From patchwork Thu Aug 25 10:20:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12954486 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 3D696C28D13 for ; Thu, 25 Aug 2022 10:22:18 +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=kJBpVpraQOJKaF+sxNMei7lT5ufr8JBJrGFFrEIu/eU=; b=y4VYnBc5QP2kYn zsNo301Azb04mwX6OyvJSk1af5cefupnB2bL2zTiN2lLBdlBrkadHjN3J27ApVIUrUCCWwoTDan8L cmbfvdT1vRDQbqqfUjPQDFScmg9/xUPxlKlxQ/nwMYhfr1a/rqBAHV4i4YSqn7gM5SUBlnK5W58Tk 7y7H57NFw626jtw5BOEoS7DkXhqxXs3v/I2kBmWzZY2Z14Y5r1DLh5UeZpoi6kggpJkBOLFs1E5F1 S3VtvEW/uGZGNj7vqbs+coIVAN10EhLpuN3qPux62JfqR2QVhjTng4aPIxapJ2ic0B2PecZ3dhxJL Lj6jkskJCaq9uCfh1h0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oR9yp-00BoyK-Mu; Thu, 25 Aug 2022 10:20:55 +0000 Received: from mail-eopbgr10074.outbound.protection.outlook.com ([40.107.1.74] helo=EUR02-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oR9yk-00BovW-Eh for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2022 10:20:54 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=AE9/88rhqS9Y7lyRIHR5UbKpOw3w4gjX0+K8O9eJX2oNDEakkZyWprdVgfCufXq0U0lHqsBiQS/vxkQWZV140Apx2IUUVZSWXtTXmQ5687xkLRR4Zxtc2j4jpCWk0qlD6EIEgXnVzaX+7flDcGxcMR20aybHgJqziDhJ4tlTglBTSD/8qAyO9QmaWQ9gBgy2XvW+PGcMW362617AXCuA9LWmxwb8Y4MpWyWtXwgRgGXV3s7c9WmvGVSOpHXGAIxnp/Cbg0nsT7Dp8Gew5LIbmWU8hXOI8cUVX3Fid6M50MyTEmphokNxUDvgp8BaObkKmpwWI8xdZefO0nF9yxKG1A== 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=SXkn6rfiWWr5ESJ1K0yJAhpOlINgZ93RrpKL+3Ii9a0=; b=aXTEWh3m+E9bQoDXyHvPIZ5gjaRa/aNV1J2m9Ty+WyPU0Prrd7L6z9ZcE6H9aVBsvhIDSN8lnq9gjsOYu2wNSmv0AONB+pnpTdt+ToIL8gE2mpTx2rpKSiJCgqQ946AOH58aQcUgK+/DMhcHH/dLEG49vVhUWWzfkaGfg+XvKJTFWkSft1OsYhwCbwkd/SPjJxVDhmyd8p9/ypdbC60va3ZlpBj7wncO/PuQi+I+GAjfYM3VVqkyedvu8oYW8q/u/yG5mbrFGH9R0roz7+0nJZeCUBlVsZQne5IGIFYx/oUu+lSVshHuC8YAdb5Cs6X8hj4oir89CzJNzShIixl4EQ== 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=SXkn6rfiWWr5ESJ1K0yJAhpOlINgZ93RrpKL+3Ii9a0=; b=4zahZ0rD15k2BbjCL7IrTji4vxeh2zhdvM2CGdfUJypS0uZOsg0Xvyf+3KEXJ/LW0Q4+qSAQuDcC3emSHttkKUBEuUeqER1iiugDCR86Q8PJCxegyeweEwbNRej2xGWvgf5pOkjW2lyO4TV6Qen1oNIbT8qd1g6UBZHNTV4DtFk= Received: from FR3P281CA0118.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::13) by AM5PR0801MB1666.eurprd08.prod.outlook.com (2603:10a6:203:3a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 10:20:43 +0000 Received: from VE1EUR03FT060.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:a3:cafe::98) by FR3P281CA0118.outlook.office365.com (2603:10a6:d10:a3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.3 via Frontend Transport; Thu, 25 Aug 2022 10:20:43 +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 VE1EUR03FT060.mail.protection.outlook.com (10.152.19.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:20:42 +0000 Received: ("Tessian outbound c883b5ba7b70:v123"); Thu, 25 Aug 2022 10:20:42 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 72efe971f0e38554 X-CR-MTA-TID: 64aa7808 Received: from c2a0128939bd.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5F48FB44-C6DA-43C0-8BBF-C153D009F23D.1; Thu, 25 Aug 2022 10:20:35 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c2a0128939bd.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 25 Aug 2022 10:20:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ImqR0Qaidoj+rrkyNcNhRdjkwaPitZ1CUyPKjP0A1iFCak5eas9sQZDt4H+mzFeh07w+SYOcGcF6LyS/VBXikiHrFJdV9kHwtqcBn3YzNeyHe0qmLk7KRQDWOtSCPSp+j0IpZ+QPkN6kVyaAIctBYCrfr1hVQkbxsW+fPEFjqHIlRyzxTQ1J4kiRDp6lUgm5o+7kx5+cD4syMV75wkFOwVdEZM6uttZqgEu/B1gJGjoUUpym3NDhW8ETox/a93mQMxO1Oi4JozMe+NLF0x+pY15dQmno/KAcBFHqD0m/nUhFq7LXTqn3ijXjCZZrC4kqrQrl/9pSY38hWBsR2vQH7A== 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=SXkn6rfiWWr5ESJ1K0yJAhpOlINgZ93RrpKL+3Ii9a0=; b=R+0EpU5TLBXAM7cyCb+liNVzvZGZRh08NX8Rrct6I57jKiIZrpe5PFkLRoYf5ZVjDX1jsr67khRrKxLIo9YhUTa90wV0VC6VwW8xpcJD3OVQpxirnSzm/8NNRvlLKUlxScrdhMIFbU2thdnj5yZaB43MxxRi/jPyAsm+fdA2EyEYCtDjCvH8ZHIyTxc7iZbvgr5xlR2yHcJX1fr8TjaJwpOL9K3/rYQIWKZNNz6SPU+fY2JbeibBUOaRLzg2dlAtHB8qgg3Wi2UFCsN4wnYobvO34uLS2tItyVy8aGbuul3VPryFjfeTuFMn12c5J7sWicqe28QS1cR+0O2SxUMi4Q== 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=SXkn6rfiWWr5ESJ1K0yJAhpOlINgZ93RrpKL+3Ii9a0=; b=4zahZ0rD15k2BbjCL7IrTji4vxeh2zhdvM2CGdfUJypS0uZOsg0Xvyf+3KEXJ/LW0Q4+qSAQuDcC3emSHttkKUBEuUeqER1iiugDCR86Q8PJCxegyeweEwbNRej2xGWvgf5pOkjW2lyO4TV6Qen1oNIbT8qd1g6UBZHNTV4DtFk= Received: from DU2P250CA0016.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:231::21) by DB9PR08MB6989.eurprd08.prod.outlook.com (2603:10a6:10:2c3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 10:20:33 +0000 Received: from DBAEUR03FT065.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:231:cafe::b5) by DU2P250CA0016.outlook.office365.com (2603:10a6:10:231::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:20:33 +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 DBAEUR03FT065.mail.protection.outlook.com (100.127.142.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:20:33 +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; Thu, 25 Aug 2022 10:20:32 +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; Thu, 25 Aug 2022 10:20:31 +0000 From: Joey Gouly To: CC: , , , , , , Subject: [PATCH v1 1/3] arm64: module: move find_section to header Date: Thu, 25 Aug 2022 11:20:23 +0100 Message-ID: <20220825102025.53916-2-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220825102025.53916-1-joey.gouly@arm.com> References: <20220825102025.53916-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 6a6fcbc5-d480-420d-1865-08da86837771 X-MS-TrafficTypeDiagnostic: DB9PR08MB6989:EE_|VE1EUR03FT060:EE_|AM5PR0801MB1666: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: m1NCcYVGH5DtLeTsJjjomtlLKu6zfeu686zBV5ZP7CtVsreW/Ycx2k0maWtmq4OOFUtgG0fee4riSEGAkr/02EV4/xzhkucPFm8KFcdy4rdjI42GCcmPT1GL2m/rz05pNBJPK4NTFq5SH9ZGCme41Oaukm+uBcH6EPVtI7pS3pwnwlGK4FX43R/q1h1bvmeRa/0tfslQWRVm5tvXq2V/3WetV+2G/tOjGeSEWiBHItTWuYf8Q8Tt6XrUtdd22FSvNZS0J3Fc9/GMZoQqp+Fl61LLp/BISh4KDa7fjPqd0M3JP5VfAFWh1Yz9/64J8yZlYDVtsatD1uWGZ3W01ov5cnCZzNDU7iSst+yqAtrL9TMHhcwhm/wa7c1GI0+jjd7VifEKOp8LdkACP5MiFfYrRljopHgIEXcLV7ozgjJWz8Ravuiw0fJ58zQNvmhkgmglpt0zDPikiWTGQn1CitHkQVAcHY5ELo1Mu6luSnkJxLRoipckOkxRLbArXRrlhQQEfWS3XqkV4lbOMaw9yLnq6oqY5scmW7bU9jZ4GfpE8lM6+AhkWx54S50g4K78CXJhvBFQ1UhG+8P+1Un53ZkUzY//UsblbRJLhvbZryBIYoLUy1A2iXiFyez8JlEqd/RWNSPZooGtzrK85bmfYCEJOmQSRGIzXPqJx7xM2Pkd3D9CLnXrNqYlCyu4Xn/bXeiFmi1eAU3KjwMaBUlJMoqw8vC4Vh2mqnc2xx5E9LESL58dZrXt5M32na3PiZN3hOrHzRx99UvMe7q1fPJkiRMMdurhF16Wvm97syecjzGD7oxt7B14rDFnd2oFH88qGjdH 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)(346002)(376002)(39860400002)(396003)(136003)(40470700004)(46966006)(36840700001)(83380400001)(82310400005)(86362001)(478600001)(41300700001)(7696005)(2616005)(40460700003)(82740400003)(356005)(81166007)(6666004)(40480700001)(336012)(1076003)(47076005)(426003)(8676002)(70586007)(26005)(36860700001)(36756003)(4326008)(54906003)(316002)(6916009)(44832011)(70206006)(5660300002)(2906002)(186003)(8936002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6989 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT060.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 5519b2b2-6c62-48d1-f5e4-08da8683718e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5wu5TK+wqljafUDwO8nxoX7I/hF5hlLX+McC+T41v0XJXEWu3Ph07Enlb0gapUiJKv9zwwOqYnlhWo8f8AX8YRKRVKZFEJ76Bqkf6EXALfVq9ME9ePJxPb2cKgkwMJNqfo5Rju/xByU6Y8rg2is2pnjurieLIJebKCh31KcGxZspUb7QolxSP8CjKBqTLRnQMkFu+bL63hZe4HuOgcTQwa+PtJvAzuHZY5gRw4bSsFEJicyfbuPNwjYaZdPpMLnjSXyv9uSraOJo1M68CY5dG/Vcc9gSIn9+uzY6IJgRPKA6NPgqhmapOp/cDYadt8Ne9B1dWO8A7eo3Hgmfl6fC6kVhJheQUDPD4pAZYlEl6/2U9hhUOdIVi46bFbZC54jH6pPQ5n5vJWneaci4yVMiQbcOmmErHZQHiK6++1nlSvCpGr2oBDQbzhpVsgHUvNiPxpyanZUxzfN3cM20fyN2aVykEMcm3Ur8I/FeyNNGInFk+BfA1SScr6d27DboGn3n7F2SZG2EqHTMS5QK0dx+stpWpRfwoiGtJTg94gmoQZY3G1ZwkiUsXOi5zTVeJ/EmBzZtQAXi2Y7ROSMs4rwtL0cfvACyZ9q+aPRx5AHGwslD5IFUV/dCWDUqS2jF37Meo5/dFTh7MqQ7azaNDPfJ1Z9QkKrtVn4dPuQYdvKDh5Z77RyKWWM1uznfEypwrE2zvt4PqDJwfuHCKC2tYwV4spO8256pASro0Ut8w6dCL6KT0mJ0ZwupCW7o9LGNItkRLGjoGeNfbeELD+cU/k01Eg== 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)(346002)(376002)(136003)(39860400002)(46966006)(36840700001)(40470700004)(40480700001)(81166007)(86362001)(70586007)(70206006)(54906003)(6916009)(316002)(36860700001)(82310400005)(4326008)(8676002)(426003)(2616005)(336012)(1076003)(83380400001)(186003)(47076005)(82740400003)(40460700003)(26005)(7696005)(2906002)(41300700001)(5660300002)(6666004)(8936002)(107886003)(36756003)(478600001)(44832011);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2022 10:20:42.7834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a6fcbc5-d480-420d-1865-08da86837771 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: VE1EUR03FT060.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1666 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220825_032050_539476_F7D6F3BB X-CRM114-Status: GOOD ( 11.94 ) 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 Thu Aug 25 10:20:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12954509 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 9CAFDC3F6B0 for ; Thu, 25 Aug 2022 10:37:27 +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=kOo7Q2r7KKmcNwIlA7kbpPa9UpL6XWZ0UUpoqaUyLVQ=; b=z3yctGa4iTbu3C hfxHxBwswoKgvYQK3m1kObH2fs9dQcCx1C+V+F9ZG42HcA29vcrIratm0Yq9pxsybX9rHIu6ZFLvI Rw/wl90p3m2EvCicOLbxPXfDsp3YOHS0Z0DT496qKGrstr/BlgdLk4iNS1xOnAitXSgCjautqwYYO 8R9OvoGOfGu+DM4b996YEVWd4LiDLiubEbZ4eWWU9ywr2Ts2KilLvmoTZDqem+SmthAzunCZ1UwTB /caR+QNgAHOJM1//qBqHCUHyfQpIhn+HB4lanwsCU6iAr9wwjiStW/ILUmtQxkd+AJSJ/9qlHdKVP sN5IYfEhVhje6zXRrFxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRADW-00Bx1J-2F; Thu, 25 Aug 2022 10:36:06 +0000 Received: from mail-eopbgr70045.outbound.protection.outlook.com ([40.107.7.45] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRADR-00Bwy0-Oc for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2022 10:36:03 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ZjHPlm5LKSY1PByrKTDx/JPj8AVUZ6eJPa/YuAwEzw+qaoknHzNe3fRFjRJSUwxRoet8NiZZmo2M+nc5vtg0hhy5cvj0YUS1itfvjhfQQ6lYEuwDmSfZORSfRpdDo/peRfTwJiIe53s6ydoofr6kTpvjRzp5BzCdim16VEelFzBrqnhey4A6dfGc7PfWS18sOVzyYdzpzYxc/L+flrjxEu4XrdYpPrBxmZKkpYzcKLp1nX6EmGQXEhvLAmr/gJ4+DeZ59HMFrDEwLwKgbxz01s3DXZpQLnC6g+NYbY4U3qCpCoFfyTveSUhwrnfzTdIHYdGlMdKvytKQ83eHz8FIPg== 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=1fLdPt0t68akl5e5XVfMQMpRV669lMKEDCfM8heown0=; b=QL2iDAc696nVJLlNQymNciv1Rr6fJQRBQnKlcHhCEtfbS8Qu/0gBXTdygkXPIPHLkP753yEO9vwZXBrb8eEUuvpTJoogPuy8ZF0jnu5bXUzsXlA00ye9+NTbr2NZAvwGwwuhNBLX6Hu0ebTNm8+1wqdy7z5b5xKQp3Da47Ek4HDlRRtkQQEMRvz9eiKI2SqSdvxt1dVY6GfN1Ysy9bQi6uRwGJGXq/8Cf9f6svfKMV4ek65dmNdD/8LeSTCDoPXrnZqd/7mgxu05SmGTvf/TgSPIyskApKOtJqpPvcjn1v36ryOOyjJvbgh0W04HEHruMpampYIzJ/sXoGw9X2bCSg== 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=1fLdPt0t68akl5e5XVfMQMpRV669lMKEDCfM8heown0=; b=5TAtEUjznT7n8hK2x/aegPQa1IyZBD3T1Tg8gZ4m7TEDRVh5NrET+HvMQ7sjWbwYH28RHX5guFJKKy8RS+ChTOY9hgtZ5+b9lo5Vqi4vXjKEzb7R7aDbIl20YqjuaYhvpiGhBdvF7nzIu6jzIA1agxBGB5F66L0x7Xh3ylUoZys= Received: from AS9PR06CA0201.eurprd06.prod.outlook.com (2603:10a6:20b:45d::19) by AM9PR08MB7226.eurprd08.prod.outlook.com (2603:10a6:20b:411::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 10:21:09 +0000 Received: from VE1EUR03FT003.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45d:cafe::19) by AS9PR06CA0201.outlook.office365.com (2603:10a6:20b:45d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.16 via Frontend Transport; Thu, 25 Aug 2022 10:21:09 +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 VE1EUR03FT003.mail.protection.outlook.com (10.152.18.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:21:09 +0000 Received: ("Tessian outbound c883b5ba7b70:v123"); Thu, 25 Aug 2022 10:21:08 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4ea891e1824a50a9 X-CR-MTA-TID: 64aa7808 Received: from 1a57fd3d8efc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 607ECEE3-A781-4F91-A414-DF1673AD25D5.1; Thu, 25 Aug 2022 10:21:02 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 1a57fd3d8efc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 25 Aug 2022 10:21:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PrqYQRuy9r/5h4d8DhEqhJGdTheji8FDxKV0JqzqO1oH3Jj0PfAlIJyOIZr43KaruY1B7PQ8mxRatM5a92JErv8P+E9cYdVPSrpsoqeHamQoR3gMUXoxfDX/O0XL9T5e3Z6vyX/QI49xlJbh2/OJHQRLzX7lejBIQfLfE8gVCijVJtCotdayNllp3TwPxAUCjwKLpx8F8qkAyMU/EbMgfjbweDr9FYH10HZAlLJwrJeOyg9I+j/KIHw9NCg/HkgCJ6KD8Nd1wiVHfzGRQwA9jEE1+3YIztjED5q9rDnqVLTf60v8nmErIL4LR/bYKlTGCmT0NL9oGHRpN6XiHU0B9g== 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=1fLdPt0t68akl5e5XVfMQMpRV669lMKEDCfM8heown0=; b=n8h5Adj3MSRa5XoqKJwa1EWkV0GW9sYTRp6nZh+M4ejXhi2LhexSsLvRvIuYRYm3U9IgISvFGUX8Zs0oM6nSV4J/EQDdUWYK67USzeYBrqyx0R9jUpzm6wagI+LjPVFWfd+qA9iy1meQYTyLd/vT5YCmCbbmUL7pMIxGis1dci990XjSM7bWoybH31BTOQgqdYstx46zHR6F0Diuve4n6eyHCO/MmwfypeYDGJpl0uObuFKZCauKUHclx7xz8jpX4FUJRPqovUwkqLAvOO7lsPjMwtx0BcpliEeliwRVdZNUxhl2AxfvN9haknv+C4OFiVBrkm7GBmAt6Qp7Ih0H/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=1fLdPt0t68akl5e5XVfMQMpRV669lMKEDCfM8heown0=; b=5TAtEUjznT7n8hK2x/aegPQa1IyZBD3T1Tg8gZ4m7TEDRVh5NrET+HvMQ7sjWbwYH28RHX5guFJKKy8RS+ChTOY9hgtZ5+b9lo5Vqi4vXjKEzb7R7aDbIl20YqjuaYhvpiGhBdvF7nzIu6jzIA1agxBGB5F66L0x7Xh3ylUoZys= Received: from DU2PR04CA0073.eurprd04.prod.outlook.com (2603:10a6:10:232::18) by PA4PR08MB5903.eurprd08.prod.outlook.com (2603:10a6:102:e9::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14; Thu, 25 Aug 2022 10:21:00 +0000 Received: from DBAEUR03FT047.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:232:cafe::2e) by DU2PR04CA0073.outlook.office365.com (2603:10a6:10:232::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:21:00 +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 DBAEUR03FT047.mail.protection.outlook.com (100.127.143.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:21:00 +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; Thu, 25 Aug 2022 10:20:32 +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; Thu, 25 Aug 2022 10:20:32 +0000 From: Joey Gouly To: CC: , , , , , , Subject: [PATCH v1 2/3] arm64: alternative: patch alternatives in the vDSO Date: Thu, 25 Aug 2022 11:20:24 +0100 Message-ID: <20220825102025.53916-3-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220825102025.53916-1-joey.gouly@arm.com> References: <20220825102025.53916-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 4727f03f-7786-4a6d-2520-08da86838713 X-MS-TrafficTypeDiagnostic: PA4PR08MB5903:EE_|VE1EUR03FT003:EE_|AM9PR08MB7226: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: dWupk/AZYIlPuGP//IQfNE/Cnmal82t1Ztrex1AzAp821Ct9cUNN+/yLpjPR0ob3Nyy3jcgPS7z7WbERP6xN7/GSklEdF5vYc5OCkqkJ9mg+hvuRWirNN8L7feTSan6dR+J5+PEjdY/K+oj05ycbR38LOO5L2I1N8i1vKuWO8ucO+NRqDzp/dqVaxs1sOycQlOqvZPHBbgexV/GX/dPFJhPo0LpxioXQwsY75IST6tbCbTaJ8kmZYkMALOTyL8bzyPmbo6KZaGP5Xr7BCuEILT+ASg5Llw/QhmfQmHxizBabD+Uh8qc3HWvwgnmQ6NI8ji9eH0NdTinSUa4hD3QLldgV+Dxa+CyxUGAOSeWFctgKgG0eddRu8KHVpMGQXTXgH9JIhp4MsUpWRm57ZVAinwyCfsJGfKKeowArvAGIxEgFavrOJU72txIBDU0acxQn9Ft9NSZNTs+OXbuiQj2x7VDGmE1U5JYu79295NBN1S70kxg2jz0yxuGUnCtTU11977j0AjjAkkLUMzHnzssSPsz7+mCAv6TaE5kDHxwpOTzx+kzAc5Le4SteBUVenT7GvaZXwbXsvrX79xki7HNz5c8jJs4LYxHFBpov21gtfJ1VXq+I1e808MvYqlDDg0AuBBnW6ZI8mvK63x6wq5D0sKdCqGBNMCZW43l1Z+f3FPBzSDUXSUP6MYx6An9aPI9G5oDbLryFJdhttJEGVC1fT7URWUBwNXf5Gr2dQeZZ+JDI5QZXeRQT350IOCf58vV/8cOa7+AIW8uc7pn9Bh/uxGRDgn4Hn3mLxWTH5FqCLrKiPqr7W7tOiQFLsDZdIMYb 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)(396003)(346002)(136003)(39860400002)(376002)(40470700004)(46966006)(36840700001)(2906002)(6916009)(82310400005)(36756003)(4326008)(70586007)(70206006)(8676002)(6666004)(316002)(478600001)(54906003)(7696005)(26005)(40480700001)(5660300002)(82740400003)(81166007)(356005)(86362001)(40460700003)(83380400001)(41300700001)(426003)(2616005)(1076003)(186003)(8936002)(36860700001)(44832011)(336012)(47076005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB5903 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT003.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b958b245-76e6-4212-e652-08da868381f1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yQ2NCz+KiSX4mmaS0vBjwnlPprgMzLZ70PZA+lr+MyJI08CXnGf2Fa8Tc0rCg0/S+uoyZxvntJXAHiAaQfVsSwn75vGDf8O/0fzp8/zJsL4H1/h9NLQF75tBRq7E3qTBvGkqsuxgev3LYi8DlO9mb254k5KEAHNznm9VzqfjpSw8brAz/o/Zz6Ul56IICdHB5p/rwDmYrYTUJBEgDdoQgyajXdLo7CRtpLemrd2uHW3cRC6Eh0ObOfSj7Ul2LsKKoN7TK0+X2XWL7WCvRhhxzAsIFYJQjIgzVrCJe76xY3wtrT2FmB2isBgjsrX/Bnat16IdjkK54/1Irqxbl5+GxY2a+NF5Ev+kbliZq522DBX/4BytlNinxaTLqgO12vEQ5rd9SX/XgsRD8kFfGfbhFzJ3Z/iI8dgumaxuN2a19kH+9w8eYXGNHhFj3XLWrvf81IbxSrAVxTwkLznkk0a/fUcdYeq1bGlboazELZ7W2BiY3T5y3zQTFiD9yPmSL2fiu+cZwuo8Xd86Sa3YwWZhSOLvogKOqGhOJMjLSCv6ADc61RXLYQauCMQWbF5+hMDnzxN/HNzJ5IMl3T4jmA1GsLMQXhu0U2QUsvPOAPfTdPfeyKSIEFLZfPTrWSpVHylLUtnouhDSprjBGYHDzJt67rUxwg1SAqNhuDFaYifE+cLkPqZRyl0/51qVJwrDP/+GKAO7CYhpj0qOq6gB5C7zb4S5agFg+Y7UKc1uW4SDewJp2wshQXTMiLgBP1N6y4r2OIfire1gqFT+EAtZWkQAzg== 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)(39860400002)(396003)(136003)(346002)(46966006)(40470700004)(36840700001)(41300700001)(36860700001)(7696005)(6666004)(86362001)(107886003)(40480700001)(316002)(6916009)(478600001)(40460700003)(82310400005)(83380400001)(54906003)(2616005)(81166007)(426003)(82740400003)(336012)(26005)(47076005)(1076003)(5660300002)(70206006)(8676002)(4326008)(44832011)(186003)(2906002)(36756003)(8936002)(70586007);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2022 10:21:09.0269 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4727f03f-7786-4a6d-2520-08da86838713 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: VE1EUR03FT003.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB7226 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220825_033601_979710_8D0B5747 X-CRM114-Status: GOOD ( 14.99 ) 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 --- arch/arm64/include/asm/vdso.h | 3 +++ arch/arm64/kernel/alternative.c | 25 +++++++++++++++++++++++++ arch/arm64/kernel/vdso.c | 3 --- arch/arm64/kernel/vdso/vdso.lds.S | 7 +++++++ 4 files changed, 35 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..a4036194a5cd 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,27 @@ static void __nocfi __apply_alternatives(struct alt_region *region, bool is_modu } } +void apply_alternatives_vdso(unsigned long *feature_mask) +{ + struct alt_region region; + const struct elf64_hdr *hdr; + const struct elf64_shdr *shdr; + const struct elf64_shdr *alt; + + 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, feature_mask); +} + /* * We might be patching the stop_machine state machine, so implement a * really simple polling protocol here. @@ -216,6 +240,7 @@ static int __apply_alternatives_multi_stop(void *unused) BUG_ON(all_alternatives_applied); __apply_alternatives(®ion, false, remaining_capabilities); + apply_alternatives_vdso(remaining_capabilities); /* Barriers provided by the cache flushing */ all_alternatives_applied = 1; } 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 Thu Aug 25 10:20:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12954497 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 55928C04AA5 for ; Thu, 25 Aug 2022 10:27:16 +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=KFB4tfgR8NGHvnbyRGoVQgU6DFPQg0F5RbvIbqBpd9U=; b=yLB3rCG/ehMxVx hia3baS5xZIPoQiaMbaWaM2Z0j0HV1DVbQTBaU4bEoPhN1VCYpUt9mvW3ELO7VUCJOivn5l+OzVAM qZWIlil6t11utYh5PsQLuB3HhnSHr0UGJsTTnrCaP7X7Rkg56QDtol++Oy2fzzJtkMeYfmSd4eMIl I+j2JjBe8vjjgZnj6GLqZSYB0JGSk8fYIotaIFfN18eGaThyzTJnVdd8LgxJCmPT3sSLKshBhq4E+ 5Z/8w7/8X758GzMCU2ZDXK/g3FOGI7U1L+xtKXvXvqCsmFilVWmFfvvJ4rW6EtMDAd/G51l4xnyaR DOGtQJVcbg2xSYFS5Ixg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRA3B-00BrK1-29; Thu, 25 Aug 2022 10:25:26 +0000 Received: from mail-eopbgr130042.outbound.protection.outlook.com ([40.107.13.42] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oR9yz-00Bp2I-KU for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2022 10:21:11 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ZvYx8ni+o12JtijsM7v34rnIcNgJNeZMGkN7XxetRFMUz2b9LudHnSmDc44UZI7DWUs1HGoACjjqb/EsT67h8gCBeoJH6xAVwou893ENCdzpLwoB93VeO8CTqy9S5pUBEQfb35u0F+bW6Idz0YsVwNagDnAc2fKhLywBOgUE7+HdBgVutq/LIqH4Xqa66v1NakWXTA6ZE6rL1rU2SaqFsJ4+l1OjURbyoV30ARNyeM+f7WP2r1Ly0Xpg/N1khnkkFZfCQ9Mlt2BZVq7glw/+G2gubTeYWuaYoU27zG1EmpUUlrTU6SQsHruT6g/xw/v/rVIF6PI2wZlEsBNiBCtBaA== 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=zWQS+jLqykVfzAMcuxnvpyNYL6JuxgmyHetHeest7iI=; b=Ea9qKMvPrkTB4nsjcbSkb2A8vAZyJDWRSaPtU4CkC3lYQrjY1SaWWxlsHYIPcl7Fl3FoOEtd0lmERleojiGpowSZDRmV77W2qAIgzm2VXCxUhbxRfpFfBMCb1RARTLo06loMr846xZng28cf/kdCyonWjF/fCVsWzPTBh9KIeOH4yc/0Fpy0O6X+vJIIywTegBU+Ru7icdcnmx22eBLpgRTVJSgdzpKB7KH/bPGTN3a45a1zdID1sPchZV5nQPXfzOnX1Kp2gM44Uv59T3iedOcTuEFUPPX5OOVr6NfG3qXCUvt/HlErMi6qfg2K33X1+FOAMG3vLxBwkDz2KHPTsg== 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=zWQS+jLqykVfzAMcuxnvpyNYL6JuxgmyHetHeest7iI=; b=fa+k2nTM3z5zVZKr2uaA8opP5fGZ8YEbpwgTda/6J0UsRIYANXFG4rR8LBRuls0ARg32QkvmrRwfpbUn5phapB6ZnlaoA0g3vwfx2VkZVqkx3QvWz6nNZ1hLKu6Np2QF5L4XzRu+YlTkF5qYaZ2s+MubLVP70mw1aQz9VX2Uvz0= Received: from DU2P251CA0013.EURP251.PROD.OUTLOOK.COM (2603:10a6:10:230::17) by DB8PR08MB4009.eurprd08.prod.outlook.com (2603:10a6:10:af::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 10:20:56 +0000 Received: from DBAEUR03FT064.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:230:cafe::e) by DU2P251CA0013.outlook.office365.com (2603:10a6:10:230::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:20:56 +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 DBAEUR03FT064.mail.protection.outlook.com (100.127.143.3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:20:56 +0000 Received: ("Tessian outbound 2af316122c7a:v123"); Thu, 25 Aug 2022 10:20:56 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3a3394b40ff42a1a X-CR-MTA-TID: 64aa7808 Received: from 5647322774fa.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6C82E10E-9ACC-4A80-B399-3BD5D3673B91.1; Thu, 25 Aug 2022 10:20:50 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5647322774fa.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 25 Aug 2022 10:20:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K2PtrdjK1Diger5prVskQ+rh5itWvFYUp6Qnk5Oe7qu3NcaFdXUFznyw/4oQ/R/u+wl+rQ+tGGDj2GeCI/CLrjm5fZLMtmhI2rpNyXY2FMssmKMvGEDeipoWzPKk2BYrRfsB6VXsZmXHcfxEY2l0BtDH4BfGxOyBouYFh39FjNFj+WiTKPoL0+osIrhweWYcLUPzldd7tbZzxY9YoOmqCzhtTEivshRmOFJ7d3iLXu3okVUrPJL8ZJ20W56hxnqHpqwVtht255Qdft+5/rhN9B9DeAIkr1bO5Ur7h1NMZkM2AhXpbsA4p0aO1KS4KmIgcbKmYxSxVkOiW623UbBtIg== 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=zWQS+jLqykVfzAMcuxnvpyNYL6JuxgmyHetHeest7iI=; b=m/kOMs4TEuWEROj5ZGDRkDpvdk0LyiFdthkjFKKYdY/OFZJyVNgXPmGXNyX5DcMiDPARoZkmxKhf9OZxmcsQCDfmUfsmJqzQOI5SQnFsk8TOG1Nv4KN/RYOAe8Dqd+it38Ci/pSHhkPMzvY7lrOSfPTZDtAeE+H/S+I951d7hJ0M01wvpzj7ZAKlN3HIGuwqHb2g+bC47DrXSCV+iZvqcoBCmA7LJ9PvsrFEaj/LGWXA5rb9sZ6WqMl4GmbixhkZjUcl+KU6YDABHwfU9lablho2q6YIi2seX1BNYdwHYNsaE/7GKly5MK4kvQkT0BxewKrXp6gJn18oy3pFqLrH8Q== 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=zWQS+jLqykVfzAMcuxnvpyNYL6JuxgmyHetHeest7iI=; b=fa+k2nTM3z5zVZKr2uaA8opP5fGZ8YEbpwgTda/6J0UsRIYANXFG4rR8LBRuls0ARg32QkvmrRwfpbUn5phapB6ZnlaoA0g3vwfx2VkZVqkx3QvWz6nNZ1hLKu6Np2QF5L4XzRu+YlTkF5qYaZ2s+MubLVP70mw1aQz9VX2Uvz0= Received: from AM7PR03CA0014.eurprd03.prod.outlook.com (2603:10a6:20b:130::24) by DB7PR08MB3754.eurprd08.prod.outlook.com (2603:10a6:10:73::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 10:20:45 +0000 Received: from AM7EUR03FT017.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:130:cafe::f3) by AM7PR03CA0014.outlook.office365.com (2603:10a6:20b:130::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:20:45 +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 AM7EUR03FT017.mail.protection.outlook.com (100.127.140.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5566.15 via Frontend Transport; Thu, 25 Aug 2022 10:20:45 +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; Thu, 25 Aug 2022 10:20:33 +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; Thu, 25 Aug 2022 10:20:32 +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; Thu, 25 Aug 2022 10:20:32 +0000 From: Joey Gouly To: CC: , , , , , , Subject: [PATCH v1 3/3] arm64: vdso: use SYS_CNTVCTSS_EL0 for gettimeofday Date: Thu, 25 Aug 2022 11:20:25 +0100 Message-ID: <20220825102025.53916-4-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220825102025.53916-1-joey.gouly@arm.com> References: <20220825102025.53916-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 8f214e0b-a1a5-4e40-7777-08da86837f9e X-MS-TrafficTypeDiagnostic: DB7PR08MB3754:EE_|DBAEUR03FT064:EE_|DB8PR08MB4009: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: fFOtnmw5ASe5/TLbgb0L72eKLfbaTf2NRjjKDKQn+qtZgWNHfa01byh9JMzvn8Ud6AMQ1GyCRehKF5Yf2aApLxOMzR4dAsKoAMb/C6ziyYz7t8SNORK7SXw0dREvJ0V8U15XOso5YSYKJckXexiLK+CGGMT/Yq5OWkJDS4RoWKpNrYu7EkbSl47liKM/sfjFXdRSnlR6skC+Aco99hwBBSn0xcvnq1jAwgBc7oB6yrJ109yHtikHsuvJp9R+6iqivsuzARib6o3YjMFU8nIVALFz1e+nn4TqDA7ny+X4pkXwRVBm1dD5OeRgw3fu0I+2ts7hg6s+2pj1jGMuBqzlVGBZwFUngoZ+I8fJJ4lCDmLgmQ8Xvme1gHat8O8MwiiRBjAoyaYno4ZE89WJ/2zoElZ9pCy+53Hvt/GjzP8xhey/FKkBc+FFkZiSz9jOheB6bpd245/q3VXfkdOH8XplsQ/J+TzgOJQHUBsY5gV+W7apbqiJSAhmhhNCA2DZnEa+RmhIeUt/Re3i+N29a2RUHRXO7zQmdxFZl7jOHLYT1vfrHLkXjqZVEvToILQJEGhUHFZBcxBnmkTzlUBl07XXQJ8wItIVaRmCZJJONQbzeqhbO0kC/od2HqD7e6RsEOKMqzvB2UWn5LrHXuFH8MQIJSLXkYLNINntcN4Gkyv80JDO3Jbl2a5HylzamTDE9TF/R8QdzOP46F+SFS9Oi1IKpWXN2cSqTSk1GrSTIuA/dxgBrXG4JeI8pZ3SwCqmzFMjkT3ApKm3n5mFS7BWvUh9/HcD8DVZrDp/ONHBd/6ORdU= 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)(346002)(376002)(36840700001)(40470700004)(46966006)(54906003)(1076003)(2616005)(186003)(426003)(336012)(41300700001)(316002)(70206006)(8676002)(6916009)(4326008)(70586007)(6666004)(7696005)(2906002)(47076005)(26005)(40460700003)(86362001)(81166007)(82310400005)(40480700001)(36756003)(36860700001)(83380400001)(8936002)(44832011)(478600001)(5660300002)(356005)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3754 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT064.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d2683cc5-854f-4546-01a1-08da868378fd X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yxVp7yBV2GMAd50pRrhMW+1xIsMzS/C4c9Ij4u7WNJExnvH10wdjVJoF9aer20sqv/UFrqQmzdwxp7+8kF88Bz2nJsjGyIcsonzEGp0oD99FZ3g86rsfiTl5KiDZp3Dkmvf/T/Sfq4CbsqgJgqPPvYw7OVePoq4BIRN3FDrTeRl39dO8wR/CHJnbQ/++noJfpRnA8b4KioyKcNqsBKDrnpS09jtRWopaSQHp3N3SDHd/PehYZYb+WdC6C/EYHPYnoZfl2zX/sZdZmCTYlbbjh6OXuzSCd8V+d6ZCTArZq4jIQphiTHEnlyha7NIS9UaJbe5Y6hfM8PH/46VHs33sEA2Jswt46LHqfbdDSGR61OG/wTTGR24qvroaqGrNG1tT6NRAyoMMSKxaY3o3SsZYDXTcfIUTTevx+GqlsDlP60Y/LT8Yx6GIGECVkWsalQ9dBQahqitzQF3re8pgWVd8l3K9imEEmBSqMSK0sRNSk5yzMW7GtBteDcDNeyEKJIneZaKAXuLSE3Ac/+JKd7cBpvN/U+ByEwa5WH21Xi4sXGbGAtHCaYGEkEJmRCsuUP9vUUhpYvow5iAOlBnMBM0LWDhlXdVCdX5ayUDYPVTLKeb6DbU/sXC5aBqZ4ZUXi0G2lcEvoJQYwmoBMSCTXJs7F/ucYL/c93XLoJtj9uklWlvm5NGRVVN0+T2er+0R/Qs5v+gr68ZXSpNBgE9EQK4vduG4CsCmO83NYMwHEvBS3Q/XuSyqHPk7NCQrg/XbujeujZ36H8wuU/YI/0FeQmfxlA== 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)(346002)(136003)(376002)(39860400002)(46966006)(40470700004)(36840700001)(6916009)(41300700001)(5660300002)(40480700001)(44832011)(36756003)(316002)(82310400005)(107886003)(2906002)(54906003)(6666004)(8676002)(426003)(478600001)(4326008)(70586007)(70206006)(8936002)(186003)(1076003)(7696005)(336012)(26005)(2616005)(47076005)(83380400001)(86362001)(40460700003)(81166007)(82740400003)(36860700001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2022 10:20:56.6119 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f214e0b-a1a5-4e40-7777-08da86837f9e 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: DBAEUR03FT064.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4009 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220825_032105_702413_E7BB7890 X-CRM114-Status: GOOD ( 12.03 ) 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 --- arch/arm64/include/asm/vdso/gettimeofday.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/include/asm/vdso/gettimeofday.h index 4f7a629df81f..d8aff747019c 100644 --- a/arch/arm64/include/asm/vdso/gettimeofday.h +++ b/arch/arm64/include/asm/vdso/gettimeofday.h @@ -9,6 +9,8 @@ #include #include +#include +#include #define VDSO_HAS_CLOCK_GETRES 1 @@ -78,11 +80,15 @@ 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\nmrs %0, cntvct_el0", + "nop\n" __mrs_s("%0", SYS_CNTVCTSS_EL0), + ARM64_HAS_ECV) + : "=r" (res) :: "memory"); + arch_counter_enforce_ordering(res); return res;