acrn/dm: Check device file of /dev/acrn_hsm to determine the path of offline VCPU

For the upstream purpose the device file of /dev/acrn_vhm is renamed
to /dev/acrn_hsm. Correspondingly the path of offline CPU is also changed.
So the device file of /dev/acrn_hsm is checked to configure the path
of ooffline VCPU.

Tracked-On: projectacrn/acrn-hypervisor#2356
Acked-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
This commit is contained in:
Zhao Yakui 2019-01-18 09:04:12 +08:00 committed by wenlingz
parent ca32881666
commit 13c44f5661
3 changed files with 22 additions and 3 deletions

View File

@ -1,5 +1,11 @@
#!/bin/bash
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
kernel_version=$(uname -r | awk -F. '{ printf("%d.%d", $1,$2) }')
@ -442,7 +448,7 @@ for i in `ls -d /sys/devices/system/cpu/cpu[1-99]`; do
echo 0 > $i/online
online=`cat $i/online`
done
echo $idx > /sys/class/vhm/acrn_vhm/offline_cpu
echo $idx > ${offline_path}/offline_cpu
fi
done

View File

@ -1,5 +1,12 @@
#!/bin/bash
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
function launch_clear()
{
mac=$(cat /sys/class/net/e*/address)
@ -45,7 +52,7 @@ for i in `ls -d /sys/devices/system/cpu/cpu[1-99]`; do
echo 0 > $i/online
online=`cat $i/online`
done
echo $idx > /sys/class/vhm/acrn_vhm/offline_cpu
echo $idx > ${offline_path}/offline_cpu
fi
done

View File

@ -1,5 +1,11 @@
#!/bin/bash
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
kernel_version=$(uname -r | awk -F. '{ printf("%d.%d", $1,$2) }')
@ -419,7 +425,7 @@ for i in `ls -d /sys/devices/system/cpu/cpu[1-99]`; do
echo 0 > $i/online
online=`cat $i/online`
done
echo $idx > /sys/class/vhm/acrn_vhm/offline_cpu
echo $idx > ${offline_path}/offline_cpu
fi
done