Skip to content

Commit

Permalink
Merge pull request kata-containers#9280 from BbolroC/enable-qemu-on-s…
Browse files Browse the repository at this point in the history
…390x

runtime-rs: Enable qemu on s390x
  • Loading branch information
BbolroC authored Mar 22, 2024
2 parents 25cd28a + 81aaa34 commit d915a79
Show file tree
Hide file tree
Showing 12 changed files with 352 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/libs/kata-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ serde_json = "1.0.73"
thiserror = "1.0"
toml = "0.5.8"
serde-enum-str = "0.4"
sysinfo = "0.29.11"
sysinfo = "0.30.5"

oci = { path = "../oci" }
safe-path = { path = "../safe-path" }
Expand Down
2 changes: 1 addition & 1 deletion src/libs/kata-types/src/config/hypervisor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use std::collections::HashMap;
use std::io::{self, Result};
use std::path::Path;
use std::sync::{Arc, Mutex};
use sysinfo::{System, SystemExt};
use sysinfo::System;

mod dragonball;
pub use self::dragonball::{DragonballConfig, HYPERVISOR_NAME_DRAGONBALL};
Expand Down
31 changes: 25 additions & 6 deletions src/runtime-rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/runtime-rs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ ifneq (,$(QEMUCMD))

# qemu-specific options
DEFSANDBOXCGROUPONLY_QEMU := false
ifeq ($(ARCH), s390x)
VMROOTFSDRIVER_QEMU := virtio-blk-ccw
else
VMROOTFSDRIVER_QEMU := virtio-pmem
endif
DEFVCPUS_QEMU := 1
DEFMAXVCPUS_QEMU := 0
DEFSHAREDFS_QEMU_VIRTIOFS := virtio-fs
Expand Down
7 changes: 2 additions & 5 deletions src/runtime-rs/arch/s390x-options.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
# SPDX-License-Identifier: Apache-2.0
#

MACHINETYPE :=
MACHINETYPE := s390-ccw-virtio
KERNELPARAMS :=
MACHINEACCELERATORS :=
CPUFEATURES := pmu=off
CPUFEATURES :=

QEMUCMD := qemu-system-s390x

# dragonball binary name
DBCMD := dragonball
7 changes: 5 additions & 2 deletions src/runtime-rs/crates/hypervisor/src/device/device_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use tokio::sync::{Mutex, RwLock};
use crate::{
vhost_user_blk::VhostUserBlkDevice, BlockConfig, BlockDevice, HybridVsockDevice, Hypervisor,
NetworkDevice, ShareFsDevice, VfioDevice, VhostUserConfig, VhostUserNetDevice, VsockDevice,
KATA_BLK_DEV_TYPE, KATA_MMIO_BLK_DEV_TYPE, KATA_NVDIMM_DEV_TYPE, VIRTIO_BLOCK_MMIO,
VIRTIO_BLOCK_PCI, VIRTIO_PMEM,
KATA_BLK_DEV_TYPE, KATA_CCW_DEV_TYPE, KATA_MMIO_BLK_DEV_TYPE, KATA_NVDIMM_DEV_TYPE,
VIRTIO_BLOCK_CCW, VIRTIO_BLOCK_MMIO, VIRTIO_BLOCK_PCI, VIRTIO_PMEM,
};

use super::{
Expand Down Expand Up @@ -447,6 +447,9 @@ impl DeviceManager {
VIRTIO_BLOCK_PCI => {
block_config.driver_option = KATA_BLK_DEV_TYPE.to_string();
}
VIRTIO_BLOCK_CCW => {
block_config.driver_option = KATA_CCW_DEV_TYPE.to_string();
}
VIRTIO_PMEM => {
block_config.driver_option = KATA_NVDIMM_DEV_TYPE.to_string();
is_pmem = true;
Expand Down
4 changes: 2 additions & 2 deletions src/runtime-rs/crates/hypervisor/src/device/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pub use vfio::{
pub use vhost_user::{VhostUserConfig, VhostUserDevice, VhostUserType};
pub use vhost_user_net::VhostUserNetDevice;
pub use virtio_blk::{
BlockConfig, BlockDevice, KATA_BLK_DEV_TYPE, KATA_MMIO_BLK_DEV_TYPE, KATA_NVDIMM_DEV_TYPE,
VIRTIO_BLOCK_MMIO, VIRTIO_BLOCK_PCI, VIRTIO_PMEM,
BlockConfig, BlockDevice, KATA_BLK_DEV_TYPE, KATA_CCW_DEV_TYPE, KATA_MMIO_BLK_DEV_TYPE,
KATA_NVDIMM_DEV_TYPE, VIRTIO_BLOCK_CCW, VIRTIO_BLOCK_MMIO, VIRTIO_BLOCK_PCI, VIRTIO_PMEM,
};
pub use virtio_fs::{
ShareFsConfig, ShareFsDevice, ShareFsMountConfig, ShareFsMountOperation, ShareFsMountType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ use async_trait::async_trait;
/// VIRTIO_BLOCK_PCI indicates block driver is virtio-pci based
pub const VIRTIO_BLOCK_PCI: &str = "virtio-blk-pci";
pub const VIRTIO_BLOCK_MMIO: &str = "virtio-blk-mmio";
pub const VIRTIO_BLOCK_CCW: &str = "virtio-blk-ccw";
pub const VIRTIO_PMEM: &str = "virtio-pmem";
pub const KATA_MMIO_BLK_DEV_TYPE: &str = "mmioblk";
pub const KATA_BLK_DEV_TYPE: &str = "blk";
pub const KATA_CCW_DEV_TYPE: &str = "ccw";
pub const KATA_NVDIMM_DEV_TYPE: &str = "nvdimm";

#[derive(Debug, Clone, Default)]
Expand Down
7 changes: 4 additions & 3 deletions src/runtime-rs/crates/hypervisor/src/kernel_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
use anyhow::{anyhow, Result};

use crate::{
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,
VM_ROOTFS_DRIVER_BLK, VM_ROOTFS_DRIVER_BLK_CCW, 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;

Expand Down Expand Up @@ -89,7 +90,7 @@ impl KernelParams {
}
}
}
VM_ROOTFS_DRIVER_BLK | VM_ROOTFS_DRIVER_MMIO => {
VM_ROOTFS_DRIVER_BLK | VM_ROOTFS_DRIVER_BLK_CCW | VM_ROOTFS_DRIVER_MMIO => {
params.push(Param::new("root", VM_ROOTFS_ROOT_BLK));
match rootfs_type {
VM_ROOTFS_FILESYSTEM_EXT4 | VM_ROOTFS_FILESYSTEM_XFS => {
Expand Down
1 change: 1 addition & 0 deletions src/runtime-rs/crates/hypervisor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ 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-pci";
const VM_ROOTFS_DRIVER_BLK_CCW: &str = "virtio-blk-ccw";
const VM_ROOTFS_DRIVER_PMEM: &str = "virtio-pmem";
const VM_ROOTFS_DRIVER_MMIO: &str = "virtio-blk-mmio";

Expand Down
Loading

0 comments on commit d915a79

Please sign in to comment.