Changes between Initial Version and Version 1 of TipAndDoc/VM/KVM/passthrough


Ignore:
Timestamp:
Oct 8, 2016 11:59:03 PM (8 years ago)
Author:
mitty
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TipAndDoc/VM/KVM/passthrough

    v1 v1  
     1[[PageOutline]] 
     2 
     3 * [http://mzyy94.com/blog/2014/12/12/kvm-intel-hd-graphics-passthrough/ KVMでQSVするためIntel HD Graphicsパススルーするー - 犬アイコンのみっきー] 
     4 * [http://www.slideshare.net/takumanakajima90/csstudy15 もしCloudStackのKVMホストでPCIパススルーできるようになったら] 
     5 * [http://ubuntuforums.org/showthread.php?t=2262280 (ubuntu) Ubuntu 14.04 KVM VGA Passthrough Nvidia GTX "How To"] 
     6 * [http://www.firewing1.com/howtos/fedora-20/create-gaming-virtual-machine-using-vfio-pci-passthrough-kvm Create a gaming virtual machine using VFIO PCI passthrough for KVM | Fedora 20 | How-to guide | firewing1] 
     7 * [http://www.nexia.jp/server/1802/ KVM PCIパススルー (PCI PassThrough) | nexia inc] 
     8 * [http://blog.livedoor.jp/karamine/archives/1726234.html GPUパススルー : karamineのブログ] [http://blog.livedoor.jp/karamine/archives/cat_50039.html 一連の続き]がある 
     9 * [http://www.goodnai.com/blog/2013/04/08/win7-on-centos6-4kvm%E3%81%A7radeon-hd-6670%E3%81%AB%E3%82%88%E3%82%8Bgpu%E3%82%A8%E3%83%B3%E3%82%B3%E3%83%BC%E3%83%89%EF%BC%88ati-stream%EF%BC%89/ Win7 on CentOS6.4+KVMでRadeon HD 6670によるGPUエンコード(ATI Stream) | Kung Noi Blog] 
     10 * [http://yujilow1220.github.io/blog/Cloud/vga-passthrough-on-kvm-on-fedora-20/ Fedora 20上のKVMでVGAパススルーをやってみた - Yujilow's Note] 
     11 * [http://seesaawiki.jp/w/kou1okada/d/Linux%20-%20PCI-PassThrough Linux - PCI-PassThrough - PIB] 
     12 * [https://bbs.archlinux.org/viewtopic.php?id=162768 KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9 / Community Contributions / Arch Linux Forums] 
     13 
     14 * QEMUの引数に追加されるものの例 
     15{{{ 
     1601:00.0 Multimedia controller [0480]: Altera Corporation Device [1172:4c15] (rev 01) 
     17}}} 
     18{{{ 
     19-device vfio-pci,host=01:00.0,id=hostdev0,bus=pci.0,addr=0x9 
     20}}} 
     21 
     22 == Marvell controller == 
     23 * [https://bbs.archlinux.org/viewtopic.php?id=185182 Intel IOMMU not working for Marvell SSD Controller / Kernel & Hardware / Arch Linux Forums] 
     24 * [https://bugzilla.kernel.org/show_bug.cgi?id=42679 Bug 42679 – DMA Read on Marvell 88SE9128 fails when Intel's IOMMU is on] 
     25  * https://bugzilla.kernel.org/show_bug.cgi?id=42679#c94 {{{Note, for google: this is the controller embedded in the Plextor m6e M.2 SSD}}} 
     26  * http://lxr.free-electrons.com/source/drivers/pci/quirks.c#L3570 
     27 
     28 === Plextor M6e === 
     29 
     30 * [https://bbs.archlinux.org/viewtopic.php?id=185182 Intel IOMMU not working for Marvell SSD Controller / Kernel & Hardware / Arch Linux Forums] 
     31 
     32 * PX-G128M6e 
     33  * lspci -nnv 
     34{{{ 
     3502:00.0 SATA controller [0106]: Lite-On IT Corp. / Plextor M6e PCI Express SSD [Marvell 88SS9183] [1c28:0122] (rev 14) (prog-if 01 [AHCI 1.0]) 
     36        Subsystem: Marvell Technology Group Ltd. Device [1b4b:9183] 
     37}}} 
     38 
     39 * root@archiso ~ # uname -a 
     40{{{ 
     41Linux archiso 4.0.4-2-ARCH #1 SMP PREEMPT Fri May 22 03:05:23 UTC 2015 x86_64 GNU/Linux 
     42}}} 
     43 * root@archiso ~ # cat /proc/cmdline 
     44{{{ 
     45BOOT_IMAGE=boot/x86_64/vmlinuz archisobasedir=arch archisolabel=ARCH_201506 initrd=boot/intel_ucode.img,boot/x86_64/archiso.img intel_iommu=on 
     46}}} 
     47 * root@archiso ~ # dmesg|grep -i -e DMAR -e IOMMU 
     48{{{ 
     49[    0.000000] Command line: BOOT_IMAGE=boot/x86_64/vmlinuz archisobasedir=arch archisolabel=ARCH_201506 initrd=boot/intel_ucode.img,boot/x86_64/archiso.img intel_iommu=on 
     50[    0.000000] ACPI: DMAR 0x00000000DAC6CED0 0000B8 (v01 INTEL  BDW      00000001 INTL 00000001) 
     51[    0.000000] Kernel command line: BOOT_IMAGE=boot/x86_64/vmlinuz archisobasedir=arch archisolabel=ARCH_201506 initrd=boot/intel_ucode.img,boot/x86_64/archiso.img intel_iommu=on 
     52[    0.000000] Intel-IOMMU: enabled 
     53[    0.086964] dmar: Host address width 39 
     54[    0.086969] dmar: DRHD base: 0x000000fed90000 flags: 0x0 
     55[    0.086987] dmar: IOMMU 0: reg_base_addr fed90000 ver 1:0 cap c0000020660462 ecap f0101a 
     56[    0.086990] dmar: DRHD base: 0x000000fed91000 flags: 0x1 
     57[    0.087000] dmar: IOMMU 1: reg_base_addr fed91000 ver 1:0 cap d2008c20660462 ecap f010da 
     58[    0.087003] dmar: RMRR base: 0x000000dbe7b000 end: 0x000000dbe89fff 
     59[    0.087006] dmar: RMRR base: 0x000000dd000000 end: 0x000000df1fffff 
     60[    0.087011] IOAPIC id 8 under DRHD base  0xfed91000 IOMMU 1 
     61[    7.370829] DMAR: No ATSR found 
     62[    7.371048] IOMMU: dmar0 using Queued invalidation 
     63[    7.371051] IOMMU: dmar1 using Queued invalidation 
     64[    7.371056] IOMMU: Setting RMRR: 
     65[    7.371083] IOMMU: Setting identity map for device 0000:00:02.0 [0xdd000000 - 0xdf1fffff] 
     66[    7.371527] IOMMU: Setting identity map for device 0000:00:14.0 [0xdbe7b000 - 0xdbe89fff] 
     67[    7.371577] IOMMU: Setting identity map for device 0000:00:1a.0 [0xdbe7b000 - 0xdbe89fff] 
     68[    7.371616] IOMMU: Setting identity map for device 0000:00:1d.0 [0xdbe7b000 - 0xdbe89fff] 
     69[    7.371644] IOMMU: Prepare 0-16MiB unity mapping for LPC 
     70[    7.371661] IOMMU: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff] 
     71[    7.673577] [drm] DMAR active, disabling use of stolen memory 
     72[    7.673740] dmar: DRHD: handling fault status reg 2 
     73[    7.673744] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000 
     74               DMAR:[fault reason 02] Present bit in context entry is clear 
     75[    7.986473] dmar: DRHD: handling fault status reg 3 
     76[    7.986493] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000 
     77               DMAR:[fault reason 02] Present bit in context entry is clear 
     78[    9.337664] dmar: DRHD: handling fault status reg 2 
     79[    9.337683] dmar: DMAR:[DMA Write] Request device [00:02.0] fault addr 74ff240000 
     80               DMAR:[fault reason 05] PTE Write access is not set 
     81[   12.985456] dmar: DRHD: handling fault status reg 2 
     82[   12.985519] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000 
     83               DMAR:[fault reason 02] Present bit in context entry is clear 
     84[   13.298243] dmar: DRHD: handling fault status reg 3 
     85[   13.298307] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000 
     86               DMAR:[fault reason 02] Present bit in context entry is clear 
     87[   18.297124] dmar: DRHD: handling fault status reg 2 
     88[   18.297152] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000 
     89               DMAR:[fault reason 02] Present bit in context entry is clear 
     90[   18.609924] dmar: DRHD: handling fault status reg 3 
     91[   18.609971] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000 
     92               DMAR:[fault reason 02] Present bit in context entry is clear 
     93[   23.608862] dmar: DRHD: handling fault status reg 2 
     94[   23.608924] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000 
     95               DMAR:[fault reason 02] Present bit in context entry is clear 
     96}}} 
     97 
     98 * PX-G128M6eを取り外すと以下のようになる 
     99{{{ 
     100[    0.000000] Command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=0f566cb2-aec8-4122-a80a-f2e5f48e4426 rw intel_iommu=on 
     101[    0.000000] ACPI: DMAR 0x00000000DAC6CED0 0000B8 (v01 INTEL  BDW      00000001 INTL 00000001) 
     102[    0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=0f566cb2-aec8-4122-a80a-f2e5f48e4426 rw intel_iommu=on 
     103[    0.000000] Intel-IOMMU: enabled 
     104[    0.107383] dmar: Host address width 39 
     105[    0.107388] dmar: DRHD base: 0x000000fed90000 flags: 0x0 
     106[    0.107406] dmar: IOMMU 0: reg_base_addr fed90000 ver 1:0 cap c0000020660462 ecap f0101a 
     107[    0.107409] dmar: DRHD base: 0x000000fed91000 flags: 0x1 
     108[    0.107419] dmar: IOMMU 1: reg_base_addr fed91000 ver 1:0 cap d2008c20660462 ecap f010da 
     109[    0.107422] dmar: RMRR base: 0x000000dbe7b000 end: 0x000000dbe89fff 
     110[    0.107425] dmar: RMRR base: 0x000000dd000000 end: 0x000000df1fffff 
     111[    0.107430] IOAPIC id 8 under DRHD base  0xfed91000 IOMMU 1 
     112[    0.677861] DMAR: No ATSR found 
     113[    0.678093] IOMMU: dmar0 using Queued invalidation 
     114[    0.678096] IOMMU: dmar1 using Queued invalidation 
     115[    0.678100] IOMMU: Setting RMRR: 
     116[    0.678127] IOMMU: Setting identity map for device 0000:00:02.0 [0xdd000000 - 0xdf1fffff] 
     117[    0.678608] IOMMU: Setting identity map for device 0000:00:14.0 [0xdbe7b000 - 0xdbe89fff] 
     118[    0.678655] IOMMU: Setting identity map for device 0000:00:1a.0 [0xdbe7b000 - 0xdbe89fff] 
     119[    0.678697] IOMMU: Setting identity map for device 0000:00:1d.0 [0xdbe7b000 - 0xdbe89fff] 
     120[    0.678725] IOMMU: Prepare 0-16MiB unity mapping for LPC 
     121[    0.678743] IOMMU: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff] 
     122[    4.326005] [drm] DMAR active, disabling use of stolen memory 
     123}}} 
     124 
     125 === patch === 
     126 * [https://lkml.org/lkml/2015/2/2/226 LKML: Tim Sander: (PATCH) 3.19-rc7: add quirk for 1c28:0122 (rev 14) SATA controller] 
     127 * linux-stable-v4.0.5.patch 
     128{{{ 
     129diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c 
     130index 85f247e..a78b225 100644 
     131--- a/drivers/pci/quirks.c 
     132+++ b/drivers/pci/quirks.c 
     133@@ -3595,6 +3595,10 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0642, 
     134 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON, 
     135                         PCI_DEVICE_ID_JMICRON_JMB388_ESD, 
     136                         quirk_dma_func1_alias); 
     137+/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c94 */ 
     138+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_LITE_ON, 
     139+                        PCI_DEVICE_ID_PLEXTOR_M6E, 
     140+                        quirk_dma_func1_alias); 
     141  
     142 /* 
     143  * Some devices DMA with the wrong devfn, not just the wrong function. 
     144diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h 
     145index e63c02a..1607b20 100644 
     146--- a/include/linux/pci_ids.h 
     147+++ b/include/linux/pci_ids.h 
     148@@ -2487,6 +2487,9 @@ 
     149  
     150 #define PCI_VENDOR_ID_ASMEDIA          0x1b21 
     151  
     152+#define PCI_VENDOR_ID_LITE_ON          0x1c28 
     153+#define PCI_DEVICE_ID_PLEXTOR_M6E      0x0122 
     154+ 
     155 #define PCI_VENDOR_ID_CIRCUITCO                0x1cc8 
     156 #define PCI_SUBSYSTEM_ID_CIRCUITCO_MINNOWBOARD 0x0001 
     157  
     158}}} 
     159  * 4.0.xでも正常に動作することを確認 
     160   * twitter:mittyorz/status/608644911533936642 
     161   * https://bugzilla.kernel.org/show_bug.cgi?id=42679#c114 
     162