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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19B23C3526D for ; Wed, 26 Jan 2022 15:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242853AbiAZPbe (ORCPT ); Wed, 26 Jan 2022 10:31:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242846AbiAZPbe (ORCPT ); Wed, 26 Jan 2022 10:31:34 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBADEC06161C for ; Wed, 26 Jan 2022 07:31:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B274618CD for ; Wed, 26 Jan 2022 15:31:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66039C340E8; Wed, 26 Jan 2022 15:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643211092; bh=CyYorHNQCHBoqo8xQvMZzI3T4+46kiWpXhSL8tXeuog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aZXdfsDT9WiY1UZzgcSPIx9Va18TNaEQIQJNSUV9vSgosHibcXKUSZOiPArSnvwpP pydP7nLmdw+Q1vZ08Q1CQLtF5ke5RuewdkUl6vjC38Miuq8GNiK7KahXGAq+g03rfl cYbN8M9c9F0MAlZlhOr98wrAfRKNEkrq6iMGQEhWDdI2w03+HbLZMPik0qqXks6AEz MCAe7RgfqPvcvudftmdmkWONwfhXg7DoM1vphK39QaBaLhfuGaXZyHpQgy2fxJKha6 FBlmpYaY+3plFIFFgbVwliBeLOHhoSyXkLloFPlcmBOrHw9a8EgjtXHLnGx4VbI98z Z3EiEwFVf1IXA== From: Mark Brown To: Catalin Marinas , Will Deacon , Marc Zyngier , Shuah Khan , Shuah Khan Cc: Alan Hayward , Luis Machado , Salil Akerkar , Basant Kumar Dwivedi , Szabolcs Nagy , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, kvmarm@lists.cs.columbia.edu, Mark Brown Subject: [PATCH v10 18/39] arm64/sme: Disable ZA and streaming mode when handling signals Date: Wed, 26 Jan 2022 15:27:28 +0000 Message-Id: <20220126152749.233712-19-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220126152749.233712-1-broonie@kernel.org> References: <20220126152749.233712-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=991; h=from:subject; bh=CyYorHNQCHBoqo8xQvMZzI3T4+46kiWpXhSL8tXeuog=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBh8WhhGMK5oeSY6nFUOtibYupakncbZg936OSHhw4h 4O/+R66JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYfFoYQAKCRAk1otyXVSH0FkUB/ 4ym6g7Ev1cXCryxHS2KyEAH6kmBXphdlEzxZ8YHtlOVXjICfwsAtce703mKDpkQzfOVzPlmlOljk/V f74Noam+eIVQFm2yVXm2wtPbyjGNqKkqzHXaFhnAqyXO1lkzMicdWuyShqKqHZBs7MWGc5gJJ9vjkr hmOXo3P4mJoSUMzLcpxe3GoysmZ3nG0zZRITMd8GvC0jsdDxOvGnKpSz5feUtNdPpeVW4Js74j9i7f SMI2DXhqrBuWoT6ugBJY9Eg/0bZmpI8TnveeLIsbaT2pLyqw4v02kF8N7Vj9KUCkP8Z0suRFicA4XO x4pv1rPWQ9L9j/J6mhehkwqJApW8FB X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The ABI requires that streaming mode and ZA are disabled when invoking signal handlers, do this in setup_return() when we prepare the task state for the signal handler. Signed-off-by: Mark Brown --- arch/arm64/kernel/signal.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index d8aaf4b6f432..cda04fd73333 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -758,6 +758,13 @@ static void setup_return(struct pt_regs *regs, struct k_sigaction *ka, /* TCO (Tag Check Override) always cleared for signal handlers */ regs->pstate &= ~PSR_TCO_BIT; + /* Signal handlers are invoked with ZA and streaming mode disabled */ + if (system_supports_sme()) { + current->thread.svcr &= ~(SYS_SVCR_EL0_ZA_MASK | + SYS_SVCR_EL0_SM_MASK); + sme_smstop(); + } + if (ka->sa.sa_flags & SA_RESTORER) sigtramp = ka->sa.sa_restorer; else -- 2.30.2 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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72765C2BA4C for ; Wed, 26 Jan 2022 15:31:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 19DC949F4A; Wed, 26 Jan 2022 10:31:38 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B5WwjGr+HKOG; Wed, 26 Jan 2022 10:31:37 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 001D349F2C; Wed, 26 Jan 2022 10:31:37 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 527AD49F1F for ; Wed, 26 Jan 2022 10:31:36 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zAt0uR75AkGp for ; Wed, 26 Jan 2022 10:31:35 -0500 (EST) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 524BB49EF1 for ; Wed, 26 Jan 2022 10:31:35 -0500 (EST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 16F9DB81EA9; Wed, 26 Jan 2022 15:31:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66039C340E8; Wed, 26 Jan 2022 15:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643211092; bh=CyYorHNQCHBoqo8xQvMZzI3T4+46kiWpXhSL8tXeuog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aZXdfsDT9WiY1UZzgcSPIx9Va18TNaEQIQJNSUV9vSgosHibcXKUSZOiPArSnvwpP pydP7nLmdw+Q1vZ08Q1CQLtF5ke5RuewdkUl6vjC38Miuq8GNiK7KahXGAq+g03rfl cYbN8M9c9F0MAlZlhOr98wrAfRKNEkrq6iMGQEhWDdI2w03+HbLZMPik0qqXks6AEz MCAe7RgfqPvcvudftmdmkWONwfhXg7DoM1vphK39QaBaLhfuGaXZyHpQgy2fxJKha6 FBlmpYaY+3plFIFFgbVwliBeLOHhoSyXkLloFPlcmBOrHw9a8EgjtXHLnGx4VbI98z Z3EiEwFVf1IXA== From: Mark Brown To: Catalin Marinas , Will Deacon , Marc Zyngier , Shuah Khan , Shuah Khan Subject: [PATCH v10 18/39] arm64/sme: Disable ZA and streaming mode when handling signals Date: Wed, 26 Jan 2022 15:27:28 +0000 Message-Id: <20220126152749.233712-19-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220126152749.233712-1-broonie@kernel.org> References: <20220126152749.233712-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=991; h=from:subject; bh=CyYorHNQCHBoqo8xQvMZzI3T4+46kiWpXhSL8tXeuog=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBh8WhhGMK5oeSY6nFUOtibYupakncbZg936OSHhw4h 4O/+R66JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYfFoYQAKCRAk1otyXVSH0FkUB/ 4ym6g7Ev1cXCryxHS2KyEAH6kmBXphdlEzxZ8YHtlOVXjICfwsAtce703mKDpkQzfOVzPlmlOljk/V f74Noam+eIVQFm2yVXm2wtPbyjGNqKkqzHXaFhnAqyXO1lkzMicdWuyShqKqHZBs7MWGc5gJJ9vjkr hmOXo3P4mJoSUMzLcpxe3GoysmZ3nG0zZRITMd8GvC0jsdDxOvGnKpSz5feUtNdPpeVW4Js74j9i7f SMI2DXhqrBuWoT6ugBJY9Eg/0bZmpI8TnveeLIsbaT2pLyqw4v02kF8N7Vj9KUCkP8Z0suRFicA4XO x4pv1rPWQ9L9j/J6mhehkwqJApW8FB X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Cc: Basant Kumar Dwivedi , Luis Machado , Szabolcs Nagy , Mark Brown , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Alan Hayward , kvmarm@lists.cs.columbia.edu, Salil Akerkar X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu The ABI requires that streaming mode and ZA are disabled when invoking signal handlers, do this in setup_return() when we prepare the task state for the signal handler. Signed-off-by: Mark Brown --- arch/arm64/kernel/signal.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index d8aaf4b6f432..cda04fd73333 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -758,6 +758,13 @@ static void setup_return(struct pt_regs *regs, struct k_sigaction *ka, /* TCO (Tag Check Override) always cleared for signal handlers */ regs->pstate &= ~PSR_TCO_BIT; + /* Signal handlers are invoked with ZA and streaming mode disabled */ + if (system_supports_sme()) { + current->thread.svcr &= ~(SYS_SVCR_EL0_ZA_MASK | + SYS_SVCR_EL0_SM_MASK); + sme_smstop(); + } + if (ka->sa.sa_flags & SA_RESTORER) sigtramp = ka->sa.sa_restorer; else -- 2.30.2 _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 EA769C2BA4C for ; Wed, 26 Jan 2022 16:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QCf8yIWb57l3WSDjnOIIdOZBCah28/xbII9c7J3ntlk=; b=XvUTijUVRv7BkF p6pxvHj2TsEwiMZm0abhouQHGzi/Z5JOk7WqTE66AyfXeqQSNQoE/c4ec9Tc/jFgDobdV9ugTd8AM y9poTz69yb8++FFQ1jnP/w4IukwlgUpi3Y8aIxiVnOwNpaVQ7fbWxYcWPB13vCTU4NrQKq+s45PQN mM0Wcmvd/tX9EVpfH/SQDvzzl9YLvqObSsnDgNkuNq7mCjMg3MsV5x0nr9N6IR08s11MMqUhKoyJH mwBMtcVlssumNqIM87j6BRmjAaeij/aTXo+lWVRPZsWI76gLmh62OCcZeb2slffmo4VNur/qV0K9Q sROgbLVZHW+7Ds8hq63g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nClFM-00CfPo-An; Wed, 26 Jan 2022 16:34:13 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCkGl-00CJPe-Hd for linux-arm-kernel@lists.infradead.org; Wed, 26 Jan 2022 15:31:36 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 16F9DB81EA9; Wed, 26 Jan 2022 15:31:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66039C340E8; Wed, 26 Jan 2022 15:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643211092; bh=CyYorHNQCHBoqo8xQvMZzI3T4+46kiWpXhSL8tXeuog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aZXdfsDT9WiY1UZzgcSPIx9Va18TNaEQIQJNSUV9vSgosHibcXKUSZOiPArSnvwpP pydP7nLmdw+Q1vZ08Q1CQLtF5ke5RuewdkUl6vjC38Miuq8GNiK7KahXGAq+g03rfl cYbN8M9c9F0MAlZlhOr98wrAfRKNEkrq6iMGQEhWDdI2w03+HbLZMPik0qqXks6AEz MCAe7RgfqPvcvudftmdmkWONwfhXg7DoM1vphK39QaBaLhfuGaXZyHpQgy2fxJKha6 FBlmpYaY+3plFIFFgbVwliBeLOHhoSyXkLloFPlcmBOrHw9a8EgjtXHLnGx4VbI98z Z3EiEwFVf1IXA== From: Mark Brown To: Catalin Marinas , Will Deacon , Marc Zyngier , Shuah Khan , Shuah Khan Cc: Alan Hayward , Luis Machado , Salil Akerkar , Basant Kumar Dwivedi , Szabolcs Nagy , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, kvmarm@lists.cs.columbia.edu, Mark Brown Subject: [PATCH v10 18/39] arm64/sme: Disable ZA and streaming mode when handling signals Date: Wed, 26 Jan 2022 15:27:28 +0000 Message-Id: <20220126152749.233712-19-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220126152749.233712-1-broonie@kernel.org> References: <20220126152749.233712-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=991; h=from:subject; bh=CyYorHNQCHBoqo8xQvMZzI3T4+46kiWpXhSL8tXeuog=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBh8WhhGMK5oeSY6nFUOtibYupakncbZg936OSHhw4h 4O/+R66JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYfFoYQAKCRAk1otyXVSH0FkUB/ 4ym6g7Ev1cXCryxHS2KyEAH6kmBXphdlEzxZ8YHtlOVXjICfwsAtce703mKDpkQzfOVzPlmlOljk/V f74Noam+eIVQFm2yVXm2wtPbyjGNqKkqzHXaFhnAqyXO1lkzMicdWuyShqKqHZBs7MWGc5gJJ9vjkr hmOXo3P4mJoSUMzLcpxe3GoysmZ3nG0zZRITMd8GvC0jsdDxOvGnKpSz5feUtNdPpeVW4Js74j9i7f SMI2DXhqrBuWoT6ugBJY9Eg/0bZmpI8TnveeLIsbaT2pLyqw4v02kF8N7Vj9KUCkP8Z0suRFicA4XO x4pv1rPWQ9L9j/J6mhehkwqJApW8FB X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220126_073135_749705_4F5F5591 X-CRM114-Status: GOOD ( 11.75 ) 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 ABI requires that streaming mode and ZA are disabled when invoking signal handlers, do this in setup_return() when we prepare the task state for the signal handler. Signed-off-by: Mark Brown --- arch/arm64/kernel/signal.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index d8aaf4b6f432..cda04fd73333 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -758,6 +758,13 @@ static void setup_return(struct pt_regs *regs, struct k_sigaction *ka, /* TCO (Tag Check Override) always cleared for signal handlers */ regs->pstate &= ~PSR_TCO_BIT; + /* Signal handlers are invoked with ZA and streaming mode disabled */ + if (system_supports_sme()) { + current->thread.svcr &= ~(SYS_SVCR_EL0_ZA_MASK | + SYS_SVCR_EL0_SM_MASK); + sme_smstop(); + } + if (ka->sa.sa_flags & SA_RESTORER) sigtramp = ka->sa.sa_restorer; else -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel