Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp436150rdh; Wed, 14 Feb 2024 01:02:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX/rw8AQwbz+1DMEONwr5dt2+EbWnXPy+cZdneKZP6tWMraldygiBz8LG3p0VBaDZ4IWAt+ZRGj56COZpTal81ukXvu5DKIB7N+/ELEUA== X-Google-Smtp-Source: AGHT+IE85Qwj+mq34NubH1kvXcL++yM/7tT73uTw4s1wjd67H80N8BNgVMmtIFGcE1x0jaQ/DjDx X-Received: by 2002:a17:902:f690:b0:1db:28b4:449f with SMTP id l16-20020a170902f69000b001db28b4449fmr2161471plg.6.1707901336895; Wed, 14 Feb 2024 01:02:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707901336; cv=pass; d=google.com; s=arc-20160816; b=Oapae5toZc6bDHdIscVclCrYnJ3HXDQ8Isnqu41xRO613gN4zxImZVCw+rEYaXae7z rpVP0KUoRsY3RJK8+1Vj/fxHvLFSl0URVS/iQfFeSpPH0I9gQ7AKWrbuJbFCQoi/b7KH N6UVg4IffPPIlO/0TDTSNNmVmfnsUkdLybneDjApYeit/79c9h2E8PDbGYjQ1fpFRNZ3 4yR0M+TpOh3tV/VrGBp9VtOoXzpNTjeeXyvLbqYUvqp66fS2VzYxcyJdHI1pLHnSS0OI s9+h8WES9cdGa656FTjjWTv+qZ+rk66mY5FDSqZLkW5vdMcg6mxxpPu04kas7HYb/AcG PYrA== 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=PG0IiU/s69rauKmwQQKq0QDss70qdtIt7mVzhoYNTgg=; fh=2JmL9D25KpO2sh1T1L7jlfkhUETN27ekVlsDnrhO0Gg=; b=Gh63qQPQtyV3ad9W9CGV+EGr8kZrtUCY9WWVf0zQ5hsNk562t325ovbjw8wLKfCH55 CzYjQQ+36/Dg02FKZ9qFbe13Yysm3G+W4tsVLmb/d7jBhrfGYnrIyv3astrup6I7OdAP 2+QMtJfeHLBHQaZvs/HOYMaT5FB6EE6e9j3khtWg1PYQI5Qqr5ugQxVBPcS7pqKKtNuh h+BO2Oiw5mylQdIUjCny0P22BfyNEvLfUAK/csMHi1+VVgjttZjv6I0ZfP/WpSl8ZdFa sZEnmyQ9Ecpoj242rDtS6atJ6S9GdlQRkRt8dyOB8eWzOG9QsIoQicj43SyprVjUiqV/ 8dtA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=kOKK98GW; 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-64904-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64904-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; AJvYcCU+wmHLjgSnfFiPzDwQOI17fXBLfya+JzsVh8UqPlcf2mU891DNIxF7Azgdv9KXiLTA5dANOmDeyDijL9AeS7oeimfTRFsUWdLuqVglOQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id kd15-20020a17090313cf00b001db5df6dfb7si661890plb.421.2024.02.14.01.02.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 01:02:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64904-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=kOKK98GW; 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-64904-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64904-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8ED0928505A for ; Wed, 14 Feb 2024 09:02:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F963B676; Wed, 14 Feb 2024 09:02:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="kOKK98GW" Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 A2BBD79DC for ; Wed, 14 Feb 2024 09:02:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707901330; cv=none; b=AWx+TIRJU6EJ/biJzsWCgCLouRsNXOHY22MxCvf9ycpP+YYKZFTOe35kWfkgKJf3ghDvGN+1GiHvH1OM8GTnkPWKxDLoUsPGsmbW+ovhovJF7M+0tbLsLglE2vq5WiqisQNUtqdtcn17qxVPzOVBJLxwUMaBIyG7/cmlaqsWGFo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707901330; c=relaxed/simple; bh=/fE39pKrfDRibqn1WWdykU0qcTy9Pk5txFzrjNPfvdA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KUDx4J0VlEHwvucnVRpnh5QOxvjPOchZyrJajUui/r+Tfu2Zbl4Y7CAY5DYteH78C01mZGEckztOsPDLenrXpJTy7OG8rn+eaYj+84GX1x7nfa+MQNF9OwLrfwhVfGWyHAoadTxJTJOxHYGaz/bP2ZQaA4X1WdhOrsdJNzef2VM= 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=kOKK98GW; arc=none smtp.client-ip=209.85.210.169 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-pf1-f169.google.com with SMTP id d2e1a72fcca58-6e08dd0fa0bso431515b3a.1 for ; Wed, 14 Feb 2024 01:02:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1707901328; x=1708506128; 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=PG0IiU/s69rauKmwQQKq0QDss70qdtIt7mVzhoYNTgg=; b=kOKK98GW5TnwXNE5+DFy6CR92iUrJtEYnVQg6P/w2mb6IqcF3RFjTBl2lEVhdjvlz/ w85VwGsPVxIiOgOPYgxIG0jUxfXGUVgRo1jlVYllSJTKcOdBDRzieCpxvcx7TSdxez7H dDtxkiV2LXpXlhv3WBkldZTCEcDb6jHCqMxfHI6kP/SxuFZTx8Z5FoHCC6+Hey/B82Th e6UYwVxqnQj2d2v/5/A7WfWZSYpjtR5XohB6u7XBTcjI+f2bA2OUbw2ZompoLUqr6Q1K OdQpNTRKdb6TEuoDmpcvwL4rQxHuRhH+n7pbgoHLWWmMoIYbbC8OCEC8mdPqjy0oDVpo dCuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707901328; x=1708506128; 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=PG0IiU/s69rauKmwQQKq0QDss70qdtIt7mVzhoYNTgg=; b=laIfF0lqD5vVs3CcSIFFxQBrKLirJE4S1nT2QLsSePqmfMEq8zfXbgb/C+WQ/bHUG8 KV5j36DlSvWQ3Egrd7hIUdMq12vkgmRocIQneQpab+AakOc61a6mDkJBjLYVkm3trl8g OAjLzHO7kMX7CaR0sacWXHerMzhzc4nC7aTEaGWglzKQGRXbdVrem0Gv+FaTE43WWyiJ KVhazqtTc6aGpVtuUfd7wjChWL6BaEqTMDfA+hublnesLJCXdnYeM583RNJj+hz7TqmY jf+vzPtrT3kxO3zs/MG2psfLxRS6vApruEaTJrdTzFOpSyQtSz13ZFyoeLDlEVzkGE0R zIJQ== X-Forwarded-Encrypted: i=1; AJvYcCXiO05iGoeBWLS6STOEN1ifUGBFn/HxynlmuXgN/+ZNua7yaQ8Ao8r71zfQue62RJF1S9IG6ye6VaV4qqmBRWvCjsiFLS3CrrK0q4ag X-Gm-Message-State: AOJu0Yw2SWbXe3JN6KfLEru6evD8kirJzMHvWVt98iprL9ujPoghjBr6 Q17+xw6ESXdtdiWNEZv4W/11FhCkByrf6kUllt02A2ABA9BUY4NjLNTl69DjYK4= X-Received: by 2002:a05:6a21:3997:b0:1a0:587d:5664 with SMTP id ad23-20020a056a21399700b001a0587d5664mr2415076pzc.15.1707901327898; Wed, 14 Feb 2024 01:02:07 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXwx8T69DaHtqPp+CeSq/WLrl/IdHgV6ExI7p/7RvPuv2E7ZTW1x36XoZ7PISg15xVLh/f2Yoh66AZ0ddPdxoWYRc/Ddqchz4mt4vauHE5KkKyhxzoxytAfLtOxiQlLneN61j5HrOVOZ0OqZU830b3Z59XwhPJl6OxtE2a46ojK0hFnlLheuEcNfvhL/FFGX6NIxwyvJm+QIPMCzVbJM2jJtUIygOpb/QKOxPPwS6OA Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id m25-20020a638c19000000b005d7994a08dcsm2476681pgd.36.2024.02.14.01.02.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 01:02:07 -0800 (PST) From: Samuel Holland To: Palmer Dabbelt Cc: Andrew Jones , linux-kernel@vger.kernel.org, Conor Dooley , linux-riscv@lists.infradead.org, Stefan O'Rear , Samuel Holland Subject: [PATCH -fixes v3 0/2] riscv: cbo.zero fixes Date: Wed, 14 Feb 2024 01:01:55 -0800 Message-ID: <20240214090206.195754-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 This series fixes a couple of issues related to using the cbo.zero instruction in userspace. The first patch fixes a bug where the wrong enable bit gets set if the kernel is running in M-mode. The second patch fixes a bug where the enable bit gets reset to its default value after a nonretentive idle state. I have hardware which reproduces this: Before this series (or without ss1p12 in the devicetree): $ tools/testing/selftests/riscv/hwprobe/cbo TAP version 13 1..3 ok 1 Zicboz block size # Zicboz block size: 64 Illegal instruction After applying this series: $ tools/testing/selftests/riscv/hwprobe/cbo TAP version 13 1..3 ok 1 Zicboz block size # Zicboz block size: 64 ok 2 cbo.zero ok 3 cbo.zero check # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0 Changes in v3: - Drop patches added in v2 - Check for Zicboz instead of the privileged ISA version Changes in v2: - Add patches to allow parsing the privileged ISA version from the DT - Check for privileged ISA v1.12 instead of the specific CSR - Use riscv_has_extension_likely() instead of new ALTERNATIVE()s Samuel Holland (2): riscv: Fix enabling cbo.zero when running in M-mode riscv: Save/restore envcfg CSR during CPU suspend arch/riscv/include/asm/csr.h | 2 ++ arch/riscv/include/asm/suspend.h | 1 + arch/riscv/kernel/cpufeature.c | 2 +- arch/riscv/kernel/suspend.c | 4 ++++ 4 files changed, 8 insertions(+), 1 deletion(-) -- 2.43.0