Bug 1310446 - PCI: BARs collision after resource re-balancing on Windows guests
PCI: BARs collision after resource re-balancing on Windows guests
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
Unspecified Unspecified
low Severity low
: rc
: ---
Assigned To: Marcel Apfelbaum
Depends On:
  Show dependency treegraph
Reported: 2016-02-21 11:20 EST by Marcel Apfelbaum
Modified: 2018-04-23 10:27 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2018-04-23 10:27:03 EDT
Type: Bug
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 Marcel Apfelbaum 2016-02-21 11:20:40 EST
Description of problem:
If a PCI device has no driver install on a Windows guest, it will not
be part of resource re-balancing algorithm if triggered.
If the device has some BARs , the firmware already assigned to them a resource range. This is not seen by Windows and on resource re-balancing the same range
can be assigned to other PCI device.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
#cat > t << EOF

#./x86_64-softmmu/qemu-system-x86_64 -snapshot -enable-kvm -snapshot \
   -monitor unix:/tmp/m,server,nowait -device pci-bridge,chassis_nr=1 \
   -boot menu=on -m 4G -trace events=t ws2012r2x64dc.img \
   -device ivshmem,id=foo,size=2M,shm,bus=pci.1,addr=01

wait till OS boots, note BARs programmed for ivshmem
   in my case it was
     01:01.0 0,0xfe800000+0x100
then execute script and watch pci_update_mappings* trace events

# for i in $(seq 3 18); do printf -- "device_add e1000,bus=pci.1,addr=%x\n" $i | nc -U /tmp/m; sleep 5; done;

Actual results:
hotplugging e1000,bus=pci.1,addr=12 triggers rebalancing where
Windows unmaps all BARs of nics on bridge but doesn't touch ivshmem
and then programs new BARs, where:
    pci_update_mappings_add d=0x7fa02ff0cf90 01:11.0 0,0xfe800000+0x20000
creates overlapping BAR with ivshmem 

Expected results:
no overlapping BARs or the ivshmem BAR should be disabled.
Comment 1 Marcel Apfelbaum 2016-03-01 07:03:43 EST
Work plan:
Comment 2 Marcel Apfelbaum 2016-03-01 07:06:34 EST
Work plan:
 - QEMU: implement PNP CMOS flag
 - SeaBIOS: If OS supports PNP -> enable BARs only for bootable devices.

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