From patchwork Fri Dec 8 16:32:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1873868 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=oNJ8Rmla; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=oNJ8Rmla; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SmxWR0qSbz23nS for ; Sat, 9 Dec 2023 03:32:35 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2448C385800C for ; Fri, 8 Dec 2023 16:32:33 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2042.outbound.protection.outlook.com [40.107.6.42]) by sourceware.org (Postfix) with ESMTPS id E4ABC385840D for ; Fri, 8 Dec 2023 16:32:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E4ABC385840D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E4ABC385840D Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.6.42 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702053143; cv=pass; b=xpIdmcN2KmzvAH3lPdekptzTqNqK6hnCINE2qmYHB7W4HK9OJhTWbyRYD88UvfYsK4NhAg8EYDB1MVmhB9SNmu8JD6rdSZRlxO+JQ/QrpLdDzR8QT+mHqs3HEuEc869jb+VILA33Zim/TKN15F7W6RjabguT6U6z+09TQe1WA38= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702053143; c=relaxed/simple; bh=2ce0y9UASpil5WSBghNDc7Gw7gvyVuJJfwn5G35/TbE=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=hTEqdLkBw1mvapR5joj+yDIDE57/dzCEDiaDUy5Mu/PEe4gbItPzGmRfDjQ9pe/osS0Kc+hWzuAPf7qqC8i5ARA5oAjFBBm4puchtsgFPoyYCLGFB4+ni/h0b/KA9shpWGfQJ66NnRDcUx6+jkQPEmuVx3FKkP2AF87a6rwT0ao= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=grAljNJRHX2kA7rJC7OWHhtW2zVhxlJHFaLnBBCRsK+S1sxe9nqLkDLcpDuM5MRD7FNGdaFJNf8CGezVzxqS3xN5qnch4Vv0EQ84vHyuWJ7m9LMuiv9LUIHs2gJwaSZgKebm8DNWe6ZzR78ClDxNNHkqS/omIR9WbGxY/ihjTB0936g6PTYD+GmKqsMGbF5j6+B6QyfJyl2pNYke6eVIv5sY3ajQhf5/Wue4c8hf7Ng9rt+lD+HLSVECd9EkgGSx4EbgwuCGm4ze9sjzPGfRzeP/OZ66bdYhHN82voIrkDXIC+WB7pw7qdj96PVEK+9KqFQ8HZfwhpoGIK4ZUDDS3A== 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=s1DhtTz0eUDx8tL4lGL4WFffgxnqnXXoPaQfyyS1tGs=; b=JCgFm11I3xOTAWQy0Xwb3k+NrNK4E/X15fAOFtlEFrTU659HHDX837/lKPd0+L6MPbbqKZZ5KbXwzErlT+GKo9vtar7Guyb4By2+Jkk0LEzHnzt8ymHgiA2UZDF0lxgwCYW6WMxGG+F4KqhKaA/II0hay87m4QtZDbbg0oYEmJKbthgGWTsqO/fMpdR9U5iRYdblVlx3dQ4ufOeUv4J73zUQ7nI2hYWecYD5WawflNgZMiX/SFxQp0ZnYIenUxgEd0e4+fzbNOgwbm6aiIFteIuy/0YQUOYidaNabYbg68+OsK9NAUebv6ppSWOCtb5Vn8MLofewQdbqHeD3mAT5rA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.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=s1DhtTz0eUDx8tL4lGL4WFffgxnqnXXoPaQfyyS1tGs=; b=oNJ8RmlalCxwuBhmSYqC/l2KoVRkGvpEMR+sRnmjgWy91TX/Fa1DvkpMqb4hnfDWOKqaWG036qzjaX8UXR7Ewc+QRWNKpXgCh+aeFYISWyjyYvzgmDzJnCNOLszSG+eS59WNX2uSX1wzG+TgLldyj7Q385dIgUsLPiTlM8Flruk= Received: from DU2PR04CA0290.eurprd04.prod.outlook.com (2603:10a6:10:28c::25) by PAXPR08MB6477.eurprd08.prod.outlook.com (2603:10a6:102:12d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28; Fri, 8 Dec 2023 16:32:19 +0000 Received: from DB1PEPF0003922F.eurprd03.prod.outlook.com (2603:10a6:10:28c:cafe::f2) by DU2PR04CA0290.outlook.office365.com (2603:10a6:10:28c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28 via Frontend Transport; Fri, 8 Dec 2023 16:32:19 +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 DB1PEPF0003922F.mail.protection.outlook.com (10.167.8.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.20 via Frontend Transport; Fri, 8 Dec 2023 16:32:19 +0000 Received: ("Tessian outbound 8289ea11ec17:v228"); Fri, 08 Dec 2023 16:32:19 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4b4a27001a140dbb X-CR-MTA-TID: 64aa7808 Received: from 19076b281716.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A73AE4CF-F255-4AB9-9F7A-49C27C804724.1; Fri, 08 Dec 2023 16:32:12 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 19076b281716.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Dec 2023 16:32:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GSi0B5cktpHe+NWYzqBaDVsjiOwIlYTkMrAcTMVeQ6oSq+6KqrNW49gIakH7hoUcorl6Y34gt5CQfiXICekU/b5luipTwaTYQRWuFo6c6ThigGB7VbEL27eTUTqoQ4gB8RW6raHCyG7K2H8NiB86Yi+DonVCB2Z27rSyWTYKOc9xnCSL7070rOw8YLfgvqeTv+t8qFwDP8kGaYXul3QDN15EwT6GLc+nr8SEp8KaTURP5I23TEWEkQ+PhVwHVyUmLaQjP1AXvtSyiMOnjNLCxrXlXpbsfCrYFNec3vAR+Z5HqN1T5cnFbx9nwzrx6TpNtGCpylwXZJlkHIh2OMONsw== 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=s1DhtTz0eUDx8tL4lGL4WFffgxnqnXXoPaQfyyS1tGs=; b=ESOP87nn6iBHzMEziBzPkvelB0mBAUdJsbbmb54Z/rMIZdWs963QCmt71P94hsL23Lq4k4p9dyatuDyKTTq6KiChjcBrpQvjyXwYdnFmPdy4EOztKZ4J7UyYofp7ApIPN6m3e2oiqR9CDLc24ANpJbN0jxSORtyI9cIEhsXDnP7t5CtFvpfchFFP5xvDC0lbKX6VFMAMWbxn599DAdyZEEpBnu/wC9DGtIdiBcOcPk9iutVY8DLkVqU0h1Ds1jtSlgu/p3PilTZ/bMvtatdh2h0doNWEwpbF2U0PpVhIpgqsmAoXEu3GN1OQCd5hwBTUVNHc+QAKvZ5FEzKU4bS12Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.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 (0) 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=s1DhtTz0eUDx8tL4lGL4WFffgxnqnXXoPaQfyyS1tGs=; b=oNJ8RmlalCxwuBhmSYqC/l2KoVRkGvpEMR+sRnmjgWy91TX/Fa1DvkpMqb4hnfDWOKqaWG036qzjaX8UXR7Ewc+QRWNKpXgCh+aeFYISWyjyYvzgmDzJnCNOLszSG+eS59WNX2uSX1wzG+TgLldyj7Q385dIgUsLPiTlM8Flruk= Received: from AS9PR06CA0425.eurprd06.prod.outlook.com (2603:10a6:20b:49e::15) by DU2PR08MB7376.eurprd08.prod.outlook.com (2603:10a6:10:2f4::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28; Fri, 8 Dec 2023 16:32:08 +0000 Received: from AMS0EPF000001B6.eurprd05.prod.outlook.com (2603:10a6:20b:49e:cafe::e8) by AS9PR06CA0425.outlook.office365.com (2603:10a6:20b:49e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28 via Frontend Transport; Fri, 8 Dec 2023 16:32:07 +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 AMS0EPF000001B6.mail.protection.outlook.com (10.167.16.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7068.20 via Frontend Transport; Fri, 8 Dec 2023 16:32:07 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 8 Dec 2023 16:32:06 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 8 Dec 2023 16:32:06 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 8 Dec 2023 16:32:06 +0000 From: Szabolcs Nagy To: Subject: [PATCH 1/4] aarch64: Add SME runtime support Date: Fri, 8 Dec 2023 16:32:06 +0000 Message-ID: <10fee36792ba4cc90d0476e4dd23671e3bbf0bed.1702051831.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS0EPF000001B6:EE_|DU2PR08MB7376:EE_|DB1PEPF0003922F:EE_|PAXPR08MB6477:EE_ X-MS-Office365-Filtering-Correlation-Id: e49f70e7-4ffc-4d10-6eeb-08dbf80b3f43 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: esqnAmvEOmvZWKout+wDRPONOWrfGQUVz3PAjOb8MbXg4k9icv5tHNGQHf30qSOhc9oCRrGqonz880Pc18SaTJ9XGckd2/epArTX/qZC2Q8+Vmj9mByote1Tf+S6Y0A1kfVq+p6/5kWxNvqsP3HSAvVPkL9CboHgp7B44iIJVDu0WOsZvuuxDJw0K2xg/RmFkh7cGumWaUMztavfG9fKABPY7ehCCPtwntfyK3GsebzUo4iN+lPeqDA6NMWpJ8MXL+QANRmYWdBrt1LkFh1qjIFyHmjSF0SBGvhvDh8+mFaVPGhSBk3btrjoUNYapBZz5wnFsd+mcioM2qkVaBMHvAABT2SthB0y3plnxc5QteaTxX9Ec2CEuBXBKdbuWCov97b4/OjdN+G2bRijkI3ioAlWOiGL253n6J7fGuKeNU5jRuaZWOiYxr8Fmn1huVKVlSgj745Tey6SI5GDPhzjitaW4o+GFTlatQeilmcu0A7GiUJxRPRcxPfz2NuFwLSmfIYD7BJde8rGC5Ubr4U3BUCZjjnPXe3/OVHiMGL7Uye6TKCFct+Bhee5WT8Xib1SbkigXdrZ93NQEEZ8Acxu1YDZikxfTB9Ke0Z8HvJOlZmAdLn5A03Sj6r+sk2CXyFXKATT4rPteLUnkYojseyjTcpwIqAJJL6dtGj96JCkZcLBsrDIrl9Yuc/QcdZicn7yUhpLJRZ/FWpEMYCtbcfbueHNV/wAOUfwBEzdGE/hX31OkhxUInoRuPrPzeqdItPK 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:(13230031)(4636009)(39850400004)(346002)(136003)(376002)(396003)(230922051799003)(186009)(1800799012)(82310400011)(451199024)(64100799003)(36840700001)(46966006)(356005)(81166007)(82740400003)(47076005)(83380400001)(40480700001)(336012)(26005)(2616005)(426003)(36860700001)(36756003)(41300700001)(2906002)(7696005)(70586007)(44832011)(6916009)(70206006)(316002)(5660300002)(478600001)(86362001)(8936002)(8676002)(2004002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB7376 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF0003922F.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 212846f8-e308-47d1-13ef-08dbf80b386f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UFyUgXXXcSNdrKPn93S+IOorC0bu+zqBcquFQBWpwOyst1w8xh5JKb6Jnw//bnMQJu4wDtnHDgDxpZb9qCG2eQ99ZgFIeyMFq7n+eggnc5nYHNkJdKZsQMaFxrdjPGtzp2SUH7VrXEImvoWm2EuUzr0kPdXWBtImlz0kXRO4G7kUU3MebtgXupNJpi9LHyAbN5EutXVCQkZlaS7fqnoJLrwFfsrjR/GupQJ68t8wK4nxihIiiSjAChJMPG9w5aBxfQwERaOyv7oIgh8YjVeTjh9l+Fa1JJPTXttiBJDSyui5Zd5Olp8IKCPp5BzHHCrEoQiFiH5Aut3MI/GQPrfXk176e8qJEy8fKbTL1bZovA4junOzIpgOIwI7pQvuztbrnDi7/6swtoYvwfQHD9ShjuejDC68e44VcN4xLVjVnLRYM2JiKuoPp31nIoavsG+OCpdqyTKMNi/WBVKd5akoo0WXe8PL9pSLaLHyvAAdM05vXGhTJ93LoIW6HYETxRF6YezqOI1aPjggXichH0iWeRhYPKYnSoKo2pxrb4iM0jkpaAHu6A26SBGNbJbQgp6qNXg4iEY/V9LoCXPrTAfT6AjWI7cGwFC8VyJ1d2k3RrCroMh1HsyxJdM2vmaLYJPug5hwhIZCqfaH6Gtt+RAJ5uOrz73LBfwR1JYXMsMkmPc2e3ZPaxALhBrURgtxuViYu1oqW8FRqTWzd62IMOmEPHXGe9XhixdgWxoy/jiFcgyMDkNaHWc7TiGd32u/Ytza 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:(13230031)(4636009)(346002)(376002)(136003)(39860400002)(396003)(230922051799003)(64100799003)(451199024)(82310400011)(1800799012)(186009)(46966006)(40470700004)(36840700001)(70206006)(70586007)(47076005)(81166007)(36860700001)(6916009)(316002)(40460700003)(82740400003)(2906002)(83380400001)(86362001)(2616005)(36756003)(26005)(40480700001)(44832011)(8676002)(478600001)(8936002)(7696005)(41300700001)(336012)(426003)(5660300002)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 16:32:19.2769 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e49f70e7-4ffc-4d10-6eeb-08dbf80b3f43 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: DB1PEPF0003922F.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6477 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org The runtime support routines for the call ABI of the Scalable Matrix Extension (SME) are mostly in libgcc. Since libc.so cannot depend on libgcc_s.so have an implementation of __arm_za_disable in libc for libc internal use in longjmp and similar APIs. __libc_arm_za_disable follows the same PCS rules as __arm_za_disable, but it's a hidden symbol so it does not need variant PCS marking. Using __libc_fatal instead of abort because it can print a message and works in ld.so too. But for now we don't need SME routines in ld.so. To check the SME HWCAP in asm, we need the _dl_hwcap2 member offset in _rtld_global_ro in the shared libc.so, while in libc.a the _dl_hwcap2 object is accessed. Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/Makefile | 10 ++- sysdeps/aarch64/__arm_za_disable.S | 112 ++++++++++++++++++++++++ sysdeps/aarch64/rtld-global-offsets.sym | 10 +++ 3 files changed, 129 insertions(+), 3 deletions(-) create mode 100644 sysdeps/aarch64/__arm_za_disable.S create mode 100644 sysdeps/aarch64/rtld-global-offsets.sym diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 6a9559e5f5..9d8844d9c8 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -48,7 +48,9 @@ endif endif ifeq ($(subdir),csu) -gen-as-const-headers += tlsdesc.sym +gen-as-const-headers += \ + tlsdesc.sym \ + rtld-global-offsets.sym endif ifeq ($(subdir),gmon) @@ -62,8 +64,10 @@ endif ifeq ($(subdir),misc) sysdep_headers += sys/ifunc.h -sysdep_routines += __mtag_tag_zero_region \ - __mtag_tag_region +sysdep_routines += \ + __mtag_tag_zero_region \ + __mtag_tag_region \ + __arm_za_disable endif ifeq ($(subdir),malloc) diff --git a/sysdeps/aarch64/__arm_za_disable.S b/sysdeps/aarch64/__arm_za_disable.S new file mode 100644 index 0000000000..f9e2d942f2 --- /dev/null +++ b/sysdeps/aarch64/__arm_za_disable.S @@ -0,0 +1,112 @@ +/* Libc internal support routine for SME. + Copyright (C) 2023 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include + +#define HWCAP2_SME_BIT 23 + +/* Disable ZA. Call ABI: + - Private ZA, streaming-compatible. + - x0-x13, x19-x29, sp and fp regs are call preserved. + - On return tpidr2_el0 = 0, ZA = 0. + - Takes no argument. + - Does not return a value. + - Can abort on failure (then registers are not preserved). */ + +ENTRY (__libc_arm_za_disable) + + /* Check if SME is available. */ +#ifdef SHARED + /* In libc.so. */ + adrp x14, :got:_rtld_global_ro + ldr x14, [x14, :got_lo12:_rtld_global_ro] + ldr x14, [x14, GLRO_DL_HWCAP2_OFFSET] +#else + /* In libc.a, may be PIC. */ + adrp x14, _dl_hwcap2 + ldr x14, [x14, :lo12:_dl_hwcap2] +#endif + tbz x14, HWCAP2_SME_BIT, L(end) + + .inst 0xd53bd0ae /* mrs x14, tpidr2_el0 */ + cbz x14, L(end) + + /* check reserved bytes. */ + ldrh w15, [x14, 10] + ldr w16, [x14, 12] + orr w15, w15, w16 + cbnz w15, L(fail) + + ldr x16, [x14] + cbz x16, L(end) + ldrh w17, [x14, 8] + cbz w17, L(end) + + /* x14: tpidr2, x15: 0, + x16: za_save_buffer, x17: num_za_save_slices. */ + +L(save_loop): + .inst 0xe1206200 /* str za[w15, 0], [x16] */ + .inst 0xe1206201 /* str za[w15, 1], [x16, 1, mul vl] */ + .inst 0xe1206202 /* str za[w15, 2], [x16, 2, mul vl] */ + .inst 0xe1206203 /* str za[w15, 3], [x16, 3, mul vl] */ + .inst 0xe1206204 /* str za[w15, 4], [x16, 4, mul vl] */ + .inst 0xe1206205 /* str za[w15, 5], [x16, 5, mul vl] */ + .inst 0xe1206206 /* str za[w15, 6], [x16, 6, mul vl] */ + .inst 0xe1206207 /* str za[w15, 7], [x16, 7, mul vl] */ + .inst 0xe1206208 /* str za[w15, 8], [x16, 8, mul vl] */ + .inst 0xe1206209 /* str za[w15, 9], [x16, 9, mul vl] */ + .inst 0xe120620a /* str za[w15, 10], [x16, 10, mul vl] */ + .inst 0xe120620b /* str za[w15, 11], [x16, 11, mul vl] */ + .inst 0xe120620c /* str za[w15, 12], [x16, 12, mul vl] */ + .inst 0xe120620d /* str za[w15, 13], [x16, 13, mul vl] */ + .inst 0xe120620e /* str za[w15, 14], [x16, 14, mul vl] */ + .inst 0xe120620f /* str za[w15, 15], [x16, 15, mul vl] */ + add w15, w15, 16 + .inst 0x04305a10 /* addsvl x16, x16, 16 */ + cmp w17, w15 + bhi L(save_loop) + .inst 0xd51bd0bf /* msr tpidr2_el0, xzr */ + .inst 0xd503447f /* smstop za */ +L(end): + ret +L(fail): +#if HAVE_AARCH64_PAC_RET + PACIASP + cfi_window_save +#endif + stp x29, x30, [sp, -32]! + cfi_adjust_cfa_offset (32) + cfi_rel_offset (x29, 0) + cfi_rel_offset (x30, 8) + mov x29, sp + .inst 0x04e0e3f0 /* cntd x16 */ + str x16, [sp, 16] + cfi_rel_offset (46, 16) + .inst 0xd503467f /* smstop */ + adrp x0, L(msg) + add x0, x0, :lo12:L(msg) + bl HIDDEN_JUMPTARGET (__libc_fatal) +END (__libc_arm_za_disable) + + .section .rodata + .align 3 +L(msg): + .string "FATAL: __libc_arm_za_disable failed.\n" diff --git a/sysdeps/aarch64/rtld-global-offsets.sym b/sysdeps/aarch64/rtld-global-offsets.sym new file mode 100644 index 0000000000..23cdaf7d9e --- /dev/null +++ b/sysdeps/aarch64/rtld-global-offsets.sym @@ -0,0 +1,10 @@ +#define SHARED 1 + +#include + +#define GLRO_offsetof(name) offsetof (struct rtld_global_ro, _##name) + +-- Offsets of _rtld_global_ro in libc.so + +GLRO_DL_HWCAP_OFFSET GLRO_offsetof (dl_hwcap) +GLRO_DL_HWCAP2_OFFSET GLRO_offsetof (dl_hwcap2) From patchwork Fri Dec 8 16:32:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1873869 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=0hd9yYLA; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=0hd9yYLA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SmxWg3BjJz23nS for ; Sat, 9 Dec 2023 03:32:47 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5A1D63857BB8 for ; Fri, 8 Dec 2023 16:32:45 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2066.outbound.protection.outlook.com [40.107.22.66]) by sourceware.org (Postfix) with ESMTPS id D8D7D3858424 for ; Fri, 8 Dec 2023 16:32:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D8D7D3858424 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D8D7D3858424 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.22.66 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702053156; cv=pass; b=uM5+p7SwwfEc81AuH3SAUyLlavjufNMJJ/6JE4XMO36BbbxcWY685MVpOkNxTeGZeIHwDh+u1EnSeuvqHYimDy3C4AHbR8G1TYb/eFb3fcDrlg6aAhz438dXieQJsDlK6bwFVPWl6tCrjdZ8QmDLOYrwhm5QNwrvWxt6Md7TOMo= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702053156; c=relaxed/simple; bh=3Xsocf6W4CHOw8WwA0x5pfN7dtNIlyxFJu2F6rwbw3Q=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=diWSu+BSW/zEx3AMBE2MrhQrZvRU9gowVNsifTQGC19bqi5xIS8Aun0T8lNIPjcbf85eSdiVOpZ689hTaRN6Ip9YiWCLymbix6+HB9paDi2m0tSaLl37M2vtCPCLTvBzrJeZZ1ZrbamLvcZf/Y3YymT46qAe0DndlpwLFdit/Jw= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Bzx7XumLukp3h35rt4QBnBtZRQ/wpz0kJFPDWfJJQ1VccynR7gN/OPZ7k3xShZ9L9hJ+k0Vte5lXN1jl0dIiUdb26EzTcxOlojxAaTNhZPxjbmbulE8WxaQrumxspCvISr90U2fRTl2USZVOepPHmq2sJRz46a5J5nDRQ/RsWJpi5u9Dznla4VgLIYLO+kG6jAlNdrn9pTGXc771RfB8h2XJw+Jds0qFCJLLJQjnl4bheI5eLtWIJ7Oeopq9emyT0nQBj7sDmsPDUQcyqhLExH3bQPS3fcDD/fk5o2ArQyOKc1IEGGJRs1iKyWNJ9AeAS9xoMbS5akLVMT2BYhMdTg== 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=mJP3PD/DSEL8N1yZvZPrBRKnbpIA78dIbA1tQ+MnMWI=; b=fU4mr0K9lRqltv5sLk1LBIrgih60L1yrUnoQr6DttyicqhR1cM/tCrJnz/ElqZqPB3ezK8TZjD3aAMRF6yyrI3oWqU1I5Re9g/jJeSA6E7Ef95osOgFySQrSnf9e0nfGn8gLovkT6XclOTZO/eQ7tGwD495GaRKe/vEo+nZ4etoYjEjjBqD29TqfXfAwBEWT/WLcRvAOoarkYcFMxZZ+c5bJoFeNUN3BTqnxznL9gDhL10BxQZKYFGVy8TYlpolefgZmMW5beaKl2vMiyDzQ85zP908Rhk8NxekIuvsdiJ4ENAicCPkZnkcvfz+a/1ee0fzRhOc4LecHdKChdCl6ig== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.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=mJP3PD/DSEL8N1yZvZPrBRKnbpIA78dIbA1tQ+MnMWI=; b=0hd9yYLAB3jHHhtVDe6cxIrhWIEgFaH/cbaa6ooyo4aWnlPfQqkRYFFQQ2BGZdo0J/Ioiholb8z0fflNjit9elQV3xgmaM6NdZLO2L3lmMD6DxyRvOEdHCfAn6JtTcX5Ff+gl3/kFQ55Y4ksqXAVE5R/WcjoToO5a6hX11hq1wY= Received: from AS9PR06CA0073.eurprd06.prod.outlook.com (2603:10a6:20b:464::17) by GVXPR08MB10862.eurprd08.prod.outlook.com (2603:10a6:150:154::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28; Fri, 8 Dec 2023 16:32:30 +0000 Received: from AMS0EPF000001A3.eurprd05.prod.outlook.com (2603:10a6:20b:464:cafe::e1) by AS9PR06CA0073.outlook.office365.com (2603:10a6:20b:464::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34 via Frontend Transport; Fri, 8 Dec 2023 16:32:30 +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 AMS0EPF000001A3.mail.protection.outlook.com (10.167.16.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.20 via Frontend Transport; Fri, 8 Dec 2023 16:32:29 +0000 Received: ("Tessian outbound 7c4ecdadb9e7:v228"); Fri, 08 Dec 2023 16:32:29 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 063d1a5048fb8895 X-CR-MTA-TID: 64aa7808 Received: from a87241478157.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 74F1CFA9-87F9-498C-9DF7-E3BDC3626BF4.1; Fri, 08 Dec 2023 16:32:22 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a87241478157.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Dec 2023 16:32:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MwwdgF4mrUIAr53+n3ihyUqqrC8/O2o+R9NBDAiu9HCzYjPe8WaqsD+ssASKnxnKWdaOBZ1lJxud3yGBds153JbaQuiBUV2yalg6V2XQsYeMVtxkwie7wWGJ7dRUld3L8PoHkl88663l0moJ5Tfg8EkS/f2GMNXytnjoYj0sDnYkpmWtCk/0pke8SyO/LUtmeLR2ODtRBET6Cr/4VAYkuRjEgkID/Q3ObOVWGpm6b5qUs4wivb1WgQLEc9rLNxj00U/81IOFHmbNPVjTKGaWW+/U308JDmPKqscZVGVbQNCiXQqaFviWow5U95xZx1hcExXL8ATzK9Wv38j5ksz5Ow== 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=mJP3PD/DSEL8N1yZvZPrBRKnbpIA78dIbA1tQ+MnMWI=; b=H/cl+c8U1Dmpa7IBUYLYONx5bnijzoeYesg3HWEF8C/M4R7vHRRR7jj4CTJMM/+oJ7iQ7355CuQuMTph87BgTIUBRrAtiryaWNibbssgA+mUdzfar+65CdQUVJlqT14QQ63HETQNtgAsjFBNWsuGgYDDRVeSX9r7FNwjJH6oG736BdUPLrJP9NHO/l2JlFqb5HZUicJt4zIxvwvIb1clTh8X2pnevZZ4DhaO6CmHU4zKaSwVBNFJhwdY36XPfhaXUGpM3oIfb1vuYGI67brc1yXsZ7AXhLLZOL+clxYwDBcrdTjnEPeo/BEutQOJ9FckUR7oIcF+L6VX1300DpDzDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.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 (0) 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=mJP3PD/DSEL8N1yZvZPrBRKnbpIA78dIbA1tQ+MnMWI=; b=0hd9yYLAB3jHHhtVDe6cxIrhWIEgFaH/cbaa6ooyo4aWnlPfQqkRYFFQQ2BGZdo0J/Ioiholb8z0fflNjit9elQV3xgmaM6NdZLO2L3lmMD6DxyRvOEdHCfAn6JtTcX5Ff+gl3/kFQ55Y4ksqXAVE5R/WcjoToO5a6hX11hq1wY= Received: from AM7PR04CA0023.eurprd04.prod.outlook.com (2603:10a6:20b:110::33) by DU0PR08MB7763.eurprd08.prod.outlook.com (2603:10a6:10:3b9::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28; Fri, 8 Dec 2023 16:32:19 +0000 Received: from AMS0EPF000001B7.eurprd05.prod.outlook.com (2603:10a6:20b:110:cafe::62) by AM7PR04CA0023.outlook.office365.com (2603:10a6:20b:110::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28 via Frontend Transport; Fri, 8 Dec 2023 16:32:19 +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 AMS0EPF000001B7.mail.protection.outlook.com (10.167.16.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7068.20 via Frontend Transport; Fri, 8 Dec 2023 16:32:18 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 8 Dec 2023 16:32:17 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 8 Dec 2023 16:32:17 +0000 From: Szabolcs Nagy To: Subject: [PATCH 2/4] aarch64: Add longjmp support for SME Date: Fri, 8 Dec 2023 16:32:17 +0000 Message-ID: <199b96a9d02f8cab61c4465cf4dbfaa191588063.1702051831.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS0EPF000001B7:EE_|DU0PR08MB7763:EE_|AMS0EPF000001A3:EE_|GVXPR08MB10862:EE_ X-MS-Office365-Filtering-Correlation-Id: 13311e7c-378d-4bde-547c-08dbf80b4598 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: 8enP5ODMdsggforrVCRwxeNH0ZqIFqyUhJRgtDm5mDt8su8jOc00rWTzN9jvSpBMFhRBngRaHrpFbK7ENK/CH/7Fo50Z/SvKB55J1b0a/uqvthNhWhPWbO7FSU5w/eBZ63zgiNYDk4eqmNaLjhaCyxd7EQsVLtZlSKblThqEdyxWvW1KxZg26mDCjGN/xPstPTHd+maLDKvKcuI2shkGDqapMBsJWQDaDUO8GqI7GAeEISqaOM9Gdx66MO4FhNklzaGBLP/OzWtk03tVyG0ggJKfc1o28I7ALMcBKMsp/Orq5hHHp3KQ6RR9+nGR0MSWVj7lmOmgskT5pdTNYU+dw2bh2mTCWW8dz9+3Dz3AbYOPl9kPjCcS/10adfZHTNzLDOemJ3GImdGZNditqBwRboK4bn4K6/HV3pVMgOOYgsk8iur0rdoTI7f8HS1TGHNIZFzVXZdIAyBDyUwrjF12i4FVlKngh6N7754xx9W8dEntdX47BM7RfOxI3lypvosjMkuqSOUOa5FT9XU0wgah/HKVa12x2weHeaOVW/e0fKRA+Z0CmjIA6+gfnP4naOqmnDezVZabe26rGphDtUDs8APFAPpmHUFLzGnpKyfI9k56tXlWw5NXcXtM3rG0Jr1iEtMBUo1beEhH/lxlm4ewEySyBG8UhsxQogKH+WVwvxy43jQPk/uvZDtHPBxfqfQ/OLqPYze+ue3EtwYnpkPTc5EboS94W0/aY6l9kI8AIBtZG7P7E9cPW40EWXwQ3oYsllUgR7aha+mLBzNLMDmv9g== 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:(13230031)(4636009)(136003)(39860400002)(346002)(376002)(396003)(230922051799003)(82310400011)(186009)(451199024)(1800799012)(64100799003)(46966006)(40470700004)(36840700001)(26005)(40460700003)(36756003)(41300700001)(7696005)(81166007)(356005)(2616005)(47076005)(336012)(426003)(82740400003)(83380400001)(5660300002)(478600001)(2906002)(40480700001)(70206006)(70586007)(6916009)(316002)(8936002)(8676002)(36860700001)(44832011)(86362001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7763 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001A3.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: dac131f4-2b06-4016-043c-08dbf80b3f15 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jMGz0XBsZVzvTWPUEfiDFM6HbJ/Q/CdJ1Ci0DM5yOi8IY1vC0E1llNvgi6fEnIxcXWXMU8xAwA+BzEUcDtwNkBbbTAb1B7gW1O50ceDd9zmzXJ0DP5H/Spm97RLrWX+4y9ipmwSrcrFKITgG11JNgPiQKN9LjIbOsByw2eK3JKCVcPoQw94w9yIRhvXOHLEAzMu9lRSHuzFcDAqjSAVAkTeb1qvRxOgsldUQ1gEU+AlpVN/Bz1ERZSLpyFMfTNU4eWRUhjEZQ8XcW0B/+05DhpMK+iZP8PigACpY3T/GtX3TG7Jb4uolgWLDUdGwzNIpX+rTRZ4RPQROapB1z631TdmU0txsozMcjwJSiFrNqmjlDIpBH5zwjAHR2h8CzJkW0MsOIbD3G60tvQsfmY/8TDRD7JvwWHP0X3klxEKFHI3y44uJR1/kxHgZ41LY5jk1KENDEg0QDGY7UHnCTkfQisl66dd55LmL+dyA/oUblZ7HmYmAtlsfHhKFCO7BVa/d8+5sjH7VW2YGdwFDdVuF6IEm4Ns8MdZvzvqGb8VtkFW9fTuSN95lM6DsE9ItKw7CapezZDrmS39tKgf9Es0RReP7ygOIsZBvY1fbyRAz/+0/cPE+Bu/GEIJu4GXqRtigZTC7o9w1xI7mD0IFXC1oAOgXgAt44sy6OYOUYgC/++3BCd6Bae3czLjSmxte1MqKkYH0nohhUm8rVuNNH/m7DQv7WLkkATsifD+8SnwYRr9bkqFMk5uyOQndHQjNjG8A 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:(13230031)(4636009)(376002)(136003)(39860400002)(346002)(396003)(230922051799003)(1800799012)(186009)(82310400011)(451199024)(64100799003)(46966006)(40470700004)(36840700001)(7696005)(70586007)(70206006)(316002)(36860700001)(40460700003)(478600001)(6916009)(40480700001)(44832011)(2906002)(86362001)(2616005)(8936002)(8676002)(26005)(426003)(336012)(5660300002)(47076005)(41300700001)(36756003)(81166007)(82740400003)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 16:32:29.8371 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 13311e7c-378d-4bde-547c-08dbf80b4598 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: AMS0EPF000001A3.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB10862 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org For the ZA lazy saving scheme to work, longjmp has to call __libc_arm_za_disable. In ld.so we assume ZA is not used so longjmp does not need special support there. Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/__longjmp.S | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sysdeps/aarch64/__longjmp.S b/sysdeps/aarch64/__longjmp.S index d743e7478d..659199d7d4 100644 --- a/sysdeps/aarch64/__longjmp.S +++ b/sysdeps/aarch64/__longjmp.S @@ -49,6 +49,28 @@ ENTRY (__longjmp) PTR_ARG (0) +#if IS_IN(libc) + /* Disable ZA state of SME in libc.a and libc.so, but not in ld.so. */ +# if HAVE_AARCH64_PAC_RET + PACIASP + cfi_window_save +# endif + stp x29, x30, [sp, -16]! + cfi_adjust_cfa_offset (16) + cfi_rel_offset (x29, 0) + cfi_rel_offset (x30, 8) + mov x29, sp + bl __libc_arm_za_disable + ldp x29, x30, [sp], 16 + cfi_adjust_cfa_offset (-16) + cfi_restore (x29) + cfi_restore (x30) +# if HAVE_AARCH64_PAC_RET + AUTIASP + cfi_window_save +# endif +#endif + ldp x19, x20, [x0, #JB_X19<<3] ldp x21, x22, [x0, #JB_X21<<3] ldp x23, x24, [x0, #JB_X23<<3] From patchwork Fri Dec 8 16:32:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1873870 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=N/nioLZw; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=N/nioLZw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SmxWs5tj4z23nS for ; Sat, 9 Dec 2023 03:32:57 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D7509385770A for ; Fri, 8 Dec 2023 16:32:55 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2052.outbound.protection.outlook.com [40.107.13.52]) by sourceware.org (Postfix) with ESMTPS id D948C385AC2D for ; Fri, 8 Dec 2023 16:32:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D948C385AC2D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D948C385AC2D Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.13.52 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702053167; cv=pass; b=blT5ZZ/MUIHxgblh/F5nzpVwmFyk9jCIWsDWFNaECs5Ez60IaFc/gSTiBUW9oMoG0LcaAbKJ3CIpXtdhUsvr9EZDxjlMqO0nWDQdX/1/SErU6i7L7ox0rdyVRBGhvK9jHuRzAlOCLfMFUUNHieXrAF1qdhgDlOa3HiAj1NCj+iM= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702053167; c=relaxed/simple; bh=RnLEYd+7MTY/G7Cxam5iuKDBG9aoSIdGSRVi6MByk0U=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=QSxr0X2k5ewkjvZZOUg3AlgdQWTu8R1Noi73oBxqnXdpESDFFMdXaanr9iMNKQKWU5GF6tDmkOtSOUX1oFAThCKNhp38eBnAfq7NVR28HfMcrnDrt7oqb8dopBOmgLZnr1qTBcNjYLcqUDokXRzSmr+9thrMZJ4b4skL4B8vIZo= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=STtu90WrmEtOP2to3pl2JALQ7k6WnHBjAsE1Oe6etfirrw3Plk+V33n8APDaIeZz6t9utC9QIcb5f1YwNA4shyyTgyDvoXvXoubhNhRIS7AG07zC0gPtmW0XfPG/9mkOa00dUktmjncU1tWK05fKo99UzVGeUnKbrlm1q3CWoRVJw0W1aX2yIkte/2xzNodsW543A/kYaRtIxVxVxHKT3CAxoXMWL0ZPm1nvCkaYcxYjcAcKFyTp0uWoVImao/KzB0gHiZGZofDuUugvW64P2KqtedtHoaN0PWf1yr7YNPwCO5vpjSmXlxy7+fsEPXnGBunvuC60W+Olt1Ul9QgXjA== 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=V5d062+4JbBFLOcdWUwRAcWGzwxC6G9JVk2p6xcaNgk=; b=EfNsJOrjF+wRDvQqRAJ+e1spm/YBtKAL+jvtVzaQrpAGGliQJNdM7pLHVI+r36S8AZfwHED2UK1SemBi78hElmkyTK1nN8+CHzPgbSiJDzEo2He+/fX4//ioeaBtuWGYRgDCXMkPtJi7G0B0EtUmdn6twrYrRSgvLZPF0j0NNJmqjU215uWPA/kPrsq6sExJb/1NIQIsMwMKKv3VtDvpdQTVNtav6PzY2Xgg8tUU5T498YimHiEAVoCFd8b6V3iEQMVHioXf3o8glO8o9lw3UeEVPR/TiNRxeUfMeofz8/IOY1727mxg69xTqHdsNgz6SqaX75WiCsqXWh5qyMwrBg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.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=V5d062+4JbBFLOcdWUwRAcWGzwxC6G9JVk2p6xcaNgk=; b=N/nioLZw1AF5ZI8m3SzFazp0pQmsPqE1W3jDdVwo2zGLVj39nsqHXzDL2KTGkiAUiKFm2Xcnbu08D8OFrzTrCiJKF++QK2atuu0IbooGFUOCpzzsoM6Xo3l2SnHeoZazDW+T/c59UmdRwO1umt/t58VWgrm7a9AwErm5IgQEcH0= Received: from AS9PR05CA0136.eurprd05.prod.outlook.com (2603:10a6:20b:497::6) by DU0PR08MB8472.eurprd08.prod.outlook.com (2603:10a6:10:404::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28; Fri, 8 Dec 2023 16:32:40 +0000 Received: from AMS0EPF000001B5.eurprd05.prod.outlook.com (2603:10a6:20b:497:cafe::3f) by AS9PR05CA0136.outlook.office365.com (2603:10a6:20b:497::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.26 via Frontend Transport; Fri, 8 Dec 2023 16:32:40 +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 AMS0EPF000001B5.mail.protection.outlook.com (10.167.16.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.20 via Frontend Transport; Fri, 8 Dec 2023 16:32:40 +0000 Received: ("Tessian outbound 7c4ecdadb9e7:v228"); Fri, 08 Dec 2023 16:32:39 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: b11a99c6222e4e36 X-CR-MTA-TID: 64aa7808 Received: from c03ef496fea9.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2AD34C10-AF45-4F6C-BA7E-89CD02060C42.1; Fri, 08 Dec 2023 16:32:32 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c03ef496fea9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Dec 2023 16:32:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iVK4NvGO/4WIrvL5Bebw3ag4fxC0GAXad/DhWaWYR5jmmAfUlXC3CKXPxcaiuZYO+Sg9gNfouVnsdUn/1n/IIH6qftW2yV/zDQzmkg0CDrMmDjm3DNXESmgLSkgLIhUX0XNqAg8hep4DcK7a+oMhLb/FL7ABWbfwG0pDxaa22lXxGCSisQumudFGGkoFJZLUi7Y4YhhqO1bZZAwwYXF89lgb9phwVbJCXw0YnsSr249MUYUyUBSEl8mXeb+7ZIXdp5ZfFco21TQBcqDk8aj4igGq9Re5ugImxVIDDEC71nJlIXOwCjB/UJ/9JF8Lj/2w/HT+Z3Gj6Tfn69+jB1KypA== 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=V5d062+4JbBFLOcdWUwRAcWGzwxC6G9JVk2p6xcaNgk=; b=YyY8FHo93jhKS3K4lY6GDzhhl8lI2AKYpQUGHQ1X8GWelIkJN7BnNZfe/S2ZehNhhBFPMXXw8HOiFZvpJZEj271CmOOLH2/yYp2/9/erKh/UW7btiZ6SnfiOfeec6BYpgD9rzxfyoyjL9gQp5PYVAvQgBsR4VOPRl9NGETZ2O4auzou/U0HwdRBOdA045JPMcj3FDElMZjefT1kZJ5XqlYdzaBqhiUCY8vI133MDIHIMukEteS/X8dVTAwpBzf3jbgrZAcMfISS08DklsK9wuHqP+b4bzfsnsLJwcvZPd8qTavPOL3s6ShzkhLUuzjNHH1+/j1tXenCBammrnsT24A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.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 (0) 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=V5d062+4JbBFLOcdWUwRAcWGzwxC6G9JVk2p6xcaNgk=; b=N/nioLZw1AF5ZI8m3SzFazp0pQmsPqE1W3jDdVwo2zGLVj39nsqHXzDL2KTGkiAUiKFm2Xcnbu08D8OFrzTrCiJKF++QK2atuu0IbooGFUOCpzzsoM6Xo3l2SnHeoZazDW+T/c59UmdRwO1umt/t58VWgrm7a9AwErm5IgQEcH0= Received: from DUZPR01CA0081.eurprd01.prod.exchangelabs.com (2603:10a6:10:46a::6) by GV1PR08MB8107.eurprd08.prod.outlook.com (2603:10a6:150:94::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.27; Fri, 8 Dec 2023 16:32:30 +0000 Received: from DB1PEPF00039234.eurprd03.prod.outlook.com (2603:10a6:10:46a:cafe::6e) by DUZPR01CA0081.outlook.office365.com (2603:10a6:10:46a::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34 via Frontend Transport; Fri, 8 Dec 2023 16:32:30 +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 DB1PEPF00039234.mail.protection.outlook.com (10.167.8.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7068.20 via Frontend Transport; Fri, 8 Dec 2023 16:32:30 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) 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.32; Fri, 8 Dec 2023 16:32:29 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 8 Dec 2023 16:32:29 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 8 Dec 2023 16:32:29 +0000 From: Szabolcs Nagy To: Subject: [PATCH 3/4] aarch64: Add setcontext support for SME Date: Fri, 8 Dec 2023 16:32:28 +0000 Message-ID: <4d546102e14a17458005727b7c8a692bcd74e435.1702051831.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DB1PEPF00039234:EE_|GV1PR08MB8107:EE_|AMS0EPF000001B5:EE_|DU0PR08MB8472:EE_ X-MS-Office365-Filtering-Correlation-Id: c35aac7f-7ffe-4951-9b06-08dbf80b4bba 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: TAMve4SlS1nqUsfrTOVCWQ7gZ1V4YPdnfzqkjwMvHQfd2wC7vfmDHxDqWSc24DoyZHvqDLe8IvL2fyaVoYtWOayARJSHR2AIoTxqkzDJGD2HIrSGIRSVKKOWOQECy45PlsSyA6BW4x/h/PuPUWfl+73u9RY2mP+7srABkvYtB8ELJ1dQMLU3HeMTrUxPk8KdONw9d491wb6QarRYbZNb/n044vHI8pknmD1AuR9AgyJ0dKsOt0ynC6YTJyupIH2Y02n/59TKDow6EchmaAtR+Fakrwa9Flny7627VftsWkR3ZbpAs6wtzsbFu/8/Xl4igYJq/msOu1xojM2J7YaxKHF62U12O0jS4ylZRaNHrbMVToSYFjTrz7kH+qXuCREIxpGNxMeZSstAwqTo6/KN7dIgRjUWBrR0PsSoBw6I9eFDEXJKt2ALcqI9We1gl0HZhfJF5vEW/dKxWwvKSMbAj7RXJuC0BbBb3D6gadC1Ur0bF6H8Tqz+Cko3N5+1la5StOyymNFNOXp5EfI5VL1ZUM22xOmAxGdF2r5Y5GELZwvpXGaNoLLWJIFWR45vjYSqrGN9gP7sgk61nS0+9Hn6gDfuRiLhhdbPlABYRZZQ989cHGkuYnmsUSa6zSmiJ5I+VXuQ1LHYdS0gWdn+eO9jrbP7y9FqQOCLPPXxtGlwu+2sy1uLjR8N4441KogLzGBS9jbxeqcl4VFEhuAYqCHCAbmiooo2mizj+l+d5CZ2HD99qPcywTrZixpdvoMLup4Ij4KMgeVqzm10hhTMfSteng== 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:(13230031)(4636009)(136003)(376002)(39860400002)(396003)(346002)(230922051799003)(64100799003)(82310400011)(186009)(1800799012)(451199024)(46966006)(40470700004)(36840700001)(81166007)(356005)(40480700001)(40460700003)(47076005)(82740400003)(8936002)(7696005)(86362001)(70206006)(70586007)(6916009)(8676002)(316002)(2616005)(44832011)(5660300002)(478600001)(2906002)(36860700001)(426003)(41300700001)(336012)(26005)(36756003)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB8107 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001B5.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: cab3bace-0e84-4a6e-4f7c-08dbf80b45e9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FZhDKgCmzjJ8XiKJHTv4nMbJl1L8k+Cky5V9/f5fXXD7S+bMJd1xK4QGt3RKR0ojgxz27aOfXL01fXIdx/8Ke5sdFnjl/DCslGXASBdcLvvKeGdXZ3XXW5o81xApTKKl6JDKFyqtfqCF2z/OXz7SX3WVDFx84Mbe07rrVYJBmzz7DHQeKMZfoVZ+geBRgXZxS7DS78ByFjsFjtSgCfBdbNoeuc2j0rQu6TABcIjU5v74zUnkdW2XTyeGqUzlASCbT5nzs6/gtx3FlE1WC1yfbzN1nx/6xKTcbLhBIV8qfrVxii5FQy2dtZJ8whqeR31zfxzMm5ZSmSYLqmoe2lZBlNMatYceLrzbULvfBFeBnp5ck82d5o1FDCYww5Y85bupcy8CMEgbdLZTWNMp0uAog+732RTB0qe8EmLESuVtA8xycT9BI9Ae+W1Dw6yUviWwjQoPQCcB3h8dZEKaZe1yi9sq/sOf6hjOAZuF2LREEJmq3xVL1GSNmYWAbMW2VEEaNOKPwhRhwxCfWT08WY2QaEb6q9RQYHZJNSeqWyfscdgSquWxXTi4C+QXqLtjXoRbPqZzz7sVdDuLS9vUbsEIiUW0gpplQHB3D1wa14u5pQ0hQ/U9FbEN1hoPYattf23FSkuNXy6kSwMwxs5AnBALV2OTaPJGdZPIKk+2yec9AKaMRcUm1ZytZszdSMho8ZJVQmzewszS2Hj0ZZZyThCB12T2AU9h/5aamw7/CAl5DnsG23kQ1HqUn3tGH6FEPu1G 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:(13230031)(4636009)(396003)(346002)(136003)(39860400002)(376002)(230922051799003)(451199024)(64100799003)(186009)(82310400011)(1800799012)(36840700001)(46966006)(40470700004)(5660300002)(7696005)(2906002)(40460700003)(478600001)(86362001)(36756003)(44832011)(70206006)(70586007)(41300700001)(316002)(6916009)(8676002)(8936002)(336012)(26005)(2616005)(36860700001)(83380400001)(40480700001)(426003)(82740400003)(47076005)(81166007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 16:32:40.1438 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c35aac7f-7ffe-4951-9b06-08dbf80b4bba 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: AMS0EPF000001B5.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8472 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org For the ZA lazy saving scheme to work, setcontext has to call __libc_arm_za_disable. Also fixes swapcontext which uses setcontext internally. Reviewed-by: Adhemerval Zanella --- sysdeps/unix/sysv/linux/aarch64/setcontext.S | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sysdeps/unix/sysv/linux/aarch64/setcontext.S b/sysdeps/unix/sysv/linux/aarch64/setcontext.S index d7756015c5..fe75adf61e 100644 --- a/sysdeps/unix/sysv/linux/aarch64/setcontext.S +++ b/sysdeps/unix/sysv/linux/aarch64/setcontext.S @@ -49,6 +49,25 @@ ENTRY (__setcontext) cbz x0, 1f b C_SYMBOL_NAME (__syscall_error) 1: + /* Disable ZA of SME. */ +#if HAVE_AARCH64_PAC_RET + PACIASP + cfi_window_save +#endif + stp x29, x30, [sp, -16]! + cfi_adjust_cfa_offset (16) + cfi_rel_offset (x29, 0) + cfi_rel_offset (x30, 8) + mov x29, sp + bl __libc_arm_za_disable + ldp x29, x30, [sp], 16 + cfi_adjust_cfa_offset (-16) + cfi_restore (x29) + cfi_restore (x30) +#if HAVE_AARCH64_PAC_RET + AUTIASP + cfi_window_save +#endif /* Restore the general purpose registers. */ mov x0, x9 cfi_def_cfa (x0, 0) From patchwork Fri Dec 8 16:32:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1873871 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=QS2P9k4l; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=QS2P9k4l; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SmxXK4mttz23nS for ; Sat, 9 Dec 2023 03:33:21 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AB4F43857C69 for ; Fri, 8 Dec 2023 16:33:19 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2081.outbound.protection.outlook.com [40.107.13.81]) by sourceware.org (Postfix) with ESMTPS id B9C83385AC22 for ; Fri, 8 Dec 2023 16:32:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B9C83385AC22 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B9C83385AC22 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.13.81 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702053176; cv=pass; b=ByCTLnxdUQqaorquBqUFdr9v3MlGQpI5R9z3CmMCmB+KDmEL8g2ODqqJCHnFDc5ZFegxMG2WVBFK34ibQTTaikzQklCKBAomgDXKcM2zoGBrZgkIbpJVOJRpLWKplGIoCa7tw/f01OQJbdyKgxcns2nYenvTS9nUNc0L8U+bv6k= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1702053176; c=relaxed/simple; bh=E6TuMv8fVjNDvp7Os45R/9rRddgo4OL+2JWK+Yb30Gc=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=U2tJH8hSro2KU8yfAiHZ6XPIp3Wr/w3HMCFocdicsFXRRBZRKVj/uZMfDJ/kvGUj8S3gnVCMs1ad7oYXwdLy2PEEJzjSHQmlGIb4f3pMm/38XojWY8GXc7/+KlnraWbkRs1LOQzfoV5t+tr7Rzxw0B84RuB5+RVg33jhvXhXAvY= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=GWz5S1NSVYxRzpnPIZRpQk1neUOznM1UdQFnSXIlt2sQfBn1xq3FfD43gZwU9uVH9a2lLV1XMehk9+4LcCZP4KG0lOvxPrMM254DAkYuNCbCSlRiPiGWM4rN6hwmj/wej3eu2Xgdu9pv5HFdo/M68DFUJKZd3qwVQe3h5sBxxrGw5QtEjsiy9lhbzKrSzp7OVvqh/zMQv38KwvcQvU0R1l6Cqr1NlaLL8Jw6OVpP1dl/Yy8YezaUyCjnzpTyG7AUKumqRGEBoRGq3jdO/HETv/ImFSDscx1s7TJf+dVM5OgeSiZ/i47D3D9t7OZFdItyVen2X3rGkbb6pOJtQEoYHA== 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=UdELP0QAUY+4QT6rLmd+uO6TBrq2DeeEvNCEQKaqLQE=; b=Nu7EnltyyEg9j3Y4W7Q7Wiw+MbpOk4vAH1NtPuo3FE6rd9l4/NVu8S5tk+f+VC7cx+BcZPFZEQOg80OCtX8YwB1ckW/7umEio3h/ZaxY1BfkBLdvlk1cJmS9NtHV8Y3L1vcq2juuysESHHW+YWaNha20MIGD028cGwRf8zV5pu9TB01jFM17+DJ9/KyfcbC90Q6spZ9Hq6aXgNvTCsTcqYud6dksP7Vwd8ioVusVK/5KNHFpTbH0I5fRVYfxGmNXWmdibtdt3HAyUGfZlbaZkpwcpbsQcO5hCF3F7iiGLS2Ju9rZiyxJzp+us+UVq4bU39dejmd8BDHbE5tB7Ays6w== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.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=UdELP0QAUY+4QT6rLmd+uO6TBrq2DeeEvNCEQKaqLQE=; b=QS2P9k4lXNqxctA3hb1I8g7bqmTyZADjA3YFpevUCln391H6rnJuRAGGXdYddAmrtOBJfaBMA88L2Chm2Sea83XfU7rsXMezhD8BIFlKPz3BhQyvNmixLemzGYGDU/gV+4sHhdtVDQDtg0yUJ/8RqOuGQw3JHlIO9oRVTeMRLMg= Received: from DU2PR04CA0220.eurprd04.prod.outlook.com (2603:10a6:10:2b1::15) by DU0PR08MB8164.eurprd08.prod.outlook.com (2603:10a6:10:3ef::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28; Fri, 8 Dec 2023 16:32:50 +0000 Received: from DB5PEPF00014B94.eurprd02.prod.outlook.com (2603:10a6:10:2b1:cafe::2c) by DU2PR04CA0220.outlook.office365.com (2603:10a6:10:2b1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.25 via Frontend Transport; Fri, 8 Dec 2023 16:32:50 +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 DB5PEPF00014B94.mail.protection.outlook.com (10.167.8.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.20 via Frontend Transport; Fri, 8 Dec 2023 16:32:50 +0000 Received: ("Tessian outbound 20615a7e7970:v228"); Fri, 08 Dec 2023 16:32:50 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 141cef550b73624e X-CR-MTA-TID: 64aa7808 Received: from 5e72deb117d5.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2455237E-C712-4C2C-9800-98304CF2A438.1; Fri, 08 Dec 2023 16:32:43 +0000 Received: from EUR02-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5e72deb117d5.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Dec 2023 16:32:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MQ6XlYzwRLchvyKCF56N7/Hb77ZC62olMny5p59knzUSRMW+YlIvGo8MAcx4GbrkJqsrXaKyj7I9jVtbN/ofNsLpeVAhfFpj3fsar7K/ToWDKUhjy84BU/GvoibzjpVt/siURLArbMWwYy0rUg0s30lsbmVLhBWv4pxuV443EkgoOqw3BtvCEnCRtP2pk9IszOE25ru+4/w0OlEld16DVnEgAQfNWB5p1MnGDDMQ2s6CnFXjg9CG7AAsj6JYoLLGi2M5qBEmL42NyWQdAk33RNDFMcR1M65LK6Jr3MelxwWNLGMIOYnrc0AAutqVH/78Z01nLNYycQ7jP1I+SOualg== 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=UdELP0QAUY+4QT6rLmd+uO6TBrq2DeeEvNCEQKaqLQE=; b=m5tyAylj2wH4MbhyISDEKuRA6w60L2QuIbWyPoZNHfj7kyrCQgpnVnrFTIJGdJxkWY7t/VMvMl0ZdTskw7zaR6ue0GMckDSGHy870MkmX21m5FuZYlL+JN6xFwUccg67ARXiyQQk9JV0/LI8VyyV2fS0VNzJWtSxY8IawHXYhHBKZRyl33b1RjNO7Aijg7Nr/nBvLkIcOwkezRmKKvK1jKS9U3W2mRLm1VkA+LzNpoM4ekcDY6LzduFR5HlIIQnTr8Wzr7PW36QwRsQoI9N5xwmMKCKJ1hEGXWDyQ52klXO3D/b/P0eC0/zlIFCnrebYS3sCWvnJDHtgnHtvUF6H7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.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 (0) 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=UdELP0QAUY+4QT6rLmd+uO6TBrq2DeeEvNCEQKaqLQE=; b=QS2P9k4lXNqxctA3hb1I8g7bqmTyZADjA3YFpevUCln391H6rnJuRAGGXdYddAmrtOBJfaBMA88L2Chm2Sea83XfU7rsXMezhD8BIFlKPz3BhQyvNmixLemzGYGDU/gV+4sHhdtVDQDtg0yUJ/8RqOuGQw3JHlIO9oRVTeMRLMg= Received: from AM5PR0101CA0001.eurprd01.prod.exchangelabs.com (2603:10a6:206:16::14) by DU0PR08MB7542.eurprd08.prod.outlook.com (2603:10a6:10:321::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.27; Fri, 8 Dec 2023 16:32:41 +0000 Received: from AMS0EPF000001B7.eurprd05.prod.outlook.com (2603:10a6:206:16:cafe::ad) by AM5PR0101CA0001.outlook.office365.com (2603:10a6:206:16::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34 via Frontend Transport; Fri, 8 Dec 2023 16:32:41 +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 AMS0EPF000001B7.mail.protection.outlook.com (10.167.16.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7068.20 via Frontend Transport; Fri, 8 Dec 2023 16:32:40 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 8 Dec 2023 16:32:40 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 8 Dec 2023 16:32:40 +0000 From: Szabolcs Nagy To: Subject: [PATCH 4/4] aarch64: Add longjmp test for SME Date: Fri, 8 Dec 2023 16:32:40 +0000 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AMS0EPF000001B7:EE_|DU0PR08MB7542:EE_|DB5PEPF00014B94:EE_|DU0PR08MB8164:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fa7e464-616c-4d2f-2122-08dbf80b51ae 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: 0t2U52VdzVQrwbw/pudSFD4dZq0tY+Q63CI9Yse/D9YtaJL4M4NisfUZ/gwfflple553/zOWp1pMX5f4rXU7jUPxww8qihIp8DJL0esRgt9ldlXdzBR2cik4pZxW9df2HKseJss2nhoUD5jA75bQIiMvJgY8LA5QoFxWGyh4ZNOYyI0oAZ1fAuPHnOy/3Z7W6MCKMF9IieCiFZ+KtWyfUsj4iyd6XceJQDrjsxw9G4/89t54E25aYTSSMcyohbGQeNkq3FDY+faeWcKcRYEP0ZNgjSi6/JgEt6GB4y56IAuQaGeCjPCzsHZ5coiWG3zE80jM3pOV+ygJr2px8SyhruQWDSVWjrW2FgfCRK189DAq35OJzACj43kWaR+ieiygNb8yCR0Z5hjKQiAReo68cA5UqdQlMq7/4E2R7wquEyayDAMIJ/JEgcV8LWHCB5ktJ7RZX1+YSM7ttjZJw95H5CSovHbWNwSpSC3n6A5PjjKP5cFBa5ZzdZdmp+RNwivd+kifRLI/nmKPQ/PN59a1J6iaPAkVjBQHNT8lP6DhxG1hY3T/2kabJmc7RpUC7mTR7Uq/YcPIEpQ2vAyga7myelZDZOR8UR5c0neM/PDI/fxmQHuZcFekXvhT7QGsCCe4xJ35Jg40rWE/f8sCBYhLINWiftJbAromVYypLge2hCALHBSx4orlDM2wYPr/+1c55qLx/ue2tXzbEfJQcJmPrXMxm1V2bOcNgNDQtmGXfgjuZ53dmwYJA49maAgrvyEogyQA7p/HsWYKSP8wQj0Z+A== 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:(13230031)(4636009)(346002)(376002)(396003)(136003)(39860400002)(230922051799003)(186009)(1800799012)(64100799003)(451199024)(82310400011)(46966006)(40470700004)(36840700001)(44832011)(70206006)(36860700001)(40480700001)(478600001)(70586007)(356005)(8936002)(82740400003)(8676002)(26005)(316002)(2616005)(336012)(6916009)(7696005)(426003)(81166007)(5660300002)(86362001)(40460700003)(2906002)(41300700001)(83380400001)(47076005)(36756003)(2004002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7542 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5PEPF00014B94.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 473fc288-0dd4-4c60-161b-08dbf80b4c39 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9JAzvV1pPlrZHXJbC6MNg89kTEk8YOfP7GTFkcSBTjIUXenSEztgsjM1rTpsU6ovfYV+rasCjd7UOZoiUtBsVL3YPMXv9Di5cr+61cTEqOZ+xwIovlM2/gnxJLwCCKtZI2IU5LKFqsrZ28a2CTQOdczGUdS/0ENT39cMPjLcXEOvwNhlROSrN3/qm8hONmokwDxGDO/W5Lci+bjwfVc4vsDWWk5yYuqOd4Wg475QXhfcVhGqdtkuey0NGhlxw+E07BTs8zNOvoLVbv6fqj++B47t4XLU3uGOhrfzRQoQsu3a92WvA3wlwfEVf9bCp4SygO0PcDu/pJp//+0V8mUZIZ0CUqL+eD04iWGL6iCC6C/clfTZy9+FTA+YtgkPyM715/f8QgJy2tTErUSjP+BA6WMIS+3SszfKY9NZszEsdj2dBdqsmC0aqeYuWWIccqAd4pvsHoqS5bo/pSr65CZ4L2eyirL1HCzRMgHAOJ7PDHK8Tk9z5DR7R4Ix4klYGpoK4sYji/JtWMaidJ9S1dowVmdK/UHnARLYIPz9cewwTpCayxgBhWx7CpoQuOhowkBzgtl8COW9PFp4lIzd9SAsnYZLWCOGn/1JqvbJ2YEWnkXTFSPQmm7Dizr0sWbkVU4lcmew//2lr6afMX0GDTHTS3KhcuuUhj1k2rtOWn6vvXVk2H2Ve9AJ7bIEII6LXj5YKrHYgVF+fL/EwZmsdb+g061nok5FQpMnpf5L9w1r216e2Qf8TVnqcxGLyHQGwBL7 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:(13230031)(4636009)(396003)(376002)(136003)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(82310400011)(46966006)(40470700004)(36840700001)(478600001)(44832011)(36860700001)(82740400003)(7696005)(26005)(5660300002)(336012)(86362001)(70206006)(316002)(6916009)(70586007)(40480700001)(2616005)(8676002)(8936002)(426003)(40460700003)(2906002)(83380400001)(41300700001)(36756003)(81166007)(47076005)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 16:32:50.1752 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fa7e464-616c-4d2f-2122-08dbf80b51ae 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: DB5PEPF00014B94.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8164 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Includes test for setcontext too. The test directly checks after longjmp if ZA got disabled and the ZA contents got saved following the lazy saving scheme. It does not use ACLE code to verify that gcc can interoperate with glibc. Reviewed-by: Adhemerval Zanella --- sysdeps/aarch64/Makefile | 3 + sysdeps/aarch64/tst-sme-jmp.c | 278 ++++++++++++++++++++++++++++++++++ 2 files changed, 281 insertions(+) create mode 100644 sysdeps/aarch64/tst-sme-jmp.c diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 9d8844d9c8..141d7d9cc2 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -68,6 +68,9 @@ sysdep_routines += \ __mtag_tag_zero_region \ __mtag_tag_region \ __arm_za_disable + +tests += \ + tst-sme-jmp endif ifeq ($(subdir),malloc) diff --git a/sysdeps/aarch64/tst-sme-jmp.c b/sysdeps/aarch64/tst-sme-jmp.c new file mode 100644 index 0000000000..08dd291b0c --- /dev/null +++ b/sysdeps/aarch64/tst-sme-jmp.c @@ -0,0 +1,278 @@ +/* Test for SME longjmp. + Copyright (C) 2023 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include +#include +#include + +struct blk { + void *za_save_buffer; + uint16_t num_za_save_slices; + char __reserved[6]; +}; + +static unsigned long svl; +static uint8_t *za_orig; +static uint8_t *za_dump; +static uint8_t *za_save; + +static unsigned long +get_svl (void) +{ + register unsigned long x0 asm ("x0"); + asm volatile ( + ".inst 0x04bf5820 /* rdsvl x0, 1 */\n" + : "=r" (x0)); + return x0; +} + +/* PSTATE.ZA = 1, set ZA state to active. */ +static void +start_za (void) +{ + asm volatile ( + ".inst 0xd503457f /* smstart za */"); +} + +/* Read SVCR to get SM (bit0) and ZA (bit1) state. */ +static unsigned long +get_svcr (void) +{ + register unsigned long x0 asm ("x0"); + asm volatile ( + ".inst 0xd53b4240 /* mrs x0, svcr */\n" + : "=r" (x0)); + return x0; +} + +/* Load data into ZA byte by byte from p. */ +static void __attribute__ ((noinline)) +load_za (const void *p) +{ + register unsigned long x15 asm ("x15") = 0; + register unsigned long x16 asm ("x16") = (unsigned long)p; + register unsigned long x17 asm ("x17") = svl; + + asm volatile ( + ".inst 0xd503437f /* smstart sm */\n" + ".L_ldr_loop:\n" + ".inst 0xe1006200 /* ldr za[w15, 0], [x16] */\n" + "add w15, w15, 1\n" + ".inst 0x04305030 /* addvl x16, x16, 1 */\n" + "cmp w15, w17\n" + "bne .L_ldr_loop\n" + ".inst 0xd503427f /* smstop sm */\n" + : "+r"(x15), "+r"(x16), "+r"(x17)); +} + +/* Set tpidr2 to BLK. */ +static void +set_tpidr2 (struct blk *blk) +{ + register unsigned long x0 asm ("x0") = (unsigned long)blk; + asm volatile ( + ".inst 0xd51bd0a0 /* msr tpidr2_el0, x0 */\n" + :: "r"(x0) : "memory"); +} + +/* Returns tpidr2. */ +static void * +get_tpidr2 (void) +{ + register unsigned long x0 asm ("x0"); + asm volatile ( + ".inst 0xd53bd0a0 /* mrs x0, tpidr2_el0 */\n" + : "=r"(x0) :: "memory"); + return (void *) x0; +} + +static void +print_data(const char *msg, void *p) +{ + unsigned char *a = p; + printf ("%s:\n", msg); + for (int i = 0; i < svl; i++) + { + printf ("%d: ", i); + for (int j = 0; j < svl; j++) + printf("%02x,", a[i*svl+j]); + printf("\n"); + } + printf(".\n"); + fflush (stdout); +} + +__attribute__ ((noinline)) +static void +do_longjmp (jmp_buf env) +{ + longjmp (env, 1); +} + +__attribute__ ((noinline)) +static void +do_setcontext (const ucontext_t *p) +{ + setcontext (p); +} + +static void +longjmp_test (void) +{ + unsigned long svcr; + jmp_buf env; + void *p; + int r; + struct blk blk = {za_save, svl, {0}}; + + printf ("longjmp test:\n"); + p = get_tpidr2 (); + printf ("initial tp2 = %p\n", p); + if (p != NULL) + FAIL_EXIT1 ("tpidr2 is not initialized to 0"); + svcr = get_svcr (); + if (svcr != 0) + FAIL_EXIT1 ("svcr != 0: %lu", svcr); + set_tpidr2 (&blk); + start_za (); + load_za (za_orig); + + print_data ("za save space", za_save); + p = get_tpidr2 (); + printf ("before setjmp: tp2 = %p\n", p); + if (p != &blk) + FAIL_EXIT1 ("tpidr2 is not set to BLK %p", (void *)&blk); + if (setjmp (env) == 0) + { + p = get_tpidr2 (); + printf ("before longjmp: tp2 = %p\n", p); + if (p != &blk) + FAIL_EXIT1 ("tpidr2 is clobbered"); + do_longjmp (env); + FAIL_EXIT1 ("longjmp returned"); + } + p = get_tpidr2 (); + printf ("after longjmp: tp2 = %p\n", p); + if (p != NULL) + FAIL_EXIT1 ("tpidr2 is not set to 0"); + svcr = get_svcr (); + if (svcr != 0) + FAIL_EXIT1 ("svcr != 0: %lu", svcr); + print_data ("za save space", za_save); + r = memcmp (za_orig, za_save, svl*svl); + if (r != 0) + FAIL_EXIT1 ("saving za failed"); +} + +static void +setcontext_test (void) +{ + volatile int setcontext_done = 0; + unsigned long svcr; + ucontext_t ctx; + void *p; + int r; + struct blk blk = {za_save, svl, {0}}; + + printf ("setcontext test:\n"); + p = get_tpidr2 (); + printf ("initial tp2 = %p\n", p); + if (p != NULL) + FAIL_EXIT1 ("tpidr2 is not initialized to 0"); + svcr = get_svcr (); + if (svcr != 0) + FAIL_EXIT1 ("svcr != 0: %lu", svcr); + set_tpidr2 (&blk); + start_za (); + load_za (za_orig); + + print_data ("za save space", za_save); + p = get_tpidr2 (); + printf ("before getcontext: tp2 = %p\n", p); + if (p != &blk) + FAIL_EXIT1 ("tpidr2 is not set to BLK %p", (void *)&blk); + r = getcontext (&ctx); + if (r != 0) + FAIL_EXIT1 ("getcontext failed"); + if (setcontext_done == 0) + { + p = get_tpidr2 (); + printf ("before setcontext: tp2 = %p\n", p); + if (p != &blk) + FAIL_EXIT1 ("tpidr2 is clobbered"); + setcontext_done = 1; + do_setcontext (&ctx); + FAIL_EXIT1 ("setcontext returned"); + } + p = get_tpidr2 (); + printf ("after setcontext: tp2 = %p\n", p); + if (p != NULL) + FAIL_EXIT1 ("tpidr2 is not set to 0"); + svcr = get_svcr (); + if (svcr != 0) + FAIL_EXIT1 ("svcr != 0: %lu", svcr); + print_data ("za save space", za_save); + r = memcmp (za_orig, za_save, svl*svl); + if (r != 0) + FAIL_EXIT1 ("saving za failed"); +} + +static int +do_test (void) +{ + unsigned long hwcap2; + + hwcap2 = getauxval (AT_HWCAP2); + if ((hwcap2 & HWCAP2_SME) == 0) + return 77; + + svl = get_svl (); + printf ("svl: %lu\n", svl); + if (svl < 16 || svl % 16 != 0 || svl >= (1 << 16)) + FAIL_EXIT1 ("invalid svl"); + + za_orig = malloc (svl*svl); + za_save = malloc (svl*svl); + za_dump = malloc (svl*svl); + memset (za_orig, 1, svl*svl); + memset (za_save, 2, svl*svl); + memset (za_dump, 3, svl*svl); + for (int i = 0; i < svl; i++) + for (int j = 0; j < svl; j++) + za_orig[i*svl+j] = i*svl+j; + print_data ("original data", za_orig); + + longjmp_test (); + + memset (za_save, 2, svl*svl); + memset (za_dump, 3, svl*svl); + + setcontext_test (); + + free (za_orig); + free (za_save); + free (za_dump); + return 0; +} + +#include