runtime-rs: add virtio-blk-mmio

add virtio-blk-mmio option for dragonball

Fixes:#5375
Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
Zhongtao Hu
2023-05-20 18:38:18 +08:00
parent f9bded4484
commit 4719802c8d
6 changed files with 12 additions and 10 deletions

View File

@@ -12,7 +12,7 @@ use super::{default, register_hypervisor_plugin};
use crate::config::default::MAX_DRAGONBALL_VCPUS;
use crate::config::default::MIN_DRAGONBALL_MEMORY_SIZE_MB;
use crate::config::hypervisor::{
VIRTIO_BLK, VIRTIO_BLK_MMIO, VIRTIO_FS, VIRTIO_FS_INLINE, VIRTIO_PMEM,
VIRTIO_BLK_MMIO, VIRTIO_BLK_PCI, VIRTIO_FS, VIRTIO_FS_INLINE, VIRTIO_PMEM,
};
use crate::config::{ConfigPlugin, TomlConfig};
use crate::{eother, resolve_path, validate_path};
@@ -107,7 +107,7 @@ impl ConfigPlugin for DragonballConfig {
}
if !db.blockdev_info.disable_block_device_use
&& db.blockdev_info.block_device_driver != VIRTIO_BLK
&& db.blockdev_info.block_device_driver != VIRTIO_BLK_PCI
&& db.blockdev_info.block_device_driver != VIRTIO_BLK_MMIO
&& db.blockdev_info.block_device_driver != VIRTIO_PMEM
{

View File

@@ -43,8 +43,8 @@ pub use self::qemu::{QemuConfig, HYPERVISOR_NAME_QEMU};
mod ch;
pub use self::ch::{CloudHypervisorConfig, HYPERVISOR_NAME_CH};
const VIRTIO_BLK: &str = "virtio-blk";
const VIRTIO_BLK_MMIO: &str = "virtio-mmio";
const VIRTIO_BLK_PCI: &str = "virtio-blk-pci";
const VIRTIO_BLK_MMIO: &str = "virtio-blk-mmio";
const VIRTIO_BLK_CCW: &str = "virtio-blk-ccw";
const VIRTIO_SCSI: &str = "virtio-scsi";
const VIRTIO_PMEM: &str = "nvdimm";
@@ -172,7 +172,7 @@ impl BlockDeviceInfo {
return Ok(());
}
let l = [
VIRTIO_BLK,
VIRTIO_BLK_PCI,
VIRTIO_BLK_CCW,
VIRTIO_BLK_MMIO,
VIRTIO_PMEM,

View File

@@ -203,7 +203,7 @@ ifneq (,$(DBCMD))
CONFIGS += $(CONFIG_DB)
# dragonball-specific options (all should be suffixed by "_DB")
DEFMAXVCPUS_DB := 1
DEFBLOCKSTORAGEDRIVER_DB := virtio-blk
DEFBLOCKSTORAGEDRIVER_DB := virtio-blk-mmio
DEFNETWORKMODEL_DB := tcfilter
KERNELPARAMS = console=ttyS1 agent.log_vport=1025
KERNELTYPE_DB = uncompressed

View File

@@ -8,6 +8,7 @@ use super::vmm_instance::VmmInstance;
use crate::{
device::DeviceType, hypervisor_persist::HypervisorState, kernel_param::KernelParams, VmmState,
DEV_HUGEPAGES, HUGETLBFS, HYPERVISOR_DRAGONBALL, SHMEM, VM_ROOTFS_DRIVER_BLK,
VM_ROOTFS_DRIVER_MMIO,
};
use anyhow::{anyhow, Context, Result};
use async_trait::async_trait;
@@ -265,7 +266,7 @@ impl DragonballInner {
.get_resource(path, DRAGONBALL_ROOT_FS)
.context("get resource")?;
if driver == VM_ROOTFS_DRIVER_BLK {
if driver == VM_ROOTFS_DRIVER_BLK || driver == VM_ROOTFS_DRIVER_MMIO {
let blk_cfg = BlockDeviceConfigInfo {
path_on_host: PathBuf::from(jail_drive),
drive_id: DRAGONBALL_ROOT_FS.to_string(),

View File

@@ -7,7 +7,7 @@
use anyhow::{anyhow, Result};
use crate::{
VM_ROOTFS_DRIVER_BLK, VM_ROOTFS_DRIVER_PMEM, VM_ROOTFS_FILESYSTEM_EROFS,
VM_ROOTFS_DRIVER_BLK, VM_ROOTFS_DRIVER_MMIO, VM_ROOTFS_DRIVER_PMEM, VM_ROOTFS_FILESYSTEM_EROFS,
VM_ROOTFS_FILESYSTEM_EXT4, VM_ROOTFS_FILESYSTEM_XFS, VM_ROOTFS_ROOT_BLK, VM_ROOTFS_ROOT_PMEM,
};
use kata_types::config::LOG_VPORT_OPTION;
@@ -91,7 +91,7 @@ impl KernelParams {
}
}
}
VM_ROOTFS_DRIVER_BLK => {
VM_ROOTFS_DRIVER_BLK | VM_ROOTFS_DRIVER_MMIO => {
params.push(Param::new("root", VM_ROOTFS_ROOT_BLK));
match rootfs_type {
VM_ROOTFS_FILESYSTEM_EXT4 | VM_ROOTFS_FILESYSTEM_XFS => {

View File

@@ -32,8 +32,9 @@ use kata_types::config::hypervisor::Hypervisor as HypervisorConfig;
pub use kata_types::config::hypervisor::HYPERVISOR_NAME_CH;
// Config which driver to use as vm root dev
const VM_ROOTFS_DRIVER_BLK: &str = "virtio-blk";
const VM_ROOTFS_DRIVER_BLK: &str = "virtio-blk-pci";
const VM_ROOTFS_DRIVER_PMEM: &str = "virtio-pmem";
const VM_ROOTFS_DRIVER_MMIO: &str = "virtio-blk-mmio";
//Configure the root corresponding to the driver
const VM_ROOTFS_ROOT_BLK: &str = "/dev/vda1";