-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4942 from Yingshun/viommu_start
sriov: Add a case about iommu_device_settings
- Loading branch information
Showing
4 changed files
with
218 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
- vIOMMU.iommu_device_settings: | ||
type = iommu_device_settings | ||
start_vm = "no" | ||
ping_dest = '8.8.8.8' | ||
disk_driver = {'name': 'qemu', 'type': 'qcow2', 'iommu': 'on'} | ||
variants: | ||
- virtio: | ||
only q35, aarch64 | ||
func_supported_since_libvirt_ver = (8, 3, 0) | ||
iommu_dict = {'model': 'virtio'} | ||
- intel: | ||
only q35 | ||
start_vm = "yes" | ||
enable_guest_iommu = "yes" | ||
iommu_dict = {'model': 'intel', 'driver': {'intremap': 'on', 'caching_mode': 'on', 'eim': 'on', 'iotlb': 'on', 'aw_bits': '48'}} | ||
- smmuv3: | ||
only aarch64 | ||
func_supported_since_libvirt_ver = (5, 5, 0) | ||
iommu_dict = {'model': 'smmuv3'} | ||
variants: | ||
- e1000e: | ||
no smmuv3 | ||
iface_model = 'e1000e' | ||
iface_dict = {'type_name': 'network', 'model': '${iface_model}', 'source': {'network': 'default'}} | ||
- rtl8139: | ||
no smmuv3 | ||
iface_model = 'rtl8139' | ||
iface_dict = {'type_name': 'network', 'model': '${iface_model}', 'source': {'network': 'default'}} | ||
- virtio_muti_devices: | ||
disk_dict = {'target': {'dev': 'vda', 'bus': 'virtio'}, 'device': 'disk', 'driver': ${disk_driver}} | ||
video_dict = {'primary': 'yes', 'model_heads': '1', 'model_type': 'virtio', 'driver': {'iommu': 'on'}} | ||
test_devices = ["Eth", "block", "gpu"] | ||
variants: | ||
- vhost_on: | ||
interface_driver_name = "vhost" | ||
- vhost_off: | ||
interface_driver_name = "qemu" | ||
interface_driver = {'driver_attr': {'name': '${interface_driver_name}', 'iommu': 'on'}} | ||
iface_dict = {'type_name': 'network', 'model': 'virtio', 'driver': ${interface_driver}, 'source': {'network': 'default'}} | ||
- hostdev_iface: | ||
only virtio | ||
ping_dest = '' | ||
test_devices = ["Eth"] | ||
iface_dict = {'managed': 'yes', 'type_name': 'hostdev', 'hostdev_address': {'type_name': 'pci', 'attrs': vf_pci_addr}} | ||
- scsi_controller: | ||
test_devices = ["scsi"] | ||
controller_dicts = [{'type': 'scsi', 'model': 'virtio-scsi','driver': {'iommu': 'on'}}] | ||
disk_dict = {'target': {'dev': 'sda', 'bus': 'scsi'}} | ||
cleanup_ifaces = no | ||
- pcie_to_pci_bridge_controller: | ||
test_devices = ["Eth", "block"] | ||
controller_dicts = [{'type': 'pci', 'model': 'pcie-to-pci-bridge', 'pre_controller': 'pcie-root-port'}] | ||
disk_dict = {'target': {'dev': 'vda', 'bus': 'virtio'}, 'device': 'disk', 'driver': ${disk_driver}, 'model': 'virtio-non-transitional'} | ||
variants: | ||
- virtio_non_transitional: | ||
iface_dict = {'source': {'network': 'default'}, 'driver': {'driver_attr': {'iommu': 'on'}},'type_name': 'network', 'model': 'virtio-non-transitional'} | ||
- hostdev_iface: | ||
only virtio | ||
ping_dest = '' | ||
iface_dict = {'managed': 'yes', 'type_name': 'hostdev', 'hostdev_address': {'type_name': 'pci', 'attrs': vf_pci_addr}} | ||
- pcie_root_port_from_expander_bus: | ||
test_devices = ["Eth", "block"] | ||
root_port = {'type': 'pci', 'model': 'pcie-root-port', 'pre_controller': 'pcie-expander-bus'} | ||
controller_dicts = [{'type': 'pci', 'model': 'pcie-expander-bus', 'pre_controller': 'pcie-root'}, ${root_port}, ${root_port}] | ||
disk_dict = {'target': {'dev': 'vda', 'bus': 'virtio'}, 'device': 'disk', 'driver': ${disk_driver}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from virttest import libvirt_version | ||
from virttest import utils_disk | ||
|
||
from virttest.libvirt_xml import vm_xml | ||
from virttest.utils_libvirt import libvirt_vmxml | ||
|
||
from provider.sriov import sriov_base | ||
from provider.sriov import check_points | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
Start vm with iommu device and kinds of virtio devices with iommu=on, and | ||
check network and disk function. | ||
""" | ||
libvirt_version.is_libvirt_feature_supported(params) | ||
cleanup_ifaces = "yes" == params.get("cleanup_ifaces", "yes") | ||
ping_dest = params.get('ping_dest') | ||
iommu_dict = eval(params.get('iommu_dict', '{}')) | ||
test_devices = eval(params.get("test_devices", "[]")) | ||
|
||
vm_name = params.get("main_vm", "avocado-vt-vm1") | ||
vm = env.get_vm(vm_name) | ||
test_obj = sriov_base.SRIOVTest(vm, test, params) | ||
try: | ||
test_obj.setup_iommu_test(iommu_dict=iommu_dict, cleanup_ifaces=cleanup_ifaces) | ||
test_obj.prepare_controller() | ||
for dev in ["disk", "video"]: | ||
dev_dict = eval(params.get('%s_dict' % dev, '{}')) | ||
if dev == "disk": | ||
dev_dict = test_obj.update_disk_addr(dev_dict) | ||
libvirt_vmxml.modify_vm_device( | ||
vm_xml.VMXML.new_from_dumpxml(vm.name), dev, dev_dict) | ||
iface_dict = test_obj.parse_iface_dict() | ||
if cleanup_ifaces: | ||
libvirt_vmxml.modify_vm_device( | ||
vm_xml.VMXML.new_from_dumpxml(vm.name), | ||
"interface", iface_dict) | ||
|
||
test.log.info("TEST_STEP: Start the VM.") | ||
vm.start() | ||
vm.cleanup_serial_console() | ||
vm.create_serial_console() | ||
vm_session = vm.wait_for_serial_login( | ||
timeout=int(params.get('login_timeout'))) | ||
test.log.debug(vm_xml.VMXML.new_from_dumpxml(vm.name)) | ||
|
||
test.log.info("TEST_STEP: Check dmesg message about iommu inside the vm.") | ||
vm_session.cmd("dmesg | grep -i 'Adding to iommu group'") | ||
check_points.check_vm_iommu_group(vm_session, test_devices) | ||
|
||
test.log.info("TEST_STEP: Check if the VM disk and network are woring well.") | ||
utils_disk.dd_data_to_vm_disk(vm_session, "/mnt/test") | ||
check_points.check_vm_network_accessed(vm_session, ping_dest=ping_dest) | ||
finally: | ||
test_obj.teardown_iommu_test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters