mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 09:25:21 +00:00
tests: ensure that IOMMU maximum address width in bits is respected
Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com>
This commit is contained in:
parent
27fda753e1
commit
5a8df3622c
@ -9111,7 +9111,10 @@ mod vfio {
|
||||
.args(["--cpus", "boot=4"])
|
||||
.args(["--memory", "size=4G"])
|
||||
.args(["--kernel", fw_path(FwType::RustHypervisorFirmware).as_str()])
|
||||
.args(["--device", format!("path={NVIDIA_VFIO_DEVICE}").as_str()])
|
||||
.args([
|
||||
"--device",
|
||||
format!("path={NVIDIA_VFIO_DEVICE},iommu=on").as_str(),
|
||||
])
|
||||
.args(["--api-socket", &api_socket])
|
||||
.default_disks()
|
||||
.default_net()
|
||||
@ -9136,6 +9139,43 @@ mod vfio {
|
||||
|
||||
handle_child_output(r, &output);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nvidia_card_iommu_address_width() {
|
||||
let jammy = UbuntuDiskConfig::new(JAMMY_VFIO_IMAGE_NAME.to_string());
|
||||
let guest = Guest::new(Box::new(jammy));
|
||||
let api_socket = temp_api_path(&guest.tmp_dir);
|
||||
|
||||
let mut child = GuestCommand::new(&guest)
|
||||
.args(["--cpus", "boot=4"])
|
||||
.args(["--memory", "size=4G"])
|
||||
.args(["--kernel", fw_path(FwType::RustHypervisorFirmware).as_str()])
|
||||
.args(["--device", format!("path={NVIDIA_VFIO_DEVICE}").as_str()])
|
||||
.args([
|
||||
"--platform",
|
||||
"num_pci_segments=2,iommu_segments=1,iommu_address_width=42",
|
||||
])
|
||||
.args(["--api-socket", &api_socket])
|
||||
.default_disks()
|
||||
.default_net()
|
||||
.capture_output()
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
let r = std::panic::catch_unwind(|| {
|
||||
guest.wait_vm_boot(None).unwrap();
|
||||
|
||||
assert!(guest
|
||||
.ssh_command("sudo dmesg")
|
||||
.unwrap()
|
||||
.contains("input address: 42 bits"));
|
||||
});
|
||||
|
||||
let _ = child.kill();
|
||||
let output = child.wait_with_output().unwrap();
|
||||
|
||||
handle_child_output(r, &output);
|
||||
}
|
||||
}
|
||||
|
||||
mod live_migration {
|
||||
|
Loading…
x
Reference in New Issue
Block a user