Skip to content

Commit 4666c73

Browse files
a4lgtaiki-eAmanieu
committed
RISC-V: Remove privileged extensions for now
Until in-kernel feature detection is implemented, runtime detection of privileged extensions is temporally removed along with features themselves since none of such privileged features are stable. Co-Authored-By: Taiki Endo <[email protected]> Co-Authored-By: Amanieu d'Antras <[email protected]>
1 parent eb03dab commit 4666c73

File tree

4 files changed

+0
-35
lines changed

4 files changed

+0
-35
lines changed

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

-24
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,6 @@ features! {
115115
/// * P: `"p"`
116116
/// * Zam: `"zam"`
117117
///
118-
/// Defined by Privileged Specification:
119-
///
120-
/// * *Supervisor-Level ISA* (not "S" extension): `"s"`
121-
/// * H (hypervisor): `"h"`
122-
/// * Svnapot: `"svnapot"`
123-
/// * Svpbmt: `"svpbmt"`
124-
/// * Svinval: `"svinval"`
125-
///
126118
/// # Performance Hints
127119
///
128120
/// The two features below define performance hints for unaligned
@@ -331,22 +323,6 @@ features! {
331323
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zvkt: "zvkt";
332324
/// "Zvkt" Extension for Vector Data-Independent Execution Latency
333325
334-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svnapot: "svnapot";
335-
without cfg check: true;
336-
/// "Svnapot" Extension for NAPOT Translation Contiguity
337-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svpbmt: "svpbmt";
338-
without cfg check: true;
339-
/// "Svpbmt" Extension for Page-Based Memory Types
340-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] svinval: "svinval";
341-
without cfg check: true;
342-
/// "Svinval" Extension for Fine-Grained Address-Translation Cache Invalidation
343-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] h: "h";
344-
without cfg check: true;
345-
/// "H" Extension for Hypervisor Support
346-
347-
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] s: "s";
348-
without cfg check: true;
349-
/// Supervisor-Level ISA
350326
@FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] j: "j";
351327
without cfg check: true;
352328
/// "J" Extension for Dynamically Translated Languages

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

-5
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ pub(crate) fn detect_features() -> cache::Initializer {
141141
enable_feature(Feature::c, bit::test(auxv.hwcap, (b'c' - b'a').into()));
142142
enable_feature(Feature::d, bit::test(auxv.hwcap, (b'd' - b'a').into()));
143143
enable_feature(Feature::f, bit::test(auxv.hwcap, (b'f' - b'a').into()));
144-
enable_feature(Feature::h, bit::test(auxv.hwcap, (b'h' - b'a').into()));
145144
enable_feature(Feature::m, bit::test(auxv.hwcap, (b'm' - b'a').into()));
146145
let has_v = bit::test(auxv.hwcap, (b'v' - b'a').into());
147146
let mut is_v_set = false;
@@ -315,9 +314,5 @@ pub(crate) fn detect_features() -> cache::Initializer {
315314
#[cfg(target_arch = "riscv32")]
316315
enable_feature(Feature::rv32e, bit::test(auxv.hwcap, (b'e' - b'a').into()));
317316

318-
// FIXME: Auxvec does not show supervisor feature support, but this mode may be useful
319-
// to detect when Rust is used to write Linux kernel modules.
320-
// These should be more than Auxvec way to detect supervisor features.
321-
322317
imply_features(value)
323318
}

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

-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ pub(crate) fn imply_features(mut value: cache::Initializer) -> cache::Initialize
123123
imply!(c & f => zcf);
124124

125125
imply!(zicntr | zihpm | f | zfinx | zve32x => zicsr);
126-
imply!(s | h => zicsr);
127126

128127
// Loop until the feature flags converge.
129128
if prev == value {

crates/std_detect/tests/cpu-detection.rs

-5
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,6 @@ fn riscv_linux() {
319319
println!("zvksc: {}", is_riscv_feature_detected!("zvksc"));
320320
println!("zvksg: {}", is_riscv_feature_detected!("zvksg"));
321321
println!("zvkt: {}", is_riscv_feature_detected!("zvkt"));
322-
println!("svnapot: {}", is_riscv_feature_detected!("svnapot"));
323-
println!("svpbmt: {}", is_riscv_feature_detected!("svpbmt"));
324-
println!("svinval: {}", is_riscv_feature_detected!("svinval"));
325-
println!("h: {}", is_riscv_feature_detected!("h"));
326-
println!("s: {}", is_riscv_feature_detected!("s"));
327322
println!("j: {}", is_riscv_feature_detected!("j"));
328323
println!("p: {}", is_riscv_feature_detected!("p"));
329324
}

0 commit comments

Comments
 (0)