Bug 1310446 - PCI: BARs collision after resource re-balancing on Windows guests
Summary: PCI: BARs collision after resource re-balancing on Windows guests
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.3
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Marcel Apfelbaum
QA Contact: FuXiangChun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-02-21 16:20 UTC by Marcel Apfelbaum
Modified: 2018-04-23 14:27 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-23 14:27:03 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Marcel Apfelbaum 2016-02-21 16:20:40 UTC
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:
100%

Steps to Reproduce:
#cat > t << EOF
pci_update_mappings_del
pci_update_mappings_add
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 12:03:43 UTC
Work plan:
QEMU

Comment 2 Marcel Apfelbaum 2016-03-01 12:06:34 UTC
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.