Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp573159lqt; Thu, 6 Jun 2024 11:32:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVMm9E992pGZdFU+lheyNQNJXvUzbyY+FqbWWQXasoHtV5SoKyGsC1mSiQUK9C1ID9vwPV5gCaUibUh6C74sUXImm0sI+z+wzN/OLG0bw== X-Google-Smtp-Source: AGHT+IGMFVPZTfYqcj6pyw+8F3PZXF6ANAbjGnaq4Yr56q8jZu3KvmB+zBC5WAF9JMqR4j67731K X-Received: by 2002:a17:902:d482:b0:1f6:7045:ff60 with SMTP id d9443c01a7336-1f6d02e51fdmr4833175ad.16.1717698766516; Thu, 06 Jun 2024 11:32:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717698766; cv=pass; d=google.com; s=arc-20160816; b=CDF09ekTrDDPY/rnEaqmHmKmAzKhhizeI+qiB0gakl3MfPEpXjk1EdtlD8rHD7G2AX D6UekdczfXN0CvgJo7p+KAClq90j1VihuVoZvdQCT7NA7vEo+slfpP3nhyaB9azQARI6 yp521hJ1Cd+ayrqMnzCZEcYi1T2uGw2xZFIMCb/LfChMpcS/8brgYVgSq6qMsVgYBtJi DtF+6XQrjw8YirAQA3gFIa/55rmYiiBUe8L6PIfEubBhP9xTd9RArJ0e4qhDPaFMB8yZ aQ5MfNQ7hsl8MMWyIXMHd4P9Ho49ee7qUFKF+0Ri9t+X0eWJ9TjrRGyjTA9/DmoYgacI cmow== 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=XHQ4xY0/ZycwaDFTeaCf9+bM8HlQPdbfiT+ZJ9McmuU=; fh=VJ0HMiGdExBUcIJ+RZDEc2L26pbVMOgAcDSpEcogayM=; b=WNpy0Nt36EsZeja8xnRvO5YE+KmvljWqrmkJvsnxaohXZeRfKUgpl6IL01SQJBahxI ad1ZCRFPvd/II6ARFjUvMNk6DBoBnRho1NfiKfN1pv3lN1o4iL0REXdh8NWf/NEmjJ0Q dWKmlmhz09G3cB89wKODlC+E07SDDe1GmYFQ8ZIEr6GKvD1dE96KVWHw/kuxebyznNDh ymEnH+/voA8aOwi7SgmIPHGDOwX8fCkIoHb2mDUR4/rxMmShw6AzwM7V+aIBzAqXJnuo gOFv7hJCn+rOcViVlNlCWkWf8C+KPRKHRjjwG1/VH2+JfF04CyZu8Jw0G46WAyGESgld pbog==; 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=kGMKl4HY; 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-204890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204890-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7f4c98si15208135ad.520.2024.06.06.11.32.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 11:32:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204890-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=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=kGMKl4HY; 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-204890-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204890-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 1E86C28F5C9 for ; Thu, 6 Jun 2024 18:32:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E19DF45945; Thu, 6 Jun 2024 18:32:34 +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="kGMKl4HY" Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 660BC282F4 for ; Thu, 6 Jun 2024 18:32:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717698754; cv=none; b=aDqvJI1/yKEE3XykK6r70Kx4HGkL+nnVNREHAnF0NkgGvio+ESky4i17Jzp0Z/ZnsCWIHmGjd6fRapt8bmEhy8x0HLWj6e4PCRqj5lvX+L4+823+UNNFCyiSgVtFg3cE9iuCKjurT9QOdFXMNS+XUR52n1w0xb6tPY80TRHHkyc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717698754; c=relaxed/simple; bh=qo5Fp+94MFzodZ7tHH/90f9zqTpsIE0APgCFKDlFrMg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=VYQMs/YVxPFyRfrWXHTcDsIlmu90eiQIiUn1LIFPcrh5PVICjjbc05jQaVWiPea7vFtYdJbezXlJgLFjB4s+F6l2FFhEIyVfwBAY1+ft9i0Lu+urqFK+IQDZh/BbuMF6QuB4fWEIQxHKJwJ3OpsFJTx6kPI4jagLP5MBltYGy48= 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=kGMKl4HY; arc=none smtp.client-ip=209.85.210.171 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-pf1-f171.google.com with SMTP id d2e1a72fcca58-702508bf0a9so1084292b3a.0 for ; Thu, 06 Jun 2024 11:32:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717698751; x=1718303551; 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=XHQ4xY0/ZycwaDFTeaCf9+bM8HlQPdbfiT+ZJ9McmuU=; b=kGMKl4HYo+NAC4Sn/WFaoMv6XP0qJ0wjkb2RMeUYaoPulUzVznrThaZZbxuCacbYhH xx4qYwrqvQKQQIY4VUjcuJsuboZ5NbNs5awEuHkIJJ7p06YjDRCZYS3aLS4Plb3Yc1Xk 5MpOSXB1GEz2s+RFYSfaQZgYz8vSPs+SRPUdpAfbaupIxNHc4fdE5E/qA7AyoOKV1OH2 1KIX2YX9AZ/0QGu1674GiDg2zULmKh21Cu8/55zZWkxIYpxf/DWAtNul4/ECzLT/N7+3 94RVX8aw+XB7t0fcbmPDdXjjBTprimU/WLaoFCdEK1J42ad7r/Xpsog1c8yrlX4YvAZV hbbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717698751; x=1718303551; 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=XHQ4xY0/ZycwaDFTeaCf9+bM8HlQPdbfiT+ZJ9McmuU=; b=ATCaKsqIKZbnB4pkCi7cN7Lrh/zRheCVDYyyWUIYuoEY7Ao23AYARg/ROlrZ4F0Qk1 W4ok/7RkCKPN0dC7oSldDE0bCMGFr/UAG+YYYNgeMH+aPwzw+B7oRwDNoo/IKcEgWBaB PNI6hVtc2fF0sEjrEXXXuLeStGscSToMzdgCwqlLpiKO9RB9j+GjeGBR7wptmHBT2Sd0 CgyKwR04tbalctGmvwMyxTDzMxZxMHAWUYFJggs10V8i1kc+5FRce2v97AMKjzomM2wZ 950MSJV9lnov6TNIgUt6sIcZhUrSe7g5mYE3X0dehHTBb2/MfcOScQVOeg3QktH6qT2c UY7Q== X-Forwarded-Encrypted: i=1; AJvYcCUoFoG4jf5KQxBUAcvYJWYGwxDj6g59kDYsnKKFL9suJ7FtrNsbeJO+Qtq4Zx4iSnMBsx3O39d9tJANWWmbG9dPfe2XhM6xMqixm59r X-Gm-Message-State: AOJu0Yw6G1NaGZoXScO9uOF6tEfIoYogk/ijp7CG9GtbqPrQGuQK1dWr XLofsaQIWV457JXmujw045QSsF8M0JOQnLbsUznFGY8ppjKm0FgUAMgPAadWYbY= X-Received: by 2002:a05:6a00:9aa:b0:702:5a22:3ccc with SMTP id d2e1a72fcca58-7040c749549mr201330b3a.33.1717698751529; Thu, 06 Jun 2024 11:32:31 -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 d2e1a72fcca58-703fd50f0c6sm1378400b3a.191.2024.06.06.11.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 11:32:31 -0700 (PDT) From: Jesse Taube To: linux-riscv@lists.infradead.org Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Evan Green , Charlie Jenkins , Andrew Jones , Jesse Taube , Xiao Wang , =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Andy Chiu , Greentime Hu , Heiko Stuebner , Guo Ren , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Costa Shulyupin , Andrew Morton , Baoquan He , Sami Tolvanen , Zong Li , Ben Dooks , Erick Archer , Vincent Chen , Joel Granados , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] RISC-V: Add Zicclsm to cpufeature and hwprobe Date: Thu, 6 Jun 2024 14:32:13 -0400 Message-ID: <20240606183215.416829-1-jesse@rivosinc.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 > 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 --- 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 + 4 files changed, 4 insertions(+) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index e17d0078a651..8c0d0b555a8e 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -81,6 +81,7 @@ #define RISCV_ISA_EXT_ZTSO 72 #define RISCV_ISA_EXT_ZACAS 73 #define RISCV_ISA_EXT_XANDESPMU 74 +#define RISCV_ISA_EXT_ZICCLSM 75 #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 2902f68dc913..060212331a03 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -59,6 +59,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZTSO (1ULL << 33) #define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34) #define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35) +#define RISCV_HWPROBE_EXT_ZICCLSM (1ULL << 36) #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 3ed2359eae35..863c708f2f2e 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -305,6 +305,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(svnapot, RISCV_ISA_EXT_SVNAPOT), __RISCV_ISA_EXT_DATA(svpbmt, RISCV_ISA_EXT_SVPBMT), __RISCV_ISA_EXT_DATA(xandespmu, RISCV_ISA_EXT_XANDESPMU), + __RISCV_ISA_EXT_DATA(zicclsm, RISCV_ISA_EXT_ZICCLSM), }; const size_t riscv_isa_ext_count = ARRAY_SIZE(riscv_isa_ext); diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c index 8cae41a502dd..b286b73e763e 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -125,6 +125,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZVKT); EXT_KEY(ZVFH); EXT_KEY(ZVFHMIN); + EXT_KEY(ZICCLSM); } if (has_fpu()) { -- 2.43.0