Skip to content

Commit 2a66bf5

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 8715c21 commit 2a66bf5

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

src/devices/src/virtio/mod.rs

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use vmm::vmm_config::block::BlockDeviceConfig;
4040
use vmm::vmm_config::boot_source::{BootSourceConfig, DEFAULT_KERNEL_CMDLINE};
4141
#[cfg(not(feature = "tee"))]
4242
use vmm::vmm_config::external_kernel::{ExternalKernel, KernelFormat};
43-
#[cfg(not(feature = "tee"))]
43+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
4444
use vmm::vmm_config::fs::FsDeviceConfig;
4545
#[cfg(not(feature = "efi"))]
4646
use vmm::vmm_config::kernel_bundle::KernelBundle;
@@ -386,7 +386,7 @@ pub extern "C" fn krun_set_vm_config(ctx_id: u32, num_vcpus: u8, ram_mib: u32) -
386386

387387
#[allow(clippy::missing_safety_doc)]
388388
#[no_mangle]
389-
#[cfg(not(feature = "tee"))]
389+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
390390
pub unsafe extern "C" fn krun_set_root(ctx_id: u32, c_root_path: *const c_char) -> i32 {
391391
let root_path = match CStr::from_ptr(c_root_path).to_str() {
392392
Ok(root) => root,

src/vmm/src/builder.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use crate::terminal::term_set_raw_mode;
5757
#[cfg(feature = "blk")]
5858
use crate::vmm_config::block::BlockBuilder;
5959
use crate::vmm_config::boot_source::DEFAULT_KERNEL_CMDLINE;
60-
#[cfg(not(feature = "tee"))]
60+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
6161
use crate::vmm_config::fs::FsDeviceConfig;
6262
#[cfg(target_os = "linux")]
6363
use crate::vstate::KvmContext;
@@ -66,7 +66,7 @@ use crate::vstate::MeasuredRegion;
6666
use crate::vstate::{Error as VstateError, Vcpu, VcpuConfig, Vm};
6767
use arch::{ArchMemoryInfo, InitrdConfig};
6868
use device_manager::shm::ShmManager;
69-
#[cfg(not(feature = "tee"))]
69+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
7070
use devices::virtio::{fs::ExportTable, VirtioShmRegion};
7171
use flate2::read::GzDecoder;
7272
#[cfg(feature = "tee")]
@@ -851,7 +851,7 @@ pub fn build_microvm(
851851
vm_resources.console_output.clone(),
852852
)?;
853853

854-
#[cfg(not(feature = "tee"))]
854+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
855855
let export_table: Option<ExportTable> = if cfg!(feature = "gpu") {
856856
Some(Default::default())
857857
} else {
@@ -873,12 +873,12 @@ pub fn build_microvm(
873873
)?;
874874
}
875875

876-
#[cfg(not(feature = "tee"))]
876+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
877877
attach_fs_devices(
878878
&mut vmm,
879879
&vm_resources.fs,
880880
&mut _shm_manager,
881-
#[cfg(not(feature = "tee"))]
881+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
882882
export_table,
883883
intc.clone(),
884884
exit_code,
@@ -1717,12 +1717,12 @@ fn attach_mmio_device(
17171717
Ok(())
17181718
}
17191719

1720-
#[cfg(not(feature = "tee"))]
1720+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
17211721
fn attach_fs_devices(
17221722
vmm: &mut Vmm,
17231723
fs_devs: &[FsDeviceConfig],
17241724
shm_manager: &mut ShmManager,
1725-
#[cfg(not(feature = "tee"))] export_table: Option<ExportTable>,
1725+
#[cfg(any(not(feature = "tee"), feature = "cca"))] export_table: Option<ExportTable>,
17261726
intc: IrqChip,
17271727
exit_code: Arc<AtomicI32>,
17281728
#[cfg(target_os = "macos")] map_sender: Sender<WorkerMessage>,
@@ -1754,7 +1754,7 @@ fn attach_fs_devices(
17541754
});
17551755
}
17561756

1757-
#[cfg(not(feature = "tee"))]
1757+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
17581758
if let Some(export_table) = export_table.as_ref() {
17591759
fs.lock().unwrap().set_export_table(export_table.clone());
17601760
}

src/vmm/src/device_manager/shm.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use kbs_types::Tee;
2323
use crate::vmm_config::block::{BlockBuilder, BlockConfigError, BlockDeviceConfig};
2424
use crate::vmm_config::boot_source::{BootSourceConfig, BootSourceConfigError};
2525
use crate::vmm_config::external_kernel::ExternalKernel;
26-
#[cfg(not(feature = "tee"))]
26+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
2727
use crate::vmm_config::fs::*;
2828
#[cfg(feature = "tee")]
2929
use crate::vmm_config::kernel_bundle::{InitrdBundle, QbootBundle, QbootBundleError};
@@ -103,7 +103,7 @@ pub struct VmResources {
103103
#[cfg(feature = "tee")]
104104
pub initrd_bundle: Option<InitrdBundle>,
105105
/// The fs device.
106-
#[cfg(not(feature = "tee"))]
106+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
107107
pub fs: Vec<FsDeviceConfig>,
108108
/// The vsock device.
109109
pub vsock: VsockBuilder,
@@ -253,7 +253,7 @@ impl VmResources {
253253
Ok(())
254254
}
255255

256-
#[cfg(not(feature = "tee"))]
256+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
257257
pub fn add_fs_device(&mut self, config: FsDeviceConfig) {
258258
self.fs.push(config)
259259
}

src/vmm/src/vmm_config/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub mod boot_source;
1212
pub mod external_kernel;
1313

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

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

0 commit comments

Comments
 (0)