From 275de453d5eb355d18f113368989f6dced848cc4 Mon Sep 17 00:00:00 2001 From: "alex.lyn" Date: Thu, 21 Dec 2023 11:07:56 +0800 Subject: [PATCH] runtime-rs: remove useless get_host_guest_map and its test case Fixes: #8665 Signed-off-by: alex.lyn --- .../crates/hypervisor/src/device/driver/mod.rs | 11 ++--------- .../crates/hypervisor/src/device/driver/vfio.rs | 6 ------ 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/runtime-rs/crates/hypervisor/src/device/driver/mod.rs b/src/runtime-rs/crates/hypervisor/src/device/driver/mod.rs index 2aff85b8c4..8ccc3dfc68 100644 --- a/src/runtime-rs/crates/hypervisor/src/device/driver/mod.rs +++ b/src/runtime-rs/crates/hypervisor/src/device/driver/mod.rs @@ -12,8 +12,8 @@ mod virtio_net; mod virtio_vsock; pub use vfio::{ - bind_device_to_host, bind_device_to_vfio, get_host_guest_map, get_vfio_device, HostDevice, - VfioBusMode, VfioConfig, VfioDevice, + bind_device_to_host, bind_device_to_vfio, get_vfio_device, HostDevice, VfioBusMode, VfioConfig, + VfioDevice, }; pub use virtio_blk::{ BlockConfig, BlockDevice, KATA_BLK_DEV_TYPE, KATA_MMIO_BLK_DEV_TYPE, KATA_NVDIMM_DEV_TYPE, @@ -207,11 +207,4 @@ mod tests { assert!(root_slot.is_some()); assert_eq!(root_slot.unwrap().0, 1); } - - #[test] - fn test_get_host_guest_map() { - // test unwrap is fine, no panic occurs. - let hg_map = get_host_guest_map("".to_owned()); - assert!(hg_map.is_none()); - } } diff --git a/src/runtime-rs/crates/hypervisor/src/device/driver/vfio.rs b/src/runtime-rs/crates/hypervisor/src/device/driver/vfio.rs index 07890de659..be1eb3cb52 100644 --- a/src/runtime-rs/crates/hypervisor/src/device/driver/vfio.rs +++ b/src/runtime-rs/crates/hypervisor/src/device/driver/vfio.rs @@ -70,12 +70,6 @@ pub fn generate_guest_pci_path(bdf: String) -> Result { }) } -// get host/guest mapping for info -pub fn get_host_guest_map(host_bdf: String) -> Option { - // safe, just do unwrap as `HOST_GUEST_MAP` is always valid. - HOST_GUEST_MAP.read().unwrap().get(&host_bdf).cloned() -} - pub fn do_check_iommu_on() -> Result { let element = std::fs::read_dir(SYS_CLASS_IOMMU)? .filter_map(|e| e.ok())