-
-
Save ItsLiyua/53f071a1ebc3c2094dad0737e5083014 to your computer and use it in GitHub Desktop.
VM config
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/bash | |
# Helpful to read output when debugging | |
set -x | |
# Stop display manager | |
systemctl stop sddm.service | |
## Uncomment the following line if you use GDM | |
#killall gdm-x-session | |
# Unbind VTconsoles | |
echo 0 > /sys/class/vtconsole/vtcon0/bind | |
echo 0 > /sys/class/vtconsole/vtcon1/bind | |
modprobe -r amdgpu | |
# Avoid a Race condition by waiting 2 seconds. This can be calibrated to be shorter or longer if required for your system | |
sleep 2 | |
# Unbind the GPU from display driver | |
virsh nodedev-detach pci_0000_0a_00_0 | |
virsh nodedev-detach pci_0000_0b_00_0 | |
virsh nodedev-detach pci_0000_0c_00_0 | |
virsh nodedev-detach pci_0000_0c_00_1 | |
# Load VFIO Kernel Module | |
modprobe vfio-pci |
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
IOMMU Group 0: | |
00:01.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge [1022:1482] | |
IOMMU Group 1: | |
00:01.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse GPP Bridge [1022:1483] | |
IOMMU Group 2: | |
00:01.3 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse GPP Bridge [1022:1483] | |
IOMMU Group 3: | |
00:02.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge [1022:1482] | |
IOMMU Group 4: | |
00:03.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge [1022:1482] | |
IOMMU Group 5: | |
00:03.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse GPP Bridge [1022:1483] | |
IOMMU Group 6: | |
00:03.4 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse GPP Bridge [1022:1483] | |
IOMMU Group 7: | |
00:04.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge [1022:1482] | |
IOMMU Group 8: | |
00:05.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge [1022:1482] | |
IOMMU Group 9: | |
00:07.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge [1022:1482] | |
IOMMU Group 10: | |
00:07.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Internal PCIe GPP Bridge 0 to bus[E:B] [1022:1484] | |
IOMMU Group 11: | |
00:08.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge [1022:1482] | |
IOMMU Group 12: | |
00:08.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Internal PCIe GPP Bridge 0 to bus[E:B] [1022:1484] | |
IOMMU Group 13: | |
00:14.0 SMBus [0c05]: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller [1022:790b] (rev 61) | |
00:14.3 ISA bridge [0601]: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge [1022:790e] (rev 51) | |
IOMMU Group 14: | |
00:18.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 0 [1022:1440] | |
00:18.1 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 1 [1022:1441] | |
00:18.2 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 2 [1022:1442] | |
00:18.3 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 3 [1022:1443] | |
00:18.4 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 4 [1022:1444] | |
00:18.5 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 5 [1022:1445] | |
00:18.6 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 6 [1022:1446] | |
00:18.7 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 7 [1022:1447] | |
IOMMU Group 15: | |
01:00.0 Non-Volatile memory controller [0108]: Samsung Electronics Co Ltd NVMe SSD Controller PM9A1/PM9A3/980PRO [144d:a80a] | |
IOMMU Group 16: | |
02:00.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Device [1022:43d0] (rev 01) | |
02:00.1 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] 400 Series Chipset SATA Controller [1022:43c8] (rev 01) | |
02:00.2 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] 400 Series Chipset PCIe Bridge [1022:43c6] (rev 01) | |
03:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] 400 Series Chipset PCIe Port [1022:43c7] (rev 01) | |
03:01.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] 400 Series Chipset PCIe Port [1022:43c7] (rev 01) | |
03:02.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] 400 Series Chipset PCIe Port [1022:43c7] (rev 01) | |
03:03.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] 400 Series Chipset PCIe Port [1022:43c7] (rev 01) | |
03:04.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] 400 Series Chipset PCIe Port [1022:43c7] (rev 01) | |
03:09.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] 400 Series Chipset PCIe Port [1022:43c7] (rev 01) | |
05:00.0 Network controller [0280]: Intel Corporation Wi-Fi 6E(802.11ax) AX210/AX1675* 2x2 [Typhoon Peak] [8086:2725] (rev 1a) | |
06:00.0 Ethernet controller [0200]: Intel Corporation I211 Gigabit Network Connection [8086:1539] (rev 03) | |
09:00.0 USB controller [0c03]: ASMedia Technology Inc. ASM2142/ASM3142 USB 3.1 Host Controller [1b21:2142] | |
IOMMU Group 17: | |
0a:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Upstream Port of PCI Express Switch [1002:1478] (rev 10) | |
IOMMU Group 18: | |
0b:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Downstream Port of PCI Express Switch [1002:1479] (rev 10) | |
IOMMU Group 19: | |
0c:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 31 [Radeon RX 7900 XT/7900 XTX/7900M] [1002:744c] (rev c8) | |
IOMMU Group 20: | |
0c:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 31 HDMI/DP Audio [1002:ab30] | |
IOMMU Group 21: | |
0d:00.0 Non-Volatile memory controller [0108]: Micron Technology Inc 2300 NVMe SSD [Santana] [1344:5405] | |
IOMMU Group 22: | |
0e:00.0 Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Function [1022:148a] | |
IOMMU Group 23: | |
0f:00.0 Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Reserved SPP [1022:1485] | |
IOMMU Group 24: | |
0f:00.1 Encryption controller [1080]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Cryptographic Coprocessor PSPCPP [1022:1486] | |
IOMMU Group 25: | |
0f:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller [1022:149c] | |
IOMMU Group 26: | |
0f:00.4 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse HD Audio Controller [1022:1487] |
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/bash | |
set -x | |
# Re-Bind GPU to Nvidia Driver | |
virsh nodedev-reattach pci_0000_0c_00_1 | |
virsh nodedev-reattach pci_0000_0c_00_0 | |
virsh nodedev-reattach pci_0000_0b_00_0 | |
virsh nodedev-reattach pci_0000_0c_00_0 | |
# Reload nvidia modules | |
modprobe amdgpu | |
# Rebind VT consoles | |
echo 1 > /sys/class/vtconsole/vtcon0/bind | |
# Some machines might have more than 1 virtual console. Add a line for each corresponding VTConsole | |
#echo 1 > /sys/class/vtconsole/vtcon1/bind | |
# Restart Display Manager | |
systemctl start display-manager.service |
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
<domain type="kvm"> | |
<name>win10</name> | |
<uuid>21ef8eac-a915-47b5-9d44-75bbe88fcb11</uuid> | |
<metadata> | |
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0"> | |
<libosinfo:os id="http://microsoft.com/win/10"/> | |
</libosinfo:libosinfo> | |
</metadata> | |
<memory unit="KiB">25165824</memory> | |
<currentMemory unit="KiB">25165824</currentMemory> | |
<vcpu placement="static">20</vcpu> | |
<os firmware="efi"> | |
<type arch="x86_64" machine="pc-q35-8.2">hvm</type> | |
<firmware> | |
<feature enabled="no" name="enrolled-keys"/> | |
<feature enabled="yes" name="secure-boot"/> | |
</firmware> | |
<loader readonly="yes" secure="yes" type="pflash">/usr/share/edk2/x64/OVMF_CODE.secboot.4m.fd</loader> | |
<nvram template="/usr/share/edk2/x64/OVMF_VARS.4m.fd">/var/lib/libvirt/qemu/nvram/win10_VARS.fd</nvram> | |
</os> | |
<features> | |
<acpi/> | |
<apic/> | |
<hyperv mode="custom"> | |
<relaxed state="on"/> | |
<vapic state="on"/> | |
<spinlocks state="on" retries="8191"/> | |
<vendor_id state="on" value="randomid"/> | |
</hyperv> | |
<kvm> | |
<hidden state="on"/> | |
</kvm> | |
<vmport state="off"/> | |
<smm state="on"/> | |
</features> | |
<cpu mode="host-passthrough" check="none" migratable="on"> | |
<topology sockets="1" dies="1" clusters="1" cores="10" threads="2"/> | |
<feature policy="disable" name="hypervisor"/> | |
</cpu> | |
<clock offset="localtime"> | |
<timer name="rtc" tickpolicy="catchup"/> | |
<timer name="pit" tickpolicy="delay"/> | |
<timer name="hpet" present="no"/> | |
<timer name="hypervclock" present="yes"/> | |
</clock> | |
<on_poweroff>destroy</on_poweroff> | |
<on_reboot>restart</on_reboot> | |
<on_crash>destroy</on_crash> | |
<pm> | |
<suspend-to-mem enabled="no"/> | |
<suspend-to-disk enabled="no"/> | |
</pm> | |
<devices> | |
<emulator>/usr/bin/qemu-system-x86_64</emulator> | |
<disk type="file" device="disk"> | |
<driver name="qemu" type="qcow2"/> | |
<source file="/home/liyua/Documents/VM/win10.qcow2"/> | |
<target dev="vda" bus="virtio"/> | |
<boot order="1"/> | |
<address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/> | |
</disk> | |
<controller type="usb" index="0" model="qemu-xhci" ports="15"> | |
<address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/> | |
</controller> | |
<controller type="pci" index="0" model="pcie-root"/> | |
<controller type="pci" index="1" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="1" port="0x10"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/> | |
</controller> | |
<controller type="pci" index="2" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="2" port="0x11"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x1"/> | |
</controller> | |
<controller type="pci" index="3" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="3" port="0x12"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x2"/> | |
</controller> | |
<controller type="pci" index="4" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="4" port="0x13"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x3"/> | |
</controller> | |
<controller type="pci" index="5" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="5" port="0x14"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x4"/> | |
</controller> | |
<controller type="pci" index="6" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="6" port="0x15"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x5"/> | |
</controller> | |
<controller type="pci" index="7" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="7" port="0x16"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x6"/> | |
</controller> | |
<controller type="pci" index="8" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="8" port="0x17"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x7"/> | |
</controller> | |
<controller type="pci" index="9" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="9" port="0x18"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0" multifunction="on"/> | |
</controller> | |
<controller type="pci" index="10" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="10" port="0x19"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x1"/> | |
</controller> | |
<controller type="pci" index="11" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="11" port="0x1a"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x2"/> | |
</controller> | |
<controller type="pci" index="12" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="12" port="0x1b"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x3"/> | |
</controller> | |
<controller type="pci" index="13" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="13" port="0x1c"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x4"/> | |
</controller> | |
<controller type="pci" index="14" model="pcie-root-port"> | |
<model name="pcie-root-port"/> | |
<target chassis="14" port="0x1d"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x5"/> | |
</controller> | |
<controller type="sata" index="0"> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x1f" function="0x2"/> | |
</controller> | |
<controller type="virtio-serial" index="0"> | |
<address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/> | |
</controller> | |
<interface type="network"> | |
<mac address="52:54:00:a3:43:21"/> | |
<source network="default"/> | |
<model type="virtio"/> | |
<address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/> | |
</interface> | |
<serial type="pty"> | |
<target type="isa-serial" port="0"> | |
<model name="isa-serial"/> | |
</target> | |
</serial> | |
<console type="pty"> | |
<target type="serial" port="0"/> | |
</console> | |
<input type="tablet" bus="usb"> | |
<address type="usb" bus="0" port="1"/> | |
</input> | |
<input type="mouse" bus="ps2"/> | |
<input type="keyboard" bus="ps2"/> | |
<graphics type="vnc" port="-1" autoport="yes" listen="0.0.0.0"> | |
<listen type="address" address="0.0.0.0"/> | |
</graphics> | |
<sound model="ich9"> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0"/> | |
</sound> | |
<audio id="1" type="none"/> | |
<video> | |
<model type="virtio" heads="1" primary="yes"/> | |
<address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/> | |
</video> | |
<hostdev mode="subsystem" type="pci" managed="yes"> | |
<source> | |
<address domain="0x0000" bus="0x0c" slot="0x00" function="0x0"/> | |
</source> | |
<rom file="/home/liyua/Documents/vbios.dump"/> | |
<address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/> | |
</hostdev> | |
<hostdev mode="subsystem" type="pci" managed="yes"> | |
<source> | |
<address domain="0x0000" bus="0x0c" slot="0x00" function="0x1"/> | |
</source> | |
<rom bar="off"/> | |
<address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/> | |
</hostdev> | |
<hostdev mode="subsystem" type="usb" managed="yes"> | |
<source> | |
<vendor id="0x3151"/> | |
<product id="0x4003"/> | |
</source> | |
<address type="usb" bus="0" port="2"/> | |
</hostdev> | |
<hostdev mode="subsystem" type="usb" managed="yes"> | |
<source> | |
<vendor id="0x1395"/> | |
<product id="0x005d"/> | |
</source> | |
<address type="usb" bus="0" port="3"/> | |
</hostdev> | |
<hostdev mode="subsystem" type="usb" managed="yes"> | |
<source> | |
<vendor id="0x1532"/> | |
<product id="0x007b"/> | |
</source> | |
<address type="usb" bus="0" port="4"/> | |
</hostdev> | |
<hostdev mode="subsystem" type="usb" managed="yes"> | |
<source> | |
<vendor id="0x25a7"/> | |
<product id="0x2420"/> | |
</source> | |
<address type="usb" bus="0" port="5"/> | |
</hostdev> | |
<watchdog model="itco" action="reset"/> | |
<memballoon model="virtio"> | |
<address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/> | |
</memballoon> | |
</devices> | |
</domain> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment