Bug 707882 - Could not hot add pci device on specified pci_address
Could not hot add pci device on specified pci_address
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kvm (Show other bugs)
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Alex Williamson
Virtualization Bugs
Depends On:
Blocks: Rhel5KvmTier3
  Show dependency treegraph
Reported: 2011-05-26 04:57 EDT by Mike Cao
Modified: 2013-01-09 18:54 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-08-16 20:34:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Mike Cao 2011-05-26 04:57:51 EDT
Description of problem:
use (qemu)pci_add pci_addr=00:00:06 ,it always add the pci device to 00:00:04

Version-Release number of selected component (if applicable):
# uname -r
[root@localhost ~]# rpm -q kvm

How reproducible:

Steps to Reproduce:
1.start a VM as following 
CLI:/usr/libexec/qemu-kvm -no-hpet -no-kvm-pit-reinjection -usbdevice tablet -rtc-td-hack -startdate now -usb -name RHEL6 -smp 4 -k en-us -m 8G -boot dnc -net nic,vlan=1,macaddr=00:1a:4a:42:49:00,model=rtl8139 -net tap,vlan=1,script=/etc/qemu-ifup,downscript=no -drive file=/home/test/windows03R2sp2.bak,media=disk,if=ide,cache=off,boot=on,format=raw,werror=stop  -cpu qemu64,+sse2 -M rhel5.6.0 -notify all -balloon none -monitor unix:/tmp/tt,server,nowait -vnc :1

2.(qemu)info pci
(qemu) info pci
  Bus  0, device   0, function 0:
    Host bridge: PCI device 8086:1237
  Bus  0, device   1, function 0:
    ISA bridge: PCI device 8086:7000
  Bus  0, device   1, function 1:
    IDE controller: PCI device 8086:7010
      BAR4: I/O at 0xc000 [0xc00f].
  Bus  0, device   1, function 2:
    USB controller: PCI device 8086:7020
      IRQ 11.
      BAR4: I/O at 0xc020 [0xc03f].
  Bus  0, device   1, function 3:
    Bridge: PCI device 8086:7113
      IRQ 9.
  Bus  0, device   2, function 0:
    VGA controller: PCI device 1013:00b8
      BAR0: 32 bit memory at 0xc2000000 [0xc3ffffff].
      BAR1: 32 bit memory at 0xc4000000 [0xc4000fff].
  Bus  0, device   3, function 0:
    Ethernet controller: PCI device 10ec:8139
      IRQ 10.
      BAR0: I/O at 0xc100 [0xc1ff].
      BAR1: 32 bit memory at 0xffffffff [0x000000fe].

3.hot add a pci device to 00:00:06
(qemu)host_net_add tap vlan=5,script=/etc/qemu-ifup,downscript=no,name=hostplugtap,ifname=tap5
(qemu)pci_add pci_addr=00:00:06 nic vlan=5,macaddr=00:00:00:00:00:01,model=rtl8139,name=hot_add_nic5
Actual results:
the pci device was added to 00:00:4
(qemu)info pci
Bus  0, device   4, function 0:
    Ethernet controller: PCI device 10ec:8139
      IRQ 11.
      BAR0: I/O at 0xff00 [0xffff].
      BAR1: 32 bit memory at 0xffffffff [0x000000fe].

Expected results:

the pci device should be added to 00:00:6

Additional info:
1.Tried windows/Linux guest ,both hit the issue.
2.On windows guest ,tried both virtio disk and rtl8139 nic ,both hit this issue.
Comment 1 Alex Williamson 2011-07-27 16:18:19 EDT
There's definitely a disconnect in the code between passing an address and having anything happen as a result of that.  I think supporting this would require this qemu patch series, plus any collateral that might have come from it.  Markus, you originated these patches upstream, has porting these to RHEL5 already been discussed or rejected?  On the surface it seems feasible, not too invasive, but also not necessarily trivial.

Comment 2 Markus Armbruster 2011-07-28 02:53:43 EDT
Upstream uses the more general -device, device_add.  -net nic,addr=DEVFN and pci_add are evolutionary dead ends.  Fine for RHEL-5, I guess.

I don't remember discussing backporting these patches to RHEL-5.

Double-checking: is the device address configurable via libvirt?

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