2018-03-07 21:01:19 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-01-18 09:04:12 +08:00
|
|
|
offline_path="/sys/class/vhm/acrn_vhm"
|
|
|
|
|
|
|
|
# Check the device file of /dev/acrn_hsm to determine the offline_path
|
|
|
|
if [ -e "/dev/acrn_hsm" ]; then
|
|
|
|
offline_path="/sys/class/acrn/acrn_hsm"
|
|
|
|
fi
|
|
|
|
|
2018-03-07 21:01:19 +08:00
|
|
|
function launch_clear()
|
|
|
|
{
|
2018-12-07 22:30:02 +08:00
|
|
|
mac=$(cat /sys/class/net/e*/address)
|
2018-03-07 21:01:19 +08:00
|
|
|
vm_name=vm$1
|
2018-12-07 22:30:02 +08:00
|
|
|
mac_seed=${mac:9:8}-${vm_name}
|
2018-03-07 21:01:19 +08:00
|
|
|
|
|
|
|
#check if the vm is running or not
|
|
|
|
vm_ps=$(pgrep -a -f acrn-dm)
|
|
|
|
result=$(echo $vm_ps | grep "${vm_name}")
|
|
|
|
if [[ "$result" != "" ]]; then
|
|
|
|
echo "$vm_name is running, can't create twice!"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
#for memsize setting
|
2018-08-12 14:07:50 +08:00
|
|
|
mem_size=2048M
|
2018-06-10 19:59:47 +08:00
|
|
|
|
2018-06-29 10:54:16 +08:00
|
|
|
acrn-dm -A -m $mem_size -c $2 -s 0:0,hostbridge -s 1:0,lpc -l com1,stdio \
|
2018-06-15 11:12:29 +08:00
|
|
|
-s 2,pci-gvt -G "$3" \
|
2018-03-07 21:01:19 +08:00
|
|
|
-s 5,virtio-console,@pty:pty_port \
|
|
|
|
-s 6,virtio-hyper_dmabuf \
|
2019-01-29 23:22:39 +08:00
|
|
|
-s 3,virtio-blk,/home/clear/uos/uos.img \
|
2018-03-09 20:04:32 +08:00
|
|
|
-s 4,virtio-net,tap0 \
|
2018-12-07 22:30:02 +08:00
|
|
|
--mac_seed $mac_seed \
|
2018-11-28 20:34:48 +08:00
|
|
|
-k /usr/lib/kernel/default-iot-lts2018 \
|
2018-04-04 17:27:45 +08:00
|
|
|
-B "root=/dev/vda3 rw rootwait maxcpus=$2 nohpet console=tty0 console=hvc0 \
|
2018-03-07 21:01:19 +08:00
|
|
|
console=ttyS0 no_timer_check ignore_loglevel log_buf_len=16M \
|
|
|
|
consoleblank=0 tsc=reliable i915.avail_planes_per_pipe=$4 \
|
2018-07-10 09:19:06 +08:00
|
|
|
i915.enable_hangcheck=0 i915.nuclear_pageflip=1 i915.enable_guc_loading=0 \
|
2018-08-16 14:38:35 +08:00
|
|
|
i915.enable_guc_submission=0 i915.enable_guc=0" $vm_name
|
2018-03-07 21:01:19 +08:00
|
|
|
}
|
|
|
|
|
2018-06-01 17:13:36 +08:00
|
|
|
# offline SOS CPUs except BSP before launch UOS
|
|
|
|
for i in `ls -d /sys/devices/system/cpu/cpu[1-99]`; do
|
|
|
|
online=`cat $i/online`
|
|
|
|
idx=`echo $i | tr -cd "[1-99]"`
|
|
|
|
echo cpu$idx online=$online
|
|
|
|
if [ "$online" = "1" ]; then
|
|
|
|
echo 0 > $i/online
|
2018-10-25 09:12:24 +08:00
|
|
|
# during boot time, cpu hotplug may be disabled by pci_device_probe during a pci module insmod
|
|
|
|
while [ "$online" = "1" ]; do
|
|
|
|
sleep 1
|
|
|
|
echo 0 > $i/online
|
|
|
|
online=`cat $i/online`
|
|
|
|
done
|
2019-01-18 09:04:12 +08:00
|
|
|
echo $idx > ${offline_path}/offline_cpu
|
2018-06-01 17:13:36 +08:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2018-10-29 18:14:26 +08:00
|
|
|
launch_clear 1 1 "64 448 8" 0x070F00
|