wiki:TipAndDoc/VM/KVM/passthrough

  • QEMUの引数に追加されるものの例
    01:00.0 Multimedia controller [0480]: Altera Corporation Device [1172:4c15] (rev 01)
    
    -device vfio-pci,host=01:00.0,id=hostdev0,bus=pci.0,addr=0x9
    

Marvell controller

Plextor M6e

  • PX-G128M6e
    • lspci -nnv
      02: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])
              Subsystem: Marvell Technology Group Ltd. Device [1b4b:9183]
      
  • root@archiso ~ # uname -a
    Linux archiso 4.0.4-2-ARCH #1 SMP PREEMPT Fri May 22 03:05:23 UTC 2015 x86_64 GNU/Linux
    
  • root@archiso ~ # cat /proc/cmdline
    BOOT_IMAGE=boot/x86_64/vmlinuz archisobasedir=arch archisolabel=ARCH_201506 initrd=boot/intel_ucode.img,boot/x86_64/archiso.img intel_iommu=on
    
  • root@archiso ~ # dmesg|grep -i -e DMAR -e IOMMU
    [    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
    [    0.000000] ACPI: DMAR 0x00000000DAC6CED0 0000B8 (v01 INTEL  BDW      00000001 INTL 00000001)
    [    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
    [    0.000000] Intel-IOMMU: enabled
    [    0.086964] dmar: Host address width 39
    [    0.086969] dmar: DRHD base: 0x000000fed90000 flags: 0x0
    [    0.086987] dmar: IOMMU 0: reg_base_addr fed90000 ver 1:0 cap c0000020660462 ecap f0101a
    [    0.086990] dmar: DRHD base: 0x000000fed91000 flags: 0x1
    [    0.087000] dmar: IOMMU 1: reg_base_addr fed91000 ver 1:0 cap d2008c20660462 ecap f010da
    [    0.087003] dmar: RMRR base: 0x000000dbe7b000 end: 0x000000dbe89fff
    [    0.087006] dmar: RMRR base: 0x000000dd000000 end: 0x000000df1fffff
    [    0.087011] IOAPIC id 8 under DRHD base  0xfed91000 IOMMU 1
    [    7.370829] DMAR: No ATSR found
    [    7.371048] IOMMU: dmar0 using Queued invalidation
    [    7.371051] IOMMU: dmar1 using Queued invalidation
    [    7.371056] IOMMU: Setting RMRR:
    [    7.371083] IOMMU: Setting identity map for device 0000:00:02.0 [0xdd000000 - 0xdf1fffff]
    [    7.371527] IOMMU: Setting identity map for device 0000:00:14.0 [0xdbe7b000 - 0xdbe89fff]
    [    7.371577] IOMMU: Setting identity map for device 0000:00:1a.0 [0xdbe7b000 - 0xdbe89fff]
    [    7.371616] IOMMU: Setting identity map for device 0000:00:1d.0 [0xdbe7b000 - 0xdbe89fff]
    [    7.371644] IOMMU: Prepare 0-16MiB unity mapping for LPC
    [    7.371661] IOMMU: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
    [    7.673577] [drm] DMAR active, disabling use of stolen memory
    [    7.673740] dmar: DRHD: handling fault status reg 2
    [    7.673744] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000
                   DMAR:[fault reason 02] Present bit in context entry is clear
    [    7.986473] dmar: DRHD: handling fault status reg 3
    [    7.986493] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000
                   DMAR:[fault reason 02] Present bit in context entry is clear
    [    9.337664] dmar: DRHD: handling fault status reg 2
    [    9.337683] dmar: DMAR:[DMA Write] Request device [00:02.0] fault addr 74ff240000
                   DMAR:[fault reason 05] PTE Write access is not set
    [   12.985456] dmar: DRHD: handling fault status reg 2
    [   12.985519] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000
                   DMAR:[fault reason 02] Present bit in context entry is clear
    [   13.298243] dmar: DRHD: handling fault status reg 3
    [   13.298307] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000
                   DMAR:[fault reason 02] Present bit in context entry is clear
    [   18.297124] dmar: DRHD: handling fault status reg 2
    [   18.297152] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000
                   DMAR:[fault reason 02] Present bit in context entry is clear
    [   18.609924] dmar: DRHD: handling fault status reg 3
    [   18.609971] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000
                   DMAR:[fault reason 02] Present bit in context entry is clear
    [   23.608862] dmar: DRHD: handling fault status reg 2
    [   23.608924] dmar: DMAR:[DMA Write] Request device [02:00.1] fault addr fffe0000
                   DMAR:[fault reason 02] Present bit in context entry is clear
    
  • PX-G128M6eを取り外すと以下のようになる
    [    0.000000] Command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=0f566cb2-aec8-4122-a80a-f2e5f48e4426 rw intel_iommu=on
    [    0.000000] ACPI: DMAR 0x00000000DAC6CED0 0000B8 (v01 INTEL  BDW      00000001 INTL 00000001)
    [    0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=0f566cb2-aec8-4122-a80a-f2e5f48e4426 rw intel_iommu=on
    [    0.000000] Intel-IOMMU: enabled
    [    0.107383] dmar: Host address width 39
    [    0.107388] dmar: DRHD base: 0x000000fed90000 flags: 0x0
    [    0.107406] dmar: IOMMU 0: reg_base_addr fed90000 ver 1:0 cap c0000020660462 ecap f0101a
    [    0.107409] dmar: DRHD base: 0x000000fed91000 flags: 0x1
    [    0.107419] dmar: IOMMU 1: reg_base_addr fed91000 ver 1:0 cap d2008c20660462 ecap f010da
    [    0.107422] dmar: RMRR base: 0x000000dbe7b000 end: 0x000000dbe89fff
    [    0.107425] dmar: RMRR base: 0x000000dd000000 end: 0x000000df1fffff
    [    0.107430] IOAPIC id 8 under DRHD base  0xfed91000 IOMMU 1
    [    0.677861] DMAR: No ATSR found
    [    0.678093] IOMMU: dmar0 using Queued invalidation
    [    0.678096] IOMMU: dmar1 using Queued invalidation
    [    0.678100] IOMMU: Setting RMRR:
    [    0.678127] IOMMU: Setting identity map for device 0000:00:02.0 [0xdd000000 - 0xdf1fffff]
    [    0.678608] IOMMU: Setting identity map for device 0000:00:14.0 [0xdbe7b000 - 0xdbe89fff]
    [    0.678655] IOMMU: Setting identity map for device 0000:00:1a.0 [0xdbe7b000 - 0xdbe89fff]
    [    0.678697] IOMMU: Setting identity map for device 0000:00:1d.0 [0xdbe7b000 - 0xdbe89fff]
    [    0.678725] IOMMU: Prepare 0-16MiB unity mapping for LPC
    [    0.678743] IOMMU: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
    [    4.326005] [drm] DMAR active, disabling use of stolen memory
    

patch

  • LKML: Tim Sander: (PATCH) 3.19-rc7: add quirk for 1c28:0122 (rev 14) SATA controller
  • linux-stable-v4.0.5.patch
    diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
    index 85f247e..a78b225 100644
    --- a/drivers/pci/quirks.c
    +++ b/drivers/pci/quirks.c
    @@ -3595,6 +3595,10 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0642,
     DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON,
     			 PCI_DEVICE_ID_JMICRON_JMB388_ESD,
     			 quirk_dma_func1_alias);
    +/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c94 */
    +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_LITE_ON,
    +			 PCI_DEVICE_ID_PLEXTOR_M6E,
    +			 quirk_dma_func1_alias);
     
     /*
      * Some devices DMA with the wrong devfn, not just the wrong function.
    diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
    index e63c02a..1607b20 100644
    --- a/include/linux/pci_ids.h
    +++ b/include/linux/pci_ids.h
    @@ -2487,6 +2487,9 @@
     
     #define PCI_VENDOR_ID_ASMEDIA		0x1b21
     
    +#define PCI_VENDOR_ID_LITE_ON		0x1c28
    +#define PCI_DEVICE_ID_PLEXTOR_M6E	0x0122
    +
     #define PCI_VENDOR_ID_CIRCUITCO		0x1cc8
     #define PCI_SUBSYSTEM_ID_CIRCUITCO_MINNOWBOARD	0x0001
     
    

patched at vanilla v4.5

  • ArchLinux 4.7.6-1
  • mitty@zankan:~ $ cat /proc/cmdline
    BOOT_IMAGE=/vmlinuz-linux root=UUID=0f566cb2-aec8-4122-a80a-f2e5f48e4426 rw intel_iommu=on
    
  • mitty@zankan:~ $ dmesg | grep -i -e dmar -e iommu
    [    0.000000] Command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=0f566cb2-aec8-4122-a80a-f2e5f48e4426 rw intel_iommu=on
    [    0.000000] ACPI: DMAR 0x00000000CCC6CED0 0000B8 (v01 INTEL  BDW      00000001 INTL 00000001)
    [    0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=0f566cb2-aec8-4122-a80a-f2e5f48e4426 rw intel_iommu=on
    [    0.000000] DMAR: IOMMU enabled
    [    0.117757] DMAR: Host address width 39
    [    0.117761] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
    [    0.117777] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap c0000020660462 ecap f0101a
    [    0.117780] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
    [    0.117789] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c20660462 ecap f010da
    [    0.117792] DMAR: RMRR base: 0x000000cde7b000 end: 0x000000cde89fff
    [    0.117795] DMAR: RMRR base: 0x000000cf000000 end: 0x000000df1fffff
    [    0.117800] DMAR-IR: IOAPIC id 8 under DRHD base  0xfed91000 IOMMU 1
    [    0.117803] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
    [    0.117806] DMAR-IR: x2apic is disabled because BIOS sets x2apic opt out bit.
    [    0.117809] DMAR-IR: Use 'intremap=no_x2apic_optout' to override the BIOS setting.
    [    0.118430] DMAR-IR: Enabled IRQ remapping in xapic mode
    [    1.342954] DMAR: No ATSR found
    [    1.344511] DMAR: dmar0: Using Queued invalidation
    [    1.344523] DMAR: dmar1: Using Queued invalidation
    [    1.344578] DMAR: Setting RMRR:
    [    1.344677] DMAR: Setting identity map for device 0000:00:02.0 [0xcf000000 - 0xdf1fffff]
    [    1.347788] DMAR: Setting identity map for device 0000:00:14.0 [0xcde7b000 - 0xcde89fff]
    [    1.347891] DMAR: Setting identity map for device 0000:00:1a.0 [0xcde7b000 - 0xcde89fff]
    [    1.347997] DMAR: Setting identity map for device 0000:00:1d.0 [0xcde7b000 - 0xcde89fff]
    [    1.348026] DMAR: Prepare 0-16MiB unity mapping for LPC
    [    1.348108] DMAR: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
    [    1.348350] DMAR: Intel(R) Virtualization Technology for Directed I/O
    [    1.348477] iommu: Adding device 0000:00:00.0 to group 0
    [    1.348511] iommu: Adding device 0000:00:01.0 to group 1
    [    1.348531] iommu: Adding device 0000:00:02.0 to group 2
    [    1.348552] iommu: Adding device 0000:00:03.0 to group 3
    [    1.348573] iommu: Adding device 0000:00:14.0 to group 4
    [    1.348601] iommu: Adding device 0000:00:16.0 to group 5
    [    1.348621] iommu: Adding device 0000:00:19.0 to group 6
    [    1.348642] iommu: Adding device 0000:00:1a.0 to group 7
    [    1.348663] iommu: Adding device 0000:00:1b.0 to group 8
    [    1.348684] iommu: Adding device 0000:00:1c.0 to group 9
    [    1.348708] iommu: Adding device 0000:00:1d.0 to group 10
    [    1.348747] iommu: Adding device 0000:00:1f.0 to group 11
    [    1.348767] iommu: Adding device 0000:00:1f.2 to group 11
    [    1.348788] iommu: Adding device 0000:00:1f.3 to group 11
    [    1.348799] iommu: Adding device 0000:01:00.0 to group 1
    [    1.348821] iommu: Adding device 0000:02:00.0 to group 12
    [    2.719372] [drm] DMAR active, disabling use of stolen memory
    
Last modified 8 years ago Last modified on Oct 9, 2016 2:01:28 AM