Bug 517857

Summary: Pass-throu NIC is invisible in guest OS via libvirt
Product: Red Hat Enterprise Linux 5 Reporter: Shaohui <shaohui.zheng>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 5.4CC: ddugger, donald.d.dugger, haicheng.li, markmc, virt-maint, xen-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-11 20:11:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
configure file
none
dmi decode information
none
virt-manager snapshot(bugus bdf)
none
dmesg when create guest with qemu-kvm
none
dmesg when create guest via libvirt
none
qemu log on /var/log/libvirt/qemu/vm2.log none

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
computer
  |
  +-pci_8086_10cc
  |   |
  |   +-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'>
      <source>
      <address bus='0x00' slot='0x19' function='0x00'/>
      </source>
      </hostdev>
      <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
      <address bus='0x01' slot='0x00' function='0x00'/>
      </source>
      </hostdev>
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.