Bug 517857 - Pass-throu NIC is invisible in guest OS via libvirt
Summary: Pass-throu NIC is invisible in guest OS via libvirt
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt
Version: 5.4
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2009-08-17 14:08 UTC by Shaohui
Modified: 2009-12-14 21:24 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2009-09-11 20:11:12 UTC

Attachments (Terms of Use)
configure file (1.20 KB, text/plain)
2009-08-17 14:12 UTC, Shaohui
no flags Details
dmi decode information (9.29 KB, text/plain)
2009-08-17 14:21 UTC, Shaohui
no flags Details
virt-manager snapshot(bugus bdf) (283.78 KB, image/png)
2009-08-17 14:37 UTC, Shaohui
no flags Details
dmesg when create guest with qemu-kvm (34.27 KB, application/octet-stream)
2009-08-17 14:46 UTC, Shaohui
no flags Details
dmesg when create guest via libvirt (34.03 KB, text/plain)
2009-08-17 14:48 UTC, Shaohui
no flags Details
qemu log on /var/log/libvirt/qemu/vm2.log (507 bytes, text/plain)
2009-08-17 15:00 UTC, Shaohui
no flags Details

Description Shaohui 2009-08-17 14:08:45 UTC
Description of problem:

I try to pass-throu device by libvirt API, I do pass-throu the NIC to the guest OS, but I can not see it in the guest OS, we can see the bdf in virt-manager control panel, I think that it should be bogus. 

If create the guest with qemu-kvm command directly, I can see the NIC. 

This issue exists on NHM-HEDT. For NHM-EP, it exists on some of hardware steppings.

I will attach the dmidecode. the demsg with or without libvirt.

Version-Release number of selected component (if applicable):
 libvirt-0.6.3-20 and kernel-2.6.18-162 (rhel5u4 rc1)

How reproducible:
1. find the device ID
#virsh nodedev-list -tree
  |   |
  |   +-net_00_1c_c0_79_8b_d7

2. Detach it from host
[root@localhost ~]# virsh nodedev-dettach pci_8086_10cc Device pci_8086_10cc dettached

I guess that It should be a typo, dettach should be detach.	

3. Reset the device
[root@localhost ~]# virsh nodedev-reset pci_8086_10cc Device pci_8086_10cc reset

No FLR capability, it should use SBR or PM reset.

4. prepare a xml file, refer the attachment: kvm-new.xml I try to pass-throu 2 device: 00:19.0,01:00.0. both does not FLR.

      <hostdev mode='subsystem' type='pci' managed='yes'>
      <address bus='0x00' slot='0x19' function='0x00'/>
      <hostdev mode='subsystem' type='pci' managed='yes'>
      <address bus='0x01' slot='0x00' function='0x00'/>
5. check the device in guest OS, I can not find them in guest OS, but it shows on virt-manager control panel.
Attachment: vir-manager.png
Check qemu log, it did do the pass-throu action -pcidevice host=00:19.0 -pcidevice host=01:00.0 My dmesg was attached, too. dmesg.txt

6. create guest without libvirt
If create guest OS with the command:
/usr/libexec/qemu-kvm  -m 512 -smp 2 -hda /root/ia32e_rhel5u1.img -net none   -pcidevice host=00:19.0 -name vm2 -pcidevice host=01:00.0
I can not find the NIC in guest OS.

Actual results:

Expected results:

Additional info:

Comment 1 Shaohui 2009-08-17 14:12:23 UTC
Created attachment 357654 [details]
configure file

Comment 2 Shaohui 2009-08-17 14:21:04 UTC
Created attachment 357655 [details]
dmi decode information

Comment 3 Shaohui 2009-08-17 14:37:00 UTC
Created attachment 357656 [details]
virt-manager snapshot(bugus bdf)

Comment 4 Shaohui 2009-08-17 14:46:44 UTC
Created attachment 357658 [details]
dmesg when create guest with qemu-kvm

Comment 5 Shaohui 2009-08-17 14:48:01 UTC
Created attachment 357659 [details]
dmesg when create guest via libvirt

Comment 6 Shaohui 2009-08-17 15:00:41 UTC
Created attachment 357662 [details]
qemu log on /var/log/libvirt/qemu/vm2.log

Comment 7 Mark McLoughlin 2009-08-17 17:12:07 UTC
Here's the problem:

  <domain type='qemu'>

it should be:

  <domain type='kvm'>

With type='qemu', libvirt runs qemu-kvm -no-kvm and -pcidevice is ignored

If you change it to type='kvm', does it work?

Comment 8 Shaohui 2009-09-11 03:28:56 UTC
After I change the hypervisor to kvm, I can success to pass-throu the device and it works fine.

Note You need to log in before you can comment on or make changes to this bug.