Live Chat Software by Kayako
Knowledgebase: KVM
Links und Skripte vom Video: Tutorial: SteamOS run in a KVM with physical GPU passthrough
Posted by Thang Le Toan on 01 May 2016 03:47 PM

Here the preparation video:

My hardware components:
Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz socket 1150
GA-Z97X-UD3H-BK
16GB DDR3 Memory
512GB SSD
NVIDIA GeForce GTX 780 (ASUS GTX780-DC2OC-3GD5) for passthrugh

Download from SteamOS:
http://store.steampowered.com/steamos/download/?ver=custom

To create the ISO file from ZIP file:
genisoimage -U -A "Steamos" -V "SteamOS" -volset "SteamOS" -J -joliet-long -r -v -T -o SteamOSInstaller.iso --eltorito-boot boot/grub/efi.img -no-emul-boot ./SteamOSInstaller


Script files:

kvm-install-steamos.sh
Please check the lines DEVICE1="01:00.0" und DEVICE2="01:00.1".
--------------------------------------------------- begin -------------------------------------------
#!/bin/sh

INSTALLFILE=steamos-uefi-x64_system.qcow2
FILESIZE=100G

INSTALLCD=/home/user/Downloads/SteamOSInstaller.iso
# if you use a hardware CD-ROM drive, check for the device. In most cases it's /dev/sr0
#INSTALLCD=/dev/sr0

# PCI address of the passtrough devices
DEVICE1="01:00.0"
DEVICE2="01:00.1"

# load vfio-pci module
modprobe vfio-pci

for dev in "0000:$DEVICE1" "0000:$DEVICE2"; do
        vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
        device=$(cat /sys/bus/pci/devices/$dev/device)
        if [ -e /sys/bus/pci/devices/$dev/driver ]; then
                echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
        fi
        echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
done

# create installation file if not exist
if [ ! -e $INSTALLFILE ]; then
 qemu-img create -f qcow2 $INSTALLFILE $FILESIZE
fi

QEMU_PA_SAMPLES=4096 QEMU_AUDIO_DRV=pa \
qemu-system-x86_64 \
-enable-kvm \
-m 4096 \
-cpu host,kvm=off \
-smp 2,sockets=1,cores=2,threads=1 \
-machine pc-i440fx-2.1,accel=kvm \
-soundhw hda \
-bios /usr/share/ovmf/OVMF.fd \
-device vfio-pci,host=$DEVICE1,addr=0x8.0x0,multifunction=on,x-vga=on \
-device vfio-pci,host=$DEVICE2,addr=0x8.0x1 \
-vga none \
-device qxl \
-device virtio-net-pci,netdev=user.0,mac=52:54:00:a0:66:43 \
-netdev user,id=user.0 \
-drive file=$INSTALLFILE,if=none,id=drive-virtio-disk0,format=qcow2,cache=unsafe \
-device virtio-blk-pci,scsi=off,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=2 \
-drive file=$INSTALLCD,if=none,id=drive-ide0-0-0,readonly=on,format=raw \
-device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
-rtc base=localtime,driftfix=slew \
-smb /home/user/Downloads/toinstall \
-usb \
-device usb-mouse \

-device usb-kbd

--------------------------------------------------- end -------------------------------------------

kvm-start-steamos.sh
--------------------------------------------------- begin -------------------------------------------

#!/bin/bash


INSTALLFILE=steamos-uefi-x64_system.qcow2
IMAGEFILE=steamos-uefi-x64_system-01.qcow2
#FILESIZE=50G

# PCI address of the passtrough devices
DEVICE1="01:00.0"
DEVICE2="01:00.1"

# load vfio-pci module
modprobe vfio-pci

for dev in "0000:$DEVICE1" "0000:$DEVICE2"; do
        vendor=$(cat /sys/bus/pci/devices/${dev}/vendor)
        device=$(cat /sys/bus/pci/devices/${dev}/device)
        if [ -e /sys/bus/pci/devices/${dev}/driver ]; then
                echo ${dev} > /sys/bus/pci/devices/${dev}/driver/unbind
        fi
        echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
done

# create a imagefile from backingfile file if not exist
if [ ! -e $IMAGEFILE ]; then
 qemu-img create -f qcow2 -o backing_file=$INSTALLFILE,backing_fmt=qcow2 $IMAGEFILE
fi


QEMU_PA_SAMPLES=4096 QEMU_AUDIO_DRV=pa \
taskset -c 0-1 \
qemu-system-x86_64 \
-enable-kvm \
-m 4096 \
-cpu host,kvm=off \
-smp 2,sockets=1,cores=2,threads=1 \
-machine pc-i440fx-2.1,accel=kvm \
-soundhw hda \
-bios /usr/share/ovmf/OVMF.fd `# SID version of OVMF` \
-device vfio-pci,host=$DEVICE1,addr=0x8.0x0,multifunction=on,x-vga=on \
-device vfio-pci,host=$DEVICE2,addr=0x8.0x1 \
-vga none \
-device qxl \
-device virtio-net-pci,netdev=user.0,mac=52:54:00:a0:66:43 \
-netdev user,id=user.0 \
-drive file=$IMAGEFILE,if=none,id=drive-virtio-disk0,format=qcow2,cache=none \
-device virtio-blk-pci,scsi=off,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
-rtc base=localtime,driftfix=slew \
-smb /home/user/Downloads/toinstall \
-usb \
-device usb-mouse \
-device usb-kbd

--------------------------------------------------- end -------------------------------------------

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

Help Desk Software by Kayako