Make if_tdx_enabled macro x86-specific

This commit is contained in:
Zejun Zhao
2025-03-25 14:17:18 +08:00
committed by Tate, Hongliang Tian
parent dd67a9a175
commit e4aa261c48
14 changed files with 80 additions and 104 deletions

View File

@ -67,7 +67,6 @@ riscv = { version = "0.11.1", features = ["s-mode"] }
[features]
all = ["cvm_guest"]
cvm_guest = ["dep:tdx-guest", "ostd/cvm_guest"]
[lints]

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
use cfg_if::cfg_if;
mod null;
mod pty;
mod random;
@ -10,15 +8,9 @@ pub mod tty;
mod urandom;
mod zero;
cfg_if! {
if #[cfg(all(target_arch = "x86_64", feature = "cvm_guest"))] {
mod tdxguest;
#[cfg(all(target_arch = "x86_64", feature = "cvm_guest"))]
mod tdxguest;
pub use tdxguest::TdxGuest;
}
}
use ostd::if_tdx_enabled;
pub use pty::{new_pty_pair, PtyMaster, PtySlave};
pub use random::Random;
pub use urandom::Urandom;
@ -40,8 +32,8 @@ pub fn init() -> Result<()> {
add_node(console, "console")?;
let tty = Arc::new(tty::TtyDevice);
add_node(tty, "tty")?;
if_tdx_enabled!({
#[cfg(target_arch = "x86_64")]
#[cfg(target_arch = "x86_64")]
ostd::if_tdx_enabled!({
add_node(Arc::new(tdxguest::TdxGuest), "tdx_guest")?;
});
let random = Arc::new(random::Random);