-
-
Save ErnyTech/4855e9e5f75c81b9012f33149fe45cd8 to your computer and use it in GitHub Desktop.
Qemu hook for Intel GVT-g
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
GVT_DRIVER=i915 | |
GVT_PCI=0000:00:02.0 | |
function create_gpu { | |
local GVT_GUID="$1" | |
local MDEV_TYPE="$2" | |
pkexec sh -c "echo $GVT_GUID > /sys/bus/pci/drivers/$GVT_DRIVER/$GVT_PCI/mdev_supported_types/$MDEV_TYPE/create" | |
} | |
function remove_gpu { | |
local GVT_GUID="$1" | |
pkexec sh -c "echo 1 > /sys/bus/pci/drivers/$GVT_DRIVER/$GVT_PCI/$GVT_GUID/remove" | |
} | |
function handle_gpu { | |
local DOMAIN="$1" | |
local GVT_GUID="$2" | |
local MDEV_TYPE="$3" | |
if [ $# -ge 6 ]; then | |
if [ "$4" = "$DOMAIN" ] && [ "$5" = "prepare" ] && [ "$6" = "begin" ]; then | |
create_gpu "$GVT_GUID" "$MDEV_TYPE" | |
elif [ "$4" = "$DOMAIN" ] && [ "$5" = "release" ] && [ "$6" = "end" ]; then | |
remove_gpu "$GVT_GUID" | |
fi | |
fi | |
} | |
# handle_gpu win10 ab54baba-ea9a-4ce5-b7b4-51b376b65849 i915-GVTg_V5_4 "$@" Example |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any benefits to this compared to the simpler one that seems functionally identical here?