.. | .. |
---|
1 | 1 | #!/bin/bash |
---|
| 2 | +# SPDX-License-Identifier: GPL-2.0+ |
---|
2 | 3 | # |
---|
3 | 4 | # Shell functions for the rest of the scripts. |
---|
4 | 5 | # |
---|
5 | | -# This program is free software; you can redistribute it and/or modify |
---|
6 | | -# it under the terms of the GNU General Public License as published by |
---|
7 | | -# the Free Software Foundation; either version 2 of the License, or |
---|
8 | | -# (at your option) any later version. |
---|
9 | | -# |
---|
10 | | -# This program is distributed in the hope that it will be useful, |
---|
11 | | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | | -# GNU General Public License for more details. |
---|
14 | | -# |
---|
15 | | -# You should have received a copy of the GNU General Public License |
---|
16 | | -# along with this program; if not, you can access it online at |
---|
17 | | -# http://www.gnu.org/licenses/gpl-2.0.html. |
---|
18 | | -# |
---|
19 | 6 | # Copyright (C) IBM Corporation, 2013 |
---|
20 | 7 | # |
---|
21 | | -# Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> |
---|
| 8 | +# Authors: Paul E. McKenney <paulmck@linux.ibm.com> |
---|
22 | 9 | |
---|
23 | 10 | # bootparam_hotplug_cpu bootparam-string |
---|
24 | 11 | # |
---|
25 | 12 | # Returns 1 if the specified boot-parameter string tells rcutorture to |
---|
26 | 13 | # test CPU-hotplug operations. |
---|
27 | 14 | bootparam_hotplug_cpu () { |
---|
28 | | - echo "$1" | grep -q "rcutorture\.onoff_" |
---|
| 15 | + echo "$1" | grep -q "torture\.onoff_" |
---|
29 | 16 | } |
---|
30 | 17 | |
---|
31 | 18 | # checkarg --argname argtype $# arg mustmatch cannotmatch |
---|
.. | .. |
---|
185 | 172 | local console=ttyS0 |
---|
186 | 173 | case "$1" in |
---|
187 | 174 | qemu-system-x86_64|qemu-system-i386) |
---|
188 | | - echo noapic selinux=0 initcall_debug debug |
---|
| 175 | + echo selinux=0 initcall_debug debug |
---|
189 | 176 | ;; |
---|
190 | 177 | qemu-system-aarch64) |
---|
191 | 178 | console=ttyAMA0 |
---|
.. | .. |
---|
204 | 191 | # Output arguments for qemu arguments based on the TORTURE_QEMU_MAC |
---|
205 | 192 | # and TORTURE_QEMU_INTERACTIVE environment variables. |
---|
206 | 193 | identify_qemu_args () { |
---|
| 194 | + local KVM_CPU="" |
---|
| 195 | + case "$1" in |
---|
| 196 | + qemu-system-x86_64) |
---|
| 197 | + KVM_CPU=kvm64 |
---|
| 198 | + ;; |
---|
| 199 | + qemu-system-i386) |
---|
| 200 | + KVM_CPU=kvm32 |
---|
| 201 | + ;; |
---|
| 202 | + esac |
---|
207 | 203 | case "$1" in |
---|
208 | 204 | qemu-system-x86_64|qemu-system-i386) |
---|
| 205 | + echo -machine q35,accel=kvm |
---|
| 206 | + echo -cpu ${KVM_CPU} |
---|
209 | 207 | ;; |
---|
210 | 208 | qemu-system-aarch64) |
---|
211 | 209 | echo -machine virt,gic-version=host -cpu host |
---|
.. | .. |
---|
217 | 215 | then |
---|
218 | 216 | echo -device spapr-vlan,netdev=net0,mac=$TORTURE_QEMU_MAC |
---|
219 | 217 | echo -netdev bridge,br=br0,id=net0 |
---|
220 | | - elif test -n "$TORTURE_QEMU_INTERACTIVE" |
---|
221 | | - then |
---|
222 | | - echo -net nic -net user |
---|
223 | 218 | fi |
---|
224 | 219 | ;; |
---|
225 | 220 | esac |
---|
.. | .. |
---|
236 | 231 | # Returns the number of virtual CPUs available to the aggregate of the |
---|
237 | 232 | # guest OSes. |
---|
238 | 233 | identify_qemu_vcpus () { |
---|
239 | | - lscpu | grep '^CPU(s):' | sed -e 's/CPU(s)://' |
---|
| 234 | + lscpu | grep '^CPU(s):' | sed -e 's/CPU(s)://' -e 's/[ ]*//g' |
---|
240 | 235 | } |
---|
241 | 236 | |
---|
242 | 237 | # print_bug |
---|
.. | .. |
---|
277 | 272 | esac |
---|
278 | 273 | fi |
---|
279 | 274 | } |
---|
| 275 | + |
---|
| 276 | +# specify_qemu_net qemu-args |
---|
| 277 | +# |
---|
| 278 | +# Appends a string containing "-net none" to qemu-args, unless the incoming |
---|
| 279 | +# qemu-args already contains "-smp" or unless the TORTURE_QEMU_INTERACTIVE |
---|
| 280 | +# environment variable is set, in which case the string that is be added is |
---|
| 281 | +# instead "-net nic -net user". |
---|
| 282 | +specify_qemu_net () { |
---|
| 283 | + if echo $1 | grep -q -e -net |
---|
| 284 | + then |
---|
| 285 | + echo $1 |
---|
| 286 | + elif test -n "$TORTURE_QEMU_INTERACTIVE" |
---|
| 287 | + then |
---|
| 288 | + echo $1 -net nic -net user |
---|
| 289 | + else |
---|
| 290 | + echo $1 -net none |
---|
| 291 | + fi |
---|
| 292 | +} |
---|