Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
PCIe Karte in Qemu-KVM durchreichen per passthroug
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
SarahS93
l33t
l33t


Joined: 21 Nov 2013
Posts: 693

PostPosted: Sun Jul 27, 2014 7:37 am    Post subject: PCIe Karte in Qemu-KVM durchreichen per passthroug Reply with quote

Habe zwei nahe zu identische NVidia GT210 Grafikkarte in meinem System.
Code:
lspci
01:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 210] (rev a2)
01:00.1 Audio device: NVIDIA Corporation High Definition Audio Controller (rev a1)
02:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 210] (rev a2)
02:00.1 Audio device: NVIDIA Corporation High Definition Audio Controller (rev a1)


Die mit 01:00.1 benutze ich an meinem Desktopbildschirm. habe sie auch fest in meine xorg.conf eingetragen (xorg.conf: ...BusID "PCI:1:0:0"...)


Diese beiden NVidia-Geräte will ich in einer VM haben.:
Code:
02:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 210] (rev a2)
02:00.1 Audio device: NVIDIA Corporation High Definition Audio Controller (rev a1)


Habe mich dazu schon etwas eingelesen....
Meine Intel Core i7-2600 hat VT-d
Im Internet finde ich mir komisch erscheinende Aussagen das ein Mainboard diese Virtualisierungstechnick auch unterstützen muss?!
Dachte bisher immer das hängt einzig und allein von dem Prozessor ab. (Gigabyte P67-UD4 verwende ich)

Code:
[*] Virtualization --->
    --- Virtualization
    <*> Kernel-based Virtual Machine (KVM) support
    <M>   KVM for Intel processors support

ist natürlich auch eingeschaltet

Grub gebe ich beim booten noch "iommu=pt iommu=1" mit.

Die Anzeige von:
dmesg | grep -e DMAR -e IOMMU
Code:
[    0.000000] Intel-IOMMU: enabled

verwundert mich etwas weil dort nichts zu DMAR angezeigt wird, ist das normal?


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

habe ich auch aktiviert


Code:
# echo "10de:0a65" > /sys/bus/pci/drivers/pci-stub/new_id
bash: echo: Schreibfehler: Das Argument ist ungültig.
# echo "0000:02:00.0" > /sys/bus/pci/devices/0000:00:1b.0/driver/unbind
bash: echo: Schreibfehler: Kein passendes Gerät gefunden.
# echo "0000:02:00.0" > /sys/bus/pci/drivers/pci-stub/bind
bash: echo: Schreibfehler: Kein passendes Gerät gefunden.

funktioniert irgendwie nicht!?


Meine VM starte ich so:
Code:
qemu-system-x86_64 \
    -k de -enable-kvm -smp 8 -m 8192 -localtime -name __vm91test__ \
    -hda vm91_disk1.img \
    -vga vmware \
    -net nic,model=virtio,macaddr=00:00:00:00:00:91 \
    -net tap,ifname=qtap91,script=no,downscript=no \
    -usbdevice tablet \
    -vnc 192.168.0.1:91 \
    -daemonize \
   -boot d \
   -cdrom ../gentoo_20140508____install-amd64-minimal-20140508.iso \
    -device pci-assign,host=02:00.0 \
    -pidfile vm91_run.pid &


und erhalte dann diese Meldungen:
Code:
qemu-system-x86_64: -device pci-assign,host=02:00.0: No IOMMU found.  Unable to assign device "(null)"
qemu-system-x86_64: -device pci-assign,host=02:00.0: Device initialization failed.
qemu-system-x86_64: -device pci-assign,host=02:00.0: Device 'kvm-pci-assign' could not be initialized


Habt Ihr ein paar Ideen was ich versuchen könnte?

Eine weitere andere Frage die ich noch habe ... wie kriege ich die Auflösung in einer VM auf 2560x1600 hoch?
Back to top
View user's profile Send private message
Jean-Paul
Guru
Guru


Joined: 13 Apr 2009
Posts: 307

PostPosted: Sun Jul 27, 2014 10:11 am    Post subject: Reply with quote

Ich nehme an du kennst dies Seiten
https://forums.gentoo.org/viewtopic-t-968156.html?sid=7d17f69a3c4c2ef0a68d86853a72344f
http://www.linux-kvm.org/page/How_to_assign_devices_with_VT-d_in_KVM
http://wiki.xenproject.org/wiki/VTdHowTo

Ob dein Mainboard explizit vt-d unterstützt weiß ich nicht. Es gibt aber im BIOS unter "Miscellaneous Settings" den Punkt "Virtualization Technology" der eingeschaltet sein sollte - manche OEM's schalten ihn aber ab. Ob dies ausreicht kann ich dir nicht sagen.

dmesg | grep -e DMAR -e IOMMU sieht bei mir so aus
Quote:

[ 0.000000] ACPI: DMAR 0x00000000C5932BC8 0000B8 (v01 INTEL HSW 00000001 INTL 00000001)
[ 0.335646] dmar: IOMMU 0: reg_base_addr fed90000 ver 1:0 cap c0000020660462 ecap f0101a
[ 0.335778] dmar: IOMMU 1: reg_base_addr fed91000 ver 1:0 cap d2008020660462 ecap f010da
[ 0.335971] DMAR: No ATSR found
[ 0.336040] IOMMU 0 0xfed90000: using Queued invalidation
[ 0.336097] IOMMU 1 0xfed91000: using Queued invalidation
[ 0.336154] IOMMU: Setting RMRR:
[ 0.336213] IOMMU: Setting identity map for device 0000:00:02.0 [0xc7000000 - 0xcf1fffff]
[ 0.336899] IOMMU: Setting identity map for device 0000:00:14.0 [0xc5ea9000 - 0xc5eb7fff]
[ 0.336992] IOMMU: Setting identity map for device 0000:00:1a.0 [0xc5ea9000 - 0xc5eb7fff]
[ 0.337081] IOMMU: Setting identity map for device 0000:00:1d.0 [0xc5ea9000 - 0xc5eb7fff]
[ 0.337167] IOMMU: Prepare 0-16MiB unity mapping for LPC
[ 0.337228] IOMMU: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
[ 0.350599] [drm] DMAR active, disabling use of stolen memory


Im Kernel habe ich dies aktiviert
zgrep "DMAR\|IOMMU" /proc/config.gz
Quote:

# CONFIG_GART_IOMMU is not set
CONFIG_CALGARY_IOMMU=y
CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y
CONFIG_IOMMU_HELPER=y
CONFIG_IOMMU_API=y
CONFIG_IOMMU_SUPPORT=y
# CONFIG_AMD_IOMMU is not set
CONFIG_DMAR_TABLE=y
CONFIG_INTEL_IOMMU=y
CONFIG_INTEL_IOMMU_DEFAULT_ON=y
CONFIG_INTEL_IOMMU_FLOPPY_WA=y
# CONFIG_IOMMU_STRESS is not set

_________________
”Everything should be made as simple as possible, but no simpler.” – Albert Einstein
Back to top
View user's profile Send private message
SarahS93
l33t
l33t


Joined: 21 Nov 2013
Posts: 693

PostPosted: Sun Jul 27, 2014 11:19 am    Post subject: Reply with quote

Ja, die links sind mir bestens bekannt (-;

Bei http://www.linux-kvm.org/page/How_to_assign_devices_with_VT-d_in_KVM steht :
Code:
echo "10de:0a65" > /sys/bus/pci/drivers/pci-stub/new_id
echo "0000:02:00.0" > /sys/bus/pci/devices/0000:00:1b.0/driver/unbind
echo "0000:02:00.0" > /sys/bus/pci/drivers/pci-stub/bind


Wenn ich das aber versuche, erhalte ich solche Fehlermeldungen :
Code:

# echo "10de:0a65" > /sys/bus/pci/drivers/pci-stub/new_id
bash: echo: Schreibfehler: Das Argument ist ungültig.
# echo "0000:02:00.0" > /sys/bus/pci/devices/0000:00:1b.0/driver/unbind
bash: echo: Schreibfehler: Kein passendes Gerät gefunden.
# echo "0000:02:00.0" > /sys/bus/pci/drivers/pci-stub/bind
bash: echo: Schreibfehler: Kein passendes Gerät gefunden.


Vielleicht liegt da ja schon mein Problem, nur weiss ich nicht wie ich es löse.


Bei dem Link ( http://www.linux-kvm.org/page/How_to_assign_devices_with_VT-d_in_KVM ) steht:
set "Bus options (PCI etc.)" -> "Support for DMA Remapping Devices" to "*"
set "Bus options (PCI etc.)" -> "Enable DMA Remapping Devices" to "*"
set "Bus options (PCI etc.)" -> "PCI Stub driver" to "*"

Bei mir gibt es in der Kernelconfig nur:
set "Bus options (PCI etc.)" -> "PCI Stub driver" to "*"

set "Bus options (PCI etc.)" -> "Support for DMA Remapping Devices" to "*"
set "Bus options (PCI etc.)" -> "Enable DMA Remapping Devices" to "*"
Ist bei mir in der Kernelconfig (Linux deruse 3.10.7-gentoo-r1) nicht da!?


Code:
Bus options (PCI etc.)  --->
  [*] PCI support
  [*]   Support mmconfig PCI config space access
  [*]   PCI Express support
  < >     PCI Express Hotplug driver
  [*]     Root Port Advanced Error Reporting support
  [ ]       PCI Express ECRC settings control
  < >       PCIe AER error injector support
  -*-     PCI Express ASPM control
  [ ]       Debug PCI Express ASPM
            Default ASPM policy (BIOS default)  --->
  [*] Message Signaled Interrupts (MSI and MSI-X)
  [ ] PCI Debugging
  [ ] Enable PCI resource re-allocation detection
  <*> PCI Stub driver
  [*] Interrupts on hypertransport devices
  [ ] PCI IOV support
  [*] PCI PRI support
  [*] PCI PASID support
  < > PCI IO-APIC hotplug support
  <*> PCCard (PCMCIA/CardBus) support  --->
  <*> Support for PCI Hotplug  --->
  [ ] RapidIO support



Virtualization Technology steht im BIOS auf enabled, hatte ich vergessen zu sagen.
Back to top
View user's profile Send private message
Jean-Paul
Guru
Guru


Joined: 13 Apr 2009
Posts: 307

PostPosted: Sun Jul 27, 2014 12:44 pm    Post subject: Reply with quote

DMAR findest du hier
Quote:
Device Drivers --->
[*] IOMMU Hardware Support --->
--- IOMMU Hardware Support
[ ] AMD IOMMU support
[*] Support for Intel IOMMU using DMA Remapping Devices
[*] Enable Intel DMA Remapping Devices by default
[ ] Support for Interrupt Remapping

_________________
”Everything should be made as simple as possible, but no simpler.” – Albert Einstein
Back to top
View user's profile Send private message
SarahS93
l33t
l33t


Joined: 21 Nov 2013
Posts: 693

PostPosted: Sun Jul 27, 2014 12:56 pm    Post subject: Reply with quote

OK, habe ich eingeschaltet. Es hat sich aber nichts verändert dadurch.

echo "10de:0a65" > /sys/bus/pci/drivers/pci-stub/new_id
echo "0000:02:00.0" > /sys/bus/pci/devices/0000:00:1b.0/driver/unbind
echo "0000:02:00.0" > /sys/bus/pci/drivers/pci-stub/bind

Was hat das damit aufsich?
Back to top
View user's profile Send private message
Jean-Paul
Guru
Guru


Joined: 13 Apr 2009
Posts: 307

PostPosted: Sun Jul 27, 2014 1:37 pm    Post subject: Reply with quote

Quote:
OK, habe ich eingeschaltet. Es hat sich aber nichts verändert dadurch.

echo "10de:0a65" > /sys/bus/pci/drivers/pci-stub/new_id
echo "0000:02:00.0" > /sys/bus/pci/devices/0000:00:1b.0/driver/unbind
echo "0000:02:00.0" > /sys/bus/pci/drivers/pci-stub/bind

Was hat das damit aufsich?

Du hast nicht aufmerksam gelesen :-)
Dort steht
Quote:
echo "8086 10b9" > /sys/bus/pci/drivers/pci-stub/new_id
echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
echo 0000:01:00.0 > /sys/bus/pci/drivers/pci-stub/bind

Also echo "8086 10b9" ohne Doppelpunkt und echo 0000:01:00.0 ohne Quots ("").

Hast du kontrolliert, ob es diesen Pfad überhaupt gibt (/sys/bus/pci/devices/0000:01:00.0/driver/unbind).
_________________
”Everything should be made as simple as possible, but no simpler.” – Albert Einstein
Back to top
View user's profile Send private message
SarahS93
l33t
l33t


Joined: 21 Nov 2013
Posts: 693

PostPosted: Sun Jul 27, 2014 3:07 pm    Post subject: Reply with quote

OK, sehe die Fehler...
Code:
echo "10de 0a65" > /sys/bus/pci/drivers/pci-stub/new_id
echo 0000:02:00.0 > /sys/bus/pci/devices/0000\:02\:00.0/driver/unbind
echo 0000:02:00.0 > /sys/bus/pci/drivers/pci-stub/bind

funktioniert jetzt schonmal... wow, kewl!

Code:
qemu-system-x86_64: -device pci-assign,host=02:00.0: No IOMMU found.  Unable to assign device "(null)"
qemu-system-x86_64: -device pci-assign,host=02:00.0: Device initialization failed.
qemu-system-x86_64: -device pci-assign,host=02:00.0: Device 'kvm-pci-assign' could not be initialized

Die Fehlermeldung beim starten bleibt aber immer noch ....

Habe den nvidia Treiber deinstalliert und entladen, bei lsmod tauchte er dann nicht mehr. Aber auch das hatte nichts gebracht.

So ein mist :-/ ....


...

"No IOMMU found. Unable to assign device "(null)"" Heisst doch das da irgendwas noch nicht mit diesem IOMMU in Ordnung ist?
Habe nur leider kein anderes Mainboard zum Testen da...
Back to top
View user's profile Send private message
firefly
Watchman
Watchman


Joined: 31 Oct 2002
Posts: 5173

PostPosted: Mon Jul 28, 2014 7:12 am    Post subject: Reply with quote

SarahS93 wrote:

Code:
qemu-system-x86_64: -device pci-assign,host=02:00.0: No IOMMU found.  Unable to assign device "(null)"
qemu-system-x86_64: -device pci-assign,host=02:00.0: Device initialization failed.
qemu-system-x86_64: -device pci-assign,host=02:00.0: Device 'kvm-pci-assign' could not be initialized

Die Fehlermeldung beim starten bleibt aber immer noch ....

Habe den nvidia Treiber deinstalliert und entladen, bei lsmod tauchte er dann nicht mehr. Aber auch das hatte nichts gebracht.

So ein mist :-/ ....


...

"No IOMMU found. Unable to assign device "(null)"" Heisst doch das da irgendwas noch nicht mit diesem IOMMU in Ordnung ist?
Habe nur leider kein anderes Mainboard zum Testen da...


Das bedeutet, dass vermutlich deine CPU/Mainboard IOMMU nicht unterstüzt oder deaktiviert ist.
_________________
Ein Ring, sie zu knechten, sie alle zu finden,
Ins Dunkel zu treiben und ewig zu binden
Im Lande Mordor, wo die Schatten drohn.
Back to top
View user's profile Send private message
SarahS93
l33t
l33t


Joined: 21 Nov 2013
Posts: 693

PostPosted: Tue Jul 29, 2014 6:50 am    Post subject: Reply with quote

Wie kann ich das denn genauer herrausfinden?

Laut Gigabyte kann das P67-UD4 Mainboard VT-d und die Intel i7-2600 CPU kann es laut Intel ebenfalls.

Gibt es eine LiveCD mit Qemu das IOMMU können muss damit ich zu 100% ausschliessen kann das es nicht an meinem Kernel oder Einstellungen bei mir liegt?
Danach zu Googeln ist mal echt schwer .. finde nur LiveCDs die man in Qemu starten kann :o
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Tue Jul 29, 2014 7:28 am    Post subject: Reply with quote

Hi,

ich bin mir ja nicht ganz sicher, wie Gigabyte das machen will mit VT-d. Aber der P67 Chipsatz von Intel kann es jedenfalls nicht: http://ark.intel.com/products/52810/Intel-BD82P67-PCH

Aber vielleicht hast du mal einen Link von Gigabyte, wo das beschrieben ist. Denn VT-x und VT-d sind zwei unterschiedliche Dinge.

MfG. Stefan
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
SarahS93
l33t
l33t


Joined: 21 Nov 2013
Posts: 693

PostPosted: Tue Jul 29, 2014 2:18 pm    Post subject: Reply with quote

OK, das ist dann wohl eindeutig. Danke für den sehr nützlichen Link zu der Intel HP.
Back to top
View user's profile Send private message
Child_of_Sun_24
Guru
Guru


Joined: 28 Jul 2004
Posts: 578

PostPosted: Fri Aug 01, 2014 1:42 pm    Post subject: Reply with quote

https://bbs.archlinux.org/viewtopic.php?id=162768

Habe den restlichen Thread von dir nur kurz überflogen, aber versuch es mal mit Vfio statt PCI-Stub (Der obige Link beschreibt das recht gut, in dem Thread selber sind auch Lösungen und Patches für verschiedene Szenarios, auch für Intel Chipsätze/Grafikkarten).

Habe selber damit 2 Radeon HD7770 im CrossfireX verbund in einer VM, allerdings habe ich ein reines AMD System womit ich dir bei Intel nicht helfen kann.

Und die Iommu ist korrekt eingeschaltet bei dir,
Code:
[    0.000000] Intel-IOMMU: enabled
bedeutet das sie aktiv ist.
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