https://linux-kvm.org/api.php?action=feedcontributions&user=KenniLund&feedformat=atomKVM - User contributions [en]2024-03-29T14:18:34ZUser contributionsMediaWiki 1.39.5https://linux-kvm.org/index.php?title=Downloads&diff=3504Downloads2011-02-22T21:02:31Z<p>KenniLund: </p>
<hr />
<div>=Downloads=<br />
<br />
(If you are searching the latest Windows drivers, go [[http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers here]])<br />
<br />
Most Linux distros already have KVM kernel modules and userspace tools available through their packaging systems. This is the easiest and recommended way of using KVM.<br />
<br />
If you want to use the latest version of KVM kernel modules and supporting userspace, you can download the latest version from [http://sourceforge.net/project/showfiles.php?group_id=180599 http://sourceforge.net/project/showfiles.php?group_id=180599]. <br />
<br />
For the userspace components, you will find both qemu-kvm-<version> and kvm-<version> there.<br />
qemu-kvm is the stable branch of kvm, it's based off of qemu's point releases with the kvm extras on top; kvm-NN releases were previously known as the development releases, but are deprecated today and should not be used.<br />
<br />
The kernel modules can be found in kvm-kmod-<kernel version>. A kernel version of 2.6.32.3 means that these are the ''same'' modules as those included with the 2.6.32.3 kernel from http://www.kernel.org<br />
<br />
You can consult the changelog files included in the download-directory with each qemu-kvm and kvm-kmod release on Sourceforge for changes in the releases.<br />
<br />
If you use a kernel from http://www.kernel.org or one provided from your distribution and '''do not''' use the modules provided by kvm-kmod releases:<br />
* your kernel has to be 2.6.29 or newer to run any version of qemu-kvm (kernel 2.6.27/2.6.28 with kvm-kmod 2.6.29 will also work)<br />
* your kernel has to be 2.6.25 or newer to run the kvm 76 userspace (or any newer kvm-XX release)<br />
* the modules provided by Linux 2.6.22 or later require kvm-22 or any later version. Some features are available only with newer kernels or userspace. It is recommended to use the latest available version.<br />
* the modules provided by Linux 2.6.21 require '''[http://downloads.sourceforge.net/kvm/kvm-17.tar.gz kvm-17]'''. If you use the external module, use the latest available version.<br />
* the modules provided by Linux 2.6.20 require '''[http://downloads.sourceforge.net/kvm/kvm-12.tar.gz kvm-12]'''. If you use the external module, use the latest available version.<br />
<br />
Refer to [[choose the right kvm & kernel version]] for more information.</div>KenniLundhttps://linux-kvm.org/index.php?title=Downloads&diff=3503Downloads2011-02-22T20:59:25Z<p>KenniLund: kvm-XX is outdated and a newer kernel is required today</p>
<hr />
<div>=Downloads=<br />
<br />
(If you are searching the latest Windows drivers, go [[http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers here]])<br />
<br />
Most Linux distros already have KVM kernel modules and userspace tools available through their packaging systems. This is the easiest and recommended way of using KVM.<br />
<br />
If you want to use the latest version of KVM kernel modules and supporting userspace, you can download the latest version from [http://sourceforge.net/project/showfiles.php?group_id=180599 http://sourceforge.net/project/showfiles.php?group_id=180599]. <br />
<br />
For the userspace components, you will find both qemu-kvm-<version> and kvm-<version> there.<br />
qemu-kvm is the stable branch of kvm, it's based off of qemu's point releases with the kvm extras on top; kvm-NN releases were previously known as the development releases, but are deprecated today and should not be used.<br />
<br />
The kernel modules can be found in kvm-kmod-<kernel version>. A kernel version of 2.6.32.3 means that these are the ''same'' modules as those included with the 2.6.32.3 kernel from http://www.kernel.org<br />
<br />
You can consult the changelog files included in the download-directory with each qemu-kvm and kvm-kmod release on Sourceforge for changes in the releases.<br />
<br />
If you use a kernel from http://www.kernel.org or one provided from your distribution and '''do not''' use the modules provided by kvm-kmod releases:<br />
* your kernel has to be at least 2.6.29 to run any version of qemu-kvm (kernel 2.6.27/2.6.28 with kvm-kmod 2.6.29 will also work)<br />
* your kernel has to be 2.6.25 or newer to run the kvm 76 userspace (or any newer kvm-XX release)<br />
* the modules provided by Linux 2.6.22 or later require kvm-22 or any later version. Some features are available only with newer kernels or userspace. It is recommended to use the latest available version.<br />
* the modules provided by Linux 2.6.21 require '''[http://downloads.sourceforge.net/kvm/kvm-17.tar.gz kvm-17]'''. If you use the external module, use the latest available version.<br />
* the modules provided by Linux 2.6.20 require '''[http://downloads.sourceforge.net/kvm/kvm-12.tar.gz kvm-12]'''. If you use the external module, use the latest available version.<br />
<br />
Refer to [[choose the right kvm & kernel version]] for more information.</div>KenniLundhttps://linux-kvm.org/index.php?title=How_to_assign_devices_with_VT-d_in_KVM&diff=3443How to assign devices with VT-d in KVM2010-12-14T12:03:36Z<p>KenniLund: Make it clear that the CPU needs to support VT-d as well (some new Core i5 doesn't)</p>
<hr />
<div>= How to assign devices with VT-d in KVM =<br />
<br />
== VT-d support ==<br />
* In order to assign devices in KVM, you'll need a system which supports VT-d. This has nothing to do with the VT-x support of your CPU, VT-d needs to be supported by both your chipset on your motherboard and by your CPU.<br />
<br />
* If you are in doubt whether your motherboard or CPU supports VT-d or not, the Xen VT-d wikipage has some pointers of VT-d enabled chipsets, motherboards and CPUs:<br />
http://wiki.xensource.com/xenwiki/VTdHowTo<br />
<br />
* If your hardware doesn't have an IOMMU ("Intel VT-d" support in case of Intel - "AMD I/O Virtualization Technology" support in case of AMD), you'll not be able to assign devices in KVM. Some work towards allowing this were done, but the code never made it into KVM, due to various issues with the code. At the moment it doesn't seem like device assignment without hardware support, will ever be integrated into KVM.<br />
<br />
* Assignment of graphics cards are not supported at the moment, but it seems like one person is currently working on writing patches for this in his spare time (February, 2010):<br />
http://www.spinics.net/lists/kvm/msg25977.html<br />
<br />
<br />
== Assigning device to guest ==<br />
'''1. Modifying kernel config:'''<br />
* make menuconfig<br />
* set "Bus options (PCI etc.)" -> "Support for DMA Remapping Devices" to "*"<br />
* set "Bus options (PCI etc.)" -> "Enable DMA Remapping Devices" to "*"<br />
* set "Bus options (PCI etc.)" -> "PCI Stub driver" to "*"<br />
* optional setting:<br />
set "Bus options (PCI etc.)" -> "Support for Interrupt Remapping" to "*"<br />
* exit/save<br />
<br />
'''2. build kernel:'''<br />
* make<br />
* make modules_install<br />
* make install<br />
<br />
'''3. reboot and verify that your system has IOMMU support'''<br />
* dmesg | grep -e DMAR -e IOMMU<br />
...<br />
DMAR:DRHD base: 0x000000feb03000 flags: 0x0<br />
IOMMU feb03000: ver 1:0 cap c9008020e30260 ecap 1000<br />
...<br />
* If you get no output you'll need to fix this before moving on. Check if your hardware supports VT-d and check that it has been enabled in BIOS.<br />
<br />
'''NOTE:''' If you still get an error "No IOMMU found." Check dmesg for errors suggesting your BIOS is broken. Another possible reason: <br />
CONFIG_DMAR_DEFAULT_ON is not set. In that case, pass "intel_iommu=on" as kernel parameter to enable it.<br />
<br />
'''4. unbind device from host kernel driver (example PCI device 01:00.0)<br />
'''<br />
* lspci -n<br />
* locate the entry for device 01:00.0 and note down the vendor & device ID 8086:10b9<br />
...<br />
01:00.0 0200: 8086:10b9 (rev 06)<br />
...<br />
<br />
* echo "8086 10b9" > /sys/bus/pci/drivers/pci-stub/new_id<br />
* echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind<br />
* echo 0000:01:00.0 > /sys/bus/pci/drivers/pci-stub/bind<br />
<br />
'''5. load KVM modules:'''<br />
* modprobe kvm<br />
* modprobe kvm-intel<br />
<br />
'''6. assign device:'''<br />
* /usr/local/bin/qemu-system-x86_64 -m 512 -boot c -net none -hda /root/ia32e_rhel5u1.img -device pci-assign,host=01:00.0<br />
<br />
<br />
== VT-d device hotplug ==<br />
KVM also supports hotplug devices with VT-d to guest. In guest command interface (you can press Ctrl+Alt+2 to enter it), you can use following command to hot add/remove devices to/from guest:<br />
* hot add:<br />
device_add pci-assign,host=01:00.0,id=mydevice<br />
* hot remove:<br />
device_del mydevice<br />
<br />
<br />
== Notes ==<br />
* VT-d spec specifies that all conventional PCI devices behind a PCIe-to PCI/PCI-X bridge or conventional PCI bridge can only be collectively assigned to the same guest. PCIe devices do not have this restriction.<br />
* If the device doesn't support MSI, and it shares IRQ with other devices, then it cannot be assigned due to host irq sharing for assigned devices is not supported. You will get warning message when you assign it. Notice this also apply to the devices which only support MSI-X.</div>KenniLundhttps://linux-kvm.org/index.php?title=How_to_assign_devices_with_VT-d_in_KVM&diff=2902How to assign devices with VT-d in KVM2010-02-25T15:18:18Z<p>KenniLund: Added note about assignment of graphics cards</p>
<hr />
<div>= How to assign devices with VT-d in KVM =<br />
<br />
== VT-d support ==<br />
* In order to assign devices in KVM, you'll need a system which supports VT-d. This has nothing to do with the VT-x support of your CPU, VT-d needs to be supported by your chipset on your motherboard.<br />
<br />
* If you are in doubt whether your motherboard supports VT-d or not, the Xen VT-d wikipage has some pointers of VT-d enabled chipsets and motherboards:<br />
http://wiki.xensource.com/xenwiki/VTdHowTo<br />
<br />
* If your hardware doesn't have an IOMMU ("Intel VT-d" support in case of Intel - "AMD I/O Virtualization Technology" support in case of AMD), you'll not be able to assign devices in KVM. Some work towards allowing this were done, but the code never made it into KVM, due to various issues with the code. At the moment it doesn't seem like device assignment without hardware support, will ever be integrated into KVM.<br />
<br />
* Assignment of graphics cards are not supported at the moment, but it seems like one person is currently working on writing patches for this in his spare time (February, 2010):<br />
http://www.spinics.net/lists/kvm/msg25977.html<br />
<br />
<br />
== Assigning device to guest ==<br />
'''1. Modifying kernel config:'''<br />
* make menuconfig<br />
* set "Bus options (PCI etc.)" -> "Support for DMA Remapping Devices" to "*"<br />
* set "Bus options (PCI etc.)" -> "Enable DMA Remapping Devices" to "*"<br />
* set "Bus options (PCI etc.)" -> "PCI Stub driver" to "*"<br />
* optional setting:<br />
set "Bus options (PCI etc.)" -> "Support for Interrupt Remapping" to "*"<br />
* exit/save<br />
<br />
'''2. build kernel:'''<br />
* make<br />
* make modules_install<br />
* make install<br />
<br />
'''3. reboot and verify that your system has IOMMU support'''<br />
* dmesg | grep -e DMAR -e IOMMU<br />
...<br />
DMAR:DRHD base: 0x000000feb03000 flags: 0x0<br />
IOMMU feb03000: ver 1:0 cap c9008020e30260 ecap 1000<br />
...<br />
* If you get no output you'll need to fix this before moving on. Check if your hardware supports VT-d and check that it has been enabled in BIOS.<br />
<br />
'''NOTE:''' If you still get an error "No IOMMU found." Check dmesg for errors suggesting your BIOS is broken.<br />
<br />
<br />
'''4. unbind device from host kernel driver (example PCI device 01:00.0)<br />
'''<br />
* lspci -n<br />
* locate the entry for device 01:00.0 and note down the vendor & device ID 8086:10b9<br />
...<br />
01:00.0 0200: 8086:10b9 (rev 06)<br />
...<br />
<br />
* echo "8086 10b9" > /sys/bus/pci/drivers/pci-stub/new_id<br />
* echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind<br />
* echo 0000:01:00.0 > /sys/bus/pci/drivers/pci-stub/bind<br />
<br />
'''5. load KVM modules:'''<br />
* modprobe kvm<br />
* modprobe kvm-intel<br />
<br />
'''6. assign device:'''<br />
* /usr/local/bin/qemu-system-x86_64 -m 512 -boot c -net none -hda /root/ia32e_rhel5u1.img -pcidevice host=01:00.0<br />
<br />
<br />
== VT-d device hotplug ==<br />
KVM also supports hotplug devices with VT-d to guest. In guest command interface (you can press Ctrl+Alt+2 to enter it), you can use following command to hot add/remove devices to/from guest:<br />
* hot add:<br />
pci_add pci_addr=auto host host=01:00.0<br />
* hot remove (e.g bdf is 00:06.0 in guest):<br />
pci_del pci_addr=6<br />
<br />
<br />
== Notes ==<br />
* VT-d spec specifies that all conventional PCI devices behind a PCIe-to PCI/PCI-X bridge or conventional PCI bridge can only be collectively assigned to the same guest. PCIe devices do not have this restriction.<br />
* If the device doesn't support MSI, and it shares IRQ with other devices, then it cannot be assigned due to host irq sharing for assigned devices is not supported. You will get warning message when you assign it. Notice this also apply to the devices which only support MSI-X.</div>KenniLundhttps://linux-kvm.org/index.php?title=How_to_assign_devices_with_VT-d_in_KVM&diff=2900How to assign devices with VT-d in KVM2010-02-24T17:53:58Z<p>KenniLund: Added note about device assignment without VT-d</p>
<hr />
<div>= How to assign devices with VT-d in KVM =<br />
<br />
== VT-d support ==<br />
* In order to assign devices in KVM, you'll need a system which supports VT-d. This has nothing to do with the VT-x support of your CPU, VT-d needs to be supported by your chipset on your motherboard.<br />
<br />
* If you are in doubt whether your motherboard supports VT-d or not, the Xen VT-d wikipage has some pointers of VT-d enabled chipsets and motherboards:<br />
http://wiki.xensource.com/xenwiki/VTdHowTo<br />
<br />
* If your hardware doesn't have an IOMMU ("Intel VT-d" support in case of Intel - "AMD I/O Virtualization Technology" support in case of AMD), you'll not be able to assign devices in KVM. Some work towards allowing this were done, but the code never made it into KVM, due to various issues with the code. At the moment it doesn't seem like device assignment without hardware support, will ever be integrated into KVM.<br />
<br />
== Assigning device to guest ==<br />
'''1. Modifying kernel config:'''<br />
* make menuconfig<br />
* set "Bus options (PCI etc.)" -> "Support for DMA Remapping Devices" to "*"<br />
* set "Bus options (PCI etc.)" -> "Enable DMA Remapping Devices" to "*"<br />
* set "Bus options (PCI etc.)" -> "PCI Stub driver" to "*"<br />
* optional setting:<br />
set "Bus options (PCI etc.)" -> "Support for Interrupt Remapping" to "*"<br />
* exit/save<br />
<br />
'''2. build kernel:'''<br />
* make<br />
* make modules_install<br />
* make install<br />
<br />
'''3. reboot and verify that your system has IOMMU support'''<br />
* dmesg | grep -e DMAR -e IOMMU<br />
...<br />
DMAR:DRHD base: 0x000000feb03000 flags: 0x0<br />
IOMMU feb03000: ver 1:0 cap c9008020e30260 ecap 1000<br />
...<br />
* If you get no output you'll need to fix this before moving on. Check if your hardware supports VT-d and check that it has been enabled in BIOS.<br />
<br />
'''NOTE:''' If you still get an error "No IOMMU found." Check dmesg for errors suggesting your BIOS is broken.<br />
<br />
<br />
'''4. unbind device from host kernel driver (example PCI device 01:00.0)<br />
'''<br />
* lspci -n<br />
* locate the entry for device 01:00.0 and note down the vendor & device ID 8086:10b9<br />
...<br />
01:00.0 0200: 8086:10b9 (rev 06)<br />
...<br />
<br />
* echo "8086 10b9" > /sys/bus/pci/drivers/pci-stub/new_id<br />
* echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind<br />
* echo 0000:01:00.0 > /sys/bus/pci/drivers/pci-stub/bind<br />
<br />
'''5. load KVM modules:'''<br />
* modprobe kvm<br />
* modprobe kvm-intel<br />
<br />
'''6. assign device:'''<br />
* /usr/local/bin/qemu-system-x86_64 -m 512 -boot c -net none -hda /root/ia32e_rhel5u1.img -pcidevice host=01:00.0<br />
<br />
<br />
== VT-d device hotplug ==<br />
KVM also supports hotplug devices with VT-d to guest. In guest command interface (you can press Ctrl+Alt+2 to enter it), you can use following command to hot add/remove devices to/from guest:<br />
* hot add:<br />
pci_add pci_addr=auto host host=01:00.0<br />
* hot remove (e.g bdf is 00:06.0 in guest):<br />
pci_del pci_addr=6<br />
<br />
<br />
== Notes ==<br />
* VT-d spec specifies that all conventional PCI devices behind a PCIe-to PCI/PCI-X bridge or conventional PCI bridge can only be collectively assigned to the same guest. PCIe devices do not have this restriction.<br />
* If the device doesn't support MSI, and it shares IRQ with other devices, then it cannot be assigned due to host irq sharing for assigned devices is not supported. You will get warning message when you assign it. Notice this also apply to the devices which only support MSI-X.</div>KenniLundhttps://linux-kvm.org/index.php?title=How_to_assign_devices_with_VT-d_in_KVM&diff=2895How to assign devices with VT-d in KVM2010-02-22T22:40:12Z<p>KenniLund: Added a section on VT-d support</p>
<hr />
<div>= How to assign devices with VT-d in KVM =<br />
<br />
== VT-d support ==<br />
* In order to assign devices in KVM, you'll need a system which supports VT-d. This has nothing to do with the VT-x support of your CPU, VT-d needs to be supported by your chipset on your motherboard.<br />
<br />
* If you are in doubt whether your motherboard supports VT-d or not, the Xen VT-d wikipage has some pointers of VT-d enabled chipsets and motherboards:<br />
http://wiki.xensource.com/xenwiki/VTdHowTo<br />
<br />
<br />
== Assigning device to guest ==<br />
'''1. Modifying kernel config:'''<br />
* make menuconfig<br />
* set "Bus options (PCI etc.)" -> "Support for DMA Remapping Devices" to "*"<br />
* set "Bus options (PCI etc.)" -> "Enable DMA Remapping Devices" to "*"<br />
* set "Bus options (PCI etc.)" -> "PCI Stub driver" to "*"<br />
* optional setting:<br />
set "Bus options (PCI etc.)" -> "Support for Interrupt Remapping" to "*"<br />
* exit/save<br />
<br />
'''2. build kernel:'''<br />
* make<br />
* make modules_install<br />
* make install<br />
<br />
'''3. reboot and verify that your system has IOMMU support'''<br />
* dmesg | grep -e DMAR -e IOMMU<br />
...<br />
DMAR:DRHD base: 0x000000feb03000 flags: 0x0<br />
IOMMU feb03000: ver 1:0 cap c9008020e30260 ecap 1000<br />
...<br />
* If you get no output you'll need to fix this before moving on. Check if your hardware supports VT-d and check that it has been enabled in BIOS.<br />
<br />
'''NOTE:''' If you still get an error "No IOMMU found." Check dmesg for errors suggesting your BIOS is broken.<br />
<br />
<br />
'''4. unbind device from host kernel driver (example PCI device 01:00.0)<br />
'''<br />
* lspci -n<br />
* locate the entry for device 01:00.0 and note down the vendor & device ID 8086:10b9<br />
...<br />
01:00.0 0200: 8086:10b9 (rev 06)<br />
...<br />
<br />
* echo "8086 10b9" > /sys/bus/pci/drivers/pci-stub/new_id<br />
* echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind<br />
* echo 0000:01:00.0 > /sys/bus/pci/drivers/pci-stub/bind<br />
<br />
'''5. load KVM modules:'''<br />
* modprobe kvm<br />
* modprobe kvm-intel<br />
<br />
'''6. assign device:'''<br />
* /usr/local/bin/qemu-system-x86_64 -m 512 -boot c -net none -hda /root/ia32e_rhel5u1.img -pcidevice host=01:00.0<br />
<br />
<br />
== VT-d device hotplug ==<br />
KVM also supports hotplug devices with VT-d to guest. In guest command interface (you can press Ctrl+Alt+2 to enter it), you can use following command to hot add/remove devices to/from guest:<br />
* hot add:<br />
pci_add pci_addr=auto host host=01:00.0<br />
* hot remove (e.g bdf is 00:06.0 in guest):<br />
pci_del pci_addr=6<br />
<br />
<br />
== Notes ==<br />
* VT-d spec specifies that all conventional PCI devices behind a PCIe-to PCI/PCI-X bridge or conventional PCI bridge can only be collectively assigned to the same guest. PCIe devices do not have this restriction.<br />
* If the device doesn't support MSI, and it shares IRQ with other devices, then it cannot be assigned due to host irq sharing for assigned devices is not supported. You will get warning message when you assign it. Notice this also apply to the devices which only support MSI-X.</div>KenniLundhttps://linux-kvm.org/index.php?title=How_to_assign_devices_with_VT-d_in_KVM&diff=2894How to assign devices with VT-d in KVM2010-02-22T14:46:43Z<p>KenniLund: </p>
<hr />
<div>= How to assign devices with VT-d in KVM =<br />
<br />
== Assigning device to guest ==<br />
'''1. Modifying kernel config:'''<br />
* make menuconfig<br />
* set "Bus options (PCI etc.)" -> "Support for DMA Remapping Devices" to "*"<br />
* set "Bus options (PCI etc.)" -> "Enable DMA Remapping Devices" to "*"<br />
* set "Bus options (PCI etc.)" -> "PCI Stub driver" to "*"<br />
* optional setting:<br />
set "Bus options (PCI etc.)" -> "Support for Interrupt Remapping" to "*"<br />
* exit/save<br />
<br />
'''2. build kernel:'''<br />
* make<br />
* make modules_install<br />
* make install<br />
<br />
'''3. reboot and verify that your system has IOMMU support'''<br />
* dmesg | grep -e DMAR -e IOMMU<br />
...<br />
DMAR:DRHD base: 0x000000feb03000 flags: 0x0<br />
IOMMU feb03000: ver 1:0 cap c9008020e30260 ecap 1000<br />
...<br />
* If you get no output you'll need to fix this before moving on. Check if your hardware supports VT-d and check that it has been enabled in BIOS.<br />
<br />
'''NOTE:''' If you still get an error "No IOMMU found." Check dmesg for errors suggesting your BIOS is broken.<br />
<br />
<br />
'''4. unbind device from host kernel driver (example PCI device 01:00.0)<br />
'''<br />
* lspci -n<br />
* locate the entry for device 01:00.0 and note down the vendor & device ID 8086:10b9<br />
...<br />
01:00.0 0200: 8086:10b9 (rev 06)<br />
...<br />
<br />
* echo "8086 10b9" > /sys/bus/pci/drivers/pci-stub/new_id<br />
* echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind<br />
* echo 0000:01:00.0 > /sys/bus/pci/drivers/pci-stub/bind<br />
<br />
'''5. load KVM modules:'''<br />
* modprobe kvm<br />
* modprobe kvm-intel<br />
<br />
'''6. assign device:'''<br />
* /usr/local/bin/qemu-system-x86_64 -m 512 -boot c -net none -hda /root/ia32e_rhel5u1.img -pcidevice host=01:00.0<br />
<br />
<br />
== VT-d device hotplug ==<br />
KVM also supports hotplug devices with VT-d to guest. In guest command interface (you can press Ctrl+Alt+2 to enter it), you can use following command to hot add/remove devices to/from guest:<br />
* hot add:<br />
pci_add pci_addr=auto host host=01:00.0<br />
* hot remove (e.g bdf is 00:06.0 in guest):<br />
pci_del pci_addr=6<br />
<br />
<br />
== Notes ==<br />
* VT-d spec specifies that all conventional PCI devices behind a PCIe-to PCI/PCI-X bridge or conventional PCI bridge can only be collectively assigned to the same guest. PCIe devices do not have this restriction.<br />
* If the device doesn't support MSI, and it shares IRQ with other devices, then it cannot be assigned due to host irq sharing for assigned devices is not supported. You will get warning message when you assign it. Notice this also apply to the devices which only support MSI-X.</div>KenniLundhttps://linux-kvm.org/index.php?title=How_to_assign_devices_with_VT-d_in_KVM&diff=2893How to assign devices with VT-d in KVM2010-02-22T14:45:17Z<p>KenniLund: Make it clear that IOMMU is required</p>
<hr />
<div>= How to assign devices with VT-d in KVM =<br />
<br />
== Assigning device to guest ==<br />
'''1. Modifying kernel config:'''<br />
* make menuconfig<br />
* set "Bus options (PCI etc.)" -> "Support for DMA Remapping Devices" to "*"<br />
* set "Bus options (PCI etc.)" -> "Enable DMA Remapping Devices" to "*"<br />
* set "Bus options (PCI etc.)" -> "PCI Stub driver" to "*"<br />
* optional setting:<br />
set "Bus options (PCI etc.)" -> "Support for Interrupt Remapping" to "*"<br />
* exit/save<br />
<br />
'''2. build kernel:'''<br />
* make<br />
* make modules_install<br />
* make install<br />
<br />
'''3. reboot and verify that your system has IOMMU support'''<br />
* dmesg | grep -e DMAR -e IOMMU<br />
...<br />
DMAR:DRHD base: 0x000000feb03000 flags: 0x0<br />
IOMMU feb03000: ver 1:0 cap c9008020e30260 ecap 1000<br />
...<br />
If you get no output you'll need to fix this before moving on. Check if your hardware supports VT-d and check that it has been enabled in BIOS.<br />
<br />
'''NOTE:''' If you still get an error "No IOMMU found." Check dmesg for errors suggesting your BIOS is broken.<br />
<br />
<br />
'''4. unbind device from host kernel driver (example PCI device 01:00.0)<br />
'''<br />
* lspci -n<br />
* locate the entry for device 01:00.0 and note down the vendor & device ID 8086:10b9<br />
...<br />
01:00.0 0200: 8086:10b9 (rev 06)<br />
...<br />
<br />
* echo "8086 10b9" > /sys/bus/pci/drivers/pci-stub/new_id<br />
* echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind<br />
* echo 0000:01:00.0 > /sys/bus/pci/drivers/pci-stub/bind<br />
<br />
'''5. load KVM modules:'''<br />
* modprobe kvm<br />
* modprobe kvm-intel<br />
<br />
'''6. assign device:'''<br />
* /usr/local/bin/qemu-system-x86_64 -m 512 -boot c -net none -hda /root/ia32e_rhel5u1.img -pcidevice host=01:00.0<br />
<br />
<br />
== VT-d device hotplug ==<br />
KVM also supports hotplug devices with VT-d to guest. In guest command interface (you can press Ctrl+Alt+2 to enter it), you can use following command to hot add/remove devices to/from guest:<br />
* hot add:<br />
pci_add pci_addr=auto host host=01:00.0<br />
* hot remove (e.g bdf is 00:06.0 in guest):<br />
pci_del pci_addr=6<br />
<br />
<br />
== Notes ==<br />
* VT-d spec specifies that all conventional PCI devices behind a PCIe-to PCI/PCI-X bridge or conventional PCI bridge can only be collectively assigned to the same guest. PCIe devices do not have this restriction.<br />
* If the device doesn't support MSI, and it shares IRQ with other devices, then it cannot be assigned due to host irq sharing for assigned devices is not supported. You will get warning message when you assign it. Notice this also apply to the devices which only support MSI-X.</div>KenniLundhttps://linux-kvm.org/index.php?title=RunningKVM&diff=2833RunningKVM2010-01-29T17:28:42Z<p>KenniLund: Updated page to use qemu-kvm stable branch and kvm-kmod</p>
<hr />
<div>== Prerequisites ==<br />
<br />
You will need (see download section):<br />
<br />
* qemu-kvm-''release''.tar.gz<br />
* kvm-kmod-''release''.tar.bz2 (if you want/need to compile kernel modules yourself)<br />
* A VT capable Intel processor, or an SVM capable AMD processor<br />
* qemu prerequisites:<br />
** `zlib` libraries and headers<br />
** `SDL` libraries and headers<br />
** `alsa` libraries and headers (optional alsa support: disabled by default but can be enabled with --enable-alsa)<br />
** `gnutls` libraries and headers (optional VNC TLS support: enabled by default but can be disabled with --disable-vnc-tls)<br />
** kernel headers (on Fedora, the kernel-devel package)<br />
<br />
On a debian etch system you can install the prerequisites with:<br />
apt-get install gcc libsdl1.2-dev zlib1g-dev libasound2-dev linux-kernel-headers pkg-config libgnutls-dev libpci-dev<br />
<br />
'''Note:''' When building from git, you also need gawk.<br />
<br />
Please report problems (and successes) to the [[Lists,_IRC| mailing list]].<br />
<br />
== Unpacking and configuring kvm components ==<br />
<br />
You may wish to take a look at the ["Kernel-optimizations"] page.<br />
There exists a [attachment:kvm-26-alt-grab.diff.gz patch] which will change the SDL keygrab combination from ctrl-alt to ctrl-alt-shift. It was written primarily to deal with the heavy use of ctrl-alt-delete in NT-based VMs.<br />
<br />
If you are using a recent kernel (2.6.25+) with kvm modules included, boot into it, and:<br />
<br />
tar xzf qemu-kvm-release.tar.gz<br />
cd qemu-kvm-release<br />
./configure --prefix=/usr/local/kvm<br />
make<br />
sudo make install<br />
sudo /sbin/modprobe kvm-intel<br />
# or: sudo /sbin/modprobe kvm-amd<br />
<br />
If you're using an older kernel, or a kernel from your distribution without the kvm modules, you'll have to compile the modules yourself:<br />
<br />
tar xjf kvm-kmod-release.tar.bz2<br />
cd kvm-kmod-release <br />
./configure<br />
make <br />
sudo make install <br />
sudo /sbin/modprobe kvm-intel <br />
# or: sudo /sbin/modprobe kvm-amd<br />
<br />
'''Note:''' if sound doesn't play in the guest vm you can add --audio-drv-list="alsa oss" to ./configure as explained in http://www.linux-kvm.com/content/sound-problem-solved<br />
<br />
== Creating a disk image for the guest ==<br />
/usr/local/kvm/bin/qemu-img create -f qcow vdisk.img 10G <br />
<br />
<br />
== Installing a guest operating system ==<br />
<br />
sudo /usr/local/kvm/bin/qemu-system-x86_64 -hda vdisk.img -cdrom /path/to/boot-media.iso \ <br />
-boot d -m 384<br />
<br />
(kvm doesn't make a distinction between i386 and x86_64 so even in i386 you should use `qemu-system-x86_64`)[[BR]] <br />
<br />
If you have less than 1GB of memory don't use the -m 384 flag (which allocates 384 MB of RAM for the guest). For computers with 512MB of RAM it's safe to use -m 192, or even -m 128 (the default)<br />
<br />
== Running the newly-installed guest ==<br />
sudo /usr/local/kvm/bin/qemu-system-x86_64 vdisk.img -m 384<br />
<br />
or a slightly more complicated example, where it is assumed that bridged networking is available on tap0; see ["Kernel-optimizations"] for some setup hints:<br />
<br />
/usr/local/kvm/bin/qemu-system-x86_64 -hda xp-curr.img -m 512 -soundhw es1370 -no-acpi -snapshot -localtime -boot c -usb -usbdevice tablet -net nic,vlan=0,macaddr=00:00:10:52:37:48 -net tap,vlan=0,ifname=tap0,script=no<br />
<br />
(kvm doesn't make a distinction between i386 and x86_64 so even in i386 you should use `qemu-system-x86_64`)<br />
<br />
If you're on Debian Etch, substitute `kvm` for `qemu-system-x86_64` (thanks to fromport, soren and mael_). See also the entries under the label "Ubuntu" on the [[HOWTO]] page.<br />
qemu-system-x86_64`<br />
<br />
If you're on Fedora/RHEL/CentOS (and installed a kvm package and not built kvm yourself from source) then substitute '''qemu-kvm''' for '''qemu-system-x86_64'''</div>KenniLundhttps://linux-kvm.org/index.php?title=Downloads&diff=2831Downloads2010-01-29T16:27:13Z<p>KenniLund: Updated with kvm-kmod information</p>
<hr />
<div>=Downloads=<br />
<br />
(If you are searching the latest Windows drivers, go [[http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers here]])<br />
<br />
Most Linux distros already have KVM kernel modules and userspace tools available through their packaging systems. This is the easiest and recommended way of using KVM.<br />
<br />
If you want to use the latest version of KVM kernel modules and supporting userspace, you can download the latest version from [http://sourceforge.net/project/showfiles.php?group_id=180599 http://sourceforge.net/project/showfiles.php?group_id=180599]. <br />
<br />
For the userspace components, you will find both qemu-kvm-<version> and kvm-<version> there.<br />
qemu-kvm is the stable branch of kvm, it's based off of qemu's point releases with the kvm extras on top; kvm-NN releases are so called development releases.<br />
<br />
The kernel modules can be found in kvm-kmod-<kernel version>. A kernel version of 2.6.32.3 means that these are the ''same'' modules as those included with the 2.6.32.3 kernel from http://www.kernel.org<br />
<br />
You can consult the [[ChangeLog]] page on this wiki for changes in the kvm development releases or you can consult the changelog files included in the download-directory with each qemu-kvm and kvm-kmod release on Sourceforge.<br />
<br />
If you use a kernel from http://www.kernel.org or one provided from your distribution and '''do not''' use the modules provided by kvm-kmod releases:<br />
* your kernel has to be 2.6.25 or newer to run the kvm 76 userspace (or any newer release)<br />
* the modules provided by Linux 2.6.22 or later require kvm-22 or any later version. Some features are available only with newer kernels or userspace. It is recommended to use the latest available version.<br />
* the modules provided by Linux 2.6.21 require '''[http://downloads.sourceforge.net/kvm/kvm-17.tar.gz kvm-17]'''. If you use the external module, use the latest available version.<br />
* the modules provided by Linux 2.6.20 require '''[http://downloads.sourceforge.net/kvm/kvm-12.tar.gz kvm-12]'''. If you use the external module, use the latest available version.<br />
<br />
Refer to [[choose the right kvm & kernel version]] for more information.</div>KenniLund