Add support for creating a ehci host controller with uhci
companion controllers, giving a usb bus which can handle
both usb 1.1 and usb 2 devices.  It is done automagically
when picking ich9-usb-ehci1 as usb controller type.

Using usb-ehci gives a standalone ehci controller which
can handle usb2 devices only.

Zap the usb host controller options (masterbus, firstport,
etc) which can be used to create a companion setup using
the config file.  It's incomplete anyway (can't set the
pci bus addr so there is no way to create a multifunction
device).

While being at it also zap the ehci freq property test,
it is gone in upstream qemu.

Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 client/tests/kvm/tests/usb.py   |   27 ---------------------------
 client/virt/kvm_vm.py           |   24 ++++++++++++------------
 client/virt/subtests.cfg.sample |    1 -
 3 files changed, 12 insertions(+), 40 deletions(-)

diff --git a/client/tests/kvm/tests/usb.py b/client/tests/kvm/tests/usb.py
index 35ca2b3..5e4d2ab 100644
--- a/client/tests/kvm/tests/usb.py
+++ b/client/tests/kvm/tests/usb.py
@@ -230,21 +230,6 @@ def run_usb(test, params, env):
         session.close()
 
 
-    @error.context_aware
-    def _check_freq_option(freq, regex_str, expect_str):
-        error.context("Set freq option to '%s'" % freq, logging.info)
-        _restart_vm({"freq_usb1": freq})
-
-        error.context("Check freq option in monitor", logging.info)
-        output = str(vm.monitor.info("qtree"))
-        _verify_string(regex_str, output, [expect_str], re.S)
-
-        error.context("Check freq option in guest", logging.info)
-        session = _login()
-        _do_io_test_guest(session)
-        session.close()
-
-
     vm = env.get_vm(params["main_vm"])
     vm.verify_alive()
 
@@ -298,15 +283,3 @@ def run_usb(test, params, env):
         # So comment these test temporary.
         #_check_io_size_option("1024", "1024")
         #_check_io_size_option("4096", "4096")
-
-    if params.get("check_freq_option") == "yes":
-        error.context("Check USB EHCI freq option", logging.info)
-        freq = "1000"
-        regex_str = 'usb-ehci.*?freq = (.*?)\n'
-        _check_freq_option(freq, regex_str, freq)
-
-        freq = "250"
-        _check_freq_option(freq, regex_str, freq)
-
-        freq = "2000"
-        _check_freq_option(freq, regex_str, freq)
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 82218f4..2aabc7c 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -818,8 +818,7 @@ class VM(virt_vm.BaseVM):
             else:
                 return ""
 
-        def add_usb(help, usb_id, usb_type, multifunction=False,
-                    masterbus=None, firstport=None, freq=None):
+        def add_usb(help, usb_id, usb_type):
             if not has_option(help, "device"):
                 # Okay, for the archaic qemu which has not device parameter,
                 # just return a usb uhci controller.
@@ -833,13 +832,18 @@ class VM(virt_vm.BaseVM):
                 raise virt_vm.VMDeviceNotSupportedError(self.name, usb_type)
 
             cmd = " -device %s" % usb_type
-
             cmd += _add_option("id", usb_id)
-            cmd += _add_option("multifunction", multifunction)
-            cmd += _add_option("masterbus", masterbus)
-            cmd += _add_option("firstport", firstport)
-            cmd += _add_option("freq", freq)
 
+            if usb_type == "ich9-usb-ehci1":
+                common = ",multifunction=on,masterbus=%s.0" % usb_id
+                uhci1 = " -device ich9-usb-uhci1,addr=1d.0,firstport=0"
+                uhci2 = " -device ich9-usb-uhci2,addr=1d.1,firstport=2"
+                uhci3 = " -device ich9-usb-uhci3,addr=1d.2,firstport=4"
+                cmd += ",addr=1d.7,multifunction=on"
+                cmd += uhci1 + common
+                cmd += uhci2 + common
+                cmd += uhci3 + common
+                
             # register this usb controller.
             self.usb_dev_dict[usb_id] = []
             return cmd
@@ -954,11 +958,7 @@ class VM(virt_vm.BaseVM):
         # Add USB controllers
         for usb_name in params.objects("usbs"):
             usb_params = params.object_params(usb_name)
-            qemu_cmd += add_usb(help, usb_name, usb_params.get("usb_type"),
-                                usb_params.get("multifunction") == "on",
-                                usb_params.get("masterbus"),
-                                usb_params.get("firstport"),
-                                usb_params.get("freq"))
+            qemu_cmd += add_usb(help, usb_name, usb_params.get("usb_type"))
 
         for image_name in params.objects("images"):
             image_params = params.object_params(image_name)
diff --git a/client/virt/subtests.cfg.sample b/client/virt/subtests.cfg.sample
index 8c5310e..599b182 100644
--- a/client/virt/subtests.cfg.sample
+++ b/client/virt/subtests.cfg.sample
@@ -2113,7 +2113,6 @@ variants:
                 check_serial_option = yes
                 check_removable_option = yes
                 check_io_size_option = yes
-                check_freq_option = yes
 
     - usb_multi_disk: install setup image_copy unattended_install.cdrom
         type = multi_disk
-- 
1.7.1

_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to