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 2.6.18-262.el5 [root@localhost ~]# rpm -q kvm kvm-83-235.el5 How reproducible: 100% 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.
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. 07b7d05377a5e2b242ef0cce3d461d3284700fc0 5607c38820366954c38dd702e979499486057481 1f5f6638c063514f193ca447d49fa95f8a574a69 c2cc47a449c3e16f7dd4d19a536c649ec56a9ac9
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?