[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251118162436.15485-1-zihong.plct@isrc.iscas.ac.cn>
Date: Wed, 19 Nov 2025 00:23:23 +0800
From: Yao Zihong <zihong.plct@...c.iscas.ac.cn>
To: linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org
Cc: ajones@...tanamicro.com,
alexghiti@...osinc.com,
shuah@...nel.org,
samuel.holland@...ive.com,
evan@...osinc.com,
cleger@...osinc.com,
zihong.plct@...c.iscas.ac.cn,
zihongyao@...look.com,
zhangyin2018@...as.ac.cn,
Paul Walmsley <pjw@...nel.org>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Alexandre Ghiti <alex@...ti.fr>
Subject: [PATCH v5 0/2] riscv: hwprobe: Add Zicbop support
Changes since v4:
------------------
- Fixed style problems. (Andrew Jones)
- Updated the selftest gating logic: the cbo.inval test is now also
enabled when `--zicboz-raises-sigill` or `-z` is supplied, instead of
being skipped when these flags are present. (Andrew Jones)
Changes since v3:
------------------
- Dropped the test for Zicbop absence, as prefetch instructions are
architecturally defined as hints and should never raise SIGILL.
- Removed `--sigsegv` and `--sigbus` options; these faults should never
occur on compliant implementations, and the test now handles them
unconditionally for reporting purposes. (Andrew Jones)
- Split the previous --sigill option into two explicit
`--zicbom-raises-sigill` and `--zicboz-raises-sigill` to enable
extension-specific tests. (Andrew Jones)
Changes since v2:
------------------
- Squashed the previous UAPI/kernel/doc patches(originally 1/4, 2/4, 3/4)
into a single hwprobe patch for simplicity.
- Selftests:
* Dropped the `memory` clobber from the prefetch inline asm since it is
pure hint.
* Fixed style problems. (Andrew Jones)
* Merged the standalone prefetch test into
`tools/testing/selftests/riscv/hwprobe/cbo.c` (Andrew Jones)
* Switched to `getopt_long` for option parsing. (Andrew Jones)
Changes since v1:
------------------
- Bumped RISCV_HWPROBE_MAX_KEY (modified 1/4).
- Added documentation for the Zicbop hwprobe bit/key (new 3/4).
- Added a selftest(prefetch.c) for Zicbop (new 4/4).
Hi all,
This patch adds UAPI and kernel plumbing to expose the Zicbop extension
presence and its block size through hwprobe. The interface mirrors
Zicbom/Zicboz. This allows userspace to safely discover and optimize
for Zicbop when available.
Background: Zicbop is mandated by the RVA22U64 profile. Downstream may
combine the presence bit with ZICBOP_BLOCK_SIZE to make profile-level
policy decisions or enable Zicbop-specific optimizations.
Yao Zihong (2):
riscv: hwprobe: Expose Zicbop extension and its block size
selftests/riscv: Add Zicbop prefetch test
Documentation/arch/riscv/hwprobe.rst | 8 +-
arch/riscv/include/asm/hwprobe.h | 2 +-
arch/riscv/include/uapi/asm/hwprobe.h | 2 +
arch/riscv/kernel/sys_hwprobe.c | 6 +
tools/testing/selftests/riscv/hwprobe/cbo.c | 165 ++++++++++++++++----
5 files changed, 152 insertions(+), 31 deletions(-)
--
2.47.2
Powered by blists - more mailing lists