{"id":16151509,"url":"https://github.com/0xf4b1/qemu-kvm-windows","last_synced_at":"2025-08-18T09:14:18.427Z","repository":{"id":45084006,"uuid":"260061382","full_name":"0xf4b1/qemu-kvm-windows","owner":"0xf4b1","description":"QEMU/KVM setup with GPU passthrough for Windows on an Arch Linux host","archived":false,"fork":false,"pushed_at":"2020-04-29T22:51:50.000Z","size":5,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-02T17:09:33.989Z","etag":null,"topics":["gpu-passthrough","kvm","qemu","qemu-kvm","windows"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xf4b1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-29T22:40:06.000Z","updated_at":"2024-08-02T20:53:40.000Z","dependencies_parsed_at":"2022-07-13T04:20:47.341Z","dependency_job_id":null,"html_url":"https://github.com/0xf4b1/qemu-kvm-windows","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/0xf4b1/qemu-kvm-windows","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xf4b1%2Fqemu-kvm-windows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xf4b1%2Fqemu-kvm-windows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xf4b1%2Fqemu-kvm-windows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xf4b1%2Fqemu-kvm-windows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xf4b1","download_url":"https://codeload.github.com/0xf4b1/qemu-kvm-windows/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xf4b1%2Fqemu-kvm-windows/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270969274,"owners_count":24677288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gpu-passthrough","kvm","qemu","qemu-kvm","windows"],"created_at":"2024-10-10T00:57:21.890Z","updated_at":"2025-08-18T09:14:18.403Z","avatar_url":"https://github.com/0xf4b1.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# qemu-kvm-windows\n\nQEMU/KVM setup with GPU passthrough for Windows on an Arch Linux host.\n\nThe script should make it comfortable and easy to launch a VM with QEMU/KVM with common and configurable parameters.\n\nIf you want to use your GPU inside the VM with PCI passthrough, it cares about driver loading/unloading with no reboot required, so if you are using the GPU on the host OS, you only have to save your work and stop the xserver and when you shutdown the VM, you can continue using the GPU on the host by restarting the xserver. If you have a secondary GPU, you can additionally start another xserver for the host OS while the VM is running.\n\nIf you take the cost of partitioning your hard disks, it has the advantage that you can use one single OS installation to natively boot into it (dual-boot) with full performance and use that installation also for the VM. For the VM, it additionally results in having much better IO performance compared with having large file system images on your host linux partition.\n\n## System\n\n|          |                            |\n|----------|----------------------------|\n|Mainboard | ASRock H87 Pro4            |\n|CPU       | Intel(R) Core(TM) i5-4570  |\n|GPU       | GeForce GTX 760            |\n|OS        | Arch Linux                 |\n\n## Host setup\n\nIn the BIOS settings of the mainboard, enable `VT-d` and set the primary GPU to `Onboard`.\n\nInstall QEMU and OVMF UEFI firmware files:\n\n    # pacman -S qemu ovmf\n\nAdd `intel_iommu=on` to the linux command line. If your bootloader is GRUB, edit `/etc/default/grub` and add it to `GRUB_CMDLINE_LINUX` and regenerate `grub.cfg`:\n\n    # grub-mkconfig -o /boot/grub/grub.cfg\n\n## Configuration\n\nThe configuration uses the high performant virtio devices, that require to install the windows guest drivers from [here](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso).\n\nThe script loads some configuration parameters from the `config` file.\n\n### File systems\n\nThe `DRIVES` parameter contains the paths of file-systems that should be available inside the VM. It can contain file-system images or physical drives, e.g.:\n\n    DRIVES=\"/dev/sda \\\n            /path/to/filesystem.img\"\n\n### Input\n\nMouse and keyboard are passed via `evdev`, which allows you to easily switch between host and guest by pressing both control keys. The `INPUTS` parameter contains the paths of input devices, e.g.:\n\n    INPUTS=\"/dev/input/by-id/usb-Logitech_Gaming_Mouse_G402_6D91317A5254-event-mouse \\\n            /dev/input/by-id/usb-Logitech_G413_Carbon_Mechanical_Gaming_Keyboard_138736523537-event-kbd,grab_all=on,repeat=on\"\n\n### File share\n\nA SMB share is accessible from within the VM via ``\\\\10.0.2.4\\qemu`` and allows access to the path defined in `SHARE` on your host OS.\n\n### VGA\n\n#### QXL\n\nThe default mode uses the virtual GPU `qxl` on the guest. The VM is accessible via the QEMU window, can be maximized and scaled to fit the screen size and performs great for non intensive rendering tasks, as showing desktop and some UI applications.\n\nSince it is the default, run the VM with:\n\n    $ sudo ./start-windows-vm.sh\n\n#### GPU passthrough\n\nThe primary GPU is passed to the guest OS and gives native rendering performance. If the GPU is used by the host, e.g. by a running xserver, the session must be closed before using any of the following modes and can be restarted when the VM is shut down.\n\n##### Secondary GPU\n\nIf you have a second GPU (including Intel Integrated Graphics), you can restart the xserver with an alternate xorg.conf.\n\nTo use Intel Integrated Graphics, it could look like this:\n\n    Section \"Device\"\n      Identifier \"intel\"\n      Driver \"intel\"\n      Option \"TearFree\" \"true\"\n    EndSection\n\n    Section \"Screen\"\n      Identifier \"intel\"\n      Device \"intel\"\n    EndSection\n\nSave the config file as `/etc/X11/xorg.intel.conf` and start a new xserver:\n\n    $ startx -- -config xorg.intel.conf\n\nThen run the VM:\n\n    $ sudo VGA=passthrough ./start-windows-vm.sh\n\n##### Looking-Glass\n\nThis option uses [Looking-Glass](https://looking-glass.hostfission.com), that allows to view the GPU output of the VM via a shared framebuffer with the looking-glass client inside a window on the host OS. It might be useful, if you have only a single monitor. You need to install the IVSHMEM driver, that is also part of the virtio drivers, and run the looking-glass server on the windows guest and afterwards the looking-glass-client on the host.\n\nRun the VM:\n\n    $ sudo VGA=passthrough-lg ./start-windows-vm.sh\n    $ looking-glass-client -s\n\n##### Single GPU passthrough\n\nHere, the single GPU is passed to the guest VM which leaves the host OS with no display output. It requires to dump the VBIOS of your GPU and patch it according to this [guide](https://gitlab.com/YuriAlek/vfio/-/wikis/vbios). Place it as `VBIOS.rom` in the directory of this script.\n\nRun the VM:\n\n    $ sudo VGA=passthrough-single ./start-windows-vm.sh\n\n## Resources\n\n- https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xf4b1%2Fqemu-kvm-windows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xf4b1%2Fqemu-kvm-windows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xf4b1%2Fqemu-kvm-windows/lists"}