dm: refine the passthrough devices with dictionary

As vm config tool will override the passthrough devices if run on
different hw, and it will take a lot of work to search and
replace the passthrough device.
This patch refine the passthrough devices that tools to overwrite.

Tracked-On: #3127
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Reviewed-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Wei Liu
2019-05-14 22:57:31 +08:00
committed by ACRN System Integration
parent 517cff1bbe
commit bb48a66b96
3 changed files with 164 additions and 101 deletions

View File

@@ -1,6 +1,19 @@
#!/bin/bash
# This is an example of launch script for KBL NUC7i7DNH, may need to revise for other platform.
# pci devices for passthru
declare -A passthru_vpid
declare -A passthru_bdf
passthru_vpid=(
["eth"]="8086 156f"
["sata"]="8086 9d03"
)
passthru_bdf=(
["eth"]="0000:00:1f.6"
["sata"]="0000:00:17.0"
)
function launch_hard_rt_vm()
{
#for memsize setting
@@ -8,14 +21,14 @@ mem_size=1024M
modprobe pci_stub
# Ethernet pass-through
#echo "8086 156f" > /sys/bus/pci/drivers/pci-stub/new_id
#echo "0000:00:1f.6" > /sys/bus/pci/devices/0000:00:1f.6/driver/unbind
#echo "0000:00:1f.6" > /sys/bus/pci/drivers/pci-stub/bind
#echo ${passthru_vpid["eth"]} > /sys/bus/pci/drivers/pci-stub/new_id
#echo ${passthru_bdf["eth"]} > /sys/bus/pci/devices/${passthru_bdf["eth"]}/driver/unbind
#echo ${passthru_bdf["eth"]} > /sys/bus/pci/drivers/pci-stub/bind
# SATA pass-through
echo "8086 9d03" > /sys/bus/pci/drivers/pci-stub/new_id
echo "0000:00:17.0" > /sys/bus/pci/devices/0000:00:17.0/driver/unbind
echo "0000:00:17.0" > /sys/bus/pci/drivers/pci-stub/bind
echo ${passthru_vpid["sata"]} > /sys/bus/pci/drivers/pci-stub/new_id
echo ${passthru_bdf["sata"]} > /sys/bus/pci/devices/${passthru_bdf["sata"]}/driver/unbind
echo ${passthru_bdf["sata"]} > /sys/bus/pci/drivers/pci-stub/bind
/usr/bin/acrn-dm -A -m $mem_size -c $1 \
-k /root/rt_uos_kernel \