From nobody Thu Sep 19 01:03:04 2024 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 A92DC17C7D7 for ; Fri, 26 Jul 2024 16:37:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722011851; cv=none; b=kHFASuWQNM9g/22ds/DS++4ahsDW+k7jUdB1YZ0vkaMWs0FZ+Sj+y+0ihz3vLWqdpqkLb/kKquoJocGyBcE/fJxdqmusmaUFAPhEWmFSdVxayK/Aqu2C/uXRGwbF1r9WikRXLuGH1OSZ5lSWBBb2Sen4UFNqctzOe1uo9/qfPB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722011851; c=relaxed/simple; bh=WXm9/HAXk5Lab1ONciXViU9JUFRbDlVwDeuyb8DjUoQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cKXlI9L/S5/0PIn44xuQkMSPKIxOKttJ83uYryoTzWTf/c1SIOd62BOwiNZBUN9q9TT30dsOezhmPychLx4n3YuY6CqytT2WphDYzp7uxeGudJS7klEEZy3pCz4oE6/l/eLorUTJKpFMFIMeRJbH3tpHObXd0GxoNLG2CwqKhig= 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=GbPk1VnS; arc=none smtp.client-ip=209.85.210.174 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 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="GbPk1VnS" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-70d2b921cdfso1051448b3a.0 for ; Fri, 26 Jul 2024 09:37:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1722011849; x=1722616649; 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=FV9ltTuKAXhQPitmW4cZ8QxbMM7L9R/Whun6TjodNdQ=; b=GbPk1VnS5ELBO44VFihW30svqRWXgmMqfhDu8Dd3z0ymPL9Dy9P/SuZOeD28P8AwXz uarGu//K7VFgTHh2UxEVtkDuTj3RUbzTAaRNBE7Ku3ogXLMSBbg1rmCd11TXpPha/mX1 /6aKbtlFDixcm4SK+K1PDOvGFTQaDdP+Z5hQzCCRjEVLi108p9O9Wah91SFqlNSkAMFU c44+dMA1Fe3ur7LRwcmLJX+xRCLkQhnEX8x800IeD6UfgyIySnJxdl1A7bDF8Yt6XlTH 4ezE+YmXlVM/+2BXh1joFSXQt4JDWH6ZeulJ9forNZkaaYnZFKAM2yFuenpV4FBUlAct PU5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722011849; x=1722616649; 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=FV9ltTuKAXhQPitmW4cZ8QxbMM7L9R/Whun6TjodNdQ=; b=gIjmOKdV5AEcF8cUUIz398/xILpzpK8s6UzI/bfNGr1HdSnfdOZ+C1hoW9xgUySdLA tQWWMf0up+fbFxDus1aOT5HNUBUHFspnS60ze9aHncB5UnAO5cOlnBZOp3LTK5jBsD97 EWaPRADDZwkkxfl9oNaSuRFtNVvK84G1TRZl5zqOLahF3GKaDegY+5jlkP4Ac4AIlOtH gYps3LL0Md2xyqECxmct2348Grbq2C8S0gtEvA8LVgD5Xu71IxRVi6slaByCIPjBq9o+ zoOo+XUMn+z+TWxDEPyeHo7QHjefvXL+YLYXrP7fK+2vTc9ti4ksP0umCy6O/Pl1kQgx SqHg== X-Forwarded-Encrypted: i=1; AJvYcCU18nK3/aU1rVtceu62EWvWRwjhFctW27fCyN4rL7u2yKLpwJrDcMRLMEYhh2MonDSZY04sj3ZOaK4ArY7Ws/K+qgGVKalDy3McuPaX X-Gm-Message-State: AOJu0YxR/Ny9zMDcGTSN2QNu8YemPZxk4PVEbK6ybD1lWF/E68+ahJT3 dtE6QYvljLCyxDmIEcMmZzh+yk4BPvdYn58YxN+N/YT0tIKvJBp8p8i5JjWLtMI= X-Google-Smtp-Source: AGHT+IG4pJEcmV6d6Swzvphs9nnzJgXZ5aoQKqB0B10DiV8FlpfaCXhCy2PLo2Umh1yZ10URzDEtKw== X-Received: by 2002:a17:90a:fb81:b0:2c9:66d3:4663 with SMTP id 98e67ed59e1d1-2cf7e720c12mr19937a91.43.1722011849015; Fri, 26 Jul 2024 09:37:29 -0700 (PDT) Received: from jesse-desktop.ba.rivosinc.com (pool-108-26-179-17.bstnma.fios.verizon.net. [108.26.179.17]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cf28c55a2dsm3676619a91.7.2024.07.26.09.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 09:37:28 -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, Conor Dooley Subject: [PATCH v7 1/8] RISC-V: Add Zicclsm to cpufeature and hwprobe Date: Fri, 26 Jul 2024 12:37:12 -0400 Message-ID: <20240726163719.1667923-2-jesse@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240726163719.1667923-1-jesse@rivosinc.com> References: <20240726163719.1667923-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: quoted-printable Content-Type: text/plain; charset="utf-8" > 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 Reviewed-by: Conor Dooley Reviewed-by: Andy Chiu --- V1 -> V2: - Add documentation for Zicclsm - Move Zicclsm to correct location V2 -> V3: - No changes V3 -> V4: - Add definitions to hwprobe.rst V4 -> V5: - No changes V5 -> V6: - No changes --- Documentation/arch/riscv/hwprobe.rst | 5 +++++ 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, 9 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/risc= v/hwprobe.rst index df5045103e73..78acd37b6477 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -207,6 +207,11 @@ 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 ma= nual. =20 + * :c:macro:`RISCV_HWPROBE_EXT_ZICCLSM`: The Zicclsm extension is suppor= ted as + defined in the RISC-V RVA Profiles Specification. Misaligned suppo= rt for + all regular load and store instructions (including scalar and vect= or) but + not AMOs or other specialized forms of memory access. + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: Deprecated. Returns similar valu= es to :c:macro:`RISCV_HWPROBE_KEY_MISALIGNED_PERF`, but the key was mistake= nly 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 =20 #define RISCV_ISA_EXT_XLINUXENVCFG 127 =20 diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uap= i/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[] =3D { __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_hwprob= e.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); =20 EXT_KEY(ZBKB); --=20 2.45.2