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 03F67C43334 for ; Tue, 7 Jun 2022 13:30:26 +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: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:In-Reply-To:References: List-Owner; bh=RfZZprRWniUAW9IRZHZWxF9Wp5ep9WYTf66sgodfOxw=; b=Ph1CYVFFgmBn2A mig7oqC924BEykrSum9EpsJY9JWmgSB9izagCVV3WBo31JlsdoHHMVOTrgwVofVMgwVHiieHfmJzl IXsbBGLJVDQh9jCU8uAAXDmff8nXlC6yb/+ICCrll+pYSnRnkgJegJy6AgWyuWfd55jbm+9qgQ7Wb NKBV3gTP+jKaH2dd4hQlZztt5sLPkJxOyYcFqMjchpj8qQ9a3+MjqRTmepL0ioPxwJNm7JskyIBId LaZkZ3XtUjEUTbG7X9QRbXdknBGd057/9ahKdSyPDOYikVCvyllx7nI7TWKau+pIpxqE7cj9jcXeo 4+jsuqKWAClWjObdZ3gg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyZGg-007k59-7Q; Tue, 07 Jun 2022 13:29:10 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyZGa-007k2w-Bg for linux-arm-kernel@lists.infradead.org; Tue, 07 Jun 2022 13:29:06 +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 C2559B81D5B; Tue, 7 Jun 2022 13:29:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70FE8C34114; Tue, 7 Jun 2022 13:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654608541; bh=YJqvWndY5CYx+1C0sLOwUD+Nd+Ixg31N+4gz2VVulqw=; h=From:To:Cc:Subject:Date:From; b=UBZ/r8jKMaSEKy2u5CjqoqIN+kYNOPYUE8HXUjiEJlEJSkNV9MjLRbCZp82+SBTLS HXX/cRK4gjGJr+4IZSJzs/wTY1RRFEHFEUMwxxVwnJ7eg5WmyYc9rVBCVmShvL3adp fFfX9TfbESQCeXEii0ZJ9K4iBYNqEKqm4JW8aozmkkJZ7YKBx6cLAp8WA0svIAqEve ci0WVdXA+vzJYC+sx/eyO8EVmeZQPvsflNzGK81BvOtLPVopLjNcVlMSJ/GiteeOIi 28tUr36leCcfZfpE6qr5fmirnxAOBIjjvw3S6PHNIx/dtZUQk392vnuWLbmoqxVY5m RiwvM2IMfEH8Q== From: Mark Brown To: Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, Mark Brown Subject: [PATCH] arm64/sme: Expose SMIDR through sysfs Date: Tue, 7 Jun 2022 14:28:57 +0100 Message-Id: <20220607132857.1358361-1-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3903; h=from:subject; bh=YJqvWndY5CYx+1C0sLOwUD+Nd+Ixg31N+4gz2VVulqw=; b=owGbwMvMwMWocq27KDak/QLjabUkhqT5QZHlew+LWT89fHmGmHJwSfee3duD3z9w+OddU9D1UKv1 TN+lTkZjFgZGLgZZMUWWtc8yVqWHS2yd/2j+K5hBrEwgUxi4OAVgIvqs7P+jeW2/OCxf/SjK5ZDxzs zcEvEnt+1Cjx//3MLw34iBk7O299qP5N8Rjh6qOwJ/Tzj7zy5brCizb+ZTLxlT5ccbeZYFzzCcz7c9 +O6cZif3nb6+NTrffbVyeoya+R0avrm2dTiuyO2fp+GXYfh4X1y5cpz9xmN9Mnqtgj0L8+O9gmaw8R Wdfu13uyM6anNNnF5Ks6XPx1lC0nKWvsvudGwryJzh5ii4+37I88KSgsOzT0qY8osJSgYc5mcJfq6+ x8K/mbWt92XOvd4sbsV9PDXH+FPzpwgFvNztPFv1cfwBsaqAkoUGSl67TF63Pwkx4e892ev4oqLLqt rz1vJko6xPHw4mKMvNrIk4EgsA 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-20220607_062904_750631_888D04BD X-CRM114-Status: GOOD ( 19.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 We currently expose MIDR and REVID to userspace through sysfs to enable it to make decisions based on the specific implementation. Since SME supports implementations where streaming mode is provided by a separate hardware unit called a SMCU it provides a similar ID register SMIDR. Expose it to userspace via sysfs when the system supports SME along with the other ID registers. Since we disable the SME priority mapping feature if it is supported by hardware we currently mask out the SMPS bit which reports that it is supported. Signed-off-by: Mark Brown --- .../ABI/testing/sysfs-devices-system-cpu | 3 ++- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/kernel/cpuinfo.c | 23 ++++++++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu index 2ad01cad7f1c..3cf03dad6466 100644 --- a/Documentation/ABI/testing/sysfs-devices-system-cpu +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu @@ -493,12 +493,13 @@ What: /sys/devices/system/cpu/cpuX/regs/ /sys/devices/system/cpu/cpuX/regs/identification/ /sys/devices/system/cpu/cpuX/regs/identification/midr_el1 /sys/devices/system/cpu/cpuX/regs/identification/revidr_el1 + /sys/devices/system/cpu/cpuX/regs/identification/smidr_el1 Date: June 2016 Contact: Linux ARM Kernel Mailing list Description: AArch64 CPU registers 'identification' directory exposes the CPU ID registers for - identifying model and revision of the CPU. + identifying model and revision of the CPU and SMCU. What: /sys/devices/system/cpu/aarch32_el0 Date: May 2021 diff --git a/arch/arm64/include/asm/cpu.h b/arch/arm64/include/asm/cpu.h index 115cdec1ae87..fd7a92219eea 100644 --- a/arch/arm64/include/asm/cpu.h +++ b/arch/arm64/include/asm/cpu.h @@ -46,6 +46,7 @@ struct cpuinfo_arm64 { u64 reg_midr; u64 reg_revidr; u64 reg_gmid; + u64 reg_smidr; u64 reg_id_aa64dfr0; u64 reg_id_aa64dfr1; diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index 8eff0a34ffd4..7f06df59df2b 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -267,6 +267,7 @@ static struct kobj_type cpuregs_kobj_type = { CPUREGS_ATTR_RO(midr_el1, midr); CPUREGS_ATTR_RO(revidr_el1, revidr); +CPUREGS_ATTR_RO(smidr_el1, smidr); static struct attribute *cpuregs_id_attrs[] = { &cpuregs_attr_midr_el1.attr, @@ -279,6 +280,16 @@ static const struct attribute_group cpuregs_attr_group = { .name = "identification" }; +static struct attribute *sme_cpuregs_id_attrs[] = { + &cpuregs_attr_smidr_el1.attr, + NULL +}; + +static const struct attribute_group sme_cpuregs_attr_group = { + .attrs = sme_cpuregs_id_attrs, + .name = "identification" +}; + static int cpuid_cpu_online(unsigned int cpu) { int rc; @@ -296,6 +307,8 @@ static int cpuid_cpu_online(unsigned int cpu) rc = sysfs_create_group(&info->kobj, &cpuregs_attr_group); if (rc) kobject_del(&info->kobj); + if (system_supports_sme()) + rc = sysfs_merge_group(&info->kobj, &sme_cpuregs_attr_group); out: return rc; } @@ -423,9 +436,17 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info) info->reg_zcr = read_zcr_features(); if (IS_ENABLED(CONFIG_ARM64_SME) && - id_aa64pfr1_sme(info->reg_id_aa64pfr1)) + id_aa64pfr1_sme(info->reg_id_aa64pfr1)) { info->reg_smcr = read_smcr_features(); + /* + * We mask out SMPS since even if the hardware + * supports priorities the kernel does not at present + * and we block access to them. + */ + info->reg_smidr = read_cpuid(SMIDR_EL1) & ~SMIDR_EL1_SMPS; + } + cpuinfo_detect_icache_policy(info); } -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel