Bug 1515110

Summary: Regression in QEMU handling for sub-page MMIO BARs for vfio-pci devices [rhel-7.4.z]
Product: Red Hat Enterprise Linux 7 Reporter: Oneata Mircea Teodor <toneata>
Component: qemu-kvmAssignee: Alex Williamson <alex.williamson>
Status: CLOSED ERRATA QA Contact: Yanan Fu <yfu>
Severity: high Docs Contact:
Priority: high    
Version: 7.4CC: alex.williamson, chayang, ddepaula, jen, jherrman, jsuchane, juzhang, knoel, michen, mkalinin, mrezanin, mtessun, qzhang, rbalakri, slopezpa, virt-maint, yfu
Target Milestone: rcKeywords: Regression, TestOnly, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-141.el7_4.5 Doc Type: Bug Fix
Doc Text:
Previously, the memory mapping of processor access to base address registers (BARs) smaller than the system page size was incorrect. As a consequence, devices assigned to a guest virtual machine using the vfio-pci driver did not work, which in some cases prevented the guest from booting. This update fixes the QEMU emulator to map the affected devices properly, and the described problem no longer occurs.
Story Points: ---
Clone Of: 1511802 Environment:
Last Closed: 2018-01-25 11:44:56 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:
Bug Depends On: 1511802    
Bug Blocks:    

Description Oneata Mircea Teodor 2017-11-20 07:27:39 UTC
This bug has been copied from bug #1511802 and has been proposed to be backported to 7.4 z-stream (EUS).

Comment 5 Miroslav Rezanina 2017-11-29 07:33:05 UTC
Fix included in qemu-kvm-1.5.3-141.el7_4.5

Comment 6 Yanan Fu 2017-11-29 10:06:47 UTC
Reproduce this bz successfully, and it is ok with qemu-kvm-1.5.3-141.el7_4.5.


Test steps:
1. Unbind one EHCI device from host, and bind to vfio-pci.
#lspci | grep "USB Enhanced"
00:1a.0 USB controller: Intel Corporation C610/X99 series chipset USB Enhanced Host Controller #2 (rev 05)
00:1d.0 USB controller: Intel Corporation C610/X99 series chipset USB Enhanced Host Controller #1 (rev 05)

Choose "00:1a.0".
# readlink /sys/bus/pci/devices/0000\:00\:1a.0/iommu_group
../../../kernel/iommu_groups/10
# ls /sys/kernel/iommu_groups/10/devices/
0000:00:1a.0  ---> iommu group 10 only have one device, it is ok for testing. 

Unbind it from host and bind it vfio-pci.
#ll /sys/bus/pci/devices/0000\:00\:1a.0/driver
lrwxrwxrwx. 1 root root 0 Nov 29 04:19 /sys/bus/pci/devices/0000:00:1a.0/driver -> ../../../bus/pci/drivers/vfio-pci

2. Boot VM with this passthrough device:
-device vfio-pci,host=00:1a.0,id=ehci \

3. Connect to VM and check the status of the VM.

----------------Reproduce--------------
Test version:
qemu: qemu-kvm-1.5.3-141.el7
kernel: kernel-3.10.0-693.el7.x86_64

Test result:
Guest stuck at "Press ESC for boot menu" (i add "-boot menu=on in the command line"), without "-boot menu=on", guest stuck at "ipxe(hrrp://ipxe.org)...."

when i boot without the pass through EHCI device, guest work well.


----------------Verification--------------
Test version:
qemu: qemu-kvm-1.5.3-141.el7_4.5.x86_64
kernel: kernel-3.10.0-693.el7.x86_64


Test result:
Guest can boot up normally, reboot, shutdown and hot-plug/unplug the pass through device several times, no problem.

Comment 10 Yanan Fu 2017-12-04 02:41:46 UTC
Move to verified per comment 6.

Comment 13 errata-xmlrpc 2018-01-25 11:44:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0148