Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp366521lqs; Thu, 13 Jun 2024 12:17:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXoEU/BfDpKRY65xNolfeFTe3GArrsKgkjiP70sHMWSlLAPvE3H9NM2w0fLPy20cacdg1so2cUPuH5eALd497onGmRyZzkTfsv/fVZGcw== X-Google-Smtp-Source: AGHT+IFT2/QexEgx2YcCkjhGevyfBYXPbwqpUpXLmOFe9rQQrBNc7HOHH4hL2wWbrBTj0HtJAyLg X-Received: by 2002:a62:b609:0:b0:704:3438:9c1a with SMTP id d2e1a72fcca58-705d713d370mr673780b3a.16.1718306231459; Thu, 13 Jun 2024 12:17:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718306231; cv=pass; d=google.com; s=arc-20160816; b=Vd0iKvw98+txWRjd94Gyz2/HXjXSnO6wmj2mzSNdOkJ21GGMsk1ow8SsARnzywXqMF uQWKKj/2f4gCnaVUR3sFS/wmMRwGRAm706jRU+eqOxRvs9rXdh30fpmArsKi+kSbdwyQ P6CvHIcWKUuh3pD75Ouxh28Fu2Uxgw1Yd+BBJ4NNLAJ9naB0N2bP80A3fj5LnNPHOFKS Z9ag/HJNg3QF9FJcA5UmWTc94YmStb9tEWgId3381NoG/c2GE2vdS9zfsahh5qntkoBh QglvkgkNqv+CA7ILfuwI4DHaLaqIXzOm0VbjRuwHrqLfla0YkDbInVBE0hk3DSPSY9wO 35VA== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zG2srFmoIcbdvzr37LUHEYY5+MFhpHwRfzd3fbsl58g=; fh=2m1lFhhWGpOPTatdG2J3OQSou5AGGnB/6W14FlxnHRY=; b=G8FakVD74oHAwubXFRLbAo87vdrYu/EO/L2bzMPkCQweZgEwJXtBBlCOyosTY5crsl hU43vSKlFr+MTnxEtMcHxFOBmT5aOExbZmOduLxKtbSx6kR9vXoaRKUOZHrQsQIcd4qv 66GJqyyTWDCoWixjZNtmHtHO2gMeakP+r+8PlIvKbsdWofCEiCw3vc708pTpJb1UoZfm DVQqjljqPW9kYMhSQe34T9LhgRPQ/nNZ84aIzbRDG7iRrD50HauIybuN3Uskij22kjBZ PMOaszZLtmyyJaEOv0B2rCcyqL71N3lzFsHwiuS5A8Lh9l19cevEuER2/yIM9k9Ztdul v+kw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=FIDxqNrV; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-213894-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213894-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fee54972a3si1330319a12.674.2024.06.13.12.17.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 12:17:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213894-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=FIDxqNrV; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-213894-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213894-linux.lists.archive=gmail.com@vger.kernel.org" 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 C4596284AB4 for ; Thu, 13 Jun 2024 19:17:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EBB614B942; Thu, 13 Jun 2024 19:16:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="FIDxqNrV" 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 AB7B5149E0A for ; Thu, 13 Jun 2024 19:16:50 +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=1718306212; cv=none; b=mRdgO6DgoKhtsmGWD+H3cUoI3l3VzNgvgpIJbhfLksFFL2SWMvw90OPKN1Sx7PFiMkxuqjSXxm3u0hvUrGJ458aNE0ZMohEMRZguHdC8lR3vjNUclGLMx3zp6K8+dl0W6GK2HCgXb4v3eZ3L70cUGTQh8uScBGJA4hecFqJLgDg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306212; c=relaxed/simple; bh=8fU1mHwB9vYSLz5MPrnsBEqugzFF3wrR753n4UMKomU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=awMYZfJDi9DxU2pT55QLgv5ebsHOUzyRPmtcdbjzAfE0Xsb4HQ2S/xchFVWl97mNuQ/y9Hgk4m6cecWT5Vvxiedo2x1pya/l0oWmyJTdcof5Wo6A+It9TeB3uFDEiStnJwp3RG51im9L1pgfoBoHiVOKXhqjTUCjKi+FzI3CzPs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=FIDxqNrV; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1f6fd08e0f2so11204445ad.3 for ; Thu, 13 Jun 2024 12:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718306210; x=1718911010; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zG2srFmoIcbdvzr37LUHEYY5+MFhpHwRfzd3fbsl58g=; b=FIDxqNrVEYedrPu2WFE29XEvN7kNJP2zTBv0oJ7YskzX6v9gwERApbBl0VFu3fFIXg AV6jin8Eou/DdT2W43jQHjPdnDc3tJLyZSQVz3UfMaxcX4ZaLks8sD3q0TqaM6MyBZ5x 07CtFN4ZiSsEYMitwuzuK75RM9Jwl3cq1tTGyO8e2L++qpffKUCwbZ1KTtB1VSGWriue 20VarN5GAnD4oPHaq2pqvQ0bjwTvIRDzj++VjTT+ogj56EY/V32lfLJjEZJEI+5URpfj IEJeZRM0Snmc0Ck018H6Ku0IyWVdp+d3g/FrrC77LsaC2lUlFz2IVW+o/ggWncY31WdG 3N2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718306210; x=1718911010; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zG2srFmoIcbdvzr37LUHEYY5+MFhpHwRfzd3fbsl58g=; b=ZGI/h+pZ/iGAM8EoTe14zH94N/hdc9o8ycFZbPCvrEgUjIWbAJI/d8HEtiQUAJb9tq 2Obsiml+r+BXMtZ3HIqRZOPKp0UB2HIxlAxQf51GZiAmQzpyOHO48pKf2V6nXtPJOI7a vXIAmnw28yHMG9HphREnnypW9C5nTYYUb+IS9uQjvdotSbWOdLY44DQAoVQIuPliu312 +JImuQXpRWW2n1SiAcAERfnWKfdTSrgV+7lWdVAtLLe8MePqivDX7HTP2+SmE1x7P/2R P+ocBu5B3mSP8ywWWhQhTJXe+hthfZ4je+Sohmdrmn6rFgeLUVPoN/d3Ju3r3bQPgllb SASQ== X-Forwarded-Encrypted: i=1; AJvYcCWpmN14xSVgHRobdpGlVtws+1BbQ9I9+cMvq78XCcE60ruEzyBSDxjNUczKut1P44ww8IZhqu4khXDdDm4BgrPI0oL2M5HYvoZwBCsS X-Gm-Message-State: AOJu0Yyg5kDAEC7g0I1h3S4uOZDm16xm8QBJ7DiAVnVB6fJ2uIAwxI1K nqPYQoBfpalW+R/vDXiPB1QpAr57ngTgMJ/X9zlR1gWGBc76VPxMSz39qJsHLtU= X-Received: by 2002:a17:902:ea07:b0:1f3:266b:ea23 with SMTP id d9443c01a7336-1f8625c1641mr6730485ad.13.1718306209838; Thu, 13 Jun 2024 12:16:49 -0700 (PDT) Received: from jesse-desktop.. (pool-108-26-179-17.bstnma.fios.verizon.net. [108.26.179.17]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f855e7ca78sm17471015ad.106.2024.06.13.12.16.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 12:16:49 -0700 (PDT) From: Jesse Taube To: linux-riscv@lists.infradead.org Cc: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Evan Green , Andrew Jones , Jesse Taube , Charlie Jenkins , Xiao Wang , Andy Chiu , Eric Biggers , Greentime Hu , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Heiko Stuebner , Costa Shulyupin , Andrew Morton , Baoquan He , Anup Patel , Zong Li , Sami Tolvanen , Ben Dooks , Alexandre Ghiti , "Gustavo A. R. Silva" , Erick Archer , Joel Granados , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 1/6] RISC-V: Add Zicclsm to cpufeature and hwprobe Date: Thu, 13 Jun 2024 15:16:10 -0400 Message-ID: <20240613191616.2101821-2-jesse@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240613191616.2101821-1-jesse@rivosinc.com> References: <20240613191616.2101821-1-jesse@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit > Zicclsm Misaligned loads and stores to main memory regions with both > the cacheability and coherence PMAs must be supported. > Note: > This introduces a new extension name for this feature. > This requires misaligned support for all regular load and store > instructions (including scalar and vector) but not AMOs or other > specialized forms of memory access. Even though mandated, misaligned > loads and stores might execute extremely slowly. Standard software > distributions should assume their existence only for correctness, > not for performance. Detecing zicclsm allows the kernel to report if the hardware supports misaligned accesses even if support wasn't probed. This is useful for usermode to know if vector misaligned accesses are supported. Signed-off-by: Jesse Taube --- V1 -> V2: - Add documentation for Zicclsm - Move Zicclsm to correct location --- Documentation/arch/riscv/hwprobe.rst | 3 +++ arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/cpufeature.c | 1 + arch/riscv/kernel/sys_hwprobe.c | 1 + 5 files changed, 7 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index df5045103e73..7085a694b801 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -207,6 +207,9 @@ The following keys are defined: * :c:macro:`RISCV_HWPROBE_EXT_ZVE64D`: The Vector sub-extension Zve64d is supported, as defined by version 1.0 of the RISC-V Vector extension manual. + * :c:macro:`RISCV_HWPROBE_EXT_ZICCLSM`: The Zicclsm extension is supported as + defined in the RISC-V RVA Profiles Specification. + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: Deprecated. Returns similar values to :c:macro:`RISCV_HWPROBE_KEY_MISALIGNED_PERF`, but the key was mistakenly classified as a bitmask rather than a value. diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index f64d4e98e67c..0b3bd8885a2b 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -86,6 +86,7 @@ #define RISCV_ISA_EXT_ZVE64X 77 #define RISCV_ISA_EXT_ZVE64F 78 #define RISCV_ISA_EXT_ZVE64D 79 +#define RISCV_ISA_EXT_ZICCLSM 80 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index 2fb8a8185e7a..023b7771d1b7 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -65,6 +65,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZVE64X (1ULL << 39) #define RISCV_HWPROBE_EXT_ZVE64F (1ULL << 40) #define RISCV_HWPROBE_EXT_ZVE64D (1ULL << 41) +#define RISCV_HWPROBE_EXT_ZICCLSM (1ULL << 42) #define RISCV_HWPROBE_KEY_CPUPERF_0 5 #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) #define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 1d6e4fda00f8..83c5ae16ad5e 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -283,6 +283,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(h, RISCV_ISA_EXT_h), __RISCV_ISA_EXT_SUPERSET(zicbom, RISCV_ISA_EXT_ZICBOM, riscv_xlinuxenvcfg_exts), __RISCV_ISA_EXT_SUPERSET(zicboz, RISCV_ISA_EXT_ZICBOZ, riscv_xlinuxenvcfg_exts), + __RISCV_ISA_EXT_DATA(zicclsm, RISCV_ISA_EXT_ZICCLSM), __RISCV_ISA_EXT_DATA(zicntr, RISCV_ISA_EXT_ZICNTR), __RISCV_ISA_EXT_DATA(zicond, RISCV_ISA_EXT_ZICOND), __RISCV_ISA_EXT_DATA(zicsr, RISCV_ISA_EXT_ZICSR), diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c index e4ec9166339f..e910e2971984 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -96,6 +96,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZBB); EXT_KEY(ZBS); EXT_KEY(ZICBOZ); + EXT_KEY(ZICCLSM); EXT_KEY(ZBC); EXT_KEY(ZBKB); -- 2.43.0