From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04A3BFA3741 for ; Mon, 31 Oct 2022 15:07:03 +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:In-Reply-To:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=c2pGNBqB2wOJnOCqm3s6sBkVEhQq+h9KkPq+2qbIJCc=; b=hdGxdTKYFTcrb8 0o6XtAtL2kMwXOcI4ACQt53NdKE0gPSNJmOZcv5MLCElkv/CX2X8cgzR/zt2e/5XGx0cBHsh2oiFK qqDirGWIuAIEg3tpZYArhSBCcGT2tzkxFCE8fnGYe3YYFmyGofA8rnPopY1H6L+dMpole0xRCclBB nJMvF1NN1h8lcblXZWk2Rn0MRLuk8yf0oImLBCw4YrQYTvtEvq7knjYUsAgfxYR+4/EUDiaA+ukmM FfmHj3akRNGgbrHBZe7Q9eYzwnVz/7c0X9CJ13WNmDAKrqyMkZJQM64YAJ4BDloZibuYm4UQeoyQO GCcMCOw2mhpmmwRMXZeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1opWMA-00CSpL-Kf; Mon, 31 Oct 2022 15:05:42 +0000 Received: from mail-vi1eur05on2068.outbound.protection.outlook.com ([40.107.21.68] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1opWM7-00CSmz-Fl for linux-arm-kernel@lists.infradead.org; Mon, 31 Oct 2022 15:05:41 +0000 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=JFNKl8laSOxE4cmcUAKLXk9aKmo552z7mWNmolt0UWqkLPfKrgVEnZQdk4e6Izb9nkzsSQr7MFcoDEl8RIfC1Lw22xni71LaNAFNhNJLQkN5jQ2xJPVqRtNE9YbX2i7zNBegM6raBtH6QFa98GQ6W3MVI5p8srxe/qod53A7ukj0zCJ5/gUvdqD1FAxrEH2yHhHkb4vTo2jAKoK6B+m0obH+lI1sqH9kgH9IylJPOw2jNyqWhtdc7R/EJybCJQ+GAFEiGuO27tEtig/j5gxhaNlT9OsHwGOcZwVNgqDLN2387si5xzrr9sjg1krAaS60R344lxfNXNyoI6qYjEmk8w== 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=WLPPNQ7L+Bq/gqgPMX7CsPzLd7/cS8qlwfgDQocEh6E=; b=nbAt8MvljTd17q1OTrApqrKlsJVpF7lsy879ccTq8GMRYlXiWFXCkHy/TgjEstZNCSNVo+22R5H+UFFi9DijX5ysiLbm79+U04b2LGz8R2vLJ7TLI4pOkfazli+XVd7qO7Z6Qjb8g56cfHPPc6IF/v2uKwHSHHcN1uvydo3XATLXd5mSKMBADRL+l8k463EeqWf7CD3OrDs1KXLMtShUjaP/1CIkg6JWodlXTpQNFYrWqAWE18Bj/2VIZnDvIvyuQkmQ0ygaXNBPeD3rtCQlEFMLNIAbi6Ghx3bF/qpYgL2U88SU7HhmdLIseuwmdU7RzPW4J903m3UKFdqDAVO9yQ== 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] dkim=[1,1,header.d=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=WLPPNQ7L+Bq/gqgPMX7CsPzLd7/cS8qlwfgDQocEh6E=; b=88eqmCU5XkKufl+CaGz4YC1zkuP5tJ/wpPo9QS6z2DIfM14DCSg5nb7EEpO4TDKFt4sWzhdYDOEHoovHTQL8yn3hSxsDr6pHXBy1URHyf7R53cIZeciAkJYmD8oKVHd9QzD9S0sX4c3fHu47HMDPxsYy9+NrSFIwKLLaHjRKVGc= Received: from AM7PR04CA0008.eurprd04.prod.outlook.com (2603:10a6:20b:110::18) by AM9PR08MB6003.eurprd08.prod.outlook.com (2603:10a6:20b:2d4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Mon, 31 Oct 2022 15:05:29 +0000 Received: from AM7EUR03FT028.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::63) by AM7PR04CA0008.outlook.office365.com (2603:10a6:20b:110::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.15 via Frontend Transport; Mon, 31 Oct 2022 15:05:29 +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 AM7EUR03FT028.mail.protection.outlook.com (100.127.140.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14 via Frontend Transport; Mon, 31 Oct 2022 15:05:29 +0000 Received: ("Tessian outbound 58faf9791229:v130"); Mon, 31 Oct 2022 15:05:28 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 623c3748f03b1e76 X-CR-MTA-TID: 64aa7808 Received: from 9499ffdfb6f2.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F9F77331-7AC3-4B10-A3A9-20B8307278F3.1; Mon, 31 Oct 2022 15:05:22 +0000 Received: from EUR03-AM7-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9499ffdfb6f2.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 31 Oct 2022 15:05:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hSYXRmVGeJwnvyimMNQq9lReI+Cj0tZE731CTidUqTBzemv48KJv7fWT09jaWE06vfFpmjDtt+26CechmDGCnXF40qA8GdKj94pEk9dTRkU5SUrAJiZJBslzMtEq+qVNnjRCOveaEZBSMhVLzxFC1/2jvzuVr7axQUZXXfCeJo1iBME3291HWrB31pJ4XR5a08ncAeVdeT24PYzbbMGu5JLHq1EP8AyQte1VH0Nyi3tr6AA76+9DFz6omX13uHDD+UAIFVeUgY3CT6VxK9/iW42IrQe52C3fU9Z/AAUsLWnxhRkaiHlwsXFGWWOK7eS1rxWYNU0Ap3nG73lzLOmVPQ== 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=WLPPNQ7L+Bq/gqgPMX7CsPzLd7/cS8qlwfgDQocEh6E=; b=FXOo9ZYfzpqmHLLDlAh2z29Gx4UkgDEfzI/nN5TZKFrTmzM7vvSGzWESOT4XOq4aDTqMTQrYxV2viYDsu4H14VrH1OH1BO491oK2L7NjiMZtEXzaPUvzrJNF0AsJjxcQh5boE+2FiirqmyHzEgPhPt9rp+BLDmd5vIh54PoPpmhEPW7/jJDVLeP8cvsMgfrLYTbh9qF9GiN+e3NSeyA019OwGbII6FltX5Is5LyVi1qX92Y05wiqyx3ql0d4y8HqZdhTSRk04NVWLzqFjZFYtFjlh2MVY7cXrJ2axKestogZn2rOQVz2Cvxdv0iAu5M8nIqC4ozKQfzw0EsTJeMiWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; 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=WLPPNQ7L+Bq/gqgPMX7CsPzLd7/cS8qlwfgDQocEh6E=; b=88eqmCU5XkKufl+CaGz4YC1zkuP5tJ/wpPo9QS6z2DIfM14DCSg5nb7EEpO4TDKFt4sWzhdYDOEHoovHTQL8yn3hSxsDr6pHXBy1URHyf7R53cIZeciAkJYmD8oKVHd9QzD9S0sX4c3fHu47HMDPxsYy9+NrSFIwKLLaHjRKVGc= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) by PA4PR08MB5933.eurprd08.prod.outlook.com (2603:10a6:102:f0::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Mon, 31 Oct 2022 15:05:20 +0000 Received: from DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::8999:7c8d:d088:d198]) by DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::8999:7c8d:d088:d198%5]) with mapi id 15.20.5769.019; Mon, 31 Oct 2022 15:05:20 +0000 Date: Mon, 31 Oct 2022 15:05:06 +0000 From: Szabolcs Nagy To: Mark Brown Cc: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v1 2/4] arm64/signal: Include TPIDR2 in the signal context Message-ID: References: <20221028185046.1316730-1-broonie@kernel.org> <20221028185046.1316730-3-broonie@kernel.org> Content-Disposition: inline In-Reply-To: <20221028185046.1316730-3-broonie@kernel.org> X-ClientProxiedBy: LO4P123CA0407.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:189::16) To DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR08MB7179:EE_|PA4PR08MB5933:EE_|AM7EUR03FT028:EE_|AM9PR08MB6003:EE_ X-MS-Office365-Filtering-Correlation-Id: 38517f87-b9e1-4336-510f-08dabb515976 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: IC125PvAjzZSEOfsICphVz37nf4noAeQynmtUqFW6dqdO7EyORsb/g4IMFY5sIxPFL7OZQLy6UTIYZycB1LVbwfKnZq/OVcDMPoiOO+Kv03hWi45L1nlyifkgEdecJSnr3P4vaoq9Gd7vPCj1/Nytocnw60MKXzL1HkB/J0EARSZIk4khtKOT+RHrJeKYCGjxMJIOpPwke/pvbujydXCjZGTqUiNDtdilEUt5JACF7fNHkoiirMUBrSv6PZNNiftMJUt0eYhEcMSYr5o110QbGDEmVlW/9HrwzNPjskTgKvv9BW8m27j6jBG3scrvhR/zwFUh1nAPY3/fqcSXkcbGUHw9Cof4s/+6Q7b2xcdImS1pzN/x1VVMhGqywwwPCzGvonEG6jPHuB1oaizg77eJr9GyXOYvE5rMuaqMY8E6jF08bNppEBxxPDdMSjhefIvTmHqO7D93pCuyaFq+ukVmiAL36jqcI7j6gmO9i4NhaJ7kreLh7mt9mluV64JR22XKP2PBo9leaHlwHnxfuJgPjTs4s3AYqHk2hZIGIqb82WNmOG0sdnnFY1hJRmRhnIsQySXf5dj9GMDnMX6FOFPisDcSUogYrPfifFWKVd12bezanyGh+4eo122hBSQQoVDLSFAmYERcGLLvx69n71AH3RmxVWiy/2tQjfaAHrk4dph/PT4VtkL06nzfrYj9YK477KVoqvrsNhFsHswiNNkBQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR08MB7179.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39860400002)(366004)(346002)(136003)(376002)(451199015)(186003)(6666004)(6506007)(26005)(6512007)(2616005)(478600001)(83380400001)(44832011)(2906002)(54906003)(316002)(6486002)(8936002)(66476007)(66556008)(66946007)(8676002)(5660300002)(4326008)(41300700001)(6916009)(86362001)(36756003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB5933 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT028.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d80abf82-09c5-4271-8939-08dabb5153ca X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LbdbQXQB79OE47caoL2tBrwOcl2xXdvd/5yv29TqSlxS9psSiEg8O4vVZczBpdhkW4n1thKexgYbLvxKoqqq6Kw6iIcFLIhKX7Miv4aUdV412VQwHP7zZNFKUT1KIYUqQkf5VlJfFVD/jKVhr4F7pfD20awCeRd8NXjbu+VPQXUBri1MupwHtf70XKpQCo/HlaF/eYfPyJRAT3BkdmWFLpcHpR8+D3FW4TNMpLhxGCChC2UG4g4EBue3ku2SdXvRK2uYbTeKzQqzZrJzkU29irAucMyAOmWCjY8LPpBDLjd8TWdJjA02PDwENVRmGbxhul706DgOhm+QI/zyNGXrnr0Ej00lTsi4Z0H/T7BU3BLmOitcDrOA8D3pBfYEd8kC2La5dIam/QtZUQNmWDgAS7QLjRMoKOzitXhSchM6kc+lr6840czdkoZa2Yav5LQD6MrsEYkJrWRlMQPUWpQdLSkF0ud+MApRAnF5o7Nrta/lvWKpKGbKqANGs1GyAM2JEGp9KS9VUmZ0y+pKuA9JJtyWJxo5Jnv83ZR3JRPP5zlco6xtT1hbdCBeoCQ+1yi838Vqp+v5TQ9CXCwEz63LYfCCjE2LmiCa6CjMEzpRd7OF6uGA6IIMSNUjguO/Y4nEimBPKqGesEy4KrwoYFAiCMaDMImxjRSROymCF+8d3viHj9fo/2u7yjGwImceefVa/hETZonxiKHP2icg9wmDPR2QfqNdSyDYrRglcwgyi1gA5I6S398ZWXYN0v0jSNYG 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:(13230022)(4636009)(376002)(396003)(39860400002)(346002)(136003)(451199015)(46966006)(36840700001)(356005)(86362001)(81166007)(36756003)(82740400003)(44832011)(2906002)(6486002)(6666004)(40480700001)(4326008)(5660300002)(8676002)(316002)(6862004)(8936002)(478600001)(54906003)(6506007)(41300700001)(70586007)(70206006)(82310400005)(6512007)(36860700001)(186003)(2616005)(26005)(47076005)(83380400001)(336012);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2022 15:05:29.3392 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38517f87-b9e1-4336-510f-08dabb515976 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: AM7EUR03FT028.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6003 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221031_080539_716343_17C95B6C X-CRM114-Status: GOOD ( 24.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 10/28/2022 19:50, Mark Brown wrote: > Add a new signal frame record for TPIDR2 using the same format as we > already use for ESR with different magic, a header with the value from the > register appended as the only data. If SME is supported then this record is > always included. > > Signed-off-by: Mark Brown this looks good from userspace point of view. originally the magic numbers made some sense, e.g. esr used 0x45535201 which is ascii encoded "ESR\01", the new ones seem random. probably does not matter. Reviewed-by: Szabolcs Nagy > --- > arch/arm64/include/uapi/asm/sigcontext.h | 8 ++++ > arch/arm64/kernel/signal.c | 59 ++++++++++++++++++++++++ > 2 files changed, 67 insertions(+) > > diff --git a/arch/arm64/include/uapi/asm/sigcontext.h b/arch/arm64/include/uapi/asm/sigcontext.h > index 4aaf31e3bf16..6315e1b8e2c4 100644 > --- a/arch/arm64/include/uapi/asm/sigcontext.h > +++ b/arch/arm64/include/uapi/asm/sigcontext.h > @@ -140,6 +140,14 @@ struct sve_context { > > #define SVE_SIG_FLAG_SM 0x1 /* Context describes streaming mode */ > > +/* TPIDR2_EL0 context */ > +#define TPIDR2_MAGIC 0x45a4209c > + > +struct tpidr2_context { > + struct _aarch64_ctx head; > + __u64 tpidr2; > +}; > + > #define ZA_MAGIC 0x54366345 > > struct za_context { > diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c > index 9ad911f1647c..ac4fb42a9613 100644 > --- a/arch/arm64/kernel/signal.c > +++ b/arch/arm64/kernel/signal.c > @@ -56,6 +56,7 @@ struct rt_sigframe_user_layout { > unsigned long fpsimd_offset; > unsigned long esr_offset; > unsigned long sve_offset; > + unsigned long tpidr2_offset; > unsigned long za_offset; > unsigned long extra_offset; > unsigned long end_offset; > @@ -219,6 +220,7 @@ static int restore_fpsimd_context(struct fpsimd_context __user *ctx) > struct user_ctxs { > struct fpsimd_context __user *fpsimd; > struct sve_context __user *sve; > + struct tpidr2_context __user *tpidr2; > struct za_context __user *za; > }; > > @@ -358,6 +360,32 @@ extern int preserve_sve_context(void __user *ctx); > > #ifdef CONFIG_ARM64_SME > > +static int preserve_tpidr2_context(struct tpidr2_context __user *ctx) > +{ > + int err = 0; > + > + current->thread.tpidr2_el0 = read_sysreg_s(SYS_TPIDR2_EL0); > + > + __put_user_error(TPIDR2_MAGIC, &ctx->head.magic, err); > + __put_user_error(sizeof(*ctx), &ctx->head.size, err); > + __put_user_error(current->thread.tpidr2_el0, &ctx->tpidr2, err); > + > + return err; > +} > + > +static int restore_tpidr2_context(struct user_ctxs *user) > +{ > + u64 tpidr2_el0; > + int err = 0; > + > + /* Magic and size were validated deciding to call this function */ > + __get_user_error(tpidr2_el0, &user->tpidr2->tpidr2, err); > + if (!err) > + current->thread.tpidr2_el0 = tpidr2_el0; > + > + return err; > +} > + > static int preserve_za_context(struct za_context __user *ctx) > { > int err = 0; > @@ -447,6 +475,8 @@ static int restore_za_context(struct user_ctxs *user) > #else /* ! CONFIG_ARM64_SME */ > > /* Turn any non-optimised out attempts to use these into a link error: */ > +extern int preserve_tpidr2_context(void __user *ctx); > +extern int restore_tpidr2_context(struct user_ctxs *user); > extern int preserve_za_context(void __user *ctx); > extern int restore_za_context(struct user_ctxs *user); > > @@ -465,6 +495,7 @@ static int parse_user_sigframe(struct user_ctxs *user, > > user->fpsimd = NULL; > user->sve = NULL; > + user->tpidr2 = NULL; > user->za = NULL; > > if (!IS_ALIGNED((unsigned long)base, 16)) > @@ -531,6 +562,19 @@ static int parse_user_sigframe(struct user_ctxs *user, > user->sve = (struct sve_context __user *)head; > break; > > + case TPIDR2_MAGIC: > + if (!system_supports_sme()) > + goto invalid; > + > + if (user->tpidr2) > + goto invalid; > + > + if (size != sizeof(*user->tpidr2)) > + goto invalid; > + > + user->tpidr2 = (struct tpidr2_context __user *)head; > + break; > + > case ZA_MAGIC: > if (!system_supports_sme()) > goto invalid; > @@ -663,6 +707,9 @@ static int restore_sigframe(struct pt_regs *regs, > err = restore_fpsimd_context(user.fpsimd); > } > > + if (err == 0 && system_supports_sme() && user.tpidr2) > + err = restore_tpidr2_context(&user); > + > if (err == 0 && system_supports_sme() && user.za) > err = restore_za_context(&user); > > @@ -757,6 +804,11 @@ static int setup_sigframe_layout(struct rt_sigframe_user_layout *user, > else > vl = task_get_sme_vl(current); > > + err = sigframe_alloc(user, &user->tpidr2_offset, > + sizeof(struct tpidr2_context)); > + if (err) > + return err; > + > if (thread_za_enabled(¤t->thread)) > vq = sve_vq_from_vl(vl); > > @@ -814,6 +866,13 @@ static int setup_sigframe(struct rt_sigframe_user_layout *user, > err |= preserve_sve_context(sve_ctx); > } > > + /* TPIDR2 if supported */ > + if (system_supports_sme() && err == 0) { > + struct tpidr2_context __user *tpidr2_ctx = > + apply_user_offset(user, user->tpidr2_offset); > + err |= preserve_tpidr2_context(tpidr2_ctx); > + } > + > /* ZA state if present */ > if (system_supports_sme() && err == 0 && user->za_offset) { > struct za_context __user *za_ctx = > -- > 2.30.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel