Posts mit dem Label GPU passthrough werden angezeigt. Alle Posts anzeigen
Posts mit dem Label GPU passthrough werden angezeigt. Alle Posts anzeigen

Mittwoch, 15. Juli 2015

Links und Skripte vom Video: Tutorial: SteamOS run in a KVM with physical GPU passthrough




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 -------------------------------------------

Dienstag, 14. Juli 2015

Links und Skripte vom Video: Tutorial: SteamOS in einer KVM betreiben und die physikalische Grafikkarte nutzen.



Hier das Tutorial zur Vorbereitung:


Dieses sind meine eingesetzten Hardwarekomponenten:
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) zum durch reichen

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

Zum erstellen der ISO datei aus der ZIP Datei:
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


Skript Dateien:

kvm-install-steamos.sh
Bite Die Zeilen DEVICE1="01:00.0" und DEVICE2="01:00.1" prüfen, ob diese zur durchzureichenden Grafikkarte passt.
--------------------------------------------------- anfang ------------------------------------------- 
#!/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

--------------------------------------------------- ende ------------------------------------------- 

kvm-start-steamos.sh
--------------------------------------------------- anfang -------------------------------------------

#!/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

--------------------------------------------------- ende ------------------------------------------- 

Montag, 6. Juli 2015

Tutorial Part 1, Debian 8, GPU Passthrough with OVMF powered by libvirt and Virt-Manager





Blog post from Alex Williamson about Libvirt with GPU passthrough and OVMF
http://vfio.blogspot.com/2015/05/vfio-gpu-how-to-series-part-4-our-first.html

Preparation for GPU passthrough:
http://kvm-exp.blogspot.com/2015/06/links-and-scripts-from-video.html

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

Here are the used commands and configurations

Install needed applications:
sudo apt-get install libvirt-daemon virt-manager

Check your passthrough device:
lspci -nk

Check groups:
groups

Change groups for libvirt:
sudo usermod -a -G libvirt,libvirt-qemu USERNAME

Create imagefile that basesd on a backingfile or a masterimage:
qemu-img create -f qcow2 -o backing_file=win7-uefi-x64_system.qcow2,backing_fmt=qcow2 win7-uefi-libvirt-x64_system.qcow2

Check the new imagefile:
qemu-img info win7-uefi-libvirt-x64_system.qcow2

Edit the libvirt machine files manually:
sudo virsh edit "machine name"

Insert the OVMF Firmwarefile to XML (without # lines):
#  <os>
#    ..
    <loader readonly='yes' type='rom'>/usr/share/ovmf/OVMF.fd</loader>
#    ..
#  </os>

For Nvidia Users, use this (without # lines):
#  <features>
#    ..
    <kvm>
      <hidden state='on'/>
    </kvm>
#    ..
#  </features>

Delete tablet device, it's not helpfull with GPU passthrough:
delete    <input type='tablet' bus='usb'/>

change:
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
to:
    <input type='mouse' bus='usb'/>
    <input type='keyboard' bus='usb'/>