Skip to content

Commit afdb383

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 db2eeca commit afdb383

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(any(feature = "tee", feature = "nitro")))]
24+
#[cfg(not(any(feature = "tee", feature = "nitro", 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(any(feature = "tee", feature = "nitro")))]
45+
#[cfg(not(any(feature = "tee", feature = "nitro", 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
@@ -41,7 +41,7 @@ use vmm::vmm_config::block::BlockDeviceConfig;
4141
use vmm::vmm_config::boot_source::{BootSourceConfig, DEFAULT_KERNEL_CMDLINE};
4242
#[cfg(not(feature = "tee"))]
4343
use vmm::vmm_config::external_kernel::{ExternalKernel, KernelFormat};
44-
#[cfg(not(feature = "tee"))]
44+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
4545
use vmm::vmm_config::fs::FsDeviceConfig;
4646
#[cfg(not(feature = "efi"))]
4747
use vmm::vmm_config::kernel_bundle::KernelBundle;
@@ -474,7 +474,7 @@ pub extern "C" fn krun_set_vm_config(ctx_id: u32, num_vcpus: u8, ram_mib: u32) -
474474

475475
#[allow(clippy::missing_safety_doc)]
476476
#[no_mangle]
477-
#[cfg(not(feature = "tee"))]
477+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
478478
pub unsafe extern "C" fn krun_set_root(ctx_id: u32, c_root_path: *const c_char) -> i32 {
479479
let root_path = match CStr::from_ptr(c_root_path).to_str() {
480480
Ok(root) => root,

src/vmm/src/builder.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use crate::terminal::term_set_raw_mode;
5959
#[cfg(feature = "blk")]
6060
use crate::vmm_config::block::BlockBuilder;
6161
use crate::vmm_config::boot_source::DEFAULT_KERNEL_CMDLINE;
62-
#[cfg(not(any(feature = "tee", feature = "nitro")))]
62+
#[cfg(not(any(feature = "tee", feature = "nitro", feature = "cca")))]
6363
use crate::vmm_config::fs::FsDeviceConfig;
6464
#[cfg(target_os = "linux")]
6565
use crate::vstate::KvmContext;
@@ -68,7 +68,7 @@ use crate::vstate::MeasuredRegion;
6868
use crate::vstate::{Error as VstateError, Vcpu, VcpuConfig, Vm};
6969
use arch::{ArchMemoryInfo, InitrdConfig};
7070
use device_manager::shm::ShmManager;
71-
#[cfg(not(any(feature = "tee", feature = "nitro")))]
71+
#[cfg(not(any(feature = "tee", feature = "nitro", feature = "cca")))]
7272
use devices::virtio::{fs::ExportTable, VirtioShmRegion};
7373
use flate2::read::GzDecoder;
7474
#[cfg(feature = "tee")]
@@ -878,7 +878,7 @@ pub fn build_microvm(
878878
vm_resources.console_output.clone(),
879879
)?;
880880

881-
#[cfg(not(any(feature = "tee", feature = "nitro")))]
881+
#[cfg(not(any(feature = "tee", feature = "nitro", feature = "cca")))]
882882
let export_table: Option<ExportTable> = if cfg!(feature = "gpu") {
883883
Some(Default::default())
884884
} else {
@@ -899,12 +899,12 @@ pub fn build_microvm(
899899
_sender.clone(),
900900
)?;
901901
}
902-
#[cfg(not(any(feature = "tee", feature = "nitro")))]
902+
#[cfg(not(any(feature = "tee", feature = "nitro", feature = "cca")))]
903903
attach_fs_devices(
904904
&mut vmm,
905905
&vm_resources.fs,
906906
&mut _shm_manager,
907-
#[cfg(not(feature = "tee"))]
907+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
908908
export_table,
909909
intc.clone(),
910910
exit_code,
@@ -1768,12 +1768,12 @@ fn attach_mmio_device(
17681768
Ok(())
17691769
}
17701770

1771-
#[cfg(not(any(feature = "tee", feature = "nitro")))]
1771+
#[cfg(not(any(feature = "tee", feature = "nitro", feature = "cca")))]
17721772
fn attach_fs_devices(
17731773
vmm: &mut Vmm,
17741774
fs_devs: &[FsDeviceConfig],
17751775
shm_manager: &mut ShmManager,
1776-
#[cfg(not(feature = "tee"))] export_table: Option<ExportTable>,
1776+
#[cfg(any(not(feature = "tee"), feature = "cca"))] export_table: Option<ExportTable>,
17771777
intc: IrqChip,
17781778
exit_code: Arc<AtomicI32>,
17791779
#[cfg(target_os = "macos")] map_sender: Sender<WorkerMessage>,
@@ -1805,7 +1805,7 @@ fn attach_fs_devices(
18051805
});
18061806
}
18071807

1808-
#[cfg(not(feature = "tee"))]
1808+
#[cfg(any(not(feature = "tee"), feature = "cca"))]
18091809
if let Some(export_table) = export_table.as_ref() {
18101810
fs.lock().unwrap().set_export_table(export_table.clone());
18111811
}

src/vmm/src/device_manager/shm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl ShmManager {
4747
regions
4848
}
4949

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

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)