Skip to content

Commit eeb0002

Browse files
committed
std_detect: Remove RISC-V privileged features
1 parent 507193a commit eeb0002

File tree

3 files changed

+1
-39
lines changed

3 files changed

+1
-39
lines changed

crates/std_detect/src/detect/arch/riscv.rs

-24
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,6 @@ features! {
7979
/// * P: `"p"`
8080
/// * Zam: `"zam"`
8181
///
82-
/// Defined by Privileged Specification:
83-
///
84-
/// * Supervisor: `"s"`
85-
/// * Svnapot: `"svnapot"`
86-
/// * Svpbmt: `"svpbmt"`
87-
/// * Svinval: `"svinval"`
88-
/// * Hypervisor: `"h"`
89-
///
9082
/// [ISA manual]: https://github.com/riscv/riscv-isa-manual/
9183
#[stable(feature = "riscv_ratified", since = "1.78.0")]
9284

@@ -254,22 +246,6 @@ features! {
254246
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] unaligned_vector_mem: "unaligned-vector-mem";
255247
/// Has reasonably performant unaligned vector
256248
257-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svnapot: "svnapot";
258-
without cfg check: true;
259-
/// "Svnapot" Extension for NAPOT Translation Contiguity
260-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svpbmt: "svpbmt";
261-
without cfg check: true;
262-
/// "Svpbmt" Extension for Page-Based Memory Types
263-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svinval: "svinval";
264-
without cfg check: true;
265-
/// "Svinval" Extension for Fine-Grained Address-Translation Cache Invalidation
266-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] h: "h";
267-
without cfg check: true;
268-
/// "H" Extension for Hypervisor Support
269-
270-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] s: "s";
271-
without cfg check: true;
272-
/// Supervisor-Level ISA
273249
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] j: "j";
274250
without cfg check: true;
275251
/// "J" Extension for Dynamically Translated Languages

crates/std_detect/src/detect/os/linux/riscv.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ pub(crate) fn detect_features() -> cache::Initializer {
253253
out[3].value == RISCV_HWPROBE_MISALIGNED_VECTOR_FAST,
254254
);
255255
}
256-
// FIXME: should be enough with hwprobe only, but our code below checks h and e
256+
// FIXME: should be enough with hwprobe only, but our code below checks e
257257
// unavailable in neither uapi/asm/hwprobe.h nor uapi/asm/hwcap.h.
258258
// https://github.com/torvalds/linux/blob/master/arch/riscv/include/uapi/asm/hwcap.h
259259
// return value;
@@ -321,20 +321,11 @@ pub(crate) fn detect_features() -> cache::Initializer {
321321
Feature::rv32e,
322322
bit::test(auxv.hwcap, (b'e' - b'a').into()),
323323
);
324-
// FIXME: h is not exposed in uapi/asm/hwcap.h and uapi/asm/hwprobe.h
325-
enable_feature(
326-
&mut value,
327-
Feature::h,
328-
bit::test(auxv.hwcap, (b'h' - b'a').into()),
329-
);
330324
enable_feature(
331325
&mut value,
332326
Feature::m,
333327
bit::test(auxv.hwcap, (b'm' - b'a').into()),
334328
);
335329

336-
// Neither hwprobe nor auxv supports detection of supervisor feature.
337-
// Since target_os = "linux" is for user mode, their detection is not useful.
338-
339330
value
340331
}

crates/std_detect/tests/cpu-detection.rs

-5
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,6 @@ fn riscv_linux() {
308308
"unaligned-vector-mem: {}",
309309
is_riscv_feature_detected!("unaligned-vector-mem")
310310
);
311-
println!("svnapot: {}", is_riscv_feature_detected!("svnapot"));
312-
println!("svpbmt: {}", is_riscv_feature_detected!("svpbmt"));
313-
println!("svinval: {}", is_riscv_feature_detected!("svinval"));
314-
println!("h: {}", is_riscv_feature_detected!("h"));
315-
println!("s: {}", is_riscv_feature_detected!("s"));
316311
println!("j: {}", is_riscv_feature_detected!("j"));
317312
println!("p: {}", is_riscv_feature_detected!("p"));
318313
}

0 commit comments

Comments
 (0)