Skip to content

Commit c17ae42

Browse files
committed
Enable virtio-fs in cca
This commit will be remove when cca use virtio-blk. For the moment, enable virtio-fs in cca. Signed-off-by: Matias Ezequiel Vara Larsen <[email protected]>
1 parent 2fbf0bb commit c17ae42

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

src/devices/src/virtio/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub mod console;
2121
pub mod descriptor_utils;
2222
pub mod device;
2323
pub mod file_traits;
24-
#[cfg(not(feature = "tee"))]
24+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
2525
pub mod fs;
2626
#[cfg(feature = "gpu")]
2727
pub mod gpu;
@@ -42,7 +42,7 @@ pub use self::balloon::*;
4242
pub use self::block::{Block, CacheType};
4343
pub use self::console::*;
4444
pub use self::device::*;
45-
#[cfg(not(feature = "tee"))]
45+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
4646
pub use self::fs::*;
4747
#[cfg(feature = "gpu")]
4848
pub use self::gpu::*;

src/libkrun/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use vmm::resources::VmResources;
4747
#[cfg(feature = "blk")]
4848
use vmm::vmm_config::block::BlockDeviceConfig;
4949
use vmm::vmm_config::boot_source::{BootSourceConfig, DEFAULT_KERNEL_CMDLINE};
50-
#[cfg(not(feature = "tee"))]
50+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
5151
use vmm::vmm_config::fs::FsDeviceConfig;
5252
#[cfg(not(feature = "efi"))]
5353
use vmm::vmm_config::kernel_bundle::KernelBundle;
@@ -417,7 +417,7 @@ pub extern "C" fn krun_set_vm_config(ctx_id: u32, num_vcpus: u8, ram_mib: u32) -
417417

418418
#[allow(clippy::missing_safety_doc)]
419419
#[no_mangle]
420-
#[cfg(not(feature = "tee"))]
420+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
421421
pub unsafe extern "C" fn krun_set_root(ctx_id: u32, c_root_path: *const c_char) -> i32 {
422422
let root_path = match CStr::from_ptr(c_root_path).to_str() {
423423
Ok(root) => root,

src/vmm/src/builder.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ use crate::terminal::term_set_raw_mode;
4949
#[cfg(feature = "blk")]
5050
use crate::vmm_config::block::BlockBuilder;
5151
use crate::vmm_config::boot_source::DEFAULT_KERNEL_CMDLINE;
52-
#[cfg(not(feature = "tee"))]
52+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
5353
use crate::vmm_config::fs::FsDeviceConfig;
5454
#[cfg(target_os = "linux")]
5555
use crate::vstate::KvmContext;
@@ -60,7 +60,7 @@ use arch::ArchMemoryInfo;
6060
#[cfg(all(feature = "tee", target_arch = "x86_64"))]
6161
use arch::InitrdConfig;
6262
use device_manager::shm::ShmManager;
63-
#[cfg(not(feature = "tee"))]
63+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
6464
use devices::virtio::{fs::ExportTable, VirtioShmRegion};
6565
#[cfg(all(feature = "tee", target_arch = "x86_64"))]
6666
use kvm_bindings::KVM_MAX_CPUID_ENTRIES;
@@ -708,7 +708,7 @@ pub fn build_microvm(
708708
vm_resources.console_output.clone(),
709709
)?;
710710

711-
#[cfg(not(feature = "tee"))]
711+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
712712
let export_table: Option<ExportTable> = if cfg!(feature = "gpu") {
713713
Some(Default::default())
714714
} else {
@@ -729,12 +729,12 @@ pub fn build_microvm(
729729
_map_sender.clone(),
730730
)?;
731731
}
732-
#[cfg(not(feature = "tee"))]
732+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
733733
attach_fs_devices(
734734
&mut vmm,
735735
&vm_resources.fs,
736736
&mut _shm_manager,
737-
#[cfg(not(feature = "tee"))]
737+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
738738
export_table,
739739
intc.clone(),
740740
#[cfg(target_os = "macos")]
@@ -1340,12 +1340,12 @@ fn attach_mmio_device(
13401340
Ok(())
13411341
}
13421342

1343-
#[cfg(not(feature = "tee"))]
1343+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
13441344
fn attach_fs_devices(
13451345
vmm: &mut Vmm,
13461346
fs_devs: &[FsDeviceConfig],
13471347
shm_manager: &mut ShmManager,
1348-
#[cfg(not(feature = "tee"))] export_table: Option<ExportTable>,
1348+
#[cfg(any(not(feature = "tee"), feature = "cca"))] export_table: Option<ExportTable>,
13491349
intc: Option<GicV3>,
13501350
#[cfg(target_os = "macos")] map_sender: Sender<MemoryMapping>,
13511351
) -> std::result::Result<(), StartMicrovmError> {
@@ -1373,7 +1373,7 @@ fn attach_fs_devices(
13731373
});
13741374
}
13751375

1376-
#[cfg(not(feature = "tee"))]
1376+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
13771377
if let Some(export_table) = export_table.as_ref() {
13781378
fs.lock().unwrap().set_export_table(export_table.clone());
13791379
}

src/vmm/src/device_manager/shm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl ShmManager {
4646
regions
4747
}
4848

49-
#[cfg(not(feature = "tee"))]
49+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
5050
pub fn fs_region(&self, index: usize) -> Option<&ShmRegion> {
5151
self.fs_regions.get(&index)
5252
}

src/vmm/src/resources.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use kbs_types::Tee;
1818
#[cfg(feature = "blk")]
1919
use crate::vmm_config::block::{BlockBuilder, BlockConfigError, BlockDeviceConfig};
2020
use crate::vmm_config::boot_source::{BootSourceConfig, BootSourceConfigError};
21-
#[cfg(not(feature = "tee"))]
21+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
2222
use crate::vmm_config::fs::*;
2323
#[cfg(feature = "tee")]
2424
use crate::vmm_config::kernel_bundle::{InitrdBundle, QbootBundle, QbootBundleError};
@@ -92,7 +92,7 @@ pub struct VmResources {
9292
#[cfg(feature = "tee")]
9393
pub initrd_bundle: Option<InitrdBundle>,
9494
/// The fs device.
95-
#[cfg(not(feature = "tee"))]
95+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
9696
pub fs: Vec<FsDeviceConfig>,
9797
/// The vsock device.
9898
pub vsock: VsockBuilder,
@@ -233,7 +233,7 @@ impl VmResources {
233233
Ok(())
234234
}
235235

236-
#[cfg(not(feature = "tee"))]
236+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
237237
pub fn add_fs_device(&mut self, config: FsDeviceConfig) {
238238
self.fs.push(config)
239239
}

src/vmm/src/vmm_config/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub mod block;
99
pub mod boot_source;
1010

1111
/// Wrapper for configuring the Fs devices attached to the microVM.
12-
#[cfg(not(feature = "tee"))]
12+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
1313
pub mod fs;
1414

1515
/// Wrapper over the microVM general information attached to the microVM.

0 commit comments

Comments
 (0)