Lines Matching +full:1 +full:- +full:based
2 # SPDX-License-Identifier: GPL-2.0+
10 # bootparam_hotplug_cpu bootparam-string
12 # Returns 1 if the specified boot-parameter string tells rcutorture to
13 # test CPU-hotplug operations.
15 echo "$1" | grep -q "torture\.onoff_"
18 # checkarg --argname argtype $# arg mustmatch cannotmatch
23 if test $3 -le 1
25 echo $1 needs argument $2 matching \"$5\"
28 if echo "$4" | grep -q -e "$5"
32 echo $1 $2 \"$4\" must match \"$5\"
35 if echo "$4" | grep -q -e "$6"
37 echo $1 $2 \"$4\" must not match \"$6\"
42 # configfrag_boot_params bootparam-string config-fragment-file
46 if test -r "$2.boot"
48 echo $1 `grep -v '^#' "$2.boot" | tr '\012' ' '`
50 echo $1
54 # configfrag_boot_cpus bootparam-string config-fragment-file config-cpus
56 # Decreases number of CPUs based on any nr_cpus= boot parameters specified.
58 local bootargs="`configfrag_boot_params "$1" "$2"`"
60 if echo "${bootargs}" | grep -q 'nr_cpus=[0-9]'
62 nr_cpus="`echo "${bootargs}" | sed -e 's/^.*nr_cpus=\([0-9]*\).*$/\1/'`"
63 if test "$3" -gt "$nr_cpus"
74 # configfrag_boot_maxcpus bootparam-string config-fragment-file config-cpus
76 # Decreases number of CPUs based on any maxcpus= boot parameters specified.
78 # test run. However, the torture parameters will be set based on the
80 # test runs based on the maxcpus= boot parameter controlling the initial
83 local bootargs="`configfrag_boot_params "$1" "$2"`"
85 if echo "${bootargs}" | grep -q 'maxcpus=[0-9]'
87 maxcpus="`echo "${bootargs}" | sed -e 's/^.*maxcpus=\([0-9]*\).*$/\1/'`"
88 if test "$3" -gt "$maxcpus"
99 # configfrag_hotplug_cpu config-fragment-file
101 # Returns 1 if the config fragment specifies hotplug CPU.
103 if test ! -r "$1"
105 echo Unreadable config fragment "$1" 1>&2
106 exit -1
108 grep -q '^CONFIG_HOTPLUG_CPU=y$' "$1"
111 # identify_boot_image qemu-cmd
118 if test -n "$TORTURE_BOOT_IMAGE"
122 case "$1" in
123 qemu-system-x86_64|qemu-system-i386)
126 qemu-system-aarch64)
141 local u="`file "$1"`"
142 if test -n "$TORTURE_QEMU_CMD"
145 elif echo $u | grep -q x86-64
147 echo qemu-system-x86_64
148 elif echo $u | grep -q "Intel 80386"
150 echo qemu-system-i386
151 elif echo $u | grep -q aarch64
153 echo qemu-system-aarch64
154 elif uname -a | grep -q ppc64
156 echo qemu-system-ppc64
158 echo Cannot figure out what qemu command to use! 1>&2
159 echo file $1 output: $u
160 # Usually this will be one of /usr/bin/qemu-system-*
162 # argument to top-level script.
163 exit 1
167 # identify_qemu_append qemu-cmd
169 # Output arguments for the qemu "-append" string based on CPU type
173 case "$1" in
174 qemu-system-x86_64|qemu-system-i386)
177 qemu-system-aarch64)
181 if test -n "$TORTURE_QEMU_INTERACTIVE"
189 # identify_qemu_args qemu-cmd serial-file
191 # Output arguments for qemu arguments based on the TORTURE_QEMU_MAC
195 case "$1" in
196 qemu-system-x86_64)
199 qemu-system-i386)
203 case "$1" in
204 qemu-system-x86_64|qemu-system-i386)
205 echo -machine q35,accel=kvm
206 echo -cpu ${KVM_CPU}
208 qemu-system-aarch64)
209 echo -machine virt,gic-version=host -cpu host
211 qemu-system-ppc64)
212 echo -enable-kvm -M pseries -nodefaults
213 echo -device spapr-vscsi
214 if test -n "$TORTURE_QEMU_INTERACTIVE" -a -n "$TORTURE_QEMU_MAC"
216 echo -device spapr-vlan,netdev=net0,mac=$TORTURE_QEMU_MAC
217 echo -netdev bridge,br=br0,id=net0
221 if test -n "$TORTURE_QEMU_INTERACTIVE"
223 echo -monitor stdio -serial pty -S
225 echo -serial file:$2
234 lscpu | grep '^CPU(s):' | sed -e 's/CPU(s)://' -e 's/[ ]*//g'
253 # specify_qemu_cpus qemu-cmd qemu-args #cpus
255 # Appends a string containing "-smp XXX" to qemu-args, unless the incoming
256 # qemu-args already contains "-smp".
260 if echo $2 | grep -q -e -smp
264 case "$1" in
265 qemu-system-x86_64|qemu-system-i386|qemu-system-aarch64)
266 echo $2 -smp $3
268 qemu-system-ppc64)
269 nt="`lscpu | grep '^NUMA node0' | sed -e 's/^[^,]*,\([0-9]*\),.*$/\1/'`"
270 echo $2 -smp cores=`expr \( $3 + $nt - 1 \) / $nt`,threads=$nt
276 # specify_qemu_net qemu-args
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
281 # instead "-net nic -net user".
283 if echo $1 | grep -q -e -net
285 echo $1
286 elif test -n "$TORTURE_QEMU_INTERACTIVE"
288 echo $1 -net nic -net user
290 echo $1 -net none