Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2224357rdb; Sun, 11 Feb 2024 18:26:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IG69nK0Rg5fiWg4Jihq1oHa2c9Dzh6sWjMpjeayR+5rvqwAzvpRwNfuBuESkeHIXBiK1OcG X-Received: by 2002:a05:6402:1a41:b0:561:40d6:c95a with SMTP id bf1-20020a0564021a4100b0056140d6c95amr3262819edb.9.1707704815094; Sun, 11 Feb 2024 18:26:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707704815; cv=pass; d=google.com; s=arc-20160816; b=jkBKVa56GTZNtXA2Pv6u3YIvZuKVL30Ct82RAXl7Pj17YXAGqG9t1k2WUVjgEKhio4 KlEBwoHTkY+bcESCGQugL94RDCbi0HAoscjlABC8K6KeKcHCk+OugbMFLpPmgupOGsw5 4pD2WCVf0xKHFEq8HO9LjhEAgoNYKafO5/MRRyxMbxjy7T+ZkfK1bvA0xJxHzzkFJArb cmfvzBZKUJ2e9Ynpso47f7qBYOOE+MZj4192jozbEvYMCyee2LPtPdKSewtOaBNc9Mri JIETTqd1awloOjniohrNhrK4EqzMJK0hZnQlDWpPtIYKtl7HtalBjTVxO0zy89ZHTxVp HSig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=+kIZpNvKn1kQfhO8EuiKdYkkbsLjW1fhO0uLZ9v9zVM=; fh=STdKJX/h5MoJTzDSrSPjIilWPgZvJlqpOCUabUdsNKI=; b=IOaY0W8lZ3P/p/xX/gg89Y98Io9CX+8/NFsqF/gY8C5TPxD7s/pKFef/WkJwAd/Q+P 2ybeDdCQypuebIVJ/FSb8yaUgpOJUmp7dS/MfzLLBihWse9GK+AxbiugQriqjq0RnfWI N8j+qAmTXitNXTK3XVaB3OIsnvWbqLzHyXyCi5ShL14eu88gflRdqKjzyhmDar4bwESC lvLdc1E27EiGGWs8Gg7dKa6fkxAT2c3RVZN4wQu3Aq2Q17PiOiZdDelZntgqriYXTMN8 FGDpo0EbdG9K9NDH0SRM2A+3rL0M58knB0VQXdcji4akdLk5zkH7oKDYWkEM10GxZM1h liSw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=LzQPPsyl; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-61067-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61067-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com X-Forwarded-Encrypted: i=2; AJvYcCVEbGKYAnnJsR1dGhC+QAuhUpV8zHJq6R3bQVeeSkfnpWqPdfmY3KGIdZYwK/XzYOYlS2WdTncfg3P+XL79AdYCaJfY3evCjy4gO+eX3w== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y62-20020a50bb44000000b00561491aee37si2228992ede.177.2024.02.11.18.26.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 18:26:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61067-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=LzQPPsyl; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-61067-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61067-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A2BDF1F244DD for ; Mon, 12 Feb 2024 02:26:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A07521FBF; Mon, 12 Feb 2024 02:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="LzQPPsyl" Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E9CF1877 for ; Mon, 12 Feb 2024 02:26:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707704806; cv=none; b=Y2/Z51OfTw3qBdDEMMzrdLgg31JAuChCx12Uej2kZGBjdBmrbte6xH9snkmNj+0Hh1DAf7eczEaNWnFoNhWQHthffP7Sh2ykykPV4J7YWQAgPOdqnl+6YiW7q/8GswsY7g4hUGM40UmplFyF1lCXqPkM6sRT3q4G0blNWKxAoFg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707704806; c=relaxed/simple; bh=I8xais3M6KWt4jD9YpX9Bk9467Z0fCdsov2sXouaIUo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LCLDrflNNUs5VMNTeb9Gqm/mNg1TdJmxKqO/cUM27RfSRKYv6npJeeerw5lxk0WycEqV6HNwZINPCCG9ASoshaacxghlE3S+DI+2nWRQFD4+tBeQ0BO8JMLqiVE83Jl9+RkzgQfun9++249t52sz3p0Cvm1dPzkid5lpPrmDi2U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=LzQPPsyl; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1d8ef977f1eso19484685ad.0 for ; Sun, 11 Feb 2024 18:26:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1707704804; x=1708309604; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+kIZpNvKn1kQfhO8EuiKdYkkbsLjW1fhO0uLZ9v9zVM=; b=LzQPPsylzO73aUClijYzrRs/vv2dIntGKpKNXabFKGHM1f9nkWp1kGdfLQ8LxmPEnd XZTHuZJKLRsRCm5hnDiHeDRmljTL5HzygMExSdukf8cc/K2xW4/xIvuWAutMda+cHcf6 1/JYQ25Cissojr2u8EzJLVFeS5RIusEPn5NK+4S1EwiqkBqnYAiNqpi22h5Pc4G0z6Qr xqp80+/vZ8nls/JpuSyjEr1eq8mzp/YBbtK5pLxBikyJYrJcwjC5GnRAXD5SJZo6tVDD 6vc44LyysN0a5NaHxQFDnMnap8c9W6YRzaWe1dApHO94IjpVGXhdINonGzyG0vZrd4Fk /3Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707704804; x=1708309604; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+kIZpNvKn1kQfhO8EuiKdYkkbsLjW1fhO0uLZ9v9zVM=; b=E43dAWEW0YecXH2LbO9MLTnZpKPy68bc8mR8Pyy2w6pmz5jFQS8nMdOzCzcqSHnRKp ElLyMFPQCetUc8+8Cs1l1hz1LrqxXiSFUiqBpOrm/ErVXePMklvFcm+Xfag/5zswtdX3 MX5+z8eYGWHSPdHWGVhVNy0ItuqM1khwnc4gVBB4C0CL8HL5RvJXGrhlVnQEkjP8p8ty L5vmkP4KBmGwsS9yk82ixawcNucsKvWDkUInbfI1jP55Fon33ik0MpxKk/ottpD6+gnW i4kdzyhuwzBxnGqP2yZckwOWICvld0JkG1RYxmUXlGJHtHBvpZ2vhDfa2WOdkrfaQrLX t1aA== X-Gm-Message-State: AOJu0YxA9NK2A+Fu7AlqzBFlizw9MR1vT6I3Q1ZJnIYbecDBnqw+kzG0 3IpZSgB6G3Im25KZGQsSzP/quHMlouaOTiQz7DaNKHUYKpklrRPozTGsHhzRm2HvjAo6rlqX4Ue i X-Received: by 2002:a17:902:ce8a:b0:1d9:5f11:d018 with SMTP id f10-20020a170902ce8a00b001d95f11d018mr6165050plg.1.1707704804598; Sun, 11 Feb 2024 18:26:44 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUfdeKz8qQ1Wm/LNrWafjLgkv2+Xkl8QrY/iZkgowaE8IySyAhm6B7a9c9c/cifytyBUKmSpQly+vFAnwjO1HIVW1XVe+DkIvqGaDhJ43ypOJnuMyTSRDRJMdhMKGU+Az55/4QPqYlZXa82EICvNRAepdBnJg4jItKVtMxdi7IV5ihxUtDCkD/VY9r2gLvJ Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id mg8-20020a170903348800b001da27cbcf5dsm1719624plb.228.2024.02.11.18.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 18:26:44 -0800 (PST) From: Samuel Holland To: Andrew Jones , Palmer Dabbelt Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Samuel Holland , stable@kernel.org Subject: [PATCH -fixes 1/2] riscv: Fix enabling cbo.zero when running in M-mode Date: Sun, 11 Feb 2024 18:26:14 -0800 Message-ID: <20240212022642.1968739-1-samuel.holland@sifive.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When the kernel is running in M-mode, the CBZE bit must be set in the menvcfg CSR, not in senvcfg. Cc: stable@kernel.org Fixes: 43c16d51a19b ("RISC-V: Enable cbo.zero in usermode") Signed-off-by: Samuel Holland --- arch/riscv/include/asm/csr.h | 2 ++ arch/riscv/kernel/cpufeature.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h index 510014051f5d..2468c55933cd 100644 --- a/arch/riscv/include/asm/csr.h +++ b/arch/riscv/include/asm/csr.h @@ -424,6 +424,7 @@ # define CSR_STATUS CSR_MSTATUS # define CSR_IE CSR_MIE # define CSR_TVEC CSR_MTVEC +# define CSR_ENVCFG CSR_MENVCFG # define CSR_SCRATCH CSR_MSCRATCH # define CSR_EPC CSR_MEPC # define CSR_CAUSE CSR_MCAUSE @@ -448,6 +449,7 @@ # define CSR_STATUS CSR_SSTATUS # define CSR_IE CSR_SIE # define CSR_TVEC CSR_STVEC +# define CSR_ENVCFG CSR_SENVCFG # define CSR_SCRATCH CSR_SSCRATCH # define CSR_EPC CSR_SEPC # define CSR_CAUSE CSR_SCAUSE diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 89920f84d0a3..c5b13f7dd482 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -950,7 +950,7 @@ arch_initcall(check_unaligned_access_all_cpus); void riscv_user_isa_enable(void) { if (riscv_cpu_has_extension_unlikely(smp_processor_id(), RISCV_ISA_EXT_ZICBOZ)) - csr_set(CSR_SENVCFG, ENVCFG_CBZE); + csr_set(CSR_ENVCFG, ENVCFG_CBZE); } #ifdef CONFIG_RISCV_ALTERNATIVE -- 2.43.0