Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
QEMU PCI Passthrough: qemu-system-x86_64: No IOMMU found
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
nexus_seven
n00b
n00b


Joined: 07 Apr 2008
Posts: 28

PostPosted: Mon Jul 04, 2016 10:08 pm    Post subject: QEMU PCI Passthrough: qemu-system-x86_64: No IOMMU found Reply with quote

Guten Abend,

ich habe einen Lenovo T430 mit Gentoo als Hostsystem und würde gern mit QEMU einer virtuellen Maschine einen USB 3.0 Controller durchreichen, was leider nicht funktioniert. Der betroffene USB Controller ist 00:14.0:
Code:

lspci
00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)
00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4)
00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4)
00:1c.2 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 3 (rev c4)
00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation QM77 Express Chipset LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04)
02:00.0 System peripheral: Ricoh Co Ltd PCIe SDXC/MMC Host Controller (rev 07)
03:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01)

lspci -n
00:00.0 0600: 8086:0154 (rev 09)
00:02.0 0300: 8086:0166 (rev 09)
00:14.0 0c03: 8086:1e31 (rev 04)
00:16.0 0780: 8086:1e3a (rev 04)
00:19.0 0200: 8086:1502 (rev 04)
00:1a.0 0c03: 8086:1e2d (rev 04)
00:1b.0 0403: 8086:1e20 (rev 04)
00:1c.0 0604: 8086:1e10 (rev c4)
00:1c.1 0604: 8086:1e12 (rev c4)
00:1c.2 0604: 8086:1e14 (rev c4)
00:1d.0 0c03: 8086:1e26 (rev 04)
00:1f.0 0601: 8086:1e55 (rev 04)
00:1f.2 0106: 8086:1e03 (rev 04)
00:1f.3 0c05: 8086:1e22 (rev 04)
02:00.0 0880: 1180:e823 (rev 07)
03:00.0 0280: 10ec:8176 (rev 01)


Ich gehe dazu wie folgt vor:
Code:

#
# USB Controller vom Host trennen
#
echo "8086 1e31" > /sys/bus/pci/drivers/pci-stub/new_id
echo 0000:00:14.0 > /sys/bus/pci/devices/0000:00:14.0/driver/unbind
echo 0000:00:14.0 > /sys/bus/pci/drivers/pci-stub/bind
#
# QEMU VM starten
#
qemu-system-x86_64 \
-enable-kvm \
-cpu host \
-m 2048M \
-device pci-assign,host=00:14.0

Als Ergebnis erscheint:
Code:

qemu-system-x86_64: -device pci-assign,host=00:14.0: No IOMMU found.  Unable to assign device "(null)"

Da ich bereits seit Tagen erfolglos nach einer Lösung suche, habe ich das Szenario bereits in Ubuntu 16.04 nachgestellt und erfolgreich getestet - hardwareseitig ist die Unterstützung also scheinbar korrekt implementiert. Auch auf einem T440s konnte ich bei praktisch gleicher Konfiguration (bis auf einige Treiber) ebenfalls das gleiche negative Verhalten unter Gentoo, sowie das erfolgreiche Verhalten unter Ubuntu nachstellen. Ich gehe daher also von einem (Konfigurations-)fehler in meinem Gentoo aus.

Mein T430 hat einen i5-3320M verbaut, VT-d ist im BIOS aktiviert, BIOS Version ist G1ETB0WW (2.70).
Ich habe bereits die Kernel Version 4.4.6 als auch 4.6.3 sowie QEMU 2.5.1 als auch 2.6.0 getestet; folgende Settings sind im Kernel aktiv (habe beides bereits als Modul sowie fest einkompiliert getestet):
Code:

Device Drivers --->
    [*] IOMMU Hardware Support  --->
        [*]   Support for Intel IOMMU using DMA Remapping Devices

Bus options (PCI etc.)  --->
    <*>   PCI Stub driver

IOMMU ist in Grub aktiviert und laut dmesg auch beim Booten:
Code:

dmesg | grep -i iommu
[    0.000000] Command line: BOOT_IMAGE=/boot/kernel-4.6.3-test root=/dev/sda1 ro init=/usr/lib/systemd/systemd acpi_backlight=vendor thinkpad_acpi.fan_control=1 intel_iommu=on
[    0.000000] Kernel command line: BOOT_IMAGE=/boot/kernel-4.6.3-test root=/dev/sda1 ro init=/usr/lib/systemd/systemd acpi_backlight=vendor thinkpad_acpi.fan_control=1 intel_iommu=on
[    0.000000] DMAR: IOMMU enabled
[    0.013676] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
[    0.287734] iommu: Adding device 0000:00:00.0 to group 0
[    0.287825] iommu: Adding device 0000:00:02.0 to group 1
[    0.287909] iommu: Adding device 0000:00:14.0 to group 2
[    0.287995] iommu: Adding device 0000:00:16.0 to group 3
[    0.288078] iommu: Adding device 0000:00:19.0 to group 4
[    0.288161] iommu: Adding device 0000:00:1a.0 to group 5
[    0.288244] iommu: Adding device 0000:00:1b.0 to group 6
[    0.288328] iommu: Adding device 0000:00:1c.0 to group 7
[    0.288412] iommu: Adding device 0000:00:1c.1 to group 8
[    0.288495] iommu: Adding device 0000:00:1c.2 to group 9
[    0.288579] iommu: Adding device 0000:00:1d.0 to group 10
[    0.288667] iommu: Adding device 0000:00:1f.0 to group 11
[    0.288750] iommu: Adding device 0000:00:1f.2 to group 11
[    0.288838] iommu: Adding device 0000:00:1f.3 to group 11
[    0.288981] iommu: Adding device 0000:02:00.0 to group 12
[    0.289064] iommu: Adding device 0000:03:00.0 to group 13


Ich hoffe, dass mir jemand weiter helfen kann. Für Fragen und weitere Tests stehe ich natürlich gerne zur Verfügung, schließlich soll das ganze ja irgendwann mal laufen.

Viele Grüße nexus_seven
Back to top
View user's profile Send private message
gorg86
Apprentice
Apprentice


Joined: 20 May 2011
Posts: 299

PostPosted: Tue Jul 05, 2016 12:43 am    Post subject: Reply with quote

Was spuckt "lspci -v" über das Gerät aus?
Back to top
View user's profile Send private message
nexus_seven
n00b
n00b


Joined: 07 Apr 2008
Posts: 28

PostPosted: Tue Jul 05, 2016 5:29 am    Post subject: Reply with quote

lspci -v direkt nach Reboot:
Code:

00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) (prog-if 30 [XHCI])
   Subsystem: Lenovo 7 Series/C210 Series Chipset Family USB xHCI Host Controller
   Flags: bus master, medium devsel, latency 0, IRQ 30
   Memory at f2520000 (64-bit, non-prefetchable) [size=64K]
   Capabilities: [70] Power Management version 2
   Capabilities: [80] MSI: Enable+ Count=1/8 Maskable- 64bit+
   Kernel driver in use: xhci_hcd

lspci -n nach unbind des Controllers
Code:

00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) (prog-if 30 [XHCI])
   Subsystem: Lenovo 7 Series/C210 Series Chipset Family USB xHCI Host Controller
   Flags: medium devsel, IRQ 16
   Memory at f2520000 (64-bit, non-prefetchable) [size=64K]
   Capabilities: [70] Power Management version 2
   Capabilities: [80] MSI: Enable- Count=1/8 Maskable- 64bit+
   Kernel driver in use: pci-stub
Back to top
View user's profile Send private message
gorg86
Apprentice
Apprentice


Joined: 20 May 2011
Posts: 299

PostPosted: Tue Jul 05, 2016 10:12 am    Post subject: Reply with quote

Hm also der einzige Unterschied zum Wiki Artikel sind, dass der pci-stub Treiber nicht als Modul sondern direkt in den Kernel kompiliert wurde und nen paar fehlende Anführungsstriche, das sind aber keine Probleme.
Du kannst auch versuchen das angeschlossene USB Gerät anstatt dem Controller durch zu reichen.

edit:
Kompilier den USB Treiber als Modul bzw. kontrollier mal was da die Einstellung ist.
Back to top
View user's profile Send private message
nexus_seven
n00b
n00b


Joined: 07 Apr 2008
Posts: 28

PostPosted: Tue Jul 05, 2016 8:59 pm    Post subject: Reply with quote

Ich hab eigentlich keine Modulunterstützung aktiv, aber dennoch dieses Szenario schon durchgespielt, um es einfach als Fehlerquelle auszuschließen.
Habe eben auch den USB 3.0 Treiber extra nochmal als Modul kompiliert, das Ergebnis ist aber das gleiche.

Vor einigen Jahren hatte ich bereits einen USB 3.0 Controller auf einem AMD-System durchgereicht, ich meine damals hatte ich auch alle benötigten Treiber einkompliliert, jedoch aufgrund der damaligen NVIDIA Grafikkarte die Modulunterstützung aktiviert. Aber letztendlich war das auch ein ganz anderes System und ist leider nicht vergleichbar.

Ich hätte ja auch schon lange aufgegeben und das ganze als nicht sauber implementierte Hardware abgetan, aber unter Ubuntu hat es ja funktioniert.
Deshalb hab ich doch immer noch mehr oder weniger Ehrgeiz und mich entschlossen, hier nach Hilfe zu fragen.

Was ich noch auffällig finde, ist die Ausgabe von lscpu bezüglich Virtualisierung. Ich meine gelesen zu haben, dass dort wohl VT-d stehen muss, bei steht jedoch VT-x. Leider finde ich die Seite dazu nicht mehr.
Code:

lscpu
Architektur:           x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte-Reihenfolge:      Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) pro Kern:    2
Kern(e) pro Socket:    2
Socket(s):             1
Anbieterkennung:       GenuineIntel
Prozessorfamilie:      6
Modell:                58
Modellname:            Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz
Stepping:              9
CPU MHz:               2902.351
Maximale Taktfrequenz der CPU:3300,0000
Minimale Taktfrequenz der CPU:1200,0000
BogoMIPS:              5187.91
Virtualisierung:       VT-x
L1d Cache:             32K
L1i Cache:             32K
L2 Cache:              256K
L3 Cache:              3072K

Edit: Das USB-Gerät selbst dem Gast zur Verfügung zu stellen hat nicht zum gewünschten Erfolg geführt. Es handelt sich um ein BD-LW, im Windows Gast wurde es nur als CD-LW angezeigt und ich hatte keinen Zugriff auf den Datenträger. Ich hab mich aber ehrlich gesagt damit nicht weiter befasst, da es nicht mein bevorzugtes Ziel ist. Zur allergrößten Not würde ich mich damit weiter auseinandersetzen, aber mein Primärziel ist es eben, den gesamten Controller durchzureichen, zumal es ja tatsächlich mit der Hardware funktioniert, nur eben mit Gentoo nicht. Auch würde ich gerne für andere Spielereien einen Netzwerkcontroller direkt durchreichen.
Back to top
View user's profile Send private message
mrsteven
Veteran
Veteran


Joined: 04 Jul 2003
Posts: 1938

PostPosted: Tue Jul 05, 2016 9:13 pm    Post subject: Reply with quote

Sagt denn dmesg etwas hilfreiches, nachdem du versucht hast, Qemu zu starten? Ich hatte vor ein paar Tagen auch das Problem, dass PCI-Passthrough nicht wollte, kann mich nur leider nicht mehr an die Fehlermeldung von Qemu erinnern, die Meldung im Kernel-Log war dann aussagekräftiger. In meinem Fall lag es daran, dass ich im Kernel die Option für Interrupt Remapping (CONFIG_IRQ_REMAP) nicht gesetzt hatte.
_________________
Unix philosophy: "Do one thing and do it well."
systemd: "Do everything and do it wrong."
Back to top
View user's profile Send private message
nexus_seven
n00b
n00b


Joined: 07 Apr 2008
Posts: 28

PostPosted: Tue Jul 05, 2016 9:22 pm    Post subject: Reply with quote

CONFIG_IRQ_REMAP ist aktiviert

dmesg sagt nix zu dem IOMMU-Fehler, nur zum hostseitigen unbind des Treibers/Controllers, was erfolgreich funktioniert:
Code:

[  145.930176] xhci_hcd 0000:00:14.0: remove, state 4
[  145.930186] usb usb4: USB disconnect, device number 1
[  145.932953] xhci_hcd 0000:00:14.0: USB bus 4 deregistered
[  145.933014] xhci_hcd 0000:00:14.0: remove, state 4
[  145.933021] usb usb3: USB disconnect, device number 1
[  145.933175] xhci_hcd 0000:00:14.0: USB bus 3 deregistered
[  145.933425] pci-stub 0000:00:14.0: claimed by stub
Back to top
View user's profile Send private message
gorg86
Apprentice
Apprentice


Joined: 20 May 2011
Posts: 299

PostPosted: Tue Jul 05, 2016 9:29 pm    Post subject: Reply with quote

poste mal die Ausgabe von "emerge --info"
Back to top
View user's profile Send private message
nexus_seven
n00b
n00b


Joined: 07 Apr 2008
Posts: 28

PostPosted: Tue Jul 05, 2016 9:37 pm    Post subject: Reply with quote

emerge --info
Code:
Portage 2.2.28 (python 3.4.3-final-0, default/linux/amd64/13.0/desktop/gnome/systemd, gcc-4.9.3, glibc-2.22-r4, 4.4.6-gentoo x86_64)
=================================================================
System uname: Linux-4.4.6-gentoo-x86_64-Intel-R-_Core-TM-_i5-3320M_CPU_@_2.60GHz-with-gentoo-2.2
KiB Mem:    16148788 total,  14104988 free
KiB Swap:   15691956 total,  15691956 free
Timestamp of repository gentoo: Sun, 03 Jul 2016 23:30:02 +0000
sh bash 4.3_p42-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p42-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.10-r1::gentoo, 3.4.3-r1::gentoo
dev-util/cmake:           3.3.1-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.19.1::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r4::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://briefkasten/gentoo-portage
    priority: -1000

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://de-mirror.org/linux/distributions/"
LANG="de_DE.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="64bit X a52 aac aacs acl acpi aes alsa amd64 atmo avx bash-completion bdplus berkdb bluray branding bzip2 cairo cdda cddb cdr cli client colord cpudetection cracklib crypt cue cups cxx dbus dhclient dri dri3 dts dvb dvbpsi dvd dvdr dxva2 egl emboss encode evo exif fam fat firefox flac fortran gconf gdbm gif glamor gnome gnome-keyring gpm gstreamer gtk gtk3 h264 iconv introspection jpeg lcms libass libnotify libsecret live lm_sensors lua lzo mad mmx mmxext mng modules mp3 mp4 mpeg mtp multilib nautilus ncurses networkmanager nfs nfsv4 nfsv41 nls nptl nss ntfs ogg opengl openmp pam pango pcre pdf playlist png policykit popcnt ppds pulseaudio qt3support readline rpst sdl seccomp session smart smp sna spell sse sse2 sse3 sse4_1 sse4_2 ssl ssse3 startup-notification svg systemd tcpd threads tiff tracker truetype udev udf udisks unicode upower usb vaapi vcd vdpau vlm vnc vorbis vpx wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" L10N="de" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Back to top
View user's profile Send private message
nexus_seven
n00b
n00b


Joined: 07 Apr 2008
Posts: 28

PostPosted: Tue Jul 12, 2016 3:26 pm    Post subject: Reply with quote

Der Fehler besteht immer noch. Hat niemand mehr eine Idee? :( :cry:
Back to top
View user's profile Send private message
gorg86
Apprentice
Apprentice


Joined: 20 May 2011
Posts: 299

PostPosted: Tue Jul 12, 2016 4:04 pm    Post subject: Reply with quote

Du kannst noch händisch überprüfen ob KVM_DEVICE_ASSIGNMENT in der Kernel config drin ist.
Ansonsten würde ich es mit VFIO versuchen https://www.kernel.org/doc/Documentation/vfio.txt
Wenns immernoch nicht geht dann würde ich mich an englischsprachige Forum und an den Chat wenden, da sind viel mehr Leute unterwegs als hier.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum