Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3591705rwb; Mon, 16 Jan 2023 10:00:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXuqdFBWzCOejMw78cA57b0xEzwmqQJRimaeqqEPtrH5VA5TaVUMy5QTWGA9PV0FXB8KOS8Q X-Received: by 2002:a17:906:7747:b0:7c1:1804:a0c7 with SMTP id o7-20020a170906774700b007c11804a0c7mr76333013ejn.75.1673892042636; Mon, 16 Jan 2023 10:00:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673892042; cv=none; d=google.com; s=arc-20160816; b=i0C+HXxQoahXWNt1o/R9GY+vFI8ymbpTbXt6vFWd3h4AZgTMQ6rquyPS7A4QWK077t srvI761fJYXqGPXJhjXBPN/ia2dp78IcXrtFSrocBng3BWMUoDN48G9QwWzjiv0gBIfR K7/eEEdMWf3pMGZxTAJmTciJRO7kJZ0PJZLZyfxkm5W7To0X4KmkoyyOaZuGNADX5Cms PPhvSSo+zXcKYxkOeVWQy+fT6ypgNhZ36vpJ8h0wA5GWPTDzxWmgEEJWJ8piAwPmxNEL q/vp7E4XoGiwtw/NYSQKQ7idoylrqF5WgxoHbhSCHBJZQ5Fvvu3ZWBAIZhvQi613d7dl bITA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=godC2/JmFI2B/xQbyZ/u/PpuVd3hdAhbCUj5Tuwvydc=; b=tDaoDFXhr7+/7S5ShONmq0/+QM332Jpkq9w6ThGfKodgqkAABLT2rc+OKWDus0Qleo /IMq5M5Y3rG7gQbtT1bOQWZMdD0piNcNvx8MAp5B2vuG33xO6YBQ0myuFcWRqNvnq/Fb edPJKEJkT4iVEpGqtejEHGPXYypABFojNMq+DkWa6ybZ+PjJXjJSr6ccf7IuTaNOC2bJ djBMhXmhbKjqPNjcsxsSive8vFJX1VB7+bb7PXv2ffePUisHoooUJ3YPCpFyxhhIVZPl dsNogf2Un8Xe84wWxkDgTBb5iN8b2izOjjhU0/iNTUzmZrdhzTsObZ36TivX+116YD0m e1Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ia3VNl7Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a17090658cc00b0087194db3565si2132312ejs.551.2023.01.16.10.00.30; Mon, 16 Jan 2023 10:00:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ia3VNl7Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232625AbjAPQJX (ORCPT + 50 others); Mon, 16 Jan 2023 11:09:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232483AbjAPQIW (ORCPT ); Mon, 16 Jan 2023 11:08:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B382822A0E; Mon, 16 Jan 2023 08:05:59 -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 ams.source.kernel.org (Postfix) with ESMTPS id 3664FB81065; Mon, 16 Jan 2023 16:05:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25FDFC433EF; Mon, 16 Jan 2023 16:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673885156; bh=A2lMnNpwS6S66/IQOfPFdDu2/4XhxRCJbXbHkSaZYLQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Ia3VNl7Q0DH7gaJ4mpSKEw+FvMPuvtkQ4nWizcmTV1ICD0u1dOEGzaq0U4WGcFCqV lCYH4m0kYzYwUqwTey2JJX9cZ1C/OiNri07/ve4nIa1ZyHX9vXAFlTfQo224sX6McQ ZnA4lqjc4uDfDQgUUF51KOVOQAQOqOgZAX20q8GuAP9hGHIFPJ30l8ysP9RspMPo9z 3qDYou7iD/qJ9yqJq4QUKfns5qiTGmd2FQbZPw1fjoPBxuqSoNAAvQbMkd5D7+9p8W R0LHOcs1Jib2VoDdH9SH+V1q15gBV09nSub/FoeU/7GMAdaMKCM1Yy57ebE9AiIq57 IVfhNSEsykZ8Q== From: Mark Brown Date: Mon, 16 Jan 2023 16:04:42 +0000 Subject: [PATCH v4 07/21] arm64/sme: Enable host kernel to access ZT0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20221208-arm64-sme2-v4-7-f2fa0aef982f@kernel.org> References: <20221208-arm64-sme2-v4-0-f2fa0aef982f@kernel.org> In-Reply-To: <20221208-arm64-sme2-v4-0-f2fa0aef982f@kernel.org> To: Catalin Marinas , Will Deacon , Oleg Nesterov , Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Shuah Khan Cc: Alan Hayward , Luis Machado , Szabolcs Nagy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org, Mark Brown X-Mailer: b4 0.12-dev-77e06 X-Developer-Signature: v=1; a=openpgp-sha256; l=1460; i=broonie@kernel.org; h=from:subject:message-id; bh=A2lMnNpwS6S66/IQOfPFdDu2/4XhxRCJbXbHkSaZYLQ=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjxXWnTp5ZGErr4lpzXbWz2naqNeSyfqHWUbeT68Dg 1kDpfYiJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY8V1pwAKCRAk1otyXVSH0FmsB/ 9usXcD+QpmmUQlVUPN6H/k4eWHLR4r3VwhBTI8+6H4bvluQqNUziGccjwm1TiSGdgS+S1OT7H6pNck WgJZ14DIivBBaWX9AN9uSycMS08b1xTQqAwyiD0Smosu4eztdGdmHuFDiLUkvrerA9+6xGgs+YZrcg EO4onn9BPWowPQVnI29JHJtVbVcvJyx/p7L+xrPJnGIVdgS2r+ISh2aZGl+oskJ4R+MKTPUAvCwBWG 5zVsubXATcOz4m5XTWwoAeZ+MqkwacbKJyLE5OxIgkL1mAe0N2+32qVp7dg9HTPc4OEnb6O0Dz+CgW kVyHsqJweSqqtZYU2lTXxxl5ZyDiNQ X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new register ZT0 introduced by SME2 comes with a new trap, disable it for the host kernel so that we can implement support for it. Signed-off-by: Mark Brown --- arch/arm64/kernel/hyp-stub.S | 6 ++++++ arch/arm64/kernel/idreg-override.c | 1 + 2 files changed, 7 insertions(+) diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S index 2ee18c860f2a..d31d1acb170d 100644 --- a/arch/arm64/kernel/hyp-stub.S +++ b/arch/arm64/kernel/hyp-stub.S @@ -132,6 +132,12 @@ SYM_CODE_START_LOCAL(__finalise_el2) orr x0, x0, SMCR_ELx_FA64_MASK .Lskip_sme_fa64: + // ZT0 available? + __check_override id_aa64smfr0 ID_AA64SMFR0_EL1_SMEver_SHIFT 4 .Linit_sme_zt0 .Lskip_sme_zt0 +.Linit_sme_zt0: + orr x0, x0, SMCR_ELx_EZT0_MASK +.Lskip_sme_zt0: + orr x0, x0, #SMCR_ELx_LEN_MASK // Enable full SME vector msr_s SYS_SMCR_EL2, x0 // length for EL1. diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c index 95133765ed29..d833d78a7f31 100644 --- a/arch/arm64/kernel/idreg-override.c +++ b/arch/arm64/kernel/idreg-override.c @@ -131,6 +131,7 @@ static const struct ftr_set_desc smfr0 __initconst = { .name = "id_aa64smfr0", .override = &id_aa64smfr0_override, .fields = { + FIELD("smever", ID_AA64SMFR0_EL1_SMEver_SHIFT, NULL), /* FA64 is a one bit field... :-/ */ { "fa64", ID_AA64SMFR0_EL1_FA64_SHIFT, 1, }, {} -- 2.34.1