summaryrefslogtreecommitdiffstats
path: root/recipes-test/virt-test/files/virt-test-ppc.patch
blob: 865f42d01ef1fd7657128218c2a50bfb465d2af7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
Enable ppc support in virt-test

Signed-off-by: Jonas Eriksson <jonas.eriksson@enea.com>
Upstream-Status: Pending
diff --git a/virttest/arch.py b/virttest/arch.py
index d5e92f6..b1f0084 100644
--- a/virttest/arch.py
+++ b/virttest/arch.py
@@ -3,7 +3,7 @@ from virttest import utils_misc
 
 ARCH = platform.machine()
 
-if ARCH == "ppc64":
+if ARCH == "ppc64" or ARCH == "ppc":
     # From include/linux/sockios.h
     SIOCSIFHWADDR = 0x8924
     SIOCGIFHWADDR = 0x8927
@@ -58,5 +58,5 @@ def get_kvm_module_list():
         arch_convert = {'GenuineIntel': 'intel', 'AuthenticAMD': 'amd'}
         host_cpu_type = utils_misc.get_cpu_vendor(verbose=False)
         return ["kvm", "kvm-%s" % arch_convert[host_cpu_type]]
-    elif ARCH == 'ppc64':
+    elif ARCH == 'ppc64' or ARCH == 'ppc':
         return ["kvm"]
diff --git a/virttest/utils_misc.py b/virttest/utils_misc.py
index c6a3104..a5098be 100644
--- a/virttest/utils_misc.py
+++ b/virttest/utils_misc.py
@@ -1589,6 +1590,8 @@ def get_host_cpu_models():
 
     if ARCH == 'ppc64':
         return ['POWER7']
+    if ARCH == 'ppc':
+        return ['e500mc']
 
     cpu_types = {"AuthenticAMD": ["Opteron_G5", "Opteron_G4", "Opteron_G3",
                                   "Opteron_G2", "Opteron_G1"],
diff --git a/virttest/qemu_vm.py b/virttest/qemu_vm.py
index 27a6025..3e982bb 100644
--- a/virttest/qemu_vm.py
+++ b/virttest/qemu_vm.py
@@ -421,20 +421,33 @@ class VM(virt_vm.BaseVM):
             cmd += _add_option("mode", "control")
             return cmd
 
-        def add_serial(devices, name, filename):
-            if not devices.has_option("chardev"):
-                return " -serial unix:'%s',server,nowait" % filename
-
-            serial_id = "serial_id_%s" % name
+        def add_serial_chardev(serial_id, filename):
             cmd = " -chardev socket"
             cmd += _add_option("id", serial_id)
             cmd += _add_option("path", filename)
             cmd += _add_option("server", "NO_EQUAL_STRING")
             cmd += _add_option("nowait", "NO_EQUAL_STRING")
+            return cmd
+
+        def add_isa_serial(devices, name, filename):
+            if not devices.has_option("chardev"):
+                return " -serial unix:'%s',server,nowait" % filename
+
+            serial_id = "serial_id_%s" % name
+            cmd = add_serial_chardev(serial_id, filename)
             cmd += " -device isa-serial"
             cmd += _add_option("chardev", serial_id)
             return cmd
 
+        def add_direct_serial(devices, name, filename):
+            if not devices.has_option("chardev"):
+                return " -serial unix:'%s',server,nowait" % filename
+
+            serial_id = "serial_id_%s" % name
+            cmd = add_serial_chardev(serial_id, filename)
+            cmd += " -serial chardev:%s" % serial_id
+            return cmd
+
         def add_virtio_port(devices, name, bus, filename, porttype, chardev,
                             name_prefix=None, index=None, extra_params=""):
             """
@@ -1190,7 +1203,11 @@ class VM(virt_vm.BaseVM):
         # Add serial console redirection
         for serial in params.objects("isa_serials"):
             serial_filename = vm.get_serial_console_filename(serial)
-            cmd = add_serial(devices, serial, serial_filename)
+            cmd = add_isa_serial(devices, serial, serial_filename)
+            devices.insert(StrDev('SER-%s' % serial, cmdline=cmd))
+        for serial in params.objects("direct_serials"):
+            serial_filename = vm.get_serial_console_filename(serial)
+            cmd = add_direct_serial(devices, serial, serial_filename)
             devices.insert(StrDev('SER-%s' % serial, cmdline=cmd))
 
         # Add virtio_serial ports
@@ -1473,10 +1490,10 @@ class VM(virt_vm.BaseVM):
                     continue
                 cpu_model = model
                 break
-            else:
-                cpu_model = model
-                logging.error("Non existing CPU model %s will be passed "
-                              "to qemu (wrong config or negative test)", model)
+        else:
+            cpu_model = model
+            logging.error("Non existing CPU model %s will be passed "
+                          "to qemu (wrong config or negative test)", model)
 
         if use_default_cpu_model:
             cpu_model = params.get("default_cpu_model")
@@ -2230,9 +2247,11 @@ class VM(virt_vm.BaseVM):
                 # Add this monitor to the list
                 self.monitors += [monitor]
 
-            # Create isa serial ports.
+            # Create serial ports.
             for serial in params.objects("isa_serials"):
                 self.serial_ports.append(serial)
+            for serial in params.objects("direct_serials"):
+                self.serial_ports.append(serial)
 
             # Create virtio_ports (virtio_serialports and virtio_consoles)
             i = 0